Skip to content

Commit 639d940

Browse files
committed
chore(adr-anchors): anchor the protocol.ts split modules that took governed bodies
The split moved the bodies the protocol.ts entry's invariants govern: applyObjectRegistryMutation and hydrateOverlayIntoRegistry into protocol-registry-hydration.ts, loadMetaFromDb into protocol-diff-delete-load.ts, saveMetaItem's view storage into protocol-save.ts. Each module gets an entry carrying the host entry's own invariant paragraphs for the ADRs it now cites (ADR-0029 and ADR-0126, ADR-0029, ADR-0005 and ADR-0087), as the sql-driver pilot did; the host entry stays for the stubs and the citations left there. Claude-Session: https://claude.ai/code/session_01WGufzgddMBbTQd9yVo4Yuz Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d72c980 commit 639d940

3 files changed

Lines changed: 23 additions & 0 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"file": "packages/metadata-protocol/src/protocol-diff-delete-load.ts",
3+
"adrs": [
4+
"ADR-0029"
5+
],
6+
"invariant": "ADR-0029 D9.8/D9.9 — the two `sys_metadata` object-hydration seams (`applyObjectRegistryMutation` and `loadMetaFromDb`) CHOOSE the contributor kind instead of defaulting to `'own'`: a packaged owner already registered for the name means the row is that object's `overlay` LAYER, and no packaged owner means the row IS the object. Registering `'own'` unconditionally is what spliced the packaged contributor out and destroyed the code definition at write time, replayed silently on every boot (#6853). The row's `package_id` is provenance ON the layer and never an ownership claim (D9.9): same package is normal, a package-less sentinel is ACCEPTED (the old throw was an artefact of the borrowed `own` slot, #6995), and a row bound to a DIFFERENT package is refused at the producer with `OBJECT_OVERLAY_PACKAGE_MISMATCH` / 422 and counted in `loadMetaFromDb`'s per-record `errors` at boot — because the overlay-uniqueness index can hold two rows for one (type, name) bound to two packages and `computeFQN` is identity, so the registry could never serve both. The delete heal subtracts the LAYER (`removeObjectOverlay`) BEFORE the tier walk, because tier 1 returns as soon as it heals the generic metadata map and would otherwise leave the object's layer registered.\n\n[#29985] Carried from the `protocol.ts` entry: the codemod split moved this body to `protocol-diff-delete-load.ts`, and its citation with it; the class member keeps its signature and docblock in `protocol.ts`, which keeps its own entry."
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"file": "packages/metadata-protocol/src/protocol-registry-hydration.ts",
3+
"adrs": [
4+
"ADR-0029",
5+
"ADR-0126"
6+
],
7+
"invariant": "ADR-0029 D9.8/D9.9 — the two `sys_metadata` object-hydration seams (`applyObjectRegistryMutation` and `loadMetaFromDb`) CHOOSE the contributor kind instead of defaulting to `'own'`: a packaged owner already registered for the name means the row is that object's `overlay` LAYER, and no packaged owner means the row IS the object. Registering `'own'` unconditionally is what spliced the packaged contributor out and destroyed the code definition at write time, replayed silently on every boot (#6853). The row's `package_id` is provenance ON the layer and never an ownership claim (D9.9): same package is normal, a package-less sentinel is ACCEPTED (the old throw was an artefact of the borrowed `own` slot, #6995), and a row bound to a DIFFERENT package is refused at the producer with `OBJECT_OVERLAY_PACKAGE_MISMATCH` / 422 and counted in `loadMetaFromDb`'s per-record `errors` at boot — because the overlay-uniqueness index can hold two rows for one (type, name) bound to two packages and `computeFQN` is identity, so the registry could never serve both. The delete heal subtracts the LAYER (`removeObjectOverlay`) BEFORE the tier walk, because tier 1 returns as soon as it heals the generic metadata map and would otherwise leave the object's layer registered.\n\nADR-0126 §2 / §3 — `flow` is Regime C, with no overlay read path. `hydrateOverlayIntoRegistry` registers a stored flow row WITHOUT the artifact's protection envelope (it is a tenant-authored row, never the package's overlay), and the flattened list (`readFlattenedMetaItems`, both faces) serves a flow name the loader's set holds from the loader's own entries alone — a stored row of that name is not merged into the package's slot (`isShippedFlowName` / `isStoredFlowEntryOfShippedName`). Grafting the envelope back, or letting the row stand in for the slot, makes the automation engine arm the stored body over the sealed one while every receipt names the package.\n\n[#29985] Carried from the `protocol.ts` entry: the codemod split moved this body to `protocol-registry-hydration.ts`, and its citation with it; the class member keeps its signature and docblock in `protocol.ts`, which keeps its own entry."
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"file": "packages/metadata-protocol/src/protocol-save.ts",
3+
"adrs": [
4+
"ADR-0005",
5+
"ADR-0087"
6+
],
7+
"invariant": "ADR-0005 appendix (c) (\"Addendum — 2026-05-16 (c): spec validation on overlay save\", as amended by ruling 甲 on #20051) + ADR-0087 (addendum 2026-08-01b, `storable` excludes schema defaults) — `saveMetaItem` stores a `view` as the parsed value of every key its request body carried (`projectStorableViewBody`): an undeclared key is dropped, a schema default the author did not write is NOT stored, and a moved key (`groups` → `sections`, `visibleOn` → `visibleWhen`) is stored under its canonical spelling, so the stored row re-parses to exactly what the save accepted. Every key the console reads back off a stored view row is declared on the contract (`VIEW_CONSOLE_ROUND_TRIP_KEYS`), which is what makes dropping the rest lossless. Every OTHER type still stores its request body verbatim, with only the operator and `groups` → `sections` grafts applied: the switch is gated on `singularType === 'view'`, and widening it to another type is its own decision, not a refactor.\n\n[#29985] Carried from the `protocol.ts` entry: the codemod split moved this body to `protocol-save.ts`, and its citation with it; the class member keeps its signature and docblock in `protocol.ts`, which keeps its own entry."
8+
}

0 commit comments

Comments
 (0)