Skip to content

Realize add-notebook-projection-identity: the sync binds to a declared account, and the migration is sequenced for Brett's login - #277

Merged
brettheap merged 4 commits into
mainfrom
change/realize-notebook-projection-identity
Aug 23, 2026
Merged

brettheap merged 4 commits into
mainfrom
change/realize-notebook-projection-identity

Conversation

@brettheap

@brettheap brettheap commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Direct realization of the ratified add-notebook-projection-identity (Brett
ruled both the ratification and the DIRECT mode on 2026-08-23; record:
openspec/changes/add-notebook-projection-identity/review/ratification-2026-08-23.md).

Everything here lands and gates green WITHOUT the migration having run. The
live cutover is gated on an interactive nlm login only Brett can perform; it
is sequenced as a runbook, not attempted here. The change stays ACTIVE and is
NOT archived — target_release: implementation_pending archives it on the
migration evidence.

Two verified CLI facts changed the design

Both checked against the installed nlm, not assumed:

  1. There is no per-invocation --profile on the verbs this sync issues.
    notebook, source, alias, tag, chat — none of them take it; only the
    newer share and login verbs do. Profile selection is process-global,
    through auth.default_profile. So the sync verifies the binding rather
    than passing it: it refuses to run when the active profile is not the
    declared one, and prints the exact nlm login switch remediation. It never
    switches the profile itself — that is shared user state and other sessions on
    the host race on it.
  2. nlm share exists — status --json, invite --role, batch, and they
    do take --profile. The proposal reasoned that "NotebookLM exposes no share
    or admin API". That holds for the half it was about — there is still no
    pending-request queue and no approval surface
    , so the approval stays a human
    act — but it is not true of sharing generally. A recorded grant can therefore
    be applied by tooling and the roster can be reconciled against the live
    account. Neither changes who decides, and the ratified requirement already
    permits automating detection and relay, so this is documented as a
    correction
    (§12 of the projection doc) rather than folded into ratified
    text on my own authority.

The roster form decision — and the ritual that did NOT fire

Decided: a governed YAML OUTSIDE contracts/, at
examples/notebook-projection-hosting.yaml, validated by a dedicated
scripts/validate-notebook-projection-hosting.py.

Reasoning, written into both files rather than left implicit: the record is the
operator's own governance artifact for one install's tooling account — no
other repository, install or domain consumes it and nothing pins it, which is
what contracts/ membership is for. Its sibling
examples/lifecycle-notebook-workspaces.yaml, the workspace registry for this
same projection, read and written by the same script, sits there for exactly
that reason.

The decision is made on the consumer/ownership test, not on the cost of the
ritual
. Promoting the shape into contracts/ remains available as a later
deliberate act if a second install ever needs to interoperate on it — and that
act, not this one, would carry the release ritual.

contracts/ is untouched, asserted in the gates. No CHANGELOG allocation, no
manifest row, no contract_bundle_version bump, no inventory rebuild, no
verify-commit, no tag.
The bundle stays at contract-v1.40.

What landed

  • The declaration (examples/notebook-projection-hosting.yaml): Opensoft's
    Case A on [email protected], a Workspace user in opensoft.one,
    profile company, with the migration recorded as pending from
    [email protected]/personal, plus the share-out roster and a denied
    lane.
  • Binding or refusing (enforce_hosting_profile): a declared install whose
    CLI points elsewhere refuses with the remediation command. An undeclared
    install is reported as a nonconforming transition state, never a third
    case, and still runs. A declaration is not a migration — while
    migration.state: pending the run binds to the account that still HOLDS the
    books and says so, because flipping the binding before the books move would
    break every sync rather than move anything.
  • --parity: per-book title-set equality plus a union reconciliation
    against the corpus scan — never against the legacy books, which are the
    artifact whose fidelity is in question — reporting 0 pending ADD/DEL/UPD or
    the exact misses. A test asserts it issues no mutating verb.
  • The validator: two-case vocabulary, Workspace-user rule, service-account
    refusal on the platform constraint, domain match, the profile the sync binds
    through, pending-migration fields, and roster uniqueness on the stable
    (hosting_account, user, book_or_alias) triple.
  • Docs: projection §1 (declared identity), §6 (bind-the-profile step 0 and
    a --parity step), §9 (the quota belongs to a named account), and a new §12
    with the mechanics and the platform correction. A new migration runbook.
    The open operational item stays OPEN by its own terms and points at it.
  • 33 new tests across tests/notebooklm/ (sync guards, per-invocation
    binding, and the validator), every new guard revert-tested.

