From 2d04d391b4d41dc5e780f730f4e231c00ee7f3bd Mon Sep 17 00:00:00 2001 From: gunbc-ci-auto-heal Date: Sat, 5 Sep 2026 10:20:54 +0000 Subject: [PATCH 1/2] Correct the rebuild plan's manifest shape before it steers the next consumer The paragraph that existed to stop the next reader following a dead recipe had itself become one. It said add and commit are blocked on building a CorpusManifestObject shaped path -> semantic_root -> authored_source_identity. Both halves are false: the object exists in gunbc.scm.object_store and is coded by object_table_json, and its entry is { path, source } -- path to authored source, deliberately not to a semantic root, because fusing them makes a manifest unauthorable for malformed or not-yet-ingested source. #10522 section 5 ruled the same separation. A second passage further down repeated the same wrong shape and is corrected with it. DESIGN section 3 names this exactly: while a superseded structure stands, every nearby question gets answered in its vocabulary. This one was positioned to decide the add/commit cut. The corrected boundary states what is actually pending -- a workspace-scoped authored-source snapshot shared by add, status and commit -- and records three obligations the old text did not: status moves with this cut rather than rendering "nothing staged" while source changes are staged; staging carries the same conditional-write obligation as publication, which save_repository does not supply since it writes unconditionally; and an established unchanged candidate is not an unreadable stage. No code changes. The staging carrier itself waits on the commit-root ruling. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01VQ4iThiZ1B9LPB9ePr8qa9 --- docs/plans/scm-demo-cli-rebuild.md | 51 +++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/docs/plans/scm-demo-cli-rebuild.md b/docs/plans/scm-demo-cli-rebuild.md index b95e5b5c82f..b19e98d135f 100644 --- a/docs/plans/scm-demo-cli-rebuild.md +++ b/docs/plans/scm-demo-cli-rebuild.md @@ -198,12 +198,45 @@ precedes `commit` and `commit` re-derives an added object's `ObjectId` by rebuil - `mint_repository_commit` takes a `SemanticNodeTarget`, not a bare `ObjectId`. Handing it an authored-source identity is not a runtime refusal to be checked for — it does not typecheck. -**The current boundary, stated so the next reader does not follow the dead recipe:** production -`add` and `commit` remain blocked on a `CorpusManifestObject` -(path → semantic_root → authored_source_identity) plus a staging authority. Immediate object-store -insertion is NOT the add model; `add` has nowhere to persist what is staged until that authority -exists. `ScmWriteOutcome` below is still the right SHAPE for the verb's result and is not what -blocks the verbs. +**SUPERSEDED — this paragraph became the dead recipe it warned about, and is corrected in place.** +It said `add` and `commit` are blocked on building a `CorpusManifestObject` shaped +`path → semantic_root → authored_source_identity`. Both halves are now false: + +- **The object exists.** `gunbc.scm.object_store` declares `CorpusManifestObject`, + `CorpusManifestRecord`, and `CorpusManifestEntry`, and `gunbc.scm.object_table_json` codes them. +- **Its shape is `{ path, source }` — path to AUTHORED SOURCE, and deliberately not to a semantic + root.** `object_store` states why: a semantic root is a derived ingestion result, and fusing it + into the entry would make a manifest unauthorable for malformed or not-yet-ingested source, which + is precisely the corpus a source-control system must still freeze. #10522 §5 ruled the same + separation — the authored snapshot is authoritative, structural interpretation is a derived view. + +**The actual boundary** is a *pending authored-source snapshot* authority shared by three consumers: +`add` updates it, `status` reads it, and `commit` consumes it. It is workspace-scoped and must +survive between invocations; it need not live in the repository document. + +Two constraints that paragraph got right and one it got wrong. Right: immediate object-store +insertion is not by itself the `add` model, and `ScmWriteOutcome` is still the right shape for the +verb's result. Wrong: `add` is not blocked — what it lacked was a place to persist a *path-grain* +selection, and `status.dag`'s `StagedRole` is role-grain, so it is not that place. + +**`status` moves with this cut rather than being an unchanged downstream reader.** Today +`scm_status` passes `empty_proposal()` and renders "nothing staged". Once source staging exists, +leaving that path in place would report "nothing staged" while authored-source changes are staged — +an observation correct about its input and wrong about the subject the user asked about. Paths must +not be translated into `StagedRole` to keep the existing renderer. + +**Staging carries the same conditional-write obligation as publication.** One `add` can race +another, and a `commit` can race a newer stage. Updates are conditional on the observed stage; a +commit consumes the exact staged snapshot rather than re-reading working files; and clearing after +commit consumes only the stage generation actually committed, so newer work is never erased. Under +the no-rebase workflow a moved target is a named stale-base condition, never permission to apply an +old stage to a different base. `save_repository` does not supply this — it checks encoding and then +performs an unconditional `Filesystem.Write`. + +Two further distinctions the verbs owe: an established unchanged candidate is not the same as an +unavailable or unreadable stage; and staged-versus-unstaged reporting needs a separate working-tree +observation, because comparing the stage to its base says nothing about whether the working files +changed again. ### The design step, stated so it is not improvised @@ -251,5 +284,7 @@ today and is the honest reading of `add` for this substrate. Mirroring this repository's history through `gunbc scm` onto srv2 stays blocked on model work: `ScmObject = SemanticNodeObject | AuthoredSourceObject | CorpusManifestObject` with one content -identity, `CorpusManifest` carrying path + semantic_root + authored_source_identity, and git -correspondence confined to a mirror-layer `GitMirrorCursor { source_commit, native_commit }`. +identity — **which now exists**; the manifest carries `{ path, source }` to authored source, NOT +path + semantic_root + authored_source_identity as this sentence originally said (see the corrected +boundary above) — and git correspondence confined to a mirror-layer +`GitMirrorCursor { source_commit, native_commit }`. From 10836c2fa21caed2e580e037afbbcc3ab74dd6dd Mon Sep 17 00:00:00 2001 From: gunbc-ci-auto-heal Date: Sat, 5 Sep 2026 10:35:22 +0000 Subject: [PATCH 2/2] Withdraw the recipe and the outcome sketch this PR had re-endorsed review 5120884296, both findings confirmed at source. R2 is the sharper one. The corrected paragraph said ScmWriteOutcome is still the right shape, which positively certified a sketch that is unsound: RepositorySave carries three failure arms, so ScmWritePersisted { save: RepositoryFileUnwritable } is constructible and a renderer selecting the outer Persisted arm announces persistence while its payload says the file was unwritable. ScmWriteRefusedByMint accepts RepositoryCommitMinted symmetrically. The outer classification and the inner payload can disagree. Replaced with the governing requirement -- a success outcome carries established success evidence for that exact operation -- and the sketch is kept visible as the instructive half rather than deleted. R1: two adjacent sections still instructed the reader to do the opposite of the corrected boundary. "The design step" prescribed store_node plus save_repository, neither of which supplies the staging contract, and "add has no staging authority" called immediate object-store insertion the honest reading of add. That section's premise stands and its conclusion is withdrawn: it picked the branch cheapest to build, and insertion cannot say which paths are selected, nor be revised or cleared. A maintainer following those sections still reached the implementation this PR exists to prevent. Also narrowed "add is not blocked" to the dependency actually removed. Host acquisition, path admission, durable selection and conditional update remain work; a removed dependency is not a finished verb. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01VQ4iThiZ1B9LPB9ePr8qa9 --- docs/plans/scm-demo-cli-rebuild.md | 70 ++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/docs/plans/scm-demo-cli-rebuild.md b/docs/plans/scm-demo-cli-rebuild.md index b19e98d135f..68893379d9c 100644 --- a/docs/plans/scm-demo-cli-rebuild.md +++ b/docs/plans/scm-demo-cli-rebuild.md @@ -216,8 +216,11 @@ survive between invocations; it need not live in the repository document. Two constraints that paragraph got right and one it got wrong. Right: immediate object-store insertion is not by itself the `add` model, and `ScmWriteOutcome` is still the right shape for the -verb's result. Wrong: `add` is not blocked — what it lacked was a place to persist a *path-grain* -selection, and `status.dag`'s `StagedRole` is role-grain, so it is not that place. +verb's result. Wrong: `add` is not blocked ON THE MANIFEST OBJECT, which is the specific dependency this +paragraph asserted and which no longer exists. It remains blocked on real work — host acquisition of +file bytes, path admission, a durable selection to persist into, and conditional update of that +selection — and `status.dag`'s `StagedRole` is role-grain, so it is not that place. A removed +dependency is not a finished verb. **`status` moves with this cut rather than being an unchanged downstream reader.** Today `scm_status` passes `empty_proposal()` and renders "nothing staged". Once source staging exists, @@ -238,14 +241,14 @@ unavailable or unreadable stage; and staged-versus-unstaged reporting needs a se observation, because comparing the stage to its base says nothing about whether the working files changed again. -### The design step, stated so it is not improvised +### The design step — SUPERSEDED as a recipe; one principle survives -`add` composes `store_node` (`Stored | LocatorCollision`) with `save_repository` (4 arms); -`commit` composes `mint_repository_commit` (4 arms) with the same save. A renderer taking two -outcome values is the wrong shape — it would have to encode "which one failed" positionally, and -the arms multiply. +**The composition below is no longer the instruction for the next increment, and the sketch under it +is unsound. Both are kept visible rather than deleted, because the sketch is the more instructive +half.** -What is wanted is one modeled write-verb outcome, something like: +It said `add` composes `store_node` with `save_repository`, and `commit` composes +`mint_repository_commit` with the same save, over one outcome coproduct: type ScmWriteOutcome = ScmWriteRepositoryUnavailable { cause: RepositoryLoadRefusal } @@ -253,17 +256,46 @@ What is wanted is one modeled write-verb outcome, something like: | ScmWriteRefusedByMint { refusal: RepositoryCommitMint } | ScmWritePersisted { save: RepositorySave } -with one renderer per verb over it. That coproduct is the increment's real content; the wiring -after it is mechanical. It is deliberately NOT sketched into `cli.dag` here, because a write-verb -outcome invented at a call site is the anemic modeling this repository keeps paying for. - -### `add` has no staging authority, and that is not a wiring gap - -`repository_status` takes `pending: Proposal` as a PARAMETER because what is staged is not a fact -the repository document carries. So a literal `git add` — stage now, commit later — has nowhere to -persist to. Either `add` writes an object into the store immediately (content-addressed, no -staging), or a staging authority has to exist first. The first is what the object store supports -today and is the honest reading of `add` for this substrate. +**Why the sketch is wrong: the outer classification and the inner payload can disagree.** +`RepositorySave = RepositorySaved | RepositorySaveRefusedByCodec | RepositoryFileUnwritable | +RepositoryWriteByteCountUnrepresentable`, so `ScmWritePersisted { save: RepositoryFileUnwritable { +path: "repo.json", error: "permission denied" } }` is constructible — a renderer selecting on the +outer `Persisted` arm announces persistence while its own payload says the file was unwritable. The +inverse is equally expressible: `ScmWriteRefusedByMint` accepts the successful `RepositoryCommitMinted` +arm. This is a fabricated-plausible-output shape, which makes it validation-where-construction-was- +available rather than a modelling nicety. + +**The governing requirement instead:** + +> A success outcome carries established success evidence for that exact operation. A refusal carries +> an actual refusal cause. Where publication cannot be established, that uncertainty remains an +> explicit outcome rather than being resolved into either. + +**What survives** is only the original motivation: compose operation outcomes without positional +ambiguity, so a renderer never encodes "which one failed" by argument position. **What does not +survive** is this coproduct, and also the composition itself — `store_node` does not preserve +authored source as authored source, and `save_repository`'s write is unconditional, so neither +supplies the staging contract stated above. Narrowing the payload to a successful save would not fix +that: an ordinary save and a *conditional* stage update are different guarantees. + +The shared result type is left undesigned here deliberately. A write-verb outcome invented at a call +site is the anemic modelling this repository keeps paying for, and so is one certified in a plan +before its operations have contracts. + +### `add` has no staging authority — SUPERSEDED, and its conclusion was the wrong branch + +This section's PREMISE stands and its CONCLUSION is withdrawn. The premise: `repository_status` takes +`pending: Proposal` as a parameter because what is staged is not a fact the repository document +carries, so a literal stage-now-commit-later has nowhere to persist to. That remains true, and it is +why `status` moves as part of this cut. + +The conclusion — that `add` therefore writes an object into the store immediately, with no staging, +and that this is "the honest reading of `add` for this substrate" — is **withdrawn**. It picked the +branch that was cheapest to build rather than the one that answers the question, and immediate +insertion is not staging: it cannot say which paths are selected for the next commit, and it cannot +be revised or cleared. The other branch was the right one — a staging authority has to exist first — +and it is workspace-scoped, not necessarily a repository-document member, so the premise never +implied its absence. ## Constraints learned the hard way