From 644bf35d893b5d712b40e8f9db7e072b14618aa8 Mon Sep 17 00:00:00 2001 From: Ben Stull Date: Sun, 7 Jun 2026 17:33:47 -0700 Subject: [PATCH] =?UTF-8?q?feat(slice3):=20persist=20entry=20metadata=20to?= =?UTF-8?q?=20cached=5Frfcs.meta=5Fjson=20at=20ingest=20(=C2=A722.4a)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/cache.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/app/cache.py b/backend/app/cache.py index 3186005..538689a 100644 --- a/backend/app/cache.py +++ b/backend/app/cache.py @@ -170,6 +170,10 @@ def _upsert_cached_rfc( # §6.7: funder_login mirrors the optional `funder:` frontmatter # field. NULL means absent — operator credentials are used. funder_login = entry.funder or None + # §22.4a SLICE-3: persist the full per-entry metadata mapping (known keys + + # extra, never the body) so facet/filter can read any declared field. Stored + # via metadata_dict so the sidecar's forward-compat keys (INV-7) ride along. + meta_json = json.dumps(metadata_mod.metadata_dict(entry)) db.conn().execute( """ INSERT INTO cached_rfcs @@ -177,8 +181,8 @@ def _upsert_cached_rfc( graduated_at, graduated_by, owners_json, arbiters_json, tags_json, models_json, funder_login, body, body_sha, unreviewed, reviewed_at, reviewed_by, collection_id, - metadata_malformed, last_entry_commit_at, updated_at) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now'), datetime('now')) + metadata_malformed, meta_json, last_entry_commit_at, updated_at) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now'), datetime('now')) ON CONFLICT(collection_id, slug) DO UPDATE SET title = excluded.title, state = excluded.state, @@ -199,6 +203,7 @@ def _upsert_cached_rfc( reviewed_at = excluded.reviewed_at, reviewed_by = excluded.reviewed_by, metadata_malformed = excluded.metadata_malformed, + meta_json = excluded.meta_json, last_entry_commit_at = datetime('now'), updated_at = datetime('now') """, @@ -224,6 +229,7 @@ def _upsert_cached_rfc( entry.reviewed_by, collection_id, 1 if metadata_malformed else 0, + meta_json, ), )