What is deliberately NOT done

Tasks 4.2 and 4.3 are annotated, not ticked. The runbook carries the explicit
per-session procedure and the record-replacement step; the code-level bulk mode
and teaching ensure_workspace_record() to replace belong with the migration
run, not before it. Tasks 4.4–4.7 and 5.1 are the migration itself.

The command Brett runs to start the migration

In a host shell with a browser, signing in as [email protected]:

nlm login --profile company

(add --wsl on WSL2 without a Linux browser). Then nlm login switch company,
flip migration.state to complete, and the re-derivation is one --apply
run of roughly 40 minutes
(the 2026-08-10 precedent moved 314 sources in about
that). Full sequence, including the live-session and workspace-record steps that
the lifecycle run does not cover:
docs/notebook-projection-migration-runbook.md.

Review round

Codex — two findings, both real, both fixed.

  1. P1: a one-time check does not bind a forty-minute run. Caught with this
    PR's own documentation: §12 says same-host sessions race on the
    process-global profile, and I shipped a single opening check. nlm() now
    re-asserts the binding before every invocation, reading
    auth.default_profile from the CLI's config file directly — a stat, not a
    subprocess, cached on the file's (mtime_ns, size) stamp — and refuses the
    next call the moment it drifts, before subprocess.run is reached. Isolated
    profile configuration was the alternative; the CLI exposes no config-path or
    profile env override I could verify, so detect-and-refuse is what is provable
    today.
  2. P2: the validator was invoked by nothing the sync runs, so an
    operator-hosted declaration naming a consumer or service account would have
    passed an ordinary --apply. The load-bearing rules are now enforced inline
    and dependency-free on that path; the validator stays the authority on what a
    sync never reads, including the roster shape.

Copilot — refuted, and the line rewritten anyway. It reported an
AttributeError in active_nlm_profile(); Python's conditional expression
binds last, so the isinstance check is the condition and runs first —
demonstrated against the real function for {}, [], None and 42, all
returning None. The expression is now an explicit early return regardless,
with a regression subtest, because a guard whose job is to refuse cleanly should
not be misreadable.

All three new guards are revert-tested, and the third earned it: neutering
the drift check failed 2 tests, but removing the assert_still_bound() call
from nlm()
left every test passing. A detector nothing invokes is decoration,
so there is now a test driving the real nlm() with a drifted config and a
stubbed subprocess, asserting the refusal lands before anything is written.

Gates

  • pytest tests/ideation-dashboard — 3983 passed, 15 skipped
  • pytest tests/notebooklm tests/doc-health tests/ideation_dashboard — 890
    passed, 10 subtests
  • openspec validate --all --strict — 69 passed, 0 failed (69 items)
  • doc-health vs a fresh same-clock origin/main (0ce4f6f8) baseline — 0 new
    findings
    (4 critical / 6 error / 77 warning / 3 info both sides)
  • scripts/validate-ideation-dashboard-contracts.py — 0 errors, 4 warnings
  • scripts/validate-notebook-projection-hosting.py — 0 errors
  • contracts/ untouched — no contract-release ritual

🤖 Generated with Claude Code

brettheap and others added 2 commits August 23, 2026 16:00
…unt or refuses

Tasks 1.1-1.5, 2.1-2.3 and 4.1 of the ratified add-notebook-projection-identity.

The declaration lives at examples/notebook-projection-hosting.yaml, beside the
workspace registry for this same projection, and carries Opensoft's Case A on
[email protected] plus the share-out roster.

TWO CLI FACTS CHANGED THE DESIGN, both verified against the installed nlm
rather than assumed. Of the verbs this sync issues — notebook, source, alias,
tag, chat — NONE accepts a per-invocation --profile; only the newer share and
login verbs do. Profile selection is process-global, through
auth.default_profile. So the sync VERIFIES the binding instead of passing it,
and refuses when the active profile is not the declared one, carrying the exact
remediation command. It never switches the profile itself: that is shared user
state and other sessions race on it.

A declaration is not a migration. While migration.state is pending the run
binds to the account that still HOLDS the books and says so, because flipping
the binding before the books move would break every sync rather than move
anything. An undeclared install is reported as a transition state, never as a
third legitimate case.

--parity proves the live books against THE CORPUS SCAN — per-book title-set
equality plus a union reconciliation — and mutates nothing, which a test
asserts by checking no mutating verb was issued.

