Skip to content

Register the replacement provider id: ensure_workspace_record() re-points a stale workspace record instead of returning "reconcile by hand" (#536) - #602

Merged
brettheap merged 2 commits into
mainfrom
fix/536-workspace-record-replacement
Sep 3, 2026
Merged

brettheap merged 2 commits into
mainfrom
fix/536-workspace-record-replacement

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Lane: openxfactory-smalls

What

ensure_workspace_record() in scripts/sync-notebooklm-books.py now REGISTERS
the replacement provider_notebook_id when it finds its own key-derived
record_id already present but bound to a different notebook, instead of
printing reconcile by hand and returning.

Why

Carried forward from add-notebook-projection-identity § 4.3. The record id is
derived from the book's KEY, which a hosting-account move leaves unchanged
while the re-derived book acquires a NEW provider notebook id. The function
found that collision and returned without registering, so the record kept
pointing at the retired notebook — and retiring the record on top of that
leaves the company-hosted book unregistered, which is the exact failure the
box was written to prevent. The 2026-08-24 migration performed the step by hand
(docs/notebook-projection-migration-evidence-2026-08-24.md, step 6); the code
half was never done.

openspec/specs/lifecycle-notebook-projection/spec.md already REQUIRES this
("The migration SHALL replace each book's workspace record rather than merely
retiring it … The replacement SHALL be explicit and SHALL leave exactly one
active record per live book", with the scenario A re-created book collides
with its own workspace record
), so this is a realization of ratified text, not
a contract change — no OpenSpec delta.

The invariant

Exactly one active record per live book, the record id key-derived and
unchanged. The record IS the live book's registration; what a migration retires
is the legacy PROVIDER NOTEBOOK, never the record. A replacement therefore
re-points one line in place and appends nothing.

How it behaves

  • Plan (no --apply) — prints an explicit op line naming both ids and
    writes nothing:
    [canon] REPLACE workspace record workspace-xfactory-lifecycle-canon: <old> -> <new> (re-pointed on --apply)
  • --apply — rewrites that one field and announces it loudly:
    [canon] REPLACED workspace record …: <old> -> <new> in … (one active record per live book; commit it with the migration evidence)
  • A silent re-point could mask an accidental binding to the wrong notebook, so
    it is never silent. REPLACE/REPLACED/REGISTER deliberately avoid the
    ADD|DEL|UPD verbs doc-health counts as pending projection operations.
  • No-op path unchanged: a record already carrying this id prints nothing
    and writes nothing, on both plan and apply.
  • Only provider_notebook_id moves. created_at, purpose, managed_by,
    every comment — preserved. The schema has no provenance field, and the
    2026-08-24 migration kept the legacy → new mapping in a file-level comment
    rather than in a record field, so the mapping lives in the diff, the printed
    line and the migration evidence. The registry is edited as TEXT rather than
    round-tripped through a YAML loader on purpose: its header comments carry the
    migration record, one line of which is frozen by citation.
  • record_id derivation is untouched.

Two supporting corrections, both load-bearing:

  1. The record is located by a whole-line id: match inside its own list
    item
    . The old f"id: {record_id}" in text substring test could not tell an
    active record from a RETIRED one kept as a commented block, nor
    …-lifecycle-ideation from the …-lifecycle-ideation-opsxfactory record
    that merely starts with it — both live in the registry today.
  2. The registration is re-asserted on the resolve path, not only at
    creation. A re-derived book is created once and merely resolved by title on
    every run after, so without this a registry left stale by a partial or
    skipped migration would never converge — and it is the only way a plan run
    can show the pending replacement at all, since a book that does not exist
    yet has no new id to name. Read-only callers stay read-only: --parity
    resolves with apply=False, which prints and writes nothing
    (test_parity_never_mutates still passes).

A record that exists but carries no provider_notebook_id line is the one case
still reported for hand reconciliation — appending a second record there would
break the one-record invariant.

Docs

docs/notebook-projection-migration-runbook.md step 6 keeps its number (the
reading is still the operator's) but now states that the sync performs the
replacement under --apply, and tells the operator to read the plan back.
docs/notebooklm-sync-open-item.md does not reference this gap (it carries the
auth item, #537), and the README's two mentions are inside the archived
add-notebook-projection-identity record, where they correctly point at this
issue — left as the record of what was true then.

Closes #536

Test evidence

New file tests/notebooklm/test_sync_workspace_record.py (a parallel PR is
adding tests for other functions of this script; a new file avoids the merge
conflict). 11 tests: plan prints and writes nothing; apply leaves exactly one
active record carrying the new id; every other field and every comment survives
(asserted as a one-line diff); another book's record untouched; the prefix id
reaches neither the longer record nor the commented retired block; the same-id
no-op is silent on both paths; a missing registry is a notice; a record with no
provider_notebook_id line stays hand-reconciled; an unregistered book is
planned then registered; and both halves of the resolve path.

$ python3 -m pytest tests/notebooklm -q
190 passed, 26 subtests passed in 5.30s

$ python3 -m pytest tests/notebooklm tests/doc-health -q
1601 passed, 7 warnings, 26 subtests passed in 491.80s

🤖 Generated with Claude Code

https://claude.ai/code/session_012WEcJUPMqpciTRSbJZzkh2

…ints a stale workspace record instead of returning "reconcile by hand" (#536)

`ensure_workspace_record()` derives the record id from the book's KEY, which a
hosting-account move leaves unchanged while the book acquires a NEW provider
notebook id. Finding its own record holding a different `provider_notebook_id`
it printed `reconcile by hand` and returned WITHOUT registering the
replacement — and retiring the legacy record on top of that leaves the
company-hosted book with no registration at all. The 2026-08-24 migration
performed the step by hand; the code half was never done.

It now performs the replacement, preserving the invariant the archived box
states and `lifecycle-notebook-projection` already requires: exactly ONE active
record per live book, its id key-derived and unchanged, because the record IS
the live book's registration — what a migration retires is the legacy PROVIDER
NOTEBOOK, never this record.

The re-point is never silent, since a silent one would hide an accidental
binding to the WRONG notebook. Without `--apply` the plan prints
`REPLACE workspace record <id>: <old> -> <new>` and writes nothing; with it the
write is announced as `REPLACED …`. Neither verb collides with the
`ADD|DEL|UPD` lines doc-health counts as pending projection operations. Only
`provider_notebook_id` moves — `created_at` and every other field are the
record's own history, and the registry is edited as TEXT rather than
round-tripped through a YAML loader because its header comments carry the
migration record, one line of which is frozen by citation.

Two supporting corrections, both load-bearing for the replacement:

- the record is located by a WHOLE-LINE `id:` match inside its own list item,
  where the old substring test could not tell an active record from a retired
  one kept as a commented block, nor `…-ideation` from the `…-ideation-opsxfactory`
  record that merely starts with it;
- the registration is re-asserted on the RESOLVE path too, not only at
  creation. A re-derived book is created once and merely resolved by title on
  every run after, so without this a registry left stale by a partial or
  skipped migration would never converge. Read-only callers stay read-only:
  `--parity` resolves with `apply=False`, which prints and writes nothing.

Tests in a new file (a parallel PR is adding tests for other functions of this
script): plan-prints-nothing-written, apply leaves exactly one active record
carrying the new id with every other field and comment intact, another book's
record untouched, the prefix id reaching neither longer record nor commented
block, the same-id no-op silent on both paths, a missing registry a notice, a
record with no `provider_notebook_id` line still hand-reconciled, and both
resolve-path halves.

Runbook step 6 stays a numbered step — the reading is still the operator's —
but now says the sync performs it under `--apply` and tells the operator to
read the plan back.

Closes #536

Lane: openxfactory-smalls
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_012WEcJUPMqpciTRSbJZzkh2
Copilot AI lite review requested due to automatic review settings September 2, 2026 23:57
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The updated runbook’s referenced registry path is inconsistent with the invocation pattern shown in the same section and should be corrected to avoid operator error during migrations.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the NotebookLM lifecycle sync to keep workspace-record registration correct across hosting-account migrations by re-pointing an existing key-derived workspace record to a replacement provider_notebook_id (instead of refusing with “reconcile by hand”), preserving the “one active record per live book” invariant.

Changes:

  • Implement workspace-record replacement in ensure_workspace_record() via whole-line active-record matching and in-place provider_notebook_id rewrite (plan prints REPLACE, apply prints REPLACED).
  • Re-assert workspace registration on the “FOUND/resolve-by-title” path so stale registries converge over time, not only on initial creation.
  • Add a focused test suite for replacement/no-op/edge cases and update the migration runbook to describe the new behavior.
File summaries
File Description
scripts/sync-notebooklm-books.py Adds whole-line record detection + bounded item rewrite to replace stale provider_notebook_id, and re-asserts registration on resolve.
tests/notebooklm/test_sync_workspace_record.py Introduces coverage for replacement vs no-op behavior, prefix/commented-retired safety, missing registry, and resolve-path re-assertion.
docs/notebook-projection-migration-runbook.md Updates step 6 to reflect automatic replacement under --apply and instructs operators to validate via dry run output.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5d7d1e000

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/sync-notebooklm-books.py Outdated
# path a re-derived book takes on the run AFTER the one that created it
# (issue #536). Read-only callers stay read-only: with `apply` false
# this prints the planned replacement and writes nothing.
ensure_workspace_record(root, spec, nid, apply)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject ambiguous titles before replacing the record

When the active account contains multiple notebooks with spec.title, the by_title comprehension silently keeps the last returned ID, and this new call immediately re-points the workspace record to that arbitrary notebook during --apply. This can overwrite an already-correct registration and can make it flap between IDs if provider ordering changes; detect duplicate title matches (or preserve the currently registered matching ID) before performing the replacement.

Useful? React with 👍 / 👎.

…ok's registry path (review round 1)

Codex P2: with two notebooks under one title, `by_title` keeps whichever row
the provider returned LAST, so the resolved id is arbitrary. Projecting into an
arbitrary notebook is a pre-existing hazard; RE-POINTING the governed workspace
record at it would be a new one — it could overwrite an already-correct
registration and flap it as the provider's ordering changes, which is the
accidental re-binding this PR's loud output exists to catch.

The found path now counts the rows carrying the title before it re-asserts the
registration. More than one, and it prints a NOTICE naming every colliding id
and leaves the record exactly as it stands: an ambiguous title is precisely the
case a hand reconciliation exists for. Resolution itself is untouched — which
notebook the sync projects into is the pre-existing behavior and not this PR's
to change.

Copilot: step 6 named `examples/lifecycle-notebook-workspaces.yaml` while its
commands are run from the aggregation root. The repo-relative spelling is this
runbook's convention (steps 1a, 3 and 10 use it too), so it is kept and the
anchor is now stated once alongside it.

Test: two rows under one title leave the registry byte-identical and print the
NOTICE rather than REPLACED.

Lane: openxfactory-smalls
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_012WEcJUPMqpciTRSbJZzkh2
Copilot AI review requested due to automatic review settings September 3, 2026 00:03
@brettheap

Copy link
Copy Markdown
Contributor Author

Round 1 addressed at `a86ad457`.

Codex P2 — reject ambiguous titles before replacing the record: TAKEN. Real, and specific to what this PR added: an arbitrary resolution becoming a governed write. by_title keeps whichever row the provider returned last, so two notebooks under one title resolve to an arbitrary one of them — projecting into an arbitrary notebook is the pre-existing hazard, but re-pointing the workspace record at it would overwrite an already-correct registration and flap it as ordering changes, which is exactly the accidental re-binding this PR's loud output exists to catch.

The found path now counts the rows carrying spec.title before it re-asserts the registration. More than one and it prints a NOTICE naming every colliding id and leaves the record byte-identical — an ambiguous title is precisely the case hand reconciliation exists for. I deliberately did not take the "preserve the currently registered matching ID" half: that would change which notebook the sync projects into, which is pre-existing resolution behavior and not this PR's to move. Refusing the write is the conservative half and closes the escalation.

New test test_two_notebooks_under_one_title_leave_the_record_alone asserts the registry is unchanged and the output carries the NOTICE rather than REPLACED.

Copilot — the registry path in step 6: TAKEN, as an anchor rather than a re-spelling. The bare examples/… spelling is this runbook's own convention (steps 1a, 3 and 10 spell openxFactory files the same way) while only the command lines are aggregation-rooted, so the convention is kept and the anchor is now stated once beside it: the sync writes <root>/openxFactory/examples/…, the root being the directory those commands are run from.

python3 -m pytest tests/notebooklm -q → 191 passed, 26 subtests passed.

Lane: openxfactory-smalls

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped, updates all call sites, preserves the one-record invariant via bounded whole-line matching, and adds thorough tests covering both plan/apply and edge cases (commented retired blocks and prefix collisions).

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap

Copy link
Copy Markdown
Contributor Author

CI green on `a86ad457`: pytest-suite pass (20m33s), merge-master-approval pass, signed-execution-chain-gate pass, wallet-validation pass.

Codex round 2 could not run — the re-request came back with "You have reached your Codex usage limits for code reviews" rather than a review. Round 1 stands as the only bot pass: one P2, taken; the Copilot doc nit, taken; Sourcery is the private-repo upsell stub, not a finding. Not merging — this is Brett's call.

Lane: openxfactory-smalls

@brettheap

Copy link
Copy Markdown
Contributor Author

RULING for lane openxfactory-smalls PR #602 (head a86ad457): Brett Heap, 2026-09-03T13:45Z, "merge all six". Admin-merged on that word — PRs opened as brettheap cannot be self-approved, so the review gate is cleared by his recorded word rather than a click. CI: all checks green on this head. Codex: round-1 P2 taken; final head quota-refused. Copilot: approval recommended.

Lane: openxfactory-smalls

@brettheap
brettheap merged commit 1c3e744 into main Sep 3, 2026
5 checks passed
@brettheap
brettheap deleted the fix/536-workspace-record-replacement branch September 3, 2026 13:45
brettheap added a commit that referenced this pull request Sep 3, 2026
…611/#614/#602/#604: README both sides; corpus pin re-derived a third time

`main` moved seven merges past this branch's base `6da1e1f5` while PR #608
sat awaiting the convener's merge word — #611 (archived
`declare-spent-bundle-state`: realized #587 `3fa222f3`, `main` green run
`33654163291`, four orchestrator decisions affirmed, promoted), #614 (pins
one `--as-of` clock across the self-gate's two report renderings), #602
(re-points a stale workspace record instead of returning "reconcile by
hand"), #604 (closes the oversized-upload duplicate-minting hole), plus
three more (#601, #599, #603) that touch neither conflicted file. GitHub
could no longer build the test-merge commit. Force-pushing is forbidden
here, so this is a CATCH-UP MERGE and not a second rebase.

TWO FILES CONFLICTED. `README.md` auto-merged cleanly — main removed the
`declare-spent-bundle-state` active row and added its archive entry, and
this branch's `create-medxchart-overlay-boundary` row stands exactly as
this branch wrote it; the diff against `origin/main` is that one row and
nothing else.

`tests/sequenced_after/test_sweep.py` conflicted. MAIN'S PIN BLOCK AND
MOVEMENT LOG ARE THE BASE (`git checkout --theirs`, keeping every entry
main has, #611's included), and the pin is then RE-DERIVED ON THE MERGED
TREE rather than netted out of arithmetic:

  main at 2b0615d                  33 active + 125 archived = 158 change
                                    ids, 108 co-modified, 50 sole
                                    modifiers, 20 / 13 active
                                    co-modified/sole
  merged tree                       158, 109, 49, 21 / 12
  merged tree, with only
  .../create-medxchart-overlay-boundary/specs/domain-descendant-boundary/
  moved aside                       158, 108, 50, 20 / 13
  origin/main at 2b0615d           158, 108, 50, 20 / 13

The exclusion reproduces main's own reading EXACTLY, and main's own tree
confirms that reading independently, so this branch's single `## MODIFIED
Requirements` delta over `domain-descendant-boundary` is the whole of the
difference between the two trees a third time: +1 `co_modified`, +1
`active_co_modified`, -1 `sole_modifiers`, -1 `active_sole`, and
`change_ids` and `active` not at all. No fourth change moved in the
window; #614/#602/#604 touch no `openspec/changes/**/specs/**` delta
(confirmed via `git diff --stat 6da1e1f..2b0615d -- openspec/changes/`,
which shows only #611's own rename).

The five pinned values become, all measured and none inferred:

  sweep.co_modified          == 109
  sweep.active_co_modified   == 21
  sweep.change_ids - 1       == 157   (held through #611's archive and this
                                      ratification alike)
  sweep.sole_modifiers - 1   == 48    (was 49 on main after #611)
  sweep.active_sole - 1      == 11    (was 12 on main after #611)

The pin moves in the SAME COMMIT as the corpus, which is that test's own
protocol.

VALIDATION ON THE MERGED TREE:

  openspec validate create-medxchart-overlay-boundary --strict   valid
  openspec validate --all --strict                               86 passed,
                                                                 0 failed
                                                                 (86 items)
  python3 -m pytest tests/sequenced_after -q                     118 passed
  scripts/doc-health.py --single-repo .                          6 critical,
                                                                 6 error,
                                                                 29 warning,
                                                                 14 info,
                                                                 0 new
                                                                 regressions

The `--all --strict` total moved 87 → 86 because #611 ARCHIVED an active
change (`declare-spent-bundle-state`) without adding a replacement; this
packet adds none and moves it not at all. The doc-health report is
IDENTICAL to the same run on `origin/main` at `2b0615da` in every finding
and count once the checkout directory name is normalised — the two runs
differ only in one `staged-candidate-aging` trend line's `min=` day count
(0 vs 1, both `class="contested"`, no action required), a clock artifact
of the two runs' wall time and not a corpus difference. `grep -c
create-medxchart-overlay-boundary` on this branch's report is 0.

The two `review/` records still state the pre-merge readings and are
corrected in the commit that follows this one, before capture — capture
is the merge of PR #608, which has not merged.

Lane: openxfactory-max001

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_012RQo21NbWtnTVsb6JU67at
brettheap added a commit that referenced this pull request Sep 3, 2026
… a third time pre-capture (main at 2b0615d)

CAPTURE IS MERGE, AND NOTHING IS MERGED. `record-immutability` forbids editing a
`Status: record` document AFTER capture; capture is the merge of the pull
request that establishes it, and PR #608 has not merged. These two records have
therefore never been captured, and correcting them on the branch is lawful. No
capture happened before this merge and none is claimed.

WHAT MOVED, AND WHY. `main` moved seven merges past this branch's previous
catch-up point `6da1e1f5` — #611 (archived `declare-spent-bundle-state`:
realized #587 `3fa222f3`, `main` green run `33654163291`, four orchestrator
decisions affirmed, promoted), #614, #602, #604, plus #601/#599/#603, which
touch neither this file nor the corpus pin — and this branch took the second
catch-up merge at `5cf9a67b` in the commit directly below. Of the seven, only
#611 moves the live corpus pin, and it moves exactly one of its five readings:
archiving a co-modified ACTIVE change lowers `active_co_modified` alone,
leaving the corpus-wide `co_modified`, `sole_modifiers`, `active_sole` and
`change_ids` untouched.

COUNTS MOVED, AND ONLY COUNTS:

  openspec validate --all --strict        87/87 -> 86/86
                                          (#611 ARCHIVED one ACTIVE change
                                          without adding a replacement; this
                                          packet adds none and moves this
                                          total not at all)

  this branch's own sweep                 158 / 109 / 49 / 22 / 12
                                          -> 158 / 109 / 49 / 21 / 12
                                          (change ids / co-modified / sole
                                          modifiers / active co-modified /
                                          active sole)

  measured-by-exclusion baseline,         158 / 108 / 50 / 21 / 13
  which is main's own reading             -> 158 / 108 / 50 / 20 / 13

so this packet's contribution, restated from main's newer baseline, still
reads `co_modified` 108 -> 109, `active_co_modified` 20 -> 21, `sole_modifiers`
50 -> 49 and `active_sole` 13 -> 12 — the same +1 / +1 / -1 / -1 shape it has
carried through every re-derivation, with `change_ids` and `active` still
moving not at all.

MEASURED BY EXCLUSION, NOT INFERRED. The baseline above was proved by moving
`openspec/changes/create-medxchart-overlay-boundary/specs/domain-descendant-boundary/`
aside on the merged tree and re-running
`python3 scripts/validate-sequenced-after.py . --sweep`, and independently
confirmed by running the same sweep on `origin/main` at `2b0615da` itself,
which prints the same 158 / 108 / 50 / 20 / 13.

NOTHING ELSE IN THE RECORDS CHANGED. Beyond those counts and the `Captured:`
header naming the third tree, no governance statement, no evidence block, no
console output, no finding and no citation moved. The full account is
`verification-2026-09-03.md` § 9's "RE-DERIVED A THIRD TIME" paragraph and the
matching line added to `ratification-2026-09-03.md`'s corrected-pre-capture
paragraph.

Lane: openxfactory-max001

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_012RQo21NbWtnTVsb6JU67at
brettheap added a commit that referenced this pull request Sep 3, 2026
This branch was authored against `origin/main` at `7af2725c`, which is the
real merge base — not `2b0615da`, which is itself a later `main` commit. Main
moved on by the ratifications of `create-medxchart-overlay-boundary` (#608)
and `create-medxpractice-overlay-boundary` (#609) — BOTH RATIFIED AND STILL
ACTIVE, neither archived — and by #614, #602, #604, #601, #599 and #603.

TWO CONFLICT POINTS, both named in advance by this branch's own README block
and sweep docstring, and both resolved by KEEPING BOTH SIDES rather than by
taking either wholesale.

README.md — the "OpenSpec Records" block auto-merged, the two sides having
touched disjoint regions, and the result was checked rather than assumed:
main's expanded RATIFIED entries for both overlay-boundary packets stand under
"Active changes", and this branch's move of `add-project-repo-schema` out of
that list and into "Archived changes" stands as well. This branch's "NOTE FOR
THE NEXT REBASE" paragraph is rewritten to RECORD its own discharge instead of
still demanding it.

tests/sequenced_after/test_sweep.py — the corpus pin, the one textual
conflict. `active_co_modified` resolves to 20, WHICH IS NEITHER SIDE'S NUMBER:
#608's ratification made an already-active change a co-modifier and raised it
20 -> 21, this branch's archive of `add-project-repo-schema` moved a
co-modified active change out of the active corpus and lowered it 20 -> 19,
and on the merged tree both are true at once so the two moves cancel at 20.
MEASURED, not netted by arithmetic, on both trees via
`python3 scripts/validate-sequenced-after.py . --sweep`: `origin/main` at
`0bf37d14` reads 33 active + 125 archived = 158 change ids, 109 co-modified,
49 sole modifiers, 21 / 12 active co-modified/sole; the merged tree reads
32 active + 126 archived = 158, 109, 49, 20 / 12. EXACTLY ONE READING DIFFERS,
main's own reading being the by-exclusion control since this archive is the
only difference between the two trees. Every other pin therefore keeps MAIN'S
post-#608/#609 value — `co_modified` 109, `sole_modifiers - 1` 48,
`active_sole - 1` 11, `change_ids - 1` 157 — and BOTH movement-log bullets are
kept, main's and this branch's, with a third recording the merged reading.
#609 moves no pin at all: its delta carries no `## MODIFIED Requirements`
block, so it was and remains a sole modifier.

NO `contract-v3.1` INVENTORY MEMBER MOVED. The 283 registered paths were
intersected with everything `main` touched across `7af2725c..0bf37d1`: main's
only edits under `contracts/`, `scripts/` or `docs/` are
`scripts/nlm_auth.py`, `scripts/sync-notebooklm-books.py`,
`scripts/validate-manifest-digests.py` and four `docs/notebook*` /
`docs/lifecycle-notebook-projection.md` files, and NONE of the seven is a
registered row. The inventory therefore stands as cut and is not rebuilt.

Lane: repo-shape
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
brettheap added a commit that referenced this pull request Sep 3, 2026
…03, realized by #593 (3c237cd), green on main (run 33717394896) (#615)

* Archive update-standards-body-current-publications: ratified 2026-09-03, realized by #593 (3c237cd), green on main (run 33717394896)

Brett's word: "archive it". Finishes work an Opus agent left on disk,
uncommitted, after being killed twice by provider errors — verified
rather than redone: the 8-file move to
openspec/changes/archive/2026-09-03-update-standards-body-current-publications/,
the byte-identical promotion to
openspec/specs/standards-body-registry/spec.md (real Purpose section,
requirements diff-clean against the delta), and the README "OpenSpec
Records" entry.

Took a catch-up merge of origin/main first: declare-spent-bundle-state's
own archive (PR #611, squash 7af2725) landed on main after this
branch was cut from 6da1e1f, so every gate and pin below is
re-measured against 7af2725 rather than the stale base. Corrected the
sequenced_after live pin accordingly in the same commit as the corpus
move (its own protocol): active_sole - 1 falls 12 -> 11 (this archive,
a SOLE modifier); active_co_modified already held at 20 from the
sibling archive this branch merged, not from this one. Ran
`python3 scripts/validate-sequenced-after.py . --sweep` on both trees
to confirm: 32 active + 126 archived = 158, 108, 50, 20 / 12.

Also added tasks.md 5.7 naming this PR as the landing act for the
archive that ran uncommitted in the isolated clone.

Gate evidence: PR #593 squash 3c237cd
on main; pytest-suite run 33717394896 (2026-09-03T05:26Z) and
signed-execution-chain-gate both success on that commit.

Validated: openspec validate --all --strict 86 -> 86 passed (33
active + 53 specs -> 32 active + 54 specs); pytest tests/doc-health
1500 passed either side; pytest tests/test_standards_body_registry.py
17 passed; pytest tests/sequenced_after 118 passed;
scripts/validate-omnigent-contracts.py all checks passed; doc-health.py
--single-repo . 6 critical / 6 error / 29 warning / 13 info either
side, 0 new regressions, and --family promotion-fidelity /
duplicate-packet / status-validity all zero findings either side.

Lane: openxfactory-f2

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GSRxesWQMRgFKUjoJiDd1w

* README: re-measure the archive entry's gates against the second catch-up merge

origin/main moved 5 more commits (#603 #599 #601 #614 #602, tip
1c3e744) while this PR was being finished. None touch this packet's
files, so the archive act itself is unaffected, but the doc-health.py
--single-repo info count and the base commit cited in the entry were
stale. Re-measured back-to-back on 1c3e744 (before) and the merged
tree (after): 6 critical, 6 error, 29 warning, 14 info, 0 new
regressions, unchanged by this act. Also records the one transient
pytest tests/doc-health network-read failure
(test_this_repository_can_consult_the_retention_namespace) that a
clean rerun did not reproduce.

Lane: openxfactory-f2

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GSRxesWQMRgFKUjoJiDd1w

* tasks.md: name PR #615 as the landing act

Fills the placeholder §5.7 left after PR creation.

Lane: openxfactory-f2

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GSRxesWQMRgFKUjoJiDd1w

* tasks.md: stop claiming PR #615 already landed on main

Copilot review round 1, taken: 5.7 said "LANDED ON main" while the PR
is still open. Corrected to state the PR exists and is open, not
merged; a follow-up line records the squash SHA once it actually
merges.

Lane: openxfactory-f2

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GSRxesWQMRgFKUjoJiDd1w

* tasks.md: name the third catch-up merge (#604)

A fourth commit landed on origin/main after the round-1 fix; §5.7 said
"TWO catch-up merges" when a third had since happened.

Lane: openxfactory-f2

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GSRxesWQMRgFKUjoJiDd1w

* Fix two Markdown rendering defects Copilot flagged

Round 2/3: an inline-code span split across two lines in tasks.md
(inline spans can't contain a newline) and a stray line break in
README.md that orphaned "with" on its own line. Cosmetic only, no
claims changed.

Lane: openxfactory-f2

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GSRxesWQMRgFKUjoJiDd1w

* Advance the review-lane pin onto codexFactory's regenerated 58-entry floor

THE OPENXFACTORY HALF OF A TWO-REPOSITORY REPAIR THIS PR'S OWN PROMOTION
FORCED. Promoting `standards-body-registry` adds a path under
`openspec/specs/`, and codexFactory's `repository_gate_floor` for this
repository ENUMERATES that surface exactly — so the new spec arrived OFF the
floor and `tests/review_lane_pin/test_floor_snapshot.py`'s LQ-A7 coverage
assertion reddened the REQUIRED `pytest-suite`. That is the guard working: a
spec the floor does not carry is a spec the floor does not protect.

THE ORDER IS FORCED AND IS THE RUNBOOK'S
(`docs/repository-gate-floor-repair-runbook.md` in the pinned core, and the
ordered repair the assertion prints on failure): codexFactory regenerates the
block at an openxFactory commit that ALREADY carries the new path, and only
then may this pin advance onto it — a pin cannot name a document that does
not yet exist.

CODEXFACTORY'S HALF LANDED FIRST: PR #184, merge
`8cb173738ebecd773eadd1b77b11d29029b37382` (2026-09-03T19:53:55Z),
regenerated by `scripts/merge_master/generate_specs_floor_block.py` at
openxFactory `c9928846` — this branch's own head, the only tree carrying the
new path.

FIVE SITES MOVE, IN ONE LOGICAL CHANGE, because the tests fail if any of them
disagree:

  contracts/review-lane-pin.yaml          core_commit  db157dbb -> 8cb17373
  .github/workflows/merge-master-approval.yml  PINNED_CORE_COMMIT (same)
  .github/workflows/merge-master-approval.yml  core checkout ref: (same)
  .github/workflows/pytest-suite.yml           core checkout ref: (same)
  contracts/review-lane-floor-snapshot.yaml    re-copied at the new commit

and the snapshot's declared witnesses move with it:
`entry_count` 57 -> 58, `sha256` bf7a6b69… ->
22993960b31ff7853df719a701b0f53cd62c420ed7fe25b2da1ba6646bf16f7b.

THE SNAPSHOT IS A WITNESS AND WAS NOT HAND-EDITED. It is a byte copy fetched
from the pinned core at `8cb17373` and verified two independent ways: sha256
as above over 9219 bytes, and GIT'S OWN content addressing —
`git hash-object` of the vendored file equals the blob sha codexFactory's
tree carries at that path and commit, `cdb08cd603a0d10c44f3c843e024d73bd1d6e1ce`.
The freshness comparison in `test_floor_snapshot.py` — which SKIPS when the
core is absent — was additionally run WITH the core on disk
(`PINNED_CORE_CHECKOUT=…`): 56 passed, ZERO skipped, so the byte-for-byte
assertion CI performs actually ran and passed here.

MEASURED, NOT ASSUMED. The new floor is the old floor plus exactly
`openspec/specs/standards-body-registry/spec.md` — nothing removed, no dead
entry introduced. 58 entries = the same 4 hand-reasoned chokepoints + 54 spec
paths (was 53). Coverage over the merged tree: all 54 tracked paths under
`openspec/specs/` are floored, 0 uncovered, and 0 floored spec paths are dead.
`project-repo-schema` has NOT landed, so 54 is the correct surface.

LOCKSTEP RE-MEASURED RATHER THAN CARRIED OVER: xFactory's two judging surfaces
still name `f4702f64` (read from xFactory main 2026-09-03), so
`lockstep.status` stays `diverged` and the obligation to converge at a future
re-point ceremony stands. The gap widened by ONE ENTRY, not by a new kind of
divergence — the cause is unchanged from 2026-09-01 and still forced by the
feature.

Also files forward the archived packet's tasks.md §5.7 with the floor repair.
The squash SHA is deliberately NOT invented there: it is filled in at landing
by the merge-provenance comment.

Validated: tests/review_lane_pin + tests/sequenced_after +
tests/test_standards_body_registry.py = 190 passed, 1 skipped (that skip being
the freshness comparison, separately exercised green with the core present);
tests/doc-health = 1500 passed; `openspec validate --all --strict` = 86 passed
0 failed; `scripts/validate-omnigent-contracts.py` = all checks passed.

Lane: openxfactory-f2
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Dt5nEtqzRNgf3Z5fEAQZtF

* Anchor §5.7's not-yet-merged claim to its writing instant, not the present tense

TAKEN FROM COPILOT's review of `0d17d1be` ("Needs a closer look"): the §5.7
prose asserts landed state in the PRESENT TENSE — "still not merged", "`main`
does not carry this archive" — and this packet is ARCHIVED, so that wording
goes FALSE the instant the pull request merges and leaves a permanent stale
claim inside a record.

The finding is right about the shape and this commit takes it FOR THE HALF THIS
LANE AUTHORED. The claim is now ANCHORED TO AN INSTANT — "as of this note's
writing, 2026-09-03, branch head `0d17d1be`, this packet had not merged" — so
it stays TRUE after the merge instead of decaying, and it points a reader
wanting the LANDED state at the merge-provenance comment rather than at a line
that speaks only for the moment it was written. No fact changes; the tense
does.

WHAT THIS COMMIT DOES NOT TOUCH, AND WHY. Copilot also flagged lines 172 and
184-189 — the PRIOR session's §5.7 prose, not this lane's. Those are left
alone on two grounds: this lane's scope is to APPEND a dated note to §5.7, not
to rewrite another lane's record text; and the phrasing there is the
repository's deliberate doctrine, stated in its own voice ("NOT YET TRUE, AND
NAMED SO IT STAYS FALSE UNTIL IT ISN'T"), which exists to stop a packet
claiming landed state before it lands — the archive-gate rule in
`docs/release-realization-flow.md` § The Archive Gate, and the
claim-outrunning-machinery lesson family. Rewriting it as a bare "TBD" would
weaken a guard rather than fix a defect. That text also already commits to
completing the provenance at landing, which is the act that retires the
staleness.

Lane: openxfactory-f2
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Dt5nEtqzRNgf3Z5fEAQZtF

* Advance the review-lane pin onto the 63-entry floor: second lander of the two-packet collision

THE OPENXFACTORY HALF OF THE FLOOR REPAIR THIS PACKET'S OWN PROMOTION FORCED,
TAKEN A SECOND TIME AND FOR A REASON THAT IS NOT A CORRECTION OF THE FIRST.

TWO openxFactory packets each promoted a NEW capability on 2026-09-03, and
codexFactory's `repository_gate_floor` for this repository is REGENERATED BY
ENUMERATING A TREE rather than by editing a list. `add-project-repo-schema`
(PR #616, merged 20:49Z as `19d00872`) landed first and codexFactory PR #183
(`605d48ac`) regenerated for it. codexFactory PR #184 (`8cb17373`) then
regenerated for THIS packet at `c9928846` — PR #615's PRE-MERGE branch head,
which did not yet carry #616's promotion — so its block went 54 -> 54 rather
than 54 -> 55 and SILENTLY DROPPED `openspec/specs/project-repo-schema/spec.md`,
the entry #183 had just landed.

NEITHER EARLIER PULL REQUEST IS DEFECTIVE. Each regenerated at a real tree,
exactly as CSC-C7 requires. This is the failure mode a two-lander collision
HAS, and the pinned core's `docs/repository-gate-floor-repair-runbook.md`
already answers it by making the SECOND LANDER regenerate once at its OWN
POST-MAIN-MERGE head.

AND `main` WAS NEVER BROKEN IN THE INTERVAL — stated so nobody hunts an
incident that did not happen. `main`'s pin named `605d48ac`, whose 58-entry
floor covers `main`'s 54-spec tree INCLUDING `project-repo-schema`. The gap
becomes reachable only when THIS packet's fifty-fifth spec lands, which is the
moment this advance exists to serve.

CODEXFACTORY'S HALF LANDED: PR #186, MERGE COMMIT (not squash)
`8f770afbf86043ee0f5494ded0f12f51c2a9b45e`, 2026-09-03T21:55:35Z, regenerated
at openxFactory `8d893a0f` — this branch's merge of `main` `19d00872`, and the
FIRST COMMIT ANYWHERE carrying fifty-five tracked paths under
`openspec/specs` — restoring `project-repo-schema` BESIDE
`standards-body-registry`. codexFactory `main` was re-verified at that same
commit by `git ls-remote` immediately before this advance rather than assumed.

FIVE SITES MOVE, IN ONE LOGICAL CHANGE, because the tests fail if any of them
disagree:

  contracts/review-lane-pin.yaml               core_commit  605d48ac -> 8f770afb
  .github/workflows/merge-master-approval.yml  PINNED_CORE_COMMIT (same)
  .github/workflows/merge-master-approval.yml  core checkout ref: (same)
  .github/workflows/pytest-suite.yml           core checkout ref: (same)
  contracts/review-lane-floor-snapshot.yaml    re-copied at the new commit

and the snapshot's declared witnesses move with it: `entry_count` 58 -> 63,
`sha256` 6ab79400… -> b8f95136916fc58d297a8319408bebbffaf327790fd2885a677e22de193f41f8.

THIS PIN NEVER NAMED `8cb17373`, AND THAT IS RECORDED RATHER THAN TIDIED AWAY.
Commit `0d17d1be` on this branch DID advance onto it at 16:24, and the later
catch-up merge of `main` — which carried PR #616's own advance to `605d48ac` —
resolved the pin sites to `main`'s side, so the intermediate 58-entry state
`8cb17373` describes was never the state this branch shipped. A reader
comparing this file's history to codexFactory's will see #184 land and this pin
skip it; that is the collision, not a lost edit.

THE SNAPSHOT IS A WITNESS AND WAS NOT HAND-EDITED (CSC-C7). It is a byte copy
fetched from the pinned core at `8f770afb` and verified THREE independent ways:
sha256 as above over 12492 bytes; GIT'S OWN CONTENT ADDRESSING —
`git hash-object` of the vendored file equals the blob sha codexFactory's tree
carries at that path and commit, `351c47fb5bfad13697dc6c777b9bb17a147e8e45`;
and `cmp` against a REAL shallow checkout of codexFactory at that commit. The
freshness comparison in `test_floor_snapshot.py` — which SKIPS when the core is
absent — was additionally run WITH that core on disk
(`PINNED_CORE_CHECKOUT=…`): 56 passed, ZERO skipped, so the byte-for-byte
assertion CI performs actually ran and passed here.

THE FLOOR GREW BY FIVE, AND ONLY ONE OF THEM IS A SPEC. Measured on the merged
tree, not inferred from the proposal.

  * THE SPEC: `openspec/specs/standards-body-registry/spec.md`. The generated
    block goes 54 -> 55 tracked paths. Coverage over this branch's merged tree:
    all 55 tracked paths under `openspec/specs` are floored, 0 uncovered, and 0
    floored spec paths are dead. Both `project-repo-schema` and
    `standards-body-registry` are present.
  * THE OTHER FOUR ARE CHOKEPOINTS, NOT SPECS, and they arrive here for the
    first time: codexFactory PR #182 (merge `e5534552`, 20:51:52Z — AUTHORED
    BEFORE #183/#184 BUT MERGED AFTER BOTH, which is why they surface at an
    advance whose stated object is a spec) floored the sibling
    FACTORY-IDENTITY REGISTER FAMILY BY NAME —
    `governance/factory-identity/register.yaml` and the wallet, grant and
    custody attestation beside it — realizing THIS repository's own ratified
    `add-cpc-clearing-boundary` task 2.7. By name is FORCED, not preferred:
    `_parse_exact_path` refuses wildcards and trailing slashes, so the
    directory cannot be floored as a prefix. All four exist on this tree,
    verified path by path, so the advisory lane gains four reachable floor
    paths and no dead entry. The document's hand-reasoned chokepoints go
    4 -> 8, and its own self-description moves with it: 4 + 1 becomes 8 + 1.

LOCKSTEP RE-MEASURED RATHER THAN CARRIED OVER: both xFactory judging surfaces
still name `f4702f64` (read directly off xFactory `main` 2026-09-03 — the two
`ref:` literals in `merge-master-approval.yml` and
`council-convening-lane.yml`), so `lockstep.status` stays `diverged` and the
obligation to converge at a future re-point ceremony stands. THE GAP WIDENED BY
FIVE ENTRIES, NOT BY A NEW KIND OF DIVERGENCE: the cause is unchanged from
2026-09-01 and is still forced by the feature.

Also takes a FIFTH catch-up merge of `origin/main` (`9a773a31`, the
`contract-v3.2` cut) — merged, never rebased — and files the archived packet's
tasks.md §5.7 forward with the completed repair. The squash SHA is deliberately
NOT invented there: it is filled in at landing by the merge-provenance comment.

Validated: tests/review_lane_pin + tests/sequenced_after +
tests/test_standards_body_registry.py = 190 passed, 1 skipped, 18 subtests
passed (that one skip being the freshness comparison, separately exercised
green with the core present); tests/doc-health = 1500 passed;
`openspec validate --all --strict` = 86 passed, 0 failed;
`scripts/validate-omnigent-contracts.py` = all checks passed;
`import cryptography` = 41.0.7.

Lane: openxfactory-f2
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Dt5nEtqzRNgf3Z5fEAQZtF

---------

Co-authored-by: openRepoShape CI <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
Co-authored-by: Brett Heap <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sync: ensure_workspace_record() returns without registering a replacement provider_notebook_id (add-notebook-projection-identity § 4.3 code gap)

2 participants