fix(slice4): make all entry write paths sidecar-aware (§22.4a carried from SLICE-1)

graduate, claim, retire/unretire, _read_meta_entry, mark_entry_reviewed,
body extract/wrap (api_branches + api_prs replay) now dual-read and write
metadata to the sidecar via write_entry_files + bot.commit_entry_files/
open_entry_pr — a migrated body-only .md no longer crashes entry.parse or
re-grows frontmatter; legacy entries lazy-migrate on first metadata write.
Existing tests updated to assert the sidecar (INV-2 clean docs).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-07 18:57:54 -07:00
parent 734290f344
commit aee9b582e5
8 changed files with 325 additions and 181 deletions
+13 -9
View File
@@ -57,12 +57,15 @@ def test_rfc_owner_can_retire_and_entry_leaves_every_surface(app_with_fake_gitea
assert r.status_code == 200, r.text
assert r.json()["state"] == "retired"
# Meta entry on main: state retired, body + fields kept.
meta = entry_mod.parse(
fake.files[("wiggleverse", "meta", "main", "rfcs/ohm.md")]["content"]
# §22.4a SLICE-4: the state flip lands in the metadata sidecar and the
# `.md` is lazy-migrated to a clean body-only file (INV-2). Fields kept.
import yaml as _yaml
sc = _yaml.safe_load(
fake.files[("wiggleverse", "meta", "main", "rfcs/ohm.meta.yaml")]["content"]
)
assert meta.state == "retired"
assert "carol" in meta.owners
assert sc["state"] == "retired"
assert "carol" in sc["owners"]
assert "---" not in fake.files[("wiggleverse", "meta", "main", "rfcs/ohm.md")]["content"]
# Cache flipped; gone from the catalog.
cached = db.conn().execute(
@@ -177,11 +180,12 @@ def test_site_owner_can_retire_active_and_unretire_restores_active_with_id(app_w
assert r.status_code == 200, r.text
assert r.json()["state"] == "active"
meta = entry_mod.parse(
fake.files[("wiggleverse", "meta", "main", "rfcs/ohm.md")]["content"]
import yaml as _yaml
sc = _yaml.safe_load(
fake.files[("wiggleverse", "meta", "main", "rfcs/ohm.meta.yaml")]["content"]
)
assert meta.state == "active"
assert meta.id == "RFC-0042"
assert sc["state"] == "active"
assert sc["id"] == "RFC-0042"
cached = db.conn().execute(
"SELECT state, rfc_id FROM cached_rfcs WHERE slug = 'ohm'"