The roster is validated outside contracts/ by a dedicated script; uniqueness is
the stable (hosting_account, user, book_or_alias) triple, so a re-decision
updates the one live entry. The reasoning for staying outside contracts/ is
written into both files.

Co-Authored-By: Claude Fable 5 <[email protected]>
…gin starts

Tasks 3.1-3.3 and the procedural halves of 4.2/4.3.

Section 1 now names the declared hosting identity and its two cases; section 9
attributes the quota ceiling to the install's one declared account rather than
to "one shared account", keeping the capacity point intact; section 6's runbook
gains a step 0 that reads and binds the profile, and a --parity step. A new
section 12 carries the mechanics: where the declaration lives, why it is not
under contracts/, how a run is bound, and what is actually verified — the
profile NAME, not the address, because the CLI stores no email for a profile.

A PLATFORM CORRECTION is recorded rather than buried. The proposal reasoned
that NotebookLM exposes no share or admin API. That holds for the half it was
about — there is still no pending-request queue and no approval surface, so the
approval stays a human act — but it is not true of sharing generally: nlm share
status/invite/batch exist and DO take --profile. So a recorded grant can be
applied by tooling and the roster can be reconciled against the live account.
Neither changes who decides, and the ratified requirement already permits
automating detection and relay, so the correction is documented instead of
being folded into ratified text.

The migration runbook sequences what only Brett can start: nlm login --profile
company as [email protected], then bind, flip the pending flag,
re-derive (~40 min), migrate each live session notebook one at a time, replace
each workspace record, prove parity against the corpus scan, and retire the
legacy books by recorded act WITHOUT retiring the record the replacement just
made current.

The open operational item stays OPEN by its own terms and now points at the
runbook: it closes on the migration, not on the rulings.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 23, 2026 20:14
@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.

Pull request overview

This PR realizes the ratified add-notebook-projection-identity change by introducing a governed hosting declaration + share-out roster, enforcing that sync runs bind to the declared nlm profile (or refuse), and adding a non-mutating parity-report mode plus supporting docs and tests.

Changes:

  • Add examples/notebook-projection-hosting.yaml and a dedicated validator script to enforce the hosting declaration + share-out roster invariants.
  • Update scripts/sync-notebooklm-books.py to read/enforce the declared hosting profile and add --parity reporting against the corpus scan.
  • Add/extend tests and documentation, including a migration runbook and updated projection operational docs.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/notebooklm/test_validate_hosting.py New unit tests for the hosting/roster validator behavior.
tests/notebooklm/test_sync_notebooklm_books.py New tests for enforcing the declared hosting profile and --parity behavior.
scripts/validate-notebook-projection-hosting.py New validator for examples/notebook-projection-hosting.yaml and share-out roster uniqueness rules.
scripts/sync-notebooklm-books.py Enforces declared hosting profile; adds --parity reporting mode.
README.md Adds link to the new hosting migration runbook doc.
openspec/changes/add-notebook-projection-identity/tasks.md Marks realized tasks and records the design adjustments.
examples/notebook-projection-hosting.yaml Adds the governed hosting declaration and placeholder roster/denied lanes.
docs/notebooklm-sync-open-item.md Updates the open operational item status and points to the runbook.
docs/notebook-projection-migration-runbook.md New step-by-step migration procedure and evidence sequencing.
docs/lifecycle-notebook-projection.md Documents declared hosting identity, binding mechanics, sharing-out behavior, and parity proof.

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

Comment thread scripts/sync-notebooklm-books.py Outdated
Comment on lines +1661 to +1666
run = runner or nlm
try:
out = run("config", "get", "auth.default_profile", parse=False)
except Exception: # noqa: BLE001 - an unreadable profile is "unknown"
return None
return out.strip() or None if isinstance(out, str) else None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Refuted as a bug — but the line was hard enough to read that a reviewer misparsed it, so it is rewritten anyway and now has a regression test.

Python's conditional expression binds LAST: out.strip() or None if isinstance(out, str) else None parses as (out.strip() or None) if isinstance(out, str) else None, so the isinstance check is the condition and is evaluated FIRST. The true-branch .strip() only runs when out is already a string. Demonstrated against the real function:

runner returns {}               -> None
runner returns []               -> None
runner returns None             -> None
runner returns 42               -> None
runner returns "  company  "    -> "company"
runner returns ""               -> None

No AttributeError on any non-string path, including the {} your comment names — that is exactly what FakeNlm returns for unknown verbs, so the existing suite was already exercising it.

Changes made regardless, because "correct but misread" is worth fixing in a guard whose whole job is to refuse cleanly:

  • the expression is now an explicit early return (if not isinstance(out, str): return None);
  • a new subtest asserts {}, [], None and 42 all yield None rather than raising, since an exception here would escape the guard instead of becoming the governed refusal.

@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: f315952d4b

ℹ️ 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".

# reaches the CLI — session notebooks and imports are created in the same
# account as the lifecycle books, so they are bound by the same rule. A run
# that cannot prove which account it writes to must not write at all.
enforce_hosting_profile(args.root)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep the profile binding stable for the whole run

When another terminal runs nlm login switch after this one-time check, every subsequent nlm() subprocess can read the new process-global default and add or delete sources in the wrong account. The recorded CLI semantics explicitly acknowledge that same-host sessions race on this setting (docs/lifecycle-notebook-projection.md:395-402), while the governing delta requires every invocation to remain bound (openspec/changes/add-notebook-projection-identity/specs/lifecycle-notebook-projection/spec.md:143-147). A single check before a roughly 40-minute apply therefore does not bind the run; use isolated profile configuration or otherwise prevent/recheck profile changes at each invocation boundary.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted — and you caught it with my own documentation, which is the right way to lose an argument. Section 12 says same-host sessions race on the process-global setting, and I then shipped a one-time check in front of a forty-minute apply. That binds nothing.

Fixed: nlm() now re-asserts the binding BEFORE EVERY invocation. It reads auth.default_profile straight from ~/.notebooklm-mcp-cli/config.toml rather than shelling out — a stat, not a subprocess, cached on the file's own (mtime_ns, size) stamp, so the per-call cost is negligible across thousands of invocations. On drift it refuses the NEXT invocation before the subprocess runs, names the re-bind command, and relies on the sync being idempotent so a resumed run is a no-op over whatever finished.

Isolated profile configuration was the other option you offered; I did not take it because the CLI exposes no config-path or profile environment override I could verify, and inventing one would have been a guess. Detect-and-refuse is provable today.

Production now reads the profile from ONE source — the same file the assertion re-reads — since two readers of one fact can disagree and this one gates the other.

Five tests cover it, and the revert-test earned its keep: neutering the drift check failed 2 tests, but REMOVING the assert_still_bound() call from nlm() left all of them passing. A detector nothing invokes is decoration, so there is now a test that drives the real nlm() with a drifted config and a stubbed subprocess.run, asserting both that it raises and that subprocess.run was never reached.

Comment thread scripts/sync-notebooklm-books.py Outdated
Comment on lines +1610 to +1611
_HOSTING_SCALARS = ("case", "account", "nlm_profile")
_HOSTING_MIGRATION_SCALARS = ("state", "from_account", "from_nlm_profile")

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 Validate the declaration before accepting it

When the declaration says operator_hosted but names a consumer or service account, this narrow reader ignores account_type and domain, and enforce_hosting_profile() proceeds whenever the named profile is active. The separate validator would reject that configuration, but a repository-wide search found no sync caller or workflow that invokes it, so the normal operational path does not enforce the refusal required by openspec/changes/add-notebook-projection-identity/specs/lifecycle-notebook-projection/spec.md:23-29. Run the validator before any CLI operation or enforce the relevant fields directly in the sync.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted. The repository-wide search is correct: nothing the sync runs invoked the validator, so an operator-hosted declaration naming a consumer or service account would have sailed through an ordinary --apply. A refusal that only fires in a script nobody calls is not a refusal.

Fixed by enforcing the load-bearing rules INLINE on the operational path, in _refuse_unusable_declaration(), called from enforce_hosting_profile() before any CLI work: the two-case vocabulary, account_type: google_workspace_user for the operator-hosted case, the service-account refusal stated on the platform constraint (no API, and a service principal cannot drive the consumer web UI), and the account-must-be-in-the-declared-domain check. Dependency-free, so the sync keeps carrying no YAML requirement.

I did not run the validator as a subprocess from the sync, which was your other suggestion, because it would add a PyYAML dependency to a script deliberately without one and make the refusal conditional on that import succeeding. The split is now explicit in both files: the sync enforces what a run must not proceed without; the validator remains the authority on the rest, including the roster shape a sync never reads.

Four tests assert the refusals fire from enforce_hosting_profile() itself, and the revert-test confirms it — deleting the inline call fails 4 of them.

…n where runs happen

Codex's two findings on PR #277, both real.

P1: a single check before a forty-minute apply does not bind the run. Profile
selection is process-global, and my own section 12 says same-host sessions race
on it — so another terminal running nlm login switch mid-run would have
redirected every later add and delete into a different account. nlm() now
re-asserts the binding before every invocation, reading auth.default_profile
from the CLI's config file directly: a stat rather than a subprocess, cached on
the file's own (mtime_ns, size) stamp. On drift it refuses the next invocation
before the subprocess runs, names the re-bind command, and leans on the sync
being idempotent so a resumed run is a no-op over what finished.

P2: the validator was invoked by nothing the sync runs, so an operator-hosted
declaration naming a consumer or service account would have passed an ordinary
--apply. The load-bearing rules are now enforced inline and dependency-free on
that path — the two-case vocabulary, the Workspace-user requirement, the
service-account refusal on the platform constraint, and the account-in-declared-
domain check. The validator stays the authority on what a sync never reads.

Production now reads the profile from ONE source: the same config file the
per-invocation assertion re-reads, since two readers of one fact can disagree
and this one gates the other.

Thirteen more tests, and all three new guards are revert-tested. The third
caught something the first two did not: removing the assert_still_bound() call
from nlm() left every test passing, so the wire — not just the check — is now
asserted by driving the real nlm() with a drifted config and a stubbed
subprocess, proving the refusal lands BEFORE anything is written.

Copilot's AttributeError report is refuted on the record (the conditional binds
last, so the isinstance check runs first), but the line was rewritten as an
early return anyway and now has its own regression subtest.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 23, 2026 20:31

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.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

scripts/validate-notebook-projection-hosting.py:161

  • validate() returns errors that are already prefixed with the full path (e.g. f"{path}: unreadable"), but main() prints each error as f"{path.name}: {error}". This yields duplicated paths like notebook-projection-hosting.yaml: /abs/path/...: unreadable ..., making CLI output noisier and harder to scan.
    try:
        record = yaml.safe_load(path.read_text(encoding="utf-8"))
    except (OSError, yaml.YAMLError) as exc:
        return [f"{path}: unreadable ({exc})"]
    if not isinstance(record, dict):

Comment thread scripts/sync-notebooklm-books.py Outdated
found[key] = value
elif indent == 4 and in_migration and key in _HOSTING_MIGRATION_SCALARS:
found[f"migration_{key}"] = value
return found or None
…rivation, not after

One blocking finding and five should-fixes, each reproduced before it was
fixed.

B1, blocking. The alias store is ONE flat, profile-independent file, and
resolve_or_create_book() registers an alias on the FOUND path as well as the
created one. So the runbook's re-derivation would have repointed xf-canon,
xf-drafts and every xf-ideation-* to the new notebooks before the operator ever
reached the step that must DELETE those aliases rather than repoint them — by
which time the ratified rule could not be honoured and the legacy notebook ids
were no longer recoverable from the store. The runbook now records the ids and
deletes the aliases in step 1, before any --apply, which is the 2026-08-10
order; the remaining steps are renumbered and the stranding window between
binding the host and flipping the state is stated as deliberate.

S1: --parity issued three alias set calls while its docstring and two doc
sections promised it never mutates. Alias binding is now off for the read-only
caller and the test's blocklist covers alias set and alias delete.

S2: a hosting file this narrow reader could not parse — flow style, four-space
indent, tabs, all valid YAML that the validator passes — took the UNDECLARED
branch, so the sync bound nothing and ran the entire job unbound. An existing
file now always yields a dict, and an empty one refuses. Present-but-unreadable
is not absent.

S3: migration.state: in_progress failed the validator and passed the sync,
which then bound the declared profile while the books were still in the
previous account. The sync now owns the state vocabulary and the
pending-requires-from_nlm_profile rule, so one rule has one owner.

S4: "the CLI stores no email for a profile" was simply false —
profiles/<name>/metadata.json carries it, populated by a recent login and null
by an older one. The sync now compares it to the declared account when present,
reports null as unknown rather than as a match, and the claim is corrected in
the docstring, section 12 and the runbook gate.

S5: the runbook's step references were off by one exactly where an operator
could strand a host between profiles.

Notes recorded, not fixed: the workbench's own unbound nlm path (named inside
task 4.2's deferral), the microsecond TOCTOU that cannot be closed without a
per-invocation flag the CLI does not offer, the validator's absence from CI,
the self_hosted and denied: field-discipline gaps, and the two share-lane
descriptions now reconciled as one act with two interfaces.

All five new guards revert-tested individually.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 23, 2026 21:03
@brettheap

Copy link
Copy Markdown
Contributor Author

Adversarial round taken — 1 blocking + 5 should-fix, each REPRODUCED before it was fixed, all on this branch (cd9c446e).

B1 (blocking) — the re-derivation repointed the aliases the retirement had to delete. Reproduced: aliases.json is one flat dict keyed on alias name, profile-independent, and resolve_or_create_book() calls _ensure_alias() on the FOUND path too — so step 3's --apply under company would overwrite xf-canon/xf-drafts/xf-ideation-* before the operator reached "delete, never repoint", leaving the legacy ids unrecoverable from the store. Fixed with the pre-step you preferred: the runbook now RECORDS the legacy notebook ids and nlm alias deletes them in step 1, before any --apply — the 2026-08-10 order — with every later step renumbered and step 8 addressing the legacy notebooks by those recorded ids.

S1 — --parity mutated. Reproduced with a stubbed runner: three alias set calls. resolve_or_create_book() now takes bind_alias, the parity path passes False, and test_parity_never_mutates blocks alias set and alias delete as well. Runbook step 7's parity run is now genuinely read-only.

S2 — fail-OPEN on an unparseable declaration. Reproduced for flow style, four-space and tabs: reader returned None, sync reported NO DECLARED HOSTING IDENTITY, bound nothing, and assert_still_bound() no-opped for the whole run — while the validator passed the same file. An existing file now always yields a dict; an empty one REFUSES, naming the indentation contract. Absent is the only undeclared case.

S3 — state vocabulary enforced by one gate. Reproduced: in_progress → validator FAIL, sync bound company with books in personal. _refuse_unusable_declaration() now owns the state vocabulary, the pending-requires-from_nlm_profile rule, and the always-required top-level nlm_profile. Tested both directions.

S4 — the no-email claim was false. Verified live: profiles/farheap/metadata.json carries [email protected], profiles/personal carries null. The sync now reads it and refuses a populated address that disagrees with the declaration, reports null as unknown rather than as a match, and the claim is corrected in the docstring, §12 and the runbook gate.

S5 — off-by-one at the stranding point. Fixed, and the refuse-window between binding the host and flipping migration.state is now stated as deliberate.

Notes recorded, not fixed (N1-N5) — in tasks.md §6.3/§6.4 and §12: the workbench's own unbound nlm path (named explicitly inside task 4.2's deferral, with the runbook telling operators to migrate sessions through the sync); the microsecond TOCTOU, now STATED as the one limit that cannot be closed without a per-invocation flag the CLI does not offer; the validator's absence from CI (pytest exercises it against the committed record); the self_hosted / denied: field-discipline gaps; and the two share-lane descriptions reconciled as one human decision with two interfaces.

All five new guards revert-tested individually — and the revert-test caught my own sloppiness once: my first attempt mutated an unrelated return found and reported a false pass, so I re-ran it against the exact line.

Gates: tests/ideation-dashboard 3983 passed/15 skipped; notebooklm+doc-health+ideation_dashboard 902 passed/13 subtests; openspec --all --strict 69/69; doc-health 0 new vs a fresh 0ce4f6f8 baseline; both validators clean; contracts/ untouched.

Not merging — the orchestrator gates it.

@brettheap
brettheap merged commit 40b3384 into main Aug 23, 2026
2 checks passed

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.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Comment on lines +99 to +109
if not isinstance(migration, dict):
_err(errors, "hosting.migration: must be a mapping when present")
elif migration.get("state") == "pending":
for field in ("from_account", "from_nlm_profile"):
if not migration.get(field):
_err(errors, f"hosting.migration.{field}: a PENDING "
f"migration must name where the books still "
f"live — the sync binds there until they move")
elif migration.get("state") not in (None, "complete"):
_err(errors, f"hosting.migration.state: {migration.get('state')!r} "
f"is neither 'pending' nor 'complete'")
unsolved about authenticating a Workspace user to the CLI rather than
implying it is routine.
- [ ] 3.3 Cross-link the two-case custody rule to `credential-contracts` so the
- REALIZED 2026-08-23: §6 gains step 0 (read and bind the profile) and step 2b (`--parity`), and says plainly that profile selection is process-global and what is verified is the profile NAME, not the address — the CLI stores no email.
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.

2 participants