Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Keep privacy labels under storage.db_only and add commit-push --untrack (GST-2519)
garrytanece7e0158dd2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d99547f8d4..63fb84595d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,18 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [Unreleased]++**A privacy label repair on a database-only page now sticks, and a supported command stops tracking a folder's files without deleting their pages.** Pages under a folder declared `storage.db_only` in `gbrain.yml` live in the database. Some of those folders still had files Git tracked from before the declaration, and on a git-canonical source every sync put the committed file back over the database, undoing a `gbrain repair visibility` that had made the page private. Sync now keeps the database version there, a commit to such a file can no longer widen who reads the page, and `gbrain git commit-push --untrack` takes the old files out of Git safely so the problem cannot come back.++### Itemized changes++- **Label repairs under `storage.db_only` stick.** On a strict (git-canonical) source a page whose file Git still tracks under a declared `storage.db_only` folder keeps a database change across `gbrain sync` and `gbrain sync --full`. A commit that changes the file still imports.+- **An import there never widens.** On every managed source, a commit to a tracked file under `storage.db_only` keeps each privacy label (`visibility`, `access`, `confidentiality`, `readable_by`) the page has and the file does not state. A label the file states applies, a wider one included, so the owner can still widen on purpose. Files outside `storage.db_only` import exactly as before.+- **Ignored pages take label repairs.** On a strict source, `gbrain repair visibility` on a page saved under a path Git ignores (`git_ignored`, no file) writes the label in the database instead of holding the page `canonical_file_missing`.+- **`gbrain git commit-push --untrack -m <msg> -- <paths>`** removes the named files from Git and the index, keeps them on disk and commits only those deletions under the commit lock; `--dry-run --untrack` previews and refuses the same way. In a managed canonical worktree it only takes files under a `storage.db_only` folder that `gbrain.yml` at HEAD declares and `.gitignore` ignores (else `untrack_not_db_only`, nothing changed), never pushes, and every page stays live with its content. A plain commit-push of a removal staged by hand with `git rm --cached` now points at `--untrack`. Guide: [untrack](docs/guides/shared-checkout-git.md#untrack).+- Tests: `test/db-only-labels-gst2519.test.ts`, `test/sync-classify-strict-g3.test.ts` and `test/git-commit-push-untrack-gst2519.test.ts` run on PGLite and Postgres, strict and non-strict sources.+## [0.60.687.0] - 2026-11-12**An upgrade can no longer run the same schema step twice at once.** When two gbrain processes started on one brain together (a cron job and an agent, or two hosts after an upgrade), both could apply the same schema migration. On Postgres reached through a transaction-mode pooler such as PgBouncer or Supabase's pooler, the lock meant to keep them apart did not hold. The pooler hands each statement to whichever server connection is free, so the lock could be taken on one connection and left behind on another. The second process then ran the step too, which showed up as a failed migration (for example a duplicate key on `pg_proc` while a function was being created) or as a step applied twice, and a lock left behind could keep later upgrades waiting until they timed out. Every path that changes the schema now takes one lock that holds for the whole run, through a pooler or a direct connection, and on PGLite. There is nothing to do beyond upgrading.diff --git a/docs/architecture/key-files/core-persistence-continued.md b/docs/architecture/key-files/core-persistence-continued.mdindex e7cf026a50..b42dcff1a2 100644--- a/docs/architecture/key-files/core-persistence-continued.md+++ b/docs/architecture/key-files/core-persistence-continued.md@@ -42,4 +42,4 @@ The #6188 fence check and fence repair live in [fence repair](core-fence-repair.- `src/core/postgres-engine/reserved-transactions.ts` with `isPersistenceDeclaration` (`src/core/persistence/protocol.ts`) — BEGIN pipelining. `isPersistenceDeclaration` (GBRA-156) accepts exactly the `protocol.ts` declarations (transaction-local `set_config` calls and the brain row FOR SHARE). Admission, the FIFO claim, the effect claims and source guards, the receipt true-up, the single publication (`coordinator.ts`) and the consumer's lent lane transactions (`consumer.ts` `onLane`, through `reservedTransactions`) pass it as `TransactionOptions.pipelineFirst`, so behind a transaction-mode pooler the declaration goes out with BEGIN (one round trip less per transaction) while every later statement still waits for BEGIN's answer; if BEGIN fails, only the declaration has run, in autocommit, where it changes nothing. A reserved transaction gates every statement its body can reach, savepoint and nested-transaction bodies and `file()` included. A sync lane group's publication passes none: its begun mark must follow BEGIN's answer (`sync-lanes.ts` `awaitLaneBegin`). Tests: `test/persistence-pipeline-first.test.ts` (the predicate and the reviewed call sites), `test/e2e/pgbouncer-transaction-pipeline-6930.test.ts`.- `src/core/links-fence.ts` + `src/core/links-fence-projection.ts` — the `## Links` fence (G5): the markdown form of authored (manual) edges, `<!--- gbrain:links:begin -->` / `end` around `| to | type | source | valid_from | valid_until | context |`, one row per (to, type, source), source defaulting to `manual`; a reconciliation-managed provenance (`MANAGED_LINK_SOURCES`, exported here and re-exported by `ops/links.ts`), a bad date or a duplicate key is a skipped row with a warning. `parseLinksFence` (state `absent` / `parsed` / `malformed`), the deterministic `renderLinksFence` (rows sorted by key), `upsertLinksFenceRow` (omitted context and dates keep the stored ones; identical row = unchanged body), `removeLinksFenceRows` (leaves an empty fence), `replaceOrInsertLinksFence` (a `## Links` section at the end of compiled_truth, above an unclosed code block) and `maskLinksFence`, which `extractBodyLinks` applies so the fence cells are never also extracted as markdown, wikilink or bare-slug edges. A rewrite of a fence that parses with warnings throws `LinksFenceRewriteRefusal`. Cells use `escapeFenceCell` plus the same one-level marker encoding for `gbrain:links:*`. `projectLinksFence(tx, page, rows)` reconciles only what the page's fence owns: edges with origin_page_id = the page and origin_field `links_fence` (deleted, context-updated, inserted by key) and `manual` transitions with origin_page_id = the page, compared per row by (to, type, link_source, kind, date) and written with the row's source in `link_source`, then refreshes the touched relationships; a row whose target is not a live page in the source yields no edge. `linksFenceProjectionRows` returns null for an absent or malformed fence, so such a body changes no edge (an absent fence retires nothing, as for facts; unlike facts no held generation is recorded, so after a hand deletion of the whole section the database keeps edges git no longer has until `remove_link` or the G3 indexer), and drops rows typed with a link type the active pack does not declare. Callers: `prepareCanonicalProjections` (every projected page publication, quarantined and segmented-unread bodies excepted), `prepareAutomaticLinks` (put_page auto-links and the managed links maintenance, so `extract --stale` restores a lost fence edge) and `persistence/manual-links.ts`. Database-only manual edges (origin_field NULL) are never touched by any of them. Pinned by `test/links-fence.test.ts` and `test/managed-links-fence.test.ts`.- `src/core/persistence/source-lifecycle.ts` retire batches with `topology-transaction.ts` (#7702/#8905) — every `topologyTransaction` runs under `statement_timeout=5s` and `lock_timeout=1s` and maps SQLSTATE 57014/55P03 to `write_pending`, so a managed `remove` or `purge` first deletes the source's pages in batches of `SOURCE_RETIRE_BATCH_PAGES` (500; about 110 ms per batch with chunks and links on Postgres) under the native locks `withTopologyLocks` holds, each batch its own `topologyTransaction`. A batch re-checks the final transaction's preconditions (admin state, `lockTopologyRows`, the incarnation read before the locks, archived or `EXPIRED_ARCHIVE_SQL` due, no prior receipt other than this request's own admission, no `oauth_clients` reference, `assertTopologyRequestsSettled` from `topology-locks.ts`, `lockTopologyPrincipal`, and on the first batch `admitTopologyRetire` from `topology-receipts.ts`, which checks the receipt quotas at the largest receipt and records the admission) and, when one would refuse or replay, stops without deleting so the final transaction reports it, or throws that refusal before deleting; a batch that fails `write_pending` is retried at half the size (floor 1), so heavy pages still fit the bound; a refusal after some batches committed says how many pages that run already deleted; a dry run, a missing checkout, an unconfirmed operation and an admission-hooked call never batch. The final transaction's `sources` delete runs `removedSourceScrubCtes` (#9068: the source's retrieval and volunteer rows, and its slugs in eval candidates), so a run that stops after some batches leaves those rows until a retry commits. Each batch deletes inside `withCoordinatedWrite` with local-CLI attribution (the `pages` guard needs the source in `gbrain.write_sources`; only the final `sources` delete sets `gbrain.topology_change`). Committed batches are durable: a retry (same or new request_id) resumes, and the receipt's `pages_deleted` counts the pages deleted by the run that commits it. #8984: the first batch's transaction records the admission, a `persistence_topology_changes` row in state `recovering` with no recovery record, bound to the source incarnation it deletes from (`isRetireAdmission`); `recordTopologyChange` settles it `committed`, and a remove or purge that deletes that incarnation under another request, or any other lifecycle operation that commits a change to it (archive, restore, rebind, claim), settles it `failed` (`supersedeTopologyRetires`, which skips only the caller's own principal and request_id pair). A retry of the request_id against another incarnation (the source was removed and re-added) refuses `source_retire_superseded`, settles the admission `failed` and deletes nothing, also when a since-replaced CLI registration (another principal) admitted that request_id for a remove or purge, since idempotency is per principal; an admission bound to the current incarnation still resumes under the new registration; deactivation and graduation list an unsettled admission as a blocker that names its request_id and asks the user whether to finish it or keep what is left; an automatic expired-archive purge's admission (`expired_only` in its outcome) is left to the next automatic run with `needsUser: false`, and `sources writer status --json` lists the stopped and superseded requests (`topology_requests`). Tests: `test/source-retire-batched.test.ts` (PGLite), `test/e2e/source-retire-batched-postgres.test.ts` (60,000 pages), `test/source-retire-incarnation.test.ts` and `test/e2e/source-retire-incarnation-postgres.test.ts`.-- `src/core/persistence/label-edit.ts` + `src/core/repair/label-write.ts` (GST-2468) — the label-only page write of operator repairs (`repair visibility`, `repair private-labels`). `label-edit.ts`: `LABEL_KEYS` (visibility, access, confidentiality), `readLabelEdit` validates a `managed_maintenance_page` intent's `label_edit` (`set` plain-word values, `remove` keys), `spliceLabelLines` removes, replaces or appends label lines in a file's frontmatter text and declines (null) a block or multi-line value, a duplicate key or a file with no frontmatter block. `page-prepare.ts` `labelEditFile` uses it in `compareFileTarget` when the file matches the snapshot: the edited file (or its edited head over the write's body, for a fence row) must read back as the file the write would render, else the write refuses `invalid_params`; the file is never re-rendered under a label edit. `label-write.ts`: `writeLabelPage` publishes through the maintenance door with `keep_trust` and the edit on a managed brain, else `importAtRevision` (maintenance transaction, page lock, `withTrustKeep`); `filesInCheckout` names the unmanaged pages whose checkout file would undo a database-only write; for those, `writeLabelFile` applies `labelEditFile` to the file's own bytes (it must still hold the page, `ownerRepairFile`), imports it under `withTrustKeep` and writes it back through `writePageThrough` (`fileText`, preimage checked) in one transaction; drift or a file edited mid-write throws `source_changed`, and a file it cannot write (`sync.write_through` off, `url_clone`, an unresolvable target, a write error) returns a held `file_backed` outcome with the import rolled back. `repair visibility` calls it directly; `private-labels` still holds those pages as `file_backed`. GST-2476: `label-edit.ts` also edits `readable_by` (`READERS_KEY`, `EDIT_KEYS`; `set` takes a plain-word list, rendered `readable_by: [a, b]`), and `writeLabelPage` takes a maintenance `batch` (then `publishMaintenancePages([page], {batch})`). `src/core/repair/readers.ts` is `repair visibility --readers`: `checkedReaders` (members exist and are enabled, groups exist, else `access_member_invalid`; a list that leaves out the owner refuses unless `allowWithoutOwner`), `planReaders` (named pages or a `--slugs-file`, up to `READERS_MAX_PAGES`, approved set bound to each page's live readers) `readersWrite` (re-checks a page, holds a segmented one, renders the edit) and `applyReaders` (phase `READERS_PHASE`, one label-only write); `visibility.ts` `applyBatch` admits a managed source's run of readers items together through `publishMaintenancePages` under the run's batch (Postgres publishes them in groups of up to 8), so the Git effect commits a window's ready files together; `readersGitCounts` reports the run's Git effect states. `visibility.ts` `labelWrite` holds a managed page with no canonical file outside `storage.db_only` as `canonical_file_missing`.+- `src/core/persistence/label-edit.ts` + `src/core/repair/label-write.ts` (GST-2468) — the label-only page write of operator repairs (`repair visibility`, `repair private-labels`). `label-edit.ts`: `LABEL_KEYS` (visibility, access, confidentiality), `readLabelEdit` validates a `managed_maintenance_page` intent's `label_edit` (`set` plain-word values, `remove` keys), `spliceLabelLines` removes, replaces or appends label lines in a file's frontmatter text and declines (null) a block or multi-line value, a duplicate key or a file with no frontmatter block. `page-prepare.ts` `labelEditFile` uses it in `compareFileTarget` when the file matches the snapshot: the edited file (or its edited head over the write's body, for a fence row) must read back as the file the write would render, else the write refuses `invalid_params`; the file is never re-rendered under a label edit. `label-write.ts`: `writeLabelPage` publishes through the maintenance door with `keep_trust` and the edit on a managed brain, else `importAtRevision` (maintenance transaction, page lock, `withTrustKeep`); `filesInCheckout` names the unmanaged pages whose checkout file would undo a database-only write; for those, `writeLabelFile` applies `labelEditFile` to the file's own bytes (it must still hold the page, `ownerRepairFile`), imports it under `withTrustKeep` and writes it back through `writePageThrough` (`fileText`, preimage checked) in one transaction; drift or a file edited mid-write throws `source_changed`, and a file it cannot write (`sync.write_through` off, `url_clone`, an unresolvable target, a write error) returns a held `file_backed` outcome with the import rolled back. `repair visibility` calls it directly; `private-labels` still holds those pages as `file_backed`. GST-2476: `label-edit.ts` also edits `readable_by` (`READERS_KEY`, `EDIT_KEYS`; `set` takes a plain-word list, rendered `readable_by: [a, b]`), and `writeLabelPage` takes a maintenance `batch` (then `publishMaintenancePages([page], {batch})`). `src/core/repair/readers.ts` is `repair visibility --readers`: `checkedReaders` (members exist and are enabled, groups exist, else `access_member_invalid`; a list that leaves out the owner refuses unless `allowWithoutOwner`), `planReaders` (named pages or a `--slugs-file`, up to `READERS_MAX_PAGES`, approved set bound to each page's live readers) `readersWrite` (re-checks a page, holds a segmented one, renders the edit) and `applyReaders` (phase `READERS_PHASE`, one label-only write); `visibility.ts` `applyBatch` admits a managed source's run of readers items together through `publishMaintenancePages` under the run's batch (Postgres publishes them in groups of up to 8), so the Git effect commits a window's ready files together; `readersGitCounts` reports the run's Git effect states. `visibility.ts` `labelWrite` holds a managed page with no canonical file outside `storage.db_only` as `canonical_file_missing`. GST-2519, labels under `storage.db_only`: `sync-classify.ts` `gitVerdict` keeps a strict source's `db_ahead` path when `state.dbOnly` (a label repair on a page whose file Git still tracks there survives later syncs; a commit that moved still imports); `sync-prepare.ts` imports a db_only file over a live page through `withStoredLabels(text, stored, incoming)`, which adds each `EDIT_KEYS` label the row holds and the file does not state, so an import there never widens (a label the file states applies, wider included); `page-prepare.ts` `prepareFileTarget` lets a label repair of a strict page stamped `git_ignored`, with no recorded file and a path Git still ignores, write the database only instead of holding it `canonical_file_missing`. Tests: `test/db-only-labels-gst2519.test.ts`, `test/sync-classify-strict-g3.test.ts`.diff --git a/docs/architecture/key-files/workspace-push-and-backup.md b/docs/architecture/key-files/workspace-push-and-backup.mdindex 198ad89866..39028c8e54 100644--- a/docs/architecture/key-files/workspace-push-and-backup.md+++ b/docs/architecture/key-files/workspace-push-and-backup.md@@ -12,7 +12,7 @@ Key files:## Shared-checkout git writer-- `src/core/git/commit-push.ts` + `src/core/git/commit-guard.ts` — writer safety in a shared checkout (#7381). `integrate` replaces the tip 3-way merge when any local commit is patch-equivalent to an upstream one (`rev-list --cherry-mark`): it replays the local commits onto the remote tip in memory (`merge-tree --merge-base` on git 2.40+, a 3-way `read-tree` otherwise), leaving out the equivalent ones and clean merges, so a copy the remote edited never conflicts and one it reverted is never re-applied; the merge message lists what it left out. `supersededPaths` resolves a content conflict to ours when the remote's blob is one the same path held earlier in ours' history (last 200 commits touching it) and a different blob replaced it there; the push reports them as `superseded_remote_paths`, and `integrate_conflict` lists only the rest (`detail.superseded` names them). `commitPaths` refuses a path outside the source roots (`configuredSourceRoots`, git config `gbrain.sourceRoot`, recorded by `sources harden`'s `recordSourceRoot`) and a file another writer staged under a named directory (`commit_prestaged_paths`), stages named tracked paths with `add -u` and visible untracked ones with `add -A` (a tracked deletion under an ignored directory commits, #7984; any other path keeps git's `commit_paths_invalid`), and restores the exact index entries (`update-index --index-info`) when git refuses the commit. After the commit step (and its index restore) `commitPaths` returns the named paths HEAD still lacks (`unstagedPaths`: a modified entry flagged assume-unchanged or skip-worktree, a named file git did not index such as one inside a nested repository, and unstaged status entries under a named directory; a skip-worktree entry absent from disk, a flagged gitlink and ignored files under a named directory are left out) and keeps an unindexed file out of `commit --only`; `commitAndPush` (classic, managed and remoteless) and `commitPathsLocked` then throw `commit_paths_skipped`, or `writer_coordinator_required` for a page in a managed worktree (its `put_page` fix names the managed source), once the rest is committed and, on a classic checkout, pushed (`detail`: `skipped`, `committed`, `pushed`, `branch`, and `publish` when the push failed too). Every commit gbrain makes carries `GBRAIN_COMMIT_VIA=<lock path>`. Every pathspec it passes goes through `literalPathspecs` (`git-env.ts`), never `git --literal-pathspecs`, so the commit's hooks keep Git's normal pathspec rules: a pre-commit guard that selects files by glob still sees and can refuse them (`git_unavailable`, paths unstaged). `commitPathsLocked` (write-through) never commits without the lock: a busy lock or refused commit notes the file in `brain-writethrough-pending.log` (git dir, O_APPEND lines), which the next locked write-through and `commit-push --pending` commit and `settlePending` prunes. `notePending` is exported: the derived and dream write-through (`cycle/derived-write-through.ts`, #8073) records each file it writes before its batch commit, so a crash in between leaves the file for that sweep. A publish refuses local non-merge commits outside the roots (`commit_outside_source_root`; `--allow-outside-source-root` lifts both refusals, and `sources harden` passes it for its root scaffolding). With git config `gbrain.quarantine` (opt-in) a content conflict publishes the remote's version of each conflicted file plus every other local change, names the local commit under `refs/gbrain/quarantine/<time>-<sha>` and appends it to `brain-quarantine.log` (`readQuarantine` lists entries whose ref still exists); structural conflicts still refuse. `commit-guard.ts` installs the opt-in `prepare-commit-msg` guard (`gbrain git guard`), which admits only commits naming a held commit lock, passes merges and in-progress operations, and honors `GBRAIN_COMMIT_GUARD=off`. The helper's no-gbrain fallback (`renderCommitPushHelper`) marks children with the absolute lock path and releases the commit lock before pushing under `brain-publish.lock`; it runs the same skipped-path check after its commit and reports `commit_paths_skipped` after the push (exit 1, or 4 when the push failed). The CLI (`src/commands/git.ts`) refuses `checkout_not_a_source` before staging when this brain home's managed-root registry records source checkouts and the resolved checkout is none of them and has no `gbrain.sourceRoot` (#8662); a registered checkout must contain the resolved one, or be a subdirectory its HEAD tracks, so a repository that only encloses one is refused, and a registry that cannot be listed refuses `writer_coordinator_required` (GST-1623). Tests: `test/git-writer-safety-7381.serial.test.ts`, `test/git-literal-pathspec-hooks-7759.test.ts`, `test/git-commit-push-not-a-source-8662.test.ts`, `test/git-commit-push-skipped-paths-gst2116.test.ts`.+- `src/core/git/commit-push.ts` + `src/core/git/commit-guard.ts` — writer safety in a shared checkout (#7381). `integrate` replaces the tip 3-way merge when any local commit is patch-equivalent to an upstream one (`rev-list --cherry-mark`): it replays the local commits onto the remote tip in memory (`merge-tree --merge-base` on git 2.40+, a 3-way `read-tree` otherwise), leaving out the equivalent ones and clean merges, so a copy the remote edited never conflicts and one it reverted is never re-applied; the merge message lists what it left out. `supersededPaths` resolves a content conflict to ours when the remote's blob is one the same path held earlier in ours' history (last 200 commits touching it) and a different blob replaced it there; the push reports them as `superseded_remote_paths`, and `integrate_conflict` lists only the rest (`detail.superseded` names them). `commitPaths` refuses a path outside the source roots (`configuredSourceRoots`, git config `gbrain.sourceRoot`, recorded by `sources harden`'s `recordSourceRoot`) and a file another writer staged under a named directory (`commit_prestaged_paths`), stages named tracked paths with `add -u` and visible untracked ones with `add -A` (a tracked deletion under an ignored directory commits, #7984; any other path keeps git's `commit_paths_invalid`), and restores the exact index entries (`update-index --index-info`) when git refuses the commit. After the commit step (and its index restore) `commitPaths` returns the named paths HEAD still lacks (`unstagedPaths`: a modified entry flagged assume-unchanged or skip-worktree, a named file git did not index such as one inside a nested repository, and unstaged status entries under a named directory; a skip-worktree entry absent from disk, a flagged gitlink and ignored files under a named directory are left out) and keeps an unindexed file out of `commit --only`; `commitAndPush` (classic, managed and remoteless) and `commitPathsLocked` then throw `commit_paths_skipped`, or `writer_coordinator_required` for a page in a managed worktree (its `put_page` fix names the managed source), once the rest is committed and, on a classic checkout, pushed (`detail`: `skipped`, `committed`, `pushed`, `branch`, and `publish` when the push failed too). Every commit gbrain makes carries `GBRAIN_COMMIT_VIA=<lock path>`. Every pathspec it passes goes through `literalPathspecs` (`git-env.ts`), never `git --literal-pathspecs`, so the commit's hooks keep Git's normal pathspec rules: a pre-commit guard that selects files by glob still sees and can refuse them (`git_unavailable`, paths unstaged). `commitPathsLocked` (write-through) never commits without the lock: a busy lock or refused commit notes the file in `brain-writethrough-pending.log` (git dir, O_APPEND lines), which the next locked write-through and `commit-push --pending` commit and `settlePending` prunes. `notePending` is exported: the derived and dream write-through (`cycle/derived-write-through.ts`, #8073) records each file it writes before its batch commit, so a crash in between leaves the file for that sweep. A publish refuses local non-merge commits outside the roots (`commit_outside_source_root`; `--allow-outside-source-root` lifts both refusals, and `sources harden` passes it for its root scaffolding). With git config `gbrain.quarantine` (opt-in) a content conflict publishes the remote's version of each conflicted file plus every other local change, names the local commit under `refs/gbrain/quarantine/<time>-<sha>` and appends it to `brain-quarantine.log` (`readQuarantine` lists entries whose ref still exists); structural conflicts still refuse. `commit-guard.ts` installs the opt-in `prepare-commit-msg` guard (`gbrain git guard`), which admits only commits naming a held commit lock, passes merges and in-progress operations, and honors `GBRAIN_COMMIT_GUARD=off`. The helper's no-gbrain fallback (`renderCommitPushHelper`) marks children with the absolute lock path and releases the commit lock before pushing under `brain-publish.lock`; it runs the same skipped-path check after its commit and reports `commit_paths_skipped` after the push (exit 1, or 4 when the push failed). The CLI (`src/commands/git.ts`) refuses `checkout_not_a_source` before staging when this brain home's managed-root registry records source checkouts and the resolved checkout is none of them and has no `gbrain.sourceRoot` (#8662); a registered checkout must contain the resolved one, or be a subdirectory its HEAD tracks, so a repository that only encloses one is refused, and a registry that cannot be listed refuses `writer_coordinator_required` (GST-1623). `--untrack` (#7753, GST-2519): `untrackPaths` removes the files HEAD holds under the named paths (`untrackTargets`; skip-worktree files refuse) with `git rm --cached` and commits from HEAD in a temporary index, taking back a commit that changed anything else; in a managed canonical worktree `untrackAdmitted` first requires each file to sit under a `storage.db_only` dir that `gbrain.yml` at HEAD declares and that `.gitignore` ignores (`untrack_not_db_only`, index untouched), and the commit stays local like every managed commit; `previewUntrack` is the dry run. A not_staged path that is a hand-staged `git rm --cached` names `--untrack` in the `commit_paths_skipped` fix. Tests: `test/git-writer-safety-7381.serial.test.ts`, `test/git-literal-pathspec-hooks-7759.test.ts`, `test/git-commit-push-not-a-source-8662.test.ts`, `test/git-commit-push-skipped-paths-gst2116.test.ts`, `test/git-commit-push-untrack-gst2519.test.ts`.- `src/core/git/range-secret-scan.ts` — `scanRange(root, from, to)`, the secret gate for automatic publishes: `gbrain git commit-push --push-only --scan-secrets` (the child `gbrain sources refresh` runs to publish a diverged managed checkout) scans `trackingRef..target` under the publish lock, right before the push. Plumbing only (`rev-list`, `cat-file commit`, one streamed `diff-tree --stdin -p --root --cc`), so log, diff and attribute settings never change what is scanned. Commit messages, added lines and merge resolutions go through `scanText` with the `.gbrain-scan-allow` allowlist; a finding, added text over the scan cap or a change to `.gbrain-scan-allow`/`.gitattributes` refuses `publish_secret_found` (file, line, rule, commit, never the value), and a range it cannot read in full (git failure, unrecognised output, 300 s budget) refuses `publish_scan_unreadable`. Commits the commit ledger records as page writes are not scanned: door and hosted-repository commits, and Git effect commits recorded `verified` (`effectCommit` in `effect-git.ts` builds the commit with `commit-tree` and moves HEAD with an `update-ref` compare-and-swap, so the recorded sha is gbrain's own; `verified` when each staged blob is the bytes whose sha256 the effect recorded); adopted records, records without `verified` and an unreadable ledger leave the commits scanned. Doctor `git_convergence`'s agent push fixes pass `--scan-secrets` too. `stagedScanPublishRefusal(root, base, target)` is the same refusal for `gbrain sources push` (`workspace-push.ts`: `origin/<branch>..HEAD` after its pull, then a push of that exact sha leased on the scanned tip, and no push when the local branch lacks the remote tip) and both first pushes of `gbrain bootstrap repo` (`bootstrap/repo.ts`, the whole history; `scanHistory` is the runner-fake seam), with gate changes exempt in commits the ledger records as `workspace_push` or `bootstrap`, whose blobs those writers scanned staged with the same allowlist. The access-policy commit (`access/policy-git.ts`) and the durability-scaffolding commit (`brain-repo-durability.ts`) publish through `commitAndPush` with `scanSecrets` (#8902). Test: `test/unmanaged-push-history-scan-8902.serial.test.ts`.- `src/commands/doctor/checks/git-writer.ts` — `checkout_lagging`, `dirty_age`, `commits_outside_source_root`, `quarantined_changes` (#7381, brain category, after `git_convergence`): over the unmanaged source checkouts with an upstream (`sourceRoots` from git-convergence, grouped by toplevel with each source's toplevel-relative root), never fetching, every git call bounded at 5 s. Lagging warns when `HEAD..@{u}` holds a commit over an hour old (fix: `gbrain git commit-push --pull --path <top>`, agent). Dirty age warns on pending write-through files older than 30 minutes (`pendingWriteThroughStillDirty`; fix: `commit-push --pending`, agent) and on files staged that long (ask_user: unstage or commit by name). Outside-root warns on unpushed non-merge commits that change files outside the DB source roots plus `gbrain.sourceRoot` (`localCommitsOutsideRoots`; ask_user fix with `--allow-outside-source-root`), and says when the checkout has no root recorded. Test: `test/doctor-git-writer-7381.test.ts`.- `src/core/git/commit-ledger.ts` — the commit ledger (PR B, docs/designs/REFRESH_WRITE_BARRIER.md part 3): `<git common dir>/gbrain/commit-ledger.jsonl`, one O_APPEND JSON line under 1 KiB per record, under its own flock `commit-ledger.lock` (start line, append, 4 MiB rotation to `commit-ledger.1.jsonl`). `recordCommit`/`recordCommitAsync` take the sha and writer kind (`commit_push`, `door`, `merge`, `replay`, `effect`, `sync_init`, `workspace_push`, `bootstrap`, `hosted_repo`); porcelain sites call `recordIntent` (head_before, `messageDigest` of the message) before `git commit`, plumbing sites record the `commit-tree` sha before the ref moves. A failed append never fails the commit (logged once); a directory outside git records nothing. `readLedger` reads both files; only a missing file reads as empty, any other read error throws (GST-1623). Tests: `test/commit-ledger.test.ts`.diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.mdindex 6118b5a284..4b431e6f39 100644--- a/docs/guides/error-codes.md+++ b/docs/guides/error-codes.md@@ -5552,6 +5552,16 @@ Reasons: `not_utf8`, `control_character`.More: [docs/guides/write-refusals.md#unsupported_path](../../docs/guides/write-refusals.md#unsupported_path)+### untrack_not_db_only++<a id="untrack_not_db_only"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| gbrain git commit-push --untrack in a managed canonical worktree was refused before the index changed: a file to untrack is not under a storage.db_only dir that gbrain.yml at HEAD declares, or .gitignore does not ignore it. | The next sync deletes the page of a file that leaves Git outside a declared storage.db_only dir, and a file .gitignore does not ignore can be committed again by any later commit. | Declare the folder under storage.db_only in gbrain.yml and add its <dir>/ line to .gitignore, commit both with gbrain git commit-push -m <msg> -- gbrain.yml .gitignore, then rerun the untrack. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/shared-checkout-git.md#untrack](../../docs/guides/shared-checkout-git.md#untrack)+### upload_expired<a id="upload_expired"></a>diff --git a/docs/guides/shared-checkout-git.md b/docs/guides/shared-checkout-git.mdindex 30669aad84..7bca5eadf7 100644--- a/docs/guides/shared-checkout-git.md+++ b/docs/guides/shared-checkout-git.md@@ -107,6 +107,9 @@ gbrain git commit-push --pull# Commit and push the write-through files gbrain could not commit (doctor's dirty_age names them)gbrain git commit-push --pending+# Stop tracking files and keep them on disk (see "Untrack" below)+gbrain git commit-push --untrack -m "stop tracking the archive" -- archive-example+# Preview: prints the paths, branch and lock it would use; takes no lock, writes nothinggbrain git commit-push --dry-run -m "people: add alice-example" -- people/alice-example.md```@@ -235,6 +238,37 @@ HEAD's blob; nothing is staged or committed. Read the file at HEAD again, redo tthe new base. Every `--base` path must also be one of the committed paths. Pages the agent also editsare better written with `gbrain put` (put_page), which carries its own revision check.+<a id="untrack"></a>+## Untrack: stop tracking files, keep them on disk++`git rm --cached` followed by a plain commit is the usual way to stop tracking a file, but in a shared+checkout the commit sweeps up whatever else is staged. `--untrack` does it in one locked step:++```bash+gbrain git commit-push --dry-run --untrack -m "stop tracking the archive" -- archive-example # preview+gbrain git commit-push --untrack -m "stop tracking the archive" -- archive-example+```++It removes every file the last commit holds under each named path from Git and the index, leaves the files+on disk, and commits exactly those deletions (anything else staged stays staged and out of the commit; a commit a+hook changed is taken back). A path the last commit holds nothing under, or a file marked skip-worktree, refuses+`commit_paths_invalid` before anything changes. In an ordinary checkout the commit is pushed like any other.++In a managed canonical worktree (the checkout gbrain's persistence owner writes), untracking a page file would+make the next sync delete that page, so `--untrack` there only takes files under a `storage.db_only` directory+that `gbrain.yml` at HEAD declares and that `.gitignore` ignores. The database row is canonical there, so every+page stays live with its content. Anything else refuses `untrack_not_db_only` with the index as it was: declare+the folder first (add it under `storage.db_only` and its `<dir>/` line to `.gitignore`, commit both with+`gbrain git commit-push -m <msg> -- gbrain.yml .gitignore`), then rerun. The commit stays local, like every+commit-push there; the owner's next Git publish, or `gbrain git commit-push --push-only --keep-checkout`,+publishes it.++If you already ran `git rm --cached` by hand, a plain commit-push of those paths refuses+`commit_paths_skipped` and names the `--untrack` command that commits the removal.++To undo, `git revert <untrack commit>` (then commit-push `--push-only` as usual). The revert writes the+committed bytes back over the files on disk, so copy any local edit to them first.+## Source rootsA brain can be one folder inside a larger repository. `gbrain sources harden`diff --git a/docs/storage-tiering.md b/docs/storage-tiering.mdindex 41bd94d4e3..15bc1a4567 100644--- a/docs/storage-tiering.md+++ b/docs/storage-tiering.md@@ -54,7 +54,7 @@ storage:When storage configuration is present, `gbrain sync` automatically manages `.gitignore` entries on every successful sync:- Adds missing `db_only` directory patterns to `.gitignore`.-- A file under a `db_only` directory that git already tracked before the declaration stays tracked and shows as modified once the database updates it; untrack it with `git rm --cached <path>`. A managed sync never soft-deletes a live page under a declared `db_only` directory because its file left Git (untracked, ignored or gone): the database copy is canonical (#7324).+- A file under a `db_only` directory that git already tracked before the declaration stays tracked and shows as modified once the database updates it; untrack it with `gbrain git commit-push --untrack -m "<msg>" -- <dir>`, which keeps the files on disk ([untrack](guides/shared-checkout-git.md#untrack)). While it stays tracked, a label repair on its page sticks, and a commit to the file never widens the page: a privacy label the row holds and the file does not state is kept (a label the file states applies). A managed sync never soft-deletes a live page under a declared `db_only` directory because its file left Git (untracked, ignored or gone): the database copy is canonical (#7324).- Idempotent — re-running adds no duplicate entries.- Stable comment header so the managed block is grep-able.- Skipped on `--dry-run` (don't mutate disk in preview mode).diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 3420adff28..1172c05cb9 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -49,5 +49,6 @@ src/commands/doctor/checks/extraction-sync.ts 1500 ratchet +7 GBRA-130 A-1: linksrc/core/search/evidence-delivery.ts 1759 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move); +7 GBRA-205: EvidencePlan.titleHeader and DeliveryMeta.title_header (interface fields cannot move) and the titles option on the header loader (logic in search/evidence-date.ts; the query budget key lives in search/evidence-packing.ts); +11 #7600: assemble_evidence quotes conversation rows and capEvidenceToBudget counts the quote fence (logic in search/transcript-quote.ts); +2 GBRA-156 /ship review: the cut-path admission and title room count the quote fence; +2 GBRA-156 /ship review pass 2: capEvidenceToBudget counts the fence only for the paths that fence (quote flag; recall counts the text as returned); +4 GST-687: page evidence and the extractive fallback quote below-owner-tier text for untrusted readers (untrusted flag; logic in search/transcript-quote.ts)src/commands/config.ts 1530 ratchet +1 GBRA-216: recall.* config set value refusal (facts/recall-config.ts); +1 GBRA-216: config set refuses a dream.claim_conflicts.mode other than propose|off (refusal in facts/claim-conflicts.ts); new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig); +1 #6865: sync.slug_conflicts.auto_remove boolean validation at set time (refusal text in repair/slug-autoheal.ts); +1 #6948: sync.origin_twins.auto_resolve boolean validation at set time (refusal text in repair/origin-twins-heal.ts); +2 #6795: config set chat_model/expansion_model help line and the model-pin import (shadow report and file-pin unset live in commands/config/model-pin-shadow.ts); +1 #6712 PR 4b: sync.admission set-time hook (value logic in commands/config/sync-admission-value.ts); +4 #7130: set-time refusal hook for sync.max_deletes / sync.max_delete_ratio (and .source.<id>) / purge.retention_hours (check lives in core/sync-reconcile.ts deleteSafetyConfigRefusal); +1 GBRA-150: sync.metafile_pages set-time route (body in config/sync-metafile-pages-value.ts); re-summed at the v0.60.330.0 merge (1520 measured); +2 #7242 minions.terminal_hook file-plane key and its set branch (logic in minions/terminal-hook.ts); +1 GBRA-161: generations.* set-time route (refusal in commands/config/generations-values.ts); +1 GBRA-207 #7630: sync.repo_path set-time refusal hook (refusal in core/sync-config-keys.ts syncRepoPathRefusal); +4 GBRA-377 PR B: skills.resolver.* file-plane routing (doc line, the one-line router and its two dispatch lines; logic in core/setup/skill-resolver-config.ts)src/commands/mcp-expose.ts 1519 ratchet hosted_option: Session carries the gbrain.io coaching notice on the first-receipt run and Tailscale/service friction exits (copy, refs and gating live in core/onboard/hosted-option.ts); +7 GBRA-199: --surface help lines, surfaceChosen option field and the advertise pass-through (registrationAdvertise in core/mcp-registration.ts)-src/core/behavior-change-notice.ts 1745 ratchet +4 train R: #7491/#7492 keyword_identifier_probe and keyword_slug_handles rows and their comment, #7175 keyword phrase row; the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +3 GBRA-200 comment, write-grant refusal and degraded-stamp rows (re-summed at the 0.60.562.0 merge: 1615 + 3); +2 GBRA-280 get_page selector-precedence row and comment (re-summed at the 0.60.569.0 merge: 1619 + 2); the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +2 GBRA-283 Wave A (#8460): engine_keyed_caches_gbra283 row and its comment (rows are data and cannot move); +2 GBRA-287: segmented_freeze_hold_gbra287 and segmented_reexport_gbra287 rows (rows are data and cannot move); +1 GST-1209: segmented_tiling_gst1209 row (rows are data and cannot move); +1 GST-1251: skillopt_loop_deprecated_gst1251 row (rows are data and cannot move); +1 GST-1209 follow-up: untiled_hold_repair_gst1209 row (rows are data and cannot move); +1 GBRA-283 B3a: embedded_scope_required_gbra283 row (rows are data and cannot move); re-summed at the train R merge with v0.60.574.0: 1623 + 4; +2 GST-1387: refresh_fence_refusal_gst1387 row and its comment (rows are data and cannot move); re-summed at the memory train #8481 merge with v0.60.578.0 (1643 measured); +3 GBRA-253 #8109 rows (frontmatter_drift_write_8109, contacts_activity_advance_8109, contact_rows_dedupe_8109; rows are data and cannot move), re-summed at the master v0.60.581.0 merge: 1643 + 3 = 1646 measured; +3 #8123 part C rows: sync_write_through_off_writeback_7084, managed_sync_dry_run_counts_7087, frontmatter_missing_source_dir_7889 (since TBD until the merge slot; re-summed at the 0.60.583.0 merge: 1646 + 3); +4 PR B commit_ledger_prb, doctor_foreign_writers_prb and sources_guard_prb rows and their comment (rows are data and cannot move; since TBD until the merge slot); +1 PR B #8615: file_drift_held_needs_prefer_8615 row; +1 PR B #8617: refresh_source_changed_retry_8617 row; +1 PR B #8662: commit_push_checkout_not_a_source_8662 row (since TBD until the merge slot; rows are data and cannot move); +2 PR B refresh_barrier_prb and commit_push_base_prb rows (re-summed: 1658 measured); +3 convergence PR A: the wave comment and two rows (conversion_content_evidence_pr_a, git_gap_live_pages_pr_a; since TBD until the merge slot; rows are data and cannot move); re-summed at the gate-ahead on master v0.60.592.0 plus #8711: 1658 + 3 = 1661 measured; +4 GST-1094/GST-900 rows (memory_recall scope-read, member-bound acting_user, recall max_chars, unknown_param _meta-only) and +1 qm_scope_writes_gst1113 and +1 recall_question_terms_gst1304 rows (rows are data and cannot move), re-summed at the 0.60.595.0 slot merge: 1661 + 6; +1 GST-1582 refresh_barrier_import_gst1582 row (since TBD until the merge slot; rows are data and cannot move); +2 GST-1601 source_changed_origin_gst1601 and adopt_local_edits_gst1601 rows (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.596.0 merge: 1668 + 2; +1 GST-1623 refresh_barrier_capacity_gst1623 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.599.0 merge: 1670 + 1; +2 GBRA-224 W1 release_channel_stable_default row and its comment; +1 GST-1623 refresh_barrier_later_write_gst1623 row (#8765; rows are data and cannot move); +5 #8766 GST-1623 items 4/6-9 and #8755: the wave comment and four rows (doctor_foreign_writers_partial_gst1623, commit_push_enclosing_repo_gst1623, owner_guard_fail_closed_gst1623, adopt_local_edits_hardening_8755) and +1 managed_sync_kind_reserved_8765 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on master v0.60.608.0 plus #8798: 1674 + 6; +1 GST-1853 refresh_barrier_aborted_refresh_sync_gst1853 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.613.0 merge: 1680 + 1; +1 GST-1674 refresh_refused_merge_recovery_gst1674 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.614.0 merge: 1681 + 1; +1 #8824/#8826/#8767: adopt_local_edits_replay_markers_8824 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8837: 1682 + 1; +1 url_source_origin row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8834: 1683 + 1; +1 #8828: the refresh_replan_own_commits_8828 row (1684 + 1 at the 0.60.618.0 slot); +1 the managed commit-push unpublished-count row; +1 the refresh publish-diverged default row; +1 GST-2051 ungranted_member_writes_gst2051 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-731 think_window_trajectory_gst731 row and +1 GST-1602 purge_cancels_deferred_write_gst1602 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8915 v0.60.621.0: 1688 + 2; +1 GST-2059: owner_reads_private row; +1 #8888: the record-origin checkout lock-down row (re-summed at the Q6 stack on #8934 v0.60.625.0: 1691 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 E1/F3/F4 rows (since TBD until the merge slot), re-summed at the master merge; +1 GBRA-284 personal_sources_gbra284 row (since TBD until the merge slot) (re-summed at the QM wave merge onto master v0.60.626.0: 1692 + 3); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 v3: the qm_personal_structured_gst1158 row (since TBD until the merge slot); +1 #8477 GST-1158 F2 personal-tools row at the QM wave merge (1695 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 #8483 memory_propose row at the QM wave merge (1696 + 1); +1 GST-1094 gap 4: the qm_admin_http_gst1094 row (since TBD until the merge slot); +1 GST-1158: the member_email_link_gst1158 row (since TBD until the merge slot); +2 #8479 member-email rows at the QM wave merge (1697 + 2); +1 GST-2112: ingest_keeps_readers_gst2112 row (re-summed at the Q7 v0.60.627.0 merge: 1692 + 1); +1 #8982 federated_member_writes_8982 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-2116 commit_push_skipped_paths_gst2116 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q10 slot on #9009 ee0f4a78: 1694 + 1; +1 GST-2118 pending_ledger_flagged_gst2118 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q12 slot on #9016 afb49de5: 1695 + 1; +1 GBRA-431: read_scope_params_gbra431 row (rows are data and cannot move), re-summed at the #9032 stack merge: 1697 measured; +2 GST-2201 sync_restored_file_gst2201 and purge_keeps_committed_file_gst2201 rows (since is the current VERSION until the merge slot; +1 GST-2243 remember_share_gst2243 row (re-summed at the #9098 stack merge: 1699 + 1); +1 GST-2312 #9024 sync_filter_owned_hold_9024 row (re-summed at the #9064 stack merge: 1700 + 1; rows are data and cannot move); +2 access-privacy wave (0.60.649.0): the owner_private_facts_gst2089 and private_labels_write_ahead_gst2092 rows; +1 GBRA-443 private_labels_batch_exit_gbra443 row (rows are data and cannot move), re-summed at the 0.60.650.0 slot on #9038: 1703 + 1; +1 postgres_tls_default row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.651.0 merge: 1704 + 1; +1 GST-2331 sync_reads_fetch_nothing_gst2331 row (rows are data and cannot move), re-summed at the 0.60.654.0 stack on #9045 6ff5540d: 1705 + 1; +7 QM wave (#9037) rows: attest_scope_read_ops_gst1158, attest_direct_page_writes_deferred_gst1158, personal_sources_gbra284, qm_personal_structured_gst1158, memory_propose_held_writes_gst1158, member_email_link_gst1158, qm_admin_http_gst1094 (re-summed at the 0.60.655.0 stack on #9110 f9b2072e: 1706 + 7); +1 GST-2228 recreated_takes_section_keeps_stored_takes_gst2228 row (since TBD; re-summed at the keep-takes-and-link-dates train merge: 1713 + 1); +1 GST-2228 links_rows_keep_own_dates_gst2228 row (since TBD; re-summed at the same train merge: 1714 + 1); +2 the W1 + memory proposals train (#9133): attest_every_page_write_deferred_gst2249 and memory_proposals_owner_http_gst2407 rows (rows are data and cannot move), re-summed at the #9138 v0.60.661.0 stack merge: 1715 + 2 = 1717 measured; +1 #8903 effect_git_secret_gate_gst1923 row (rows are data and cannot move), re-summed at the 0.60.664.0 stack on #9142 3931adb4: 1717 + 1; +1 GST-2407 PR 3: qm_recall_own_page_contract_v4 row (rows are data and cannot move), re-summed at the 0.60.666.0 stack on #9148 69c12917: 1718 + 1; +2 GST-363 PR 1 and PR 3 (#9135): the serves_several_labels_gst363 and stdio_member_per_harness_gst363 rows; +3 #9134 train rows member_forget_names_host_9101, refresh_fence_retry_id_gst2353 and recorded_read_view_args_gst2214 (rows are data and cannot move), re-summed at the #9134 slot merge onto #8829 dfc24954: 1721 + 3; +3 source-checkouts wave rows (autopilot_git_reconcile_gbra386, unknown_drift_history_rescreen, refresh_abandon_members_gst1465), re-summed at the #9137 stack merge: 1724 + 3; persistence train 13 at 0.60.676.0: its five rows on top of 0.60.675.0; +1 GST-2250 reconcile_publish_opt_out_gst2250 row (since TBD until the merge slot; rows are data and cannot move); +1 #8902 unmanaged_push_history_scan_8902 row (re-summed at the 0.60.678.0 stack on 501742d9: 1733 + 1); +1 GST-2246 maintain_safe_free_phases_gst2246 row (since TBD until the merge slot; rows are data and cannot move), re-summed on the doctor/dream/enrich train at the 0.60.679.0 slot merge onto #9170 82932eda: 1734 + 1; +2 GST-2462 privacy_label_ignored_gst2462 and access_page_rules_gst2462 rows (rows are data and cannot move), re-summed at the #9173 slot merge onto 49a922ef: 1735 + 2; +1 GST-2107 follow-up write_capacity_low_not_refusal_gst2107 row (rows are data and cannot move), re-summed at the 0.60.681.0 slot merge onto #9173 c08d0c8b: 1737 + 1; +1 GST-2490: owner_reads_derived_gst2490 row (rows are data and cannot move); +1 GST-2468: the label_only_operator_repairs_gst2468 row (a BEHAVIOR_CHANGES row cannot move); +1 GST-2446 remember_pageless_reply_gst2446, +1 GST-2492 strict_held_facts_gst2492 and +1 GST-2346 D1 owner_facts_shared_gst2346 rows (rows are data and cannot move), re-summed at the 0.60.685.0 train merge onto #9181 405ea4cf: 1740 + 3; +1 GST-2476: the readers_label_setter_gst2476 row (rows are data and cannot move), re-summed at the #9184 slot merge onto the #9179 train 361d57c6: 1743 + 1; +1 GST-2487: the fence_fact_private_in_place_gst2487 row (rows are data and cannot move), at the same slot merge of #9188 0075f09a: 1744 + 1+src/core/behavior-change-notice.ts 1748 ratchet +4 train R: #7491/#7492 keyword_identifier_probe and keyword_slug_handles rows and their comment, #7175 keyword phrase row; the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +3 GBRA-200 comment, write-grant refusal and degraded-stamp rows (re-summed at the 0.60.562.0 merge: 1615 + 3); +2 GBRA-280 get_page selector-precedence row and comment (re-summed at the 0.60.569.0 merge: 1619 + 2); the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +2 GBRA-283 Wave A (#8460): engine_keyed_caches_gbra283 row and its comment (rows are data and cannot move); +2 GBRA-287: segmented_freeze_hold_gbra287 and segmented_reexport_gbra287 rows (rows are data and cannot move); +1 GST-1209: segmented_tiling_gst1209 row (rows are data and cannot move); +1 GST-1251: skillopt_loop_deprecated_gst1251 row (rows are data and cannot move); +1 GST-1209 follow-up: untiled_hold_repair_gst1209 row (rows are data and cannot move); +1 GBRA-283 B3a: embedded_scope_required_gbra283 row (rows are data and cannot move); re-summed at the train R merge with v0.60.574.0: 1623 + 4; +2 GST-1387: refresh_fence_refusal_gst1387 row and its comment (rows are data and cannot move); re-summed at the memory train #8481 merge with v0.60.578.0 (1643 measured); +3 GBRA-253 #8109 rows (frontmatter_drift_write_8109, contacts_activity_advance_8109, contact_rows_dedupe_8109; rows are data and cannot move), re-summed at the master v0.60.581.0 merge: 1643 + 3 = 1646 measured; +3 #8123 part C rows: sync_write_through_off_writeback_7084, managed_sync_dry_run_counts_7087, frontmatter_missing_source_dir_7889 (since TBD until the merge slot; re-summed at the 0.60.583.0 merge: 1646 + 3); +4 PR B commit_ledger_prb, doctor_foreign_writers_prb and sources_guard_prb rows and their comment (rows are data and cannot move; since TBD until the merge slot); +1 PR B #8615: file_drift_held_needs_prefer_8615 row; +1 PR B #8617: refresh_source_changed_retry_8617 row; +1 PR B #8662: commit_push_checkout_not_a_source_8662 row (since TBD until the merge slot; rows are data and cannot move); +2 PR B refresh_barrier_prb and commit_push_base_prb rows (re-summed: 1658 measured); +3 convergence PR A: the wave comment and two rows (conversion_content_evidence_pr_a, git_gap_live_pages_pr_a; since TBD until the merge slot; rows are data and cannot move); re-summed at the gate-ahead on master v0.60.592.0 plus #8711: 1658 + 3 = 1661 measured; +4 GST-1094/GST-900 rows (memory_recall scope-read, member-bound acting_user, recall max_chars, unknown_param _meta-only) and +1 qm_scope_writes_gst1113 and +1 recall_question_terms_gst1304 rows (rows are data and cannot move), re-summed at the 0.60.595.0 slot merge: 1661 + 6; +1 GST-1582 refresh_barrier_import_gst1582 row (since TBD until the merge slot; rows are data and cannot move); +2 GST-1601 source_changed_origin_gst1601 and adopt_local_edits_gst1601 rows (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.596.0 merge: 1668 + 2; +1 GST-1623 refresh_barrier_capacity_gst1623 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.599.0 merge: 1670 + 1; +2 GBRA-224 W1 release_channel_stable_default row and its comment; +1 GST-1623 refresh_barrier_later_write_gst1623 row (#8765; rows are data and cannot move); +5 #8766 GST-1623 items 4/6-9 and #8755: the wave comment and four rows (doctor_foreign_writers_partial_gst1623, commit_push_enclosing_repo_gst1623, owner_guard_fail_closed_gst1623, adopt_local_edits_hardening_8755) and +1 managed_sync_kind_reserved_8765 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on master v0.60.608.0 plus #8798: 1674 + 6; +1 GST-1853 refresh_barrier_aborted_refresh_sync_gst1853 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.613.0 merge: 1680 + 1; +1 GST-1674 refresh_refused_merge_recovery_gst1674 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.614.0 merge: 1681 + 1; +1 #8824/#8826/#8767: adopt_local_edits_replay_markers_8824 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8837: 1682 + 1; +1 url_source_origin row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8834: 1683 + 1; +1 #8828: the refresh_replan_own_commits_8828 row (1684 + 1 at the 0.60.618.0 slot); +1 the managed commit-push unpublished-count row; +1 the refresh publish-diverged default row; +1 GST-2051 ungranted_member_writes_gst2051 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-731 think_window_trajectory_gst731 row and +1 GST-1602 purge_cancels_deferred_write_gst1602 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8915 v0.60.621.0: 1688 + 2; +1 GST-2059: owner_reads_private row; +1 #8888: the record-origin checkout lock-down row (re-summed at the Q6 stack on #8934 v0.60.625.0: 1691 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 E1/F3/F4 rows (since TBD until the merge slot), re-summed at the master merge; +1 GBRA-284 personal_sources_gbra284 row (since TBD until the merge slot) (re-summed at the QM wave merge onto master v0.60.626.0: 1692 + 3); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 v3: the qm_personal_structured_gst1158 row (since TBD until the merge slot); +1 #8477 GST-1158 F2 personal-tools row at the QM wave merge (1695 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 #8483 memory_propose row at the QM wave merge (1696 + 1); +1 GST-1094 gap 4: the qm_admin_http_gst1094 row (since TBD until the merge slot); +1 GST-1158: the member_email_link_gst1158 row (since TBD until the merge slot); +2 #8479 member-email rows at the QM wave merge (1697 + 2); +1 GST-2112: ingest_keeps_readers_gst2112 row (re-summed at the Q7 v0.60.627.0 merge: 1692 + 1); +1 #8982 federated_member_writes_8982 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-2116 commit_push_skipped_paths_gst2116 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q10 slot on #9009 ee0f4a78: 1694 + 1; +1 GST-2118 pending_ledger_flagged_gst2118 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q12 slot on #9016 afb49de5: 1695 + 1; +1 GBRA-431: read_scope_params_gbra431 row (rows are data and cannot move), re-summed at the #9032 stack merge: 1697 measured; +2 GST-2201 sync_restored_file_gst2201 and purge_keeps_committed_file_gst2201 rows (since is the current VERSION until the merge slot; +1 GST-2243 remember_share_gst2243 row (re-summed at the #9098 stack merge: 1699 + 1); +1 GST-2312 #9024 sync_filter_owned_hold_9024 row (re-summed at the #9064 stack merge: 1700 + 1; rows are data and cannot move); +2 access-privacy wave (0.60.649.0): the owner_private_facts_gst2089 and private_labels_write_ahead_gst2092 rows; +1 GBRA-443 private_labels_batch_exit_gbra443 row (rows are data and cannot move), re-summed at the 0.60.650.0 slot on #9038: 1703 + 1; +1 postgres_tls_default row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.651.0 merge: 1704 + 1; +1 GST-2331 sync_reads_fetch_nothing_gst2331 row (rows are data and cannot move), re-summed at the 0.60.654.0 stack on #9045 6ff5540d: 1705 + 1; +7 QM wave (#9037) rows: attest_scope_read_ops_gst1158, attest_direct_page_writes_deferred_gst1158, personal_sources_gbra284, qm_personal_structured_gst1158, memory_propose_held_writes_gst1158, member_email_link_gst1158, qm_admin_http_gst1094 (re-summed at the 0.60.655.0 stack on #9110 f9b2072e: 1706 + 7); +1 GST-2228 recreated_takes_section_keeps_stored_takes_gst2228 row (since TBD; re-summed at the keep-takes-and-link-dates train merge: 1713 + 1); +1 GST-2228 links_rows_keep_own_dates_gst2228 row (since TBD; re-summed at the same train merge: 1714 + 1); +2 the W1 + memory proposals train (#9133): attest_every_page_write_deferred_gst2249 and memory_proposals_owner_http_gst2407 rows (rows are data and cannot move), re-summed at the #9138 v0.60.661.0 stack merge: 1715 + 2 = 1717 measured; +1 #8903 effect_git_secret_gate_gst1923 row (rows are data and cannot move), re-summed at the 0.60.664.0 stack on #9142 3931adb4: 1717 + 1; +1 GST-2407 PR 3: qm_recall_own_page_contract_v4 row (rows are data and cannot move), re-summed at the 0.60.666.0 stack on #9148 69c12917: 1718 + 1; +2 GST-363 PR 1 and PR 3 (#9135): the serves_several_labels_gst363 and stdio_member_per_harness_gst363 rows; +3 #9134 train rows member_forget_names_host_9101, refresh_fence_retry_id_gst2353 and recorded_read_view_args_gst2214 (rows are data and cannot move), re-summed at the #9134 slot merge onto #8829 dfc24954: 1721 + 3; +3 source-checkouts wave rows (autopilot_git_reconcile_gbra386, unknown_drift_history_rescreen, refresh_abandon_members_gst1465), re-summed at the #9137 stack merge: 1724 + 3; persistence train 13 at 0.60.676.0: its five rows on top of 0.60.675.0; +1 GST-2250 reconcile_publish_opt_out_gst2250 row (since TBD until the merge slot; rows are data and cannot move); +1 #8902 unmanaged_push_history_scan_8902 row (re-summed at the 0.60.678.0 stack on 501742d9: 1733 + 1); +1 GST-2246 maintain_safe_free_phases_gst2246 row (since TBD until the merge slot; rows are data and cannot move), re-summed on the doctor/dream/enrich train at the 0.60.679.0 slot merge onto #9170 82932eda: 1734 + 1; +2 GST-2462 privacy_label_ignored_gst2462 and access_page_rules_gst2462 rows (rows are data and cannot move), re-summed at the #9173 slot merge onto 49a922ef: 1735 + 2; +1 GST-2107 follow-up write_capacity_low_not_refusal_gst2107 row (rows are data and cannot move), re-summed at the 0.60.681.0 slot merge onto #9173 c08d0c8b: 1737 + 1; +1 GST-2490: owner_reads_derived_gst2490 row (rows are data and cannot move); +1 GST-2468: the label_only_operator_repairs_gst2468 row (a BEHAVIOR_CHANGES row cannot move); +1 GST-2446 remember_pageless_reply_gst2446, +1 GST-2492 strict_held_facts_gst2492 and +1 GST-2346 D1 owner_facts_shared_gst2346 rows (rows are data and cannot move), re-summed at the 0.60.685.0 train merge onto #9181 405ea4cf: 1740 + 3; +1 GST-2476: the readers_label_setter_gst2476 row (rows are data and cannot move), re-summed at the #9184 slot merge onto the #9179 train 361d57c6: 1743 + 1; +1 GST-2487: the fence_fact_private_in_place_gst2487 row (rows are data and cannot move), at the same slot merge of #9188 0075f09a: 1744 + 1; +3 GST-2519: commit_push_untrack_gst2519, db_only_labels_kept_gst2519 and git_ignored_label_repair_gst2519 rows (since TBD until the merge slot; rows are data and cannot move): 1745 + 3+src/core/git/commit-push.ts 1627 ratchet GST-2519: --untrack (#7753 port: untrackTargets, untrackPaths; untrackAdmitted, the managed-worktree storage.db_only admission; previewUntrack) and the staged-removal hint in skippedPathsError grow the commit door past the 1500 default (master 1487 + 140)src/commands/auth.ts 1503 ratchet new row: crossed the 1500 unlisted cap at the v0.60.595.0 merge: GST-1113 --attest-sources help lines plus GST-1158 F3 --attest-read help lines (3); CLI help lines cannot movediff --git a/src/cli/enforced-commit-push.ts b/src/cli/enforced-commit-push.tsindex 62fa8a867a..68e6af6a58 100644--- a/src/cli/enforced-commit-push.ts+++ b/src/cli/enforced-commit-push.ts@@ -12,7 +12,7 @@ import type { BrainEngine } from '../core/engine.ts';import { enforcedAccess, markdownLabels, memberPageView, refuseEnforced } from './enforced-member.ts';const VALUE_FLAGS = new Set(['-m', '--message', '--path', '--repo', '--base', '--branch', '--resolve', '--expect-remote']);-const REFUSED_FLAGS = new Set(['--pending', '--push-only', '--resolve', '--expect-remote', '--allow-outside-source-root', '--keep-checkout', '--branch', '--scan-secrets', '--install', '--uninstall']);+const REFUSED_FLAGS = new Set(['--pending', '--push-only', '--resolve', '--expect-remote', '--allow-outside-source-root', '--keep-checkout', '--branch', '--scan-secrets', '--install', '--uninstall', '--untrack']);function gitOut(repo: string, args: string[]): string | null {try { return execFileSync('git', ['-C', repo, ...args], { stdio: ['ignore', 'pipe', 'ignore'] }).toString(); } catch { return null; }diff --git a/src/cli/enforced-member-classes.ts b/src/cli/enforced-member-classes.tsindex cb09513df7..f15d49f520 100644--- a/src/cli/enforced-member-classes.ts+++ b/src/cli/enforced-member-classes.ts@@ -86,7 +86,7 @@ export const ARGUMENT_CONDITIONS: Readonly<Record<string, string>> = {/** Arguments of classified CLI-only commands the mode refuses. */export const CLI_ARGUMENT_CONDITIONS: Readonly<Record<string, string>> = {recall: 'the facts arms (entity, --since, --question, --grep, --query) and the page arm; --pending, --supersessions, --session, --watch and --since-last-run are refused',- 'git commit-push': 'named paths (each readable by the member, no label change, no access policy file), --dry-run and --pull; --pending, --push-only, --resolve and --allow-outside-source-root are refused; output withheld',+ 'git commit-push': 'named paths (each readable by the member, no label change, no access policy file), --dry-run and --pull; --pending, --push-only, --resolve, --untrack and --allow-outside-source-root are refused; output withheld',sync: 'only --source <id> (a source the member reads), --no-pull, --no-embed, --json and --dry-run; output withheld; sync status and every other flag or subcommand are refused','sources refresh': 'exactly one source id the member reads, with --json or --dry-run only; output withheld; every other sources subcommand (status and writer status name held paths) is refused',doctor: 'plain doctor or doctor --json only; output replaced by each check name and status and the count per status',diff --git a/src/commands/git.ts b/src/commands/git.tsindex 9a96855da1..35596281c9 100644--- a/src/commands/git.ts+++ b/src/commands/git.ts@@ -7,13 +7,14 @@* gbrain git commit-push [--path <dir>] -m <msg> [--json] [--] <paths…>* gbrain git commit-push --push-only [--keep-checkout] [--path <dir>] [--expect-remote <sha> --resolve <p>=ours|theirs|file:<f>…]* gbrain git commit-push --pull [--path <dir>] [--require-clean]- * gbrain git commit-push --dry-run [--path <dir>] [-m <msg>] [--] <paths…>+ * gbrain git commit-push --untrack [--path <dir>] -m <msg> [--] <paths…>+ * gbrain git commit-push --dry-run [--untrack] [--path <dir>] [-m <msg>] [--] <paths…>* gbrain git commit-push --pending [--path <dir>] [-m <msg>]* gbrain git guard [--install | --uninstall] [--path <dir>] [--json]*/import { existsSync, realpathSync } from 'node:fs';import { isAbsolute, join, relative, sep } from 'node:path';-import { commitAndPush, checkoutRoot, pullShared, scopePaths, COMMIT_LOCK_NAME, SOURCE_ROOT_CONFIG, type Resolution } from '../core/git/commit-push.ts';+import { commitAndPush, checkoutRoot, previewUntrack, pullShared, scopePaths, COMMIT_LOCK_NAME, SOURCE_ROOT_CONFIG, type Resolution } from '../core/git/commit-push.ts';import { guardStatus, installGuard, uninstallGuard } from '../core/git/commit-guard.ts';import { appendPushLog } from '../core/brain-repo-durability.ts';import { opError } from '../core/ops/contract.ts';@@ -30,6 +31,7 @@ const HELP = `Usage: gbrain git commit-push [--path <dir>] -m <msg> [--json] [--gbrain git commit-push --push-only [--keep-checkout] [--path <dir>] --expect-remote <sha> --resolve <path>=ours|theirs|file:<file>...gbrain git commit-push --pull [--path <dir>] [--require-clean]gbrain git commit-push --pending [--path <dir>] [-m <msg>]+ gbrain git commit-push --untrack [--path <dir>] -m <msg> [--] <paths...>gbrain git guard [--install | --uninstall] [--path <dir>] [--json]Commit only the named paths and push them, safely, in a checkout other agents@@ -65,7 +67,12 @@ Flags:ledger doctor's dirty_age reports), then push.--allow-outside-source-root Commit and publish files outside the checkout's source root(s)(git config gbrain.sourceRoot); only after the user agrees.+ --untrack Remove the named paths from Git (git rm --cached), keeping the files on disk; a+ directory untracks every file Git holds under it. In a managed canonical worktree+ only files under a storage.db_only dir that gbrain.yml at HEAD declares and+ .gitignore ignores; it commits there and never pushes.--dry-run Print the paths, branch and lock that would be used; take no lock, write nothing.+ With --untrack, the real run's path checks run first and refuse as it would.--json One JSON result (or the error envelope) on stdout.Paths are relative to --path when it is given (like git -C), else to the current@@ -82,12 +89,12 @@ is installed.`;interface Parsed {sub?: string; path?: string; message?: string; branch?: string; expectRemote?: string; json: boolean; pushOnly: boolean; pull: boolean;- requireClean: boolean; dryRun: boolean; help: boolean; keepCheckout: boolean; paths: string[]; resolve: string[]; base: string[];+ requireClean: boolean; dryRun: boolean; help: boolean; keepCheckout: boolean; paths: string[]; resolve: string[]; base: string[]; untrack: boolean;pending: boolean; allowOutside: boolean; install: boolean; uninstall: boolean; scanSecrets: boolean;}function parse(args: string[]): Parsed {- const p: Parsed = { json: false, pushOnly: false, pull: false, requireClean: false, dryRun: false, help: false, keepCheckout: false, paths: [], resolve: [], base: [],+ const p: Parsed = { json: false, pushOnly: false, pull: false, requireClean: false, dryRun: false, help: false, keepCheckout: false, paths: [], resolve: [], base: [], untrack: false,pending: false, allowOutside: false, install: false, uninstall: false, scanSecrets: false };let rest = false;for (let i = 0; i < args.length; i++) {@@ -109,6 +116,7 @@ function parse(args: string[]): Parsed {else if (a === '--pull') p.pull = true;else if (a === '--require-clean') p.requireClean = true;else if (a === '--dry-run') p.dryRun = true;+ else if (a === '--untrack') p.untrack = true;else if (a === '--pending') p.pending = true;else if (a === '--allow-outside-source-root') p.allowOutside = true;else if (a === '--install') p.install = true;@@ -190,11 +198,11 @@ export async function runGit(args: string[]): Promise<number> {const repo = checkoutRoot(p.path ?? process.cwd());if (!p.path) assertSourceCheckout(repo);const cwd = p.path ? realpathSync(p.path) : process.cwd();- if ((p.pull && p.pushOnly) || (p.pull && (p.message || p.paths.length || p.resolve.length || p.branch))+ if ((p.pull && p.pushOnly) || (p.pull && (p.message || p.paths.length || p.resolve.length || p.branch)) || (p.untrack && (p.pull || p.pushOnly || p.pending))|| (p.pushOnly && (p.message || p.paths.length)) || ((p.resolve.length || p.branch || p.expectRemote || p.keepCheckout || p.scanSecrets) && !p.pushOnly)|| (p.pending && (p.pull || p.pushOnly || p.paths.length)) || (p.allowOutside && p.pull) || (p.base.length && (p.pull || p.pushOnly || p.pending))) {throw opError('commit_paths_invalid', 'These flags do not combine.',- 'Use one mode: -m <msg> -- <paths> (commit + push), --pending [-m <msg>], --push-only [--keep-checkout] [--branch <b>] [--expect-remote <sha> --resolve ...], or --pull [--require-clean].');+ 'Use one mode: -m <msg> -- <paths> (commit + push), --untrack -m <msg> -- <paths>, --pending [-m <msg>], --push-only [--keep-checkout] [--branch <b>] [--expect-remote <sha> --resolve ...], or --pull [--require-clean].');}const bases = new Map(p.base.map(spec => {const eq = spec.lastIndexOf('=');@@ -212,8 +220,9 @@ export async function runGit(args: string[]): Promise<number> {const lock = execFileSync('git', ['-C', repo, 'rev-parse', '--git-path', COMMIT_LOCK_NAME], { env: gitChildEnv({ ...GIT_ENV }) }).toString().trim();const branch = execFileSync('git', ['-C', repo, 'symbolic-ref', '--quiet', '--short', 'HEAD'], { env: gitChildEnv({ ...GIT_ENV }) }).toString().trim();const paths = p.pull || p.pushOnly || !p.paths.length ? [] : scopePaths(repo, p.paths, cwd);- emit(json, { dry_run: true, repo, branch, lock, paths, mode: p.pull ? 'pull' : p.pushOnly ? 'push-only' : 'commit-push' },- `dry run: ${p.pull ? 'pull' : p.pushOnly ? 'push-only' : `commit ${paths.join(' ')}`} on ${branch} in ${repo} (lock ${lock}); nothing written`);+ const untracked = p.untrack && paths.length ? previewUntrack(repo, paths, { allowOutsideSourceRoot: p.allowOutside }) : undefined;+ emit(json, { dry_run: true, repo, branch, lock, paths, mode: p.pull ? 'pull' : p.pushOnly ? 'push-only' : p.untrack ? 'untrack' : 'commit-push', ...(untracked ? { untracked } : {}) },+ `dry run: ${p.pull ? 'pull' : p.pushOnly ? 'push-only' : `${p.untrack ? 'untrack' : 'commit'} ${paths.join(' ')}`} on ${branch} in ${repo} (lock ${lock}); nothing written`);return 0;}@@ -232,6 +241,7 @@ export async function runGit(args: string[]): Promise<number> {...(p.allowOutside ? { allowOutsideSourceRoot: true } : {}),...(p.keepCheckout ? { keepCheckout: true } : {}),...(p.scanSecrets ? { scanSecrets: true } : {}),+ ...(p.untrack ? { untrack: true } : {}),...(p.branch ? { branch: p.branch } : {}),...(p.resolve.length ? { resolutions: parseResolutions(p.resolve) } : {}),...(p.expectRemote ? { expectRemote: p.expectRemote } : {}),diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex 1eb3ff7858..1a0d273fb1 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -1547,6 +1547,9 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;{ since: '0.60.685.0', id: 'owner_facts_shared_gst2346', text: 'A credential bound to the brain owner (`gbrain access owner set`), or a stdio server started with `--stdio-member <owner>`, speaking for itself, now saves `remember` facts the way a credential bound to no member does: with no `visibility`, a fact is shared on its subject\'s page and every reader of the source recalls it, where it used to be kept private on the owner\'s member page. It stays private on that page when the call passes `visibility: "private"` or the subject\'s page or `facts.default_visibility` keeps facts private, and the reply names the `page` and `visibility` either way. Its `visibility: "world"` is saved instead of refused (`member_share_required`), except onto a page whose facts are kept private (`share_target_restricted`, as `share: true`), and its `forget` withdraws a shared fact it reads instead of saying only the brain host can. An owner agent that follows a planted instruction can therefore share a fact without passing any flag; to keep a fact private, pass `visibility: "private"`. Member credentials, attested QM calls (`x-qm-actor`), audiences (`X-Gbrain-On-Behalf-Of`), subagent jobs and slug-fenced clients are unchanged, and with writeback on the owner\'s credential is no longer told its saves stay private.' },{ since: '0.60.686.0', id: 'readers_label_setter_gst2476', text: 'New `gbrain repair visibility (--slug <page>... | --slugs-file <file>) --readers <ids|none>` sets or removes a page\'s `readable_by` through the label-only door: the page keeps its trust tier and provenance and its file changes only on that line. Unknown or disabled members and unknown groups refuse `access_member_invalid`; a list without the brain owner refuses unless `--allow-without-owner`. Every `repair visibility` write to a managed page with no file outside a declared `storage.db_only` path is now held `canonical_file_missing` with nothing written, instead of failing `source_changed`.' },{ since: '0.60.686.0', id: 'fence_fact_private_in_place_gst2487', text: 'A page write that only makes a `## Facts` row private (same claim, world to private) now makes the stored row private in place, keeping its id and trust tier, even when the row is more trusted than the writer. Before, such a row stayed live and world beside a contested private copy, so `gbrain repair visibility --class facts` could leave a fact remote callers still read while the page and its file read as fixed (`fact_left_readable`, `fact_left_world`). On a brain without managed persistence the repair now also makes the fenced row private. A write that makes a more trusted private row world is still held for the owner as before.' },+ { since: 'TBD', id: 'commit_push_untrack_gst2519', text: 'New `gbrain git commit-push --untrack -m <msg> -- <paths>` stops tracking files and keeps them on disk: it removes every file the last commit holds under each named path from Git and the index and commits only those deletions, under the commit lock (`--dry-run --untrack` previews and refuses the same way). In an ordinary checkout the commit is pushed. In a managed canonical worktree it only takes files under a `storage.db_only` directory that `gbrain.yml` at HEAD declares and `.gitignore` ignores, refusing anything else `untrack_not_db_only` with the index as it was, and never pushes; the pages stay live. A plain commit-push of a removal staged by hand with `git rm --cached` now names the `--untrack` command instead of blaming a nested repository. Members under `GBRAIN_ENFORCED_MEMBER` are refused `--untrack`.' },+ { since: 'TBD', id: 'db_only_labels_kept_gst2519', text: 'A page under a declared `storage.db_only` directory whose file Git still tracks keeps its privacy labels. On a git-canonical (strict) source the next sync no longer imports the unchanged committed file over a database change such as a `gbrain repair visibility` label repair, which used to undo the repair and widen the page again. On every managed source a commit to such a file no longer widens the page: a `visibility`, `access`, `confidentiality` or `readable_by` label the page has and the file does not state is kept, and a label the file states applies, a wider one included. Files outside `storage.db_only` import as they stand.' },+ { since: 'TBD', id: 'git_ignored_label_repair_gst2519', text: 'On a git-canonical (strict) source, `gbrain repair visibility` on a page stamped `git_ignored` (saved under a path the checkout\'s Git ignores, so it has no file) now writes the label in the database, where the page lives, instead of holding it `canonical_file_missing`. A page whose ignore rule is gone is still held.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.tsindex e1d13c738a..bf4470cda6 100644--- a/src/core/cli-flag-registry.generated.ts+++ b/src/core/cli-flag-registry.generated.ts@@ -52,7 +52,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'db-repair': ['--accept-pending', '--apply', '--apply-rewrites', '--as', '--background', '--brain', '--break-lock', '--db-url', '--dry-run', '--explain', '--filter', '--follow', '--force', '--force-retry', '--format', '--help', '--http', '--json', '--legacy-lock', '--locks', '--name', '--no-accept-pending', '--path', '--prefer-postgres', '--probe', '--progress-interval', '--progress-json', '--quiet', '--remediate', '--restart', '--skip-verify', '--source', '--statement-timeout', '--supabase', '--timeout', '--timings', '--undo-last-rewrite', '--url', '--version', '--wait', '--yes'],'decide': ['--accept-all', '--all', '--all-from', '--apply', '--brain', '--call-site', '--claims', '--dataset', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--expect', '--from', '--help', '--include-withdrawals', '--input', '--items-out', '--json', '--kind', '--limit', '--max-cost', '--max-usd', '--min', '--non-interactive', '--out', '--provenance', '--provider', '--query', '--rate', '--reason', '--reason-family', '--recommended', '--remove', '--shadow', '--since', '--slot', '--source', '--status', '--suite', '--target', '--threshold', '--trust', '--undo', '--uri-prefix', '--version', '--what-if-threshold', '--yes'],'diag': ['--access', '--add', '--all', '--allowed-operations', '--apply', '--as', '--asof', '--body', '--bound-slug-prefixes', '--brain', '--budget-ms', '--client', '--count', '--cursor', '--date', '--dated-since', '--days', '--detach', '--entities', '--expect', '--expected-revision', '--federated-read', '--filter', '--follow', '--format', '--from-index', '--full', '--fuzzy', '--group-by', '--held', '--help', '--http', '--id', '--include', '--include-ambiguous', '--include-deleted', '--json', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--no-pull', '--no-walk', '--of', '--only', '--page', '--params', '--path', '--phase', '--prefer', '--preview', '--purge', '--query', '--recent', '--refresh-operations', '--replace', '--restart-only', '--reverse', '--row', '--scopes', '--session', '--side', '--since', '--slug', '--slugs', '--source', '--source-id', '--sources', '--stale', '--state', '--surface', '--to', '--updated-after', '--url', '--yes'],- 'doctor': ['--abandon', '--abbrev-ref', '--abort', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--accept-pending', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--advertise', '--after', '--agent', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allow-without-owner', '--allowed-operations', '--anchor', '--applied', '--apply', '--apply-rewrites', '--approval-out', '--approved', '--as', '--assign-corpus', '--assume-unchanged', '--attest-actor', '--attest-ops', '--attest-read', '--attest-sources', '--audit', '--auto', '--auto-additive', '--auto-fix', '--autostash', '--background', '--base', '--batch', '--batch-check', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--bundled', '--by-mention', '--cached', '--cacheinfo', '--call-site', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--cherry-mark', '--claims', '--class', '--claude-plugins', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--concurrency', '--confidence', '--config', '--confirm', '--confirm-destructive', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--continue', '--conversation', '--count', '--credentials-file', '--cursor', '--cwd', '--dataset', '--day', '--db-url', '--deadline', '--decisions', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--detail', '--diff-filter', '--dim', '--dimensions', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--email', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--env-file', '--error-unmatch', '--exclude', '--exclude-standard', '--exit-code', '--expand', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--filter', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-rechunk', '--force-remove', '--force-retry', '--force-schema', '--force-with-lease', '--format', '--fresh', '--fresh-token', '--from', '--from-json', '--from-meetings', '--from-pages', '--full', '--full-tree', '--fuzzy', '--gbrain-bin', '--generation', '--get', '--get-all', '--get-regexp', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--grammar', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--heads', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--ignore-missing', '--images', '--import', '--include-ambiguous', '--include-covered', '--include-cross-entity', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--index-info', '--infer-dates', '--init', '--input', '--input-type', '--install', '--instructions', '--instructions-only', '--is-ancestor', '--is-bare-repository', '--is-inside-work-tree', '--is-shallow-repository', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--label-lowerings', '--lanes', '--lang', '--left-right', '--legacy-lock', '--limit', '--link', '--link-source', '--link-type', '--list', '--list-out', '--literal-pathspecs', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-count', '--max-facts', '--max-jobs', '--max-requests', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--merge-base', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--min-n', '--mode', '--model', '--multimodal', '--name', '--name-only', '--name-status', '--nice', '--no-accept-pending', '--no-assume-unchanged', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-commit-id', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embed-cache', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-gpg-sign', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-merges', '--no-migrate', '--no-optional-locks', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-seat', '--no-skip-worktree', '--no-stdio-member', '--no-tags', '--no-verify', '--no-walk', '--no-write-fetch-head', '--non-interactive', '--not', '--now', '--of', '--older-than', '--once', '--only', '--operation', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--parents', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--path-format', '--pending', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--prefix', '--preload', '--preset', '--preview', '--principal', '--private-pages', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provenance', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push', '--push-only', '--qm', '--query', '--question', '--queue', '--quiet', '--rate', '--reader-mode', '--readers', '--reason', '--reauth', '--rebase', '--rebuild', '--recommended', '--redact-paths', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remote', '--remove', '--remove-core', '--repair', '--repair-unknown-markers', '--replace', '--repo', '--request', '--request-id', '--require', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--reset-session', '--resolve', '--restart-only', '--restore-only', '--resume', '--retire', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--reverse', '--review-lower', '--revision', '--right-only', '--rollback-to-source', '--root', '--routing', '--rules', '--run', '--runtime', '--safe', '--sample', '--save', '--scan-secrets', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--segmented', '--select', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--set', '--set-upstream-to', '--shadow', '--shared-skills', '--short', '--show-current', '--show-object-format', '--show-prefix', '--show-token', '--show-toplevel', '--side', '--since', '--since-last-run', '--skill-loading', '--skills-dir', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--skip-worktree', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slugs', '--slugs-file', '--source', '--source-id', '--source-ids', '--sources', '--squash', '--src-subpath', '--staged', '--stale', '--stat', '--state', '--statement-timeout', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--swap-only', '--symbol-kind', '--symbolic-full-name', '--tags', '--take', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--tsconfig-override', '--type', '--types', '--unindexed', '--uninstall', '--unsafe-bypass-dream-guard', '--unset', '--unset-all', '--unsettle', '--unshallow', '--untracked-files', '--url', '--url-env', '--user', '--vacuum', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--watch', '--what-if-threshold', '--where', '--window', '--workers', '--working-tree', '--workspace', '--worktree', '--write-tree', '--yes'],+ 'doctor': ['--abandon', '--abbrev-ref', '--abort', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--accept-pending', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--advertise', '--after', '--agent', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allow-without-owner', '--allowed-operations', '--anchor', '--applied', '--apply', '--apply-rewrites', '--approval-out', '--approved', '--as', '--assign-corpus', '--assume-unchanged', '--attest-actor', '--attest-ops', '--attest-read', '--attest-sources', '--audit', '--auto', '--auto-additive', '--auto-fix', '--autostash', '--background', '--base', '--batch', '--batch-check', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--bundled', '--by-mention', '--cached', '--cacheinfo', '--call-site', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--cherry-mark', '--claims', '--class', '--claude-plugins', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--concurrency', '--confidence', '--config', '--confirm', '--confirm-destructive', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--continue', '--conversation', '--count', '--credentials-file', '--cursor', '--cwd', '--dataset', '--day', '--db-url', '--deadline', '--decisions', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--detail', '--diff-filter', '--dim', '--dimensions', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--email', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--env-file', '--error-unmatch', '--exclude', '--exclude-standard', '--exit-code', '--expand', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--filter', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-rechunk', '--force-remove', '--force-retry', '--force-schema', '--force-with-lease', '--format', '--fresh', '--fresh-token', '--from', '--from-json', '--from-meetings', '--from-pages', '--full', '--full-tree', '--fuzzy', '--gbrain-bin', '--generation', '--get', '--get-all', '--get-regexp', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--grammar', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--heads', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--ignore-missing', '--ignore-unmatch', '--images', '--import', '--include-ambiguous', '--include-covered', '--include-cross-entity', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--index-info', '--infer-dates', '--init', '--input', '--input-type', '--install', '--instructions', '--instructions-only', '--is-ancestor', '--is-bare-repository', '--is-inside-work-tree', '--is-shallow-repository', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--label-lowerings', '--lanes', '--lang', '--left-right', '--legacy-lock', '--limit', '--link', '--link-source', '--link-type', '--list', '--list-out', '--literal-pathspecs', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-count', '--max-facts', '--max-jobs', '--max-requests', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--merge-base', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--min-n', '--mode', '--model', '--multimodal', '--name', '--name-only', '--name-status', '--nice', '--no-accept-pending', '--no-assume-unchanged', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-commit-id', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embed-cache', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-gpg-sign', '--no-hooks', '--no-index', '--no-instructions', '--no-lanes', '--no-llm', '--no-merges', '--no-migrate', '--no-optional-locks', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-seat', '--no-skip-worktree', '--no-stdio-member', '--no-tags', '--no-verify', '--no-walk', '--no-write-fetch-head', '--non-interactive', '--not', '--now', '--of', '--older-than', '--once', '--only', '--operation', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--parents', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--path-format', '--pending', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--prefix', '--preload', '--preset', '--preview', '--principal', '--private-pages', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provenance', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push', '--push-only', '--qm', '--query', '--question', '--queue', '--quiet', '--rate', '--reader-mode', '--readers', '--reason', '--reauth', '--rebase', '--rebuild', '--recommended', '--redact-paths', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remote', '--remove', '--remove-core', '--repair', '--repair-unknown-markers', '--replace', '--repo', '--request', '--request-id', '--require', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--reset-session', '--resolve', '--restart-only', '--restore-only', '--resume', '--retire', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--reverse', '--review-lower', '--revision', '--right-only', '--rollback-to-source', '--root', '--routing', '--rules', '--run', '--runtime', '--safe', '--sample', '--save', '--scan-secrets', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--segmented', '--select', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--set', '--set-upstream-to', '--shadow', '--shared-skills', '--short', '--show-current', '--show-object-format', '--show-prefix', '--show-token', '--show-toplevel', '--side', '--since', '--since-last-run', '--skill-loading', '--skills-dir', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--skip-worktree', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slugs', '--slugs-file', '--source', '--source-id', '--source-ids', '--sources', '--squash', '--src-subpath', '--staged', '--stale', '--stat', '--state', '--statement-timeout', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--swap-only', '--symbol-kind', '--symbolic-full-name', '--tags', '--take', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--tsconfig-override', '--type', '--types', '--unindexed', '--uninstall', '--unsafe-bypass-dream-guard', '--unset', '--unset-all', '--unsettle', '--unshallow', '--untrack', '--untracked-files', '--url', '--url-env', '--user', '--vacuum', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--watch', '--what-if-threshold', '--where', '--window', '--workers', '--working-tree', '--workspace', '--worktree', '--write-tree', '--yes'],'dream': ['--audit-rejects', '--brain', '--cancel-unmatched', '--date', '--dir', '--drain', '--dry-run', '--eval-run', '--force', '--from', '--help', '--input', '--install', '--json', '--limit', '--list', '--max-usd', '--once', '--phase', '--probe', '--pull', '--reconcile-queue', '--since', '--source', '--source-id', '--threshold', '--to', '--unsafe-bypass-dream-guard', '--window', '--yes'],'edge-proposals': ['--access', '--add', '--all', '--all-applied', '--all-held', '--allowed-operations', '--as', '--asof', '--body', '--bound-slug-prefixes', '--brain', '--client', '--cursor', '--date', '--dated-since', '--days', '--entities', '--federated-read', '--follow', '--from-index', '--full', '--fuzzy', '--group-by', '--help', '--http', '--id', '--include', '--include-deleted', '--json', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--of', '--only', '--page', '--params', '--path', '--phase', '--prefer', '--purge', '--recent', '--refresh-operations', '--row', '--scopes', '--session', '--since', '--slugs', '--source', '--sources', '--stale', '--status', '--surface', '--to', '--updated-after', '--url', '--yes'],'edges-backfill': ['--all-sources', '--brain', '--concurrency', '--help', '--json', '--max-chunks', '--source', '--workers'],@@ -73,15 +73,15 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'founder': ['--brain', '--help', '--json', '--mcp-only', '--request-id', '--since', '--source', '--until'],'friction': ['--agent', '--base', '--brain', '--compare', '--help', '--hint', '--json', '--kind', '--message', '--no-redact', '--phase', '--run-id', '--severity', '--source', '--transcript-path', '--transcripts'],'frontmatter': ['--allow-catch-all', '--batch', '--brain', '--cached', '--diff-filter', '--dry-run', '--exclude-standard', '--fix', '--force', '--full-name', '--get', '--git-common-dir', '--help', '--importable', '--include-ambiguous', '--include-catch-all', '--json', '--literal-pathspecs', '--local', '--name-only', '--no-verify', '--others', '--path', '--show-prefix', '--show-toplevel', '--source', '--stage', '--staged', '--stdin', '--type', '--uninstall'],- 'git': ['--abbrev-ref', '--absolute-git-dir', '--add', '--aggressive', '--all', '--allow-outside-source-root', '--assume-unchanged', '--autostash', '--base', '--batch-check', '--brain', '--branch', '--cached', '--cacheinfo', '--cherry-mark', '--count', '--diff-filter', '--dry-run', '--enable', '--error-unmatch', '--exclude-standard', '--exit-code', '--expect-remote', '--ff-only', '--file', '--force', '--force-remove', '--force-with-lease', '--format', '--get', '--get-all', '--get-regexp', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--hard', '--help', '--index-info', '--install', '--is-ancestor', '--is-inside-work-tree', '--json', '--keep-checkout', '--local', '--local-env-vars', '--max-count', '--merge-base', '--message', '--mode', '--name-only', '--name-status', '--no-assume-unchanged', '--no-autostash', '--no-commit-id', '--no-cron', '--no-gpg-sign', '--no-merges', '--no-optional-locks', '--no-recurse-submodules', '--no-renames', '--no-skip-worktree', '--no-tags', '--no-verify', '--no-write-fetch-head', '--not', '--only', '--others', '--parents', '--pat-file', '--path', '--path-format', '--pending', '--porcelain', '--pull', '--push', '--push-only', '--quiet', '--rebase', '--repo', '--request-id', '--require-clean', '--resolve', '--reverse', '--right-only', '--root', '--scan-secrets', '--short', '--show-toplevel', '--skip-worktree', '--source', '--source-id', '--staged', '--stat', '--stdin', '--topo-order', '--type', '--uninstall', '--unset', '--unset-all', '--untracked-files', '--verify', '--worktree', '--write-tree'],+ 'git': ['--abbrev-ref', '--absolute-git-dir', '--add', '--aggressive', '--all', '--allow-outside-source-root', '--assume-unchanged', '--autostash', '--base', '--batch-check', '--brain', '--branch', '--cached', '--cacheinfo', '--cherry-mark', '--count', '--diff-filter', '--dry-run', '--enable', '--error-unmatch', '--exclude-standard', '--exit-code', '--expect-remote', '--ff-only', '--file', '--force', '--force-remove', '--force-with-lease', '--format', '--get', '--get-all', '--get-regexp', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--hard', '--help', '--ignore-unmatch', '--index-info', '--install', '--is-ancestor', '--is-inside-work-tree', '--json', '--keep-checkout', '--local', '--local-env-vars', '--max-count', '--merge-base', '--message', '--mode', '--name-only', '--name-status', '--no-assume-unchanged', '--no-autostash', '--no-commit-id', '--no-cron', '--no-gpg-sign', '--no-index', '--no-merges', '--no-optional-locks', '--no-recurse-submodules', '--no-renames', '--no-skip-worktree', '--no-tags', '--no-verify', '--no-write-fetch-head', '--not', '--only', '--others', '--parents', '--pat-file', '--path', '--path-format', '--pending', '--porcelain', '--pull', '--push', '--push-only', '--quiet', '--rebase', '--repo', '--request-id', '--require-clean', '--resolve', '--reverse', '--right-only', '--root', '--scan-secrets', '--short', '--show-toplevel', '--skip-worktree', '--source', '--source-id', '--staged', '--stat', '--stdin', '--topo-order', '--type', '--uninstall', '--unset', '--unset-all', '--untrack', '--untracked-files', '--verify', '--worktree', '--write-tree'],'google': ['--access', '--account', '--allow-create-db', '--allow-docker', '--brain', '--calendar-id', '--chat-model', '--client-id', '--client-json', '--client-secret', '--code', '--consent-state', '--content-root', '--db-only', '--embedding-dimensions', '--embedding-model', '--expansion-model', '--force', '--git', '--grant-types', '--help', '--history-days', '--http', '--issuer-url', '--json', '--key', '--kind', '--limit', '--local-postgres', '--mcp-only', '--mcp-url', '--migrate-only', '--model', '--no-browser', '--no-embed', '--no-embedding', '--no-git', '--no-probe', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--paste', '--path', '--pglite', '--plan', '--port', '--prefer-postgres', '--probe', '--provenance', '--purge-client', '--query', '--reauth', '--retry-failed', '--schema-pack', '--scopes', '--search-mode', '--services', '--skip-embed-check', '--source', '--status', '--supabase', '--surface', '--sync-budget-ms', '--timeout-ms', '--to', '--token-command', '--url', '--version', '--via', '--yes'],'graph-query': ['--brain', '--depth', '--direction', '--help', '--hop', '--include-foreign', '--json', '--mcp-only', '--request-id', '--source', '--type'],'hook': ['--allow-unverified-remote', '--auto', '--batch-check', '--brain', '--branch', '--cached', '--catalog', '--count', '--diff-filter', '--dir', '--enable', '--end-of-options', '--env', '--force-with-lease', '--gbrain-bin', '--get', '--harness', '--help', '--instructions', '--instructions-only', '--is-ancestor', '--jq', '--json', '--limit', '--name-only', '--no-instructions', '--only', '--others', '--pat-file', '--path', '--porcelain', '--print', '--pure', '--quiet', '--remove', '--scope', '--seat', '--session', '--show-current', '--show-toplevel', '--since', '--source', '--source-ids', '--verify', '--workspace', '--yes'],'import': ['--accept-pending', '--access-policy', '--admin-intent', '--allow-empty', '--allow-noncanonical-root', '--apply', '--as', '--background', '--batch-check', '--brain', '--cached', '--confirm-relocated-root', '--diff-filter', '--dim', '--embedding-dimensions', '--embedding-model', '--empty', '--exclude', '--exclude-standard', '--expected-epoch', '--expected-state', '--explain', '--follow', '--force', '--force-rechunk', '--format', '--fresh', '--help', '--include-gitignored', '--is-shallow-repository', '--json', '--literal-pathspecs', '--log-noop', '--manifest', '--name-only', '--no-accept-pending', '--no-embed', '--no-embedding', '--no-gpg-sign', '--no-pull', '--no-renames', '--no-verify', '--only', '--others', '--path', '--probe', '--progress-interval', '--progress-json', '--quiet', '--self-transfer', '--show-toplevel', '--skip-failed', '--slugs', '--source', '--source-id', '--stale', '--status', '--supabase', '--timeout', '--timings', '--to', '--url', '--verify', '--wait', '--workers', '--yes'],- 'init': ['--abandon', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--access', '--access-policy', '--acknowledge-managed', '--adopt', '--advertise', '--after', '--aliases', '--all', '--all-drifted', '--allow-create-db', '--allow-docker', '--allow-outside-source-root', '--allow-without-owner', '--anchor', '--applied', '--apply', '--approval-out', '--approved', '--as', '--assign-corpus', '--attest-actor', '--attest-ops', '--attest-read', '--attest-sources', '--audit', '--auto', '--auto-additive', '--background', '--base', '--batch', '--bound-slug-prefixes', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--catch-up', '--channel', '--chat-model', '--check', '--check-downgrade', '--class', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--content-root', '--continue', '--conversation', '--cursor', '--db-only', '--deadline', '--decisions', '--dest', '--detach', '--detail', '--dim', '--disable', '--drain', '--email', '--embedding-dimensions', '--embedding-model', '--enable', '--entity', '--exclude', '--expand', '--expansion-model', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--explain', '--facts', '--fast', '--federated', '--file', '--filter', '--first-parent', '--fix', '--force', '--force-retry', '--force-schema', '--format', '--fresh-token', '--from', '--from-meetings', '--from-pages', '--full', '--git', '--grammar', '--grant-types', '--group-by', '--harness', '--held', '--help', '--hold-state', '--holds', '--http', '--id', '--images', '--include-ambiguous', '--include-covered', '--include-cross-entity', '--include-failures', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--infer-dates', '--input', '--install', '--instructions-only', '--issuer-url', '--job-isolation', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--label-lowerings', '--lanes', '--legacy-lock', '--limit', '--link', '--list', '--list-out', '--local', '--local-postgres', '--markdown', '--max-cost-usd', '--max-facts', '--max-requests', '--max-rss', '--max-usd', '--may-act-for', '--mcp-only', '--mcp-url', '--member', '--members', '--members-file', '--migrate-only', '--migration', '--min-n', '--mode', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-git', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-stdio-member', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--of', '--older-than', '--once', '--only', '--operation', '--output', '--oversized', '--page', '--params', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--pending', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--prefix', '--preview', '--private-pages', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--qm', '--query', '--question', '--quiet', '--readers', '--reason', '--rebase', '--rebuild', '--redact-paths', '--reference-date', '--remediate', '--remote', '--remove', '--repair', '--repair-unknown-markers', '--repo', '--request', '--request-id', '--require-clean', '--reset', '--resolve', '--restart-only', '--resume', '--retire', '--retry-failed', '--retry-parked', '--runtime', '--safe', '--save', '--scan-secrets', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--segmented', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--shared-skills', '--show-toplevel', '--side', '--since', '--since-last-run', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--slugs-file', '--source', '--source-id', '--sources', '--squash', '--src-subpath', '--stale', '--state', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--supabase', '--surface', '--swap-only', '--take', '--tier', '--timeout', '--to', '--token', '--touchpoint', '--type', '--types', '--uninstall', '--unsettle', '--url', '--url-env', '--user', '--vacuum', '--verbose', '--version', '--wait', '--warn-only', '--watch', '--working-tree', '--workspace', '--yes'],+ 'init': ['--abandon', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--access', '--access-policy', '--acknowledge-managed', '--adopt', '--advertise', '--after', '--aliases', '--all', '--all-drifted', '--allow-create-db', '--allow-docker', '--allow-outside-source-root', '--allow-without-owner', '--anchor', '--applied', '--apply', '--approval-out', '--approved', '--as', '--assign-corpus', '--attest-actor', '--attest-ops', '--attest-read', '--attest-sources', '--audit', '--auto', '--auto-additive', '--background', '--base', '--batch', '--bound-slug-prefixes', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--cached', '--catch-up', '--channel', '--chat-model', '--check', '--check-downgrade', '--class', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--content-root', '--continue', '--conversation', '--cursor', '--db-only', '--deadline', '--decisions', '--dest', '--detach', '--detail', '--dim', '--disable', '--drain', '--email', '--embedding-dimensions', '--embedding-model', '--enable', '--entity', '--exclude', '--expand', '--expansion-model', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--explain', '--facts', '--fast', '--federated', '--file', '--filter', '--first-parent', '--fix', '--force', '--force-retry', '--force-schema', '--format', '--fresh-token', '--from', '--from-meetings', '--from-pages', '--full', '--git', '--grammar', '--grant-types', '--group-by', '--harness', '--held', '--help', '--hold-state', '--holds', '--http', '--id', '--images', '--include-ambiguous', '--include-covered', '--include-cross-entity', '--include-failures', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--infer-dates', '--input', '--install', '--instructions-only', '--issuer-url', '--job-isolation', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--label-lowerings', '--lanes', '--legacy-lock', '--limit', '--link', '--list', '--list-out', '--local', '--local-postgres', '--markdown', '--max-cost-usd', '--max-facts', '--max-requests', '--max-rss', '--max-usd', '--may-act-for', '--mcp-only', '--mcp-url', '--member', '--members', '--members-file', '--migrate-only', '--migration', '--min-n', '--mode', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-git', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-stdio-member', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--of', '--older-than', '--once', '--only', '--operation', '--output', '--oversized', '--page', '--params', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--pending', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--prefix', '--preview', '--private-pages', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--qm', '--query', '--question', '--quiet', '--readers', '--reason', '--rebase', '--rebuild', '--redact-paths', '--reference-date', '--remediate', '--remote', '--remove', '--repair', '--repair-unknown-markers', '--repo', '--request', '--request-id', '--require-clean', '--reset', '--resolve', '--restart-only', '--resume', '--retire', '--retry-failed', '--retry-parked', '--runtime', '--safe', '--save', '--scan-secrets', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--segmented', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--shared-skills', '--show-toplevel', '--side', '--since', '--since-last-run', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--slugs-file', '--source', '--source-id', '--sources', '--squash', '--src-subpath', '--stale', '--state', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--supabase', '--surface', '--swap-only', '--take', '--tier', '--timeout', '--to', '--token', '--touchpoint', '--type', '--types', '--uninstall', '--unsettle', '--untrack', '--url', '--url-env', '--user', '--vacuum', '--verbose', '--version', '--wait', '--warn-only', '--watch', '--working-tree', '--workspace', '--yes'],'integrations': ['--auto', '--brain', '--dry-run', '--help', '--json', '--overwrite', '--refresh', '--source', '--target'],'integrity': ['--accept-pending', '--as', '--auto', '--backend', '--background', '--body', '--brain', '--check', '--confidence', '--cost', '--dry-run', '--explain', '--follow', '--fresh', '--help', '--json', '--limit', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--review-lower', '--skip-bare-tweet', '--skip-urls', '--source', '--timeout', '--timings', '--type', '--wait'],- 'jobs': ['--abbrev-ref', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt-slug-path', '--agent', '--aliases', '--all', '--all-sources', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--apply', '--approval-out', '--approved', '--as', '--asof', '--assign-corpus', '--attest-actor', '--attest-ops', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--base', '--batch-size', '--body', '--bound-slug-prefixes', '--brain', '--break-lock', '--budget-ms', '--bundled', '--by-mention', '--cached', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--clear', '--cli-path', '--client', '--close', '--cluster-errors', '--code', '--concurrency', '--confidence', '--confirm-destructive', '--confirm-relocated-root', '--cost-estimate', '--cursor', '--date', '--dated-since', '--days', '--decisions', '--delay', '--detach', '--detail', '--diff-filter', '--dir', '--drain', '--drain-timeout', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--enable', '--entities', '--exclude', '--exclude-standard', '--expect', '--expect-catalog', '--expect-local', '--expect-upstream', '--expected-state', '--explain', '--facts', '--federated-read', '--ff-only', '--file', '--filter', '--filters', '--finished-since', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--force-schema', '--format', '--fresh', '--from-index', '--from-json', '--from-meetings', '--full', '--full-history', '--fuzzy', '--git', '--grammar', '--grammar-diagnostics', '--group', '--group-by', '--hard-deadline', '--health-interval', '--held', '--help', '--hold-state', '--http', '--id', '--idempotency-key', '--ids', '--images', '--include', '--include-ambiguous', '--include-content', '--include-deleted', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-null-signature', '--infer-dates', '--inject-bootstrap', '--inline', '--input', '--input-json', '--install', '--interval', '--is-ancestor', '--is-shallow-repository', '--job-id', '--job-isolation', '--json', '--keep', '--kind', '--lanes', '--legacy-lock', '--limit', '--list', '--local', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--migration', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name', '--name-only', '--ner', '--nice', '--no-assume-unchanged', '--no-auto-embed', '--no-autopilot-install', '--no-bulk', '--no-confirm', '--no-delegate', '--no-embed', '--no-embedding', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-lanes', '--no-llm', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-skip-worktree', '--no-verify', '--no-worker', '--non-interactive', '--now', '--of', '--older-than', '--once', '--only', '--order', '--others', '--output', '--override-disabled', '--oversized', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--parked-code', '--pat-file', '--path', '--pause', '--pglite', '--phase', '--pid-file', '--plan', '--port', '--prefer', '--preview', '--priority', '--probe', '--prune-orphans', '--pull', '--purge', '--qm', '--question', '--queue', '--queue-only', '--quiet', '--rate', '--readers', '--reason', '--reason-scan-limit', '--rebuild', '--recent', '--record', '--redact-paths', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--remediate', '--repo', '--request-id', '--reset-checkpoint', '--restart-only', '--resume', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--review-lower', '--routing', '--row', '--save', '--scope', '--scopes', '--section', '--segment-limit', '--segmented', '--select', '--self-transfer', '--serial', '--serves', '--session', '--show-toplevel', '--side', '--sigkill-rescue', '--since', '--skill-loading', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-guard', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--state', '--statement-timeout', '--status', '--stdio-member', '--stop-mcp', '--strategy', '--suites', '--surface', '--swap-only', '--target', '--text', '--thin', '--thin-threshold', '--tier', '--timeout', '--timeout-ms', '--to', '--token', '--token-env', '--trust', '--type', '--types', '--uninstall', '--updated-after', '--url', '--user', '--vectors', '--verbose', '--verify', '--version', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],+ 'jobs': ['--abbrev-ref', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt-slug-path', '--agent', '--aliases', '--all', '--all-sources', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--apply', '--approval-out', '--approved', '--as', '--asof', '--assign-corpus', '--attest-actor', '--attest-ops', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--base', '--batch-size', '--body', '--bound-slug-prefixes', '--brain', '--break-lock', '--budget-ms', '--bundled', '--by-mention', '--cached', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--clear', '--cli-path', '--client', '--close', '--cluster-errors', '--code', '--concurrency', '--confidence', '--confirm-destructive', '--confirm-relocated-root', '--cost-estimate', '--cursor', '--date', '--dated-since', '--days', '--decisions', '--delay', '--detach', '--detail', '--diff-filter', '--dir', '--drain', '--drain-timeout', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--enable', '--entities', '--exclude', '--exclude-standard', '--expect', '--expect-catalog', '--expect-local', '--expect-upstream', '--expected-state', '--explain', '--facts', '--federated-read', '--ff-only', '--file', '--filter', '--filters', '--finished-since', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--force-schema', '--format', '--fresh', '--from-index', '--from-json', '--from-meetings', '--full', '--full-history', '--fuzzy', '--git', '--grammar', '--grammar-diagnostics', '--group', '--group-by', '--hard-deadline', '--health-interval', '--held', '--help', '--hold-state', '--http', '--id', '--idempotency-key', '--ids', '--images', '--include', '--include-ambiguous', '--include-content', '--include-deleted', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-null-signature', '--infer-dates', '--inject-bootstrap', '--inline', '--input', '--input-json', '--install', '--interval', '--is-ancestor', '--is-shallow-repository', '--job-id', '--job-isolation', '--json', '--keep', '--kind', '--lanes', '--legacy-lock', '--limit', '--list', '--local', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--migration', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name', '--name-only', '--ner', '--nice', '--no-assume-unchanged', '--no-auto-embed', '--no-autopilot-install', '--no-bulk', '--no-confirm', '--no-delegate', '--no-embed', '--no-embedding', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-lanes', '--no-llm', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-skip-worktree', '--no-verify', '--no-worker', '--non-interactive', '--now', '--of', '--older-than', '--once', '--only', '--order', '--others', '--output', '--override-disabled', '--oversized', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--parked-code', '--pat-file', '--path', '--pause', '--pglite', '--phase', '--pid-file', '--plan', '--port', '--prefer', '--preview', '--priority', '--probe', '--prune-orphans', '--pull', '--purge', '--qm', '--question', '--queue', '--queue-only', '--quiet', '--rate', '--readers', '--reason', '--reason-scan-limit', '--rebuild', '--recent', '--record', '--redact-paths', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--remediate', '--repo', '--request-id', '--reset-checkpoint', '--restart-only', '--resume', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--review-lower', '--routing', '--row', '--save', '--scope', '--scopes', '--section', '--segment-limit', '--segmented', '--select', '--self-transfer', '--serial', '--serves', '--session', '--show-toplevel', '--side', '--sigkill-rescue', '--since', '--skill-loading', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-guard', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--state', '--statement-timeout', '--status', '--stdio-member', '--stop-mcp', '--strategy', '--suites', '--surface', '--swap-only', '--target', '--text', '--thin', '--thin-threshold', '--tier', '--timeout', '--timeout-ms', '--to', '--token', '--token-env', '--trust', '--type', '--types', '--uninstall', '--untrack', '--updated-after', '--url', '--user', '--vectors', '--verbose', '--verify', '--version', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],'lint': ['--abbrev-ref', '--accept-pending', '--add', '--admin-intent', '--adopt-slug-path', '--as', '--audit', '--autostash', '--background', '--brain', '--branch', '--cached', '--client', '--confirm-relocated-root', '--conflicts', '--dry-run', '--enable', '--error-unmatch', '--exclude', '--expect-remote', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--ff-only', '--file', '--fix', '--follow', '--force', '--get', '--get-all', '--git-dir', '--git-path', '--grammar-diagnostics', '--hard', '--help', '--id', '--infer-entity', '--is-inside-work-tree', '--json', '--keep', '--keep-checkout', '--local', '--local-env-vars', '--manifest', '--max-cost-usd', '--no-accept-pending', '--no-assume-unchanged', '--no-autostash', '--no-cron', '--no-pull', '--no-renames', '--no-skip-worktree', '--no-tags', '--no-verify', '--older-than', '--only', '--pat-file', '--path', '--porcelain', '--prefer', '--preview', '--probe', '--progress-interval', '--progress-json', '--provenance', '--pull', '--purge', '--push-only', '--quiet', '--readers', '--rebase', '--require-clean', '--resolve', '--scopes', '--self-transfer', '--short', '--show-toplevel', '--slug', '--slugs', '--source', '--source-id', '--stdin', '--timeout', '--timings', '--unset-all', '--untracked-files', '--verify', '--wait', '--yes'],'loops': ['--all', '--as-of', '--brain', '--dry-run', '--fail-fast', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--tools-json', '--top', '--type'],'lsd': ['--brain', '--force-resume', '--help', '--json', '--judge-model', '--limit', '--list-runs', '--max-cost', '--max-far-set', '--max-ideas-per-judge-call', '--max-usd', '--no-save', '--resume', '--save', '--source', '--strict-budget', '--yes'],diff --git a/src/core/error-registry.ts b/src/core/error-registry.tsindex 3a26281a18..49aeca0d34 100644--- a/src/core/error-registry.ts+++ b/src/core/error-registry.ts@@ -896,6 +896,7 @@ export const CODES = {unsupported_export_data: { class: 'unavailable', summary: "The source contains data this export path cannot carry." },unsupported_path: { class: 'caller', reasons: ['not_utf8', 'control_character'], summary: "Classic sync held a file whose name is not valid UTF-8 or contains a control character, so it cannot be a page path; the rest of the source synced.", why: "Git stores a name as bytes and a page path is text, so importing a lossy decoding would store a path no file has. The hold key spells the exact bytes (`/gbrain-bytes/` plus %XX escapes), the message names an item id bound to them, and the hold re-screens on every sync and clears once the name leaves the tree.", docs: 'docs/guides/write-refusals.md#unsupported_path', suggestion: 'Rename the file to a valid UTF-8 name without control characters (the hold\'s fix spells the old name with printf escapes, never raw bytes), commit, then run gbrain sync --source <source> --no-pull.' },unsupported_mutation_protocol: { class: 'unavailable', summary: "Prepared mutation does not match its accepted target." },+ untrack_not_db_only: { class: 'caller', summary: "gbrain git commit-push --untrack in a managed canonical worktree was refused before the index changed: a file to untrack is not under a storage.db_only dir that gbrain.yml at HEAD declares, or .gitignore does not ignore it.", why: "The next sync deletes the page of a file that leaves Git outside a declared storage.db_only dir, and a file .gitignore does not ignore can be committed again by any later commit.", docs: 'docs/guides/shared-checkout-git.md#untrack', suggestion: 'Declare the folder under storage.db_only in gbrain.yml and add its <dir>/ line to .gitignore, commit both with gbrain git commit-push -m <msg> -- gbrain.yml .gitignore, then rerun the untrack.' },upload_expired: { class: 'caller', summary: "The upload session passed its idle or hard deadline before it was committed, so its parts were discarded and nothing was written.", why: "Open sessions hold staged bytes against per-connection and per-brain quotas; persistence.limits.upload_idle_seconds (1 h) and upload_max_seconds (24 h) bound how long they may.", suggestion: 'Begin the upload again with a new request_id and send every part from part 0.' },upload_not_found: { class: 'caller', summary: "No open upload session matches this upload_id for this connection.", why: "A session answers only its creating connection, in its source, while the page it began against is unchanged; every other case gets this same answer so an upload_id reveals nothing.", suggestion: 'Begin a new upload with begin_page_upload and a new request_id.' },upload_protected_content: { class: 'caller', reasons: ['takes', 'facts', 'timeline'], summary: "A remote replace upload over 24 MiB was refused because the page holds content it cannot carry over: a takes fence or facts rows remote reads hide, or timeline rows.", why: "put_page keeps a hidden takes fence and hidden facts rows and checks omitted timeline rows by comparing whole bodies; an upload over the single-string ceiling is never held whole, so it refuses instead of dropping them.", suggestion: 'Replace the page with content of at most 24 MiB through put_page, write it locally on the brain host, or (timeline only) commit with drop_timeline: true when deleting every entry is intended.' },diff --git a/src/core/git/commit-push.ts b/src/core/git/commit-push.tsindex f0709edbca..dcdbc1f7e7 100644--- a/src/core/git/commit-push.ts+++ b/src/core/git/commit-push.ts@@ -28,7 +28,7 @@import { appendFileSync, existsSync, lstatSync, mkdtempSync, readFileSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { rangeSecretRefusal, scanRange } from './range-secret-scan.ts';-import { isAbsolute, join, relative, resolve } from 'node:path';+import { isAbsolute, join, relative, resolve, sep } from 'node:path';import { execFileSync } from '../spawn.ts';import { gitChildEnv, literalPathspecs } from '../git-env.ts';import { GIT_ENV, GIT_ENV_AUTH, GIT_SSRF_SUBCOMMAND_FLAGS, ownRemoteTransportFlags as transportFlags } from '../git-transport.ts';@@ -37,7 +37,8 @@ import { acquireNativeLock, acquireNativeLockSync, type NativeLockSyncHandle } fimport { recordCommit, recordIntent } from './commit-ledger.ts';import { OperationError, opError } from '../ops/contract.ts';import { shellQuote, type Action } from '../agent-output.ts';-import { isSyncable } from '../sync.ts';+import { isSyncable, resolveSlugForPath } from '../sync.ts';+import { isDeclaredDbOnlySlug, storageConfigFromYaml, unresolvedDbOnlyIn, type StorageConfig } from '../storage-config.ts';export const COMMIT_LOCK_NAME = 'brain-commit.lock';/** Taken by pre-#6530 helpers and hooks; held too so they still exclude us during the mixed-version window. */@@ -127,6 +128,8 @@ export interface CommitPushOptions {scanSecrets?: boolean;/** Commit the pending write-through files (`--pending`) instead of named paths. */pending?: boolean;+ /** `--untrack` (#7753): remove the named paths from Git and the index, keeping the files on disk. */+ untrack?: boolean;/** Commit and publish files outside the configured source root(s): the user's explicit choice, or gbrain's own scaffolding at the checkout root. */allowOutsideSourceRoot?: boolean;/** `--base <path>=<blob>`: the blob (or `absent`) each named path had at HEAD when the writer read it; a moved one refuses `commit_base_moved`. */@@ -425,7 +428,11 @@ function restoreIndex(root: string, rel: string[], before: string[], flagged: st}}-interface CommitScope { roots: string[]; lockPath: string; markHeld: boolean; bases?: ReadonlyMap<string, string> }+/**+ * `untrack`: commit the removal of the named paths instead (#7753); `db_only` (GST-2519, a managed canonical worktree)+ * admits only files under a storage.db_only dir HEAD's gbrain.yml declares (untrackAdmitted).+ */+interface CommitScope { roots: string[]; lockPath: string; markHeld: boolean; bases?: ReadonlyMap<string, string>; untrack?: 'any' | { dbOnly: ManagedFilesystemRoot } }/** A named path `git add -A` left out of the index while still exiting 0 (GST-2116). */export interface SkippedPath { path: string; reason: 'assume_unchanged' | 'skip_worktree' | 'not_staged' }@@ -535,6 +542,15 @@ function skippedPathsError(root: string, skipped: SkippedPath[], result: CommitPconst flagNote = 'an assume-unchanged or skip-worktree flag; an editor, an indexer or a sparse checkout can leave one, and people also set skip-worktree on purpose to keep local edits out of commits, so clearing it commits those edits';const chain = (steps: string[][], last?: Action): Action | undefined => steps.reduceRight<Action | undefined>((then, argv) =>({ argv, consent: [], actor: 'agent', requires_exclusive: false, why: 'Clears the flag so git sees the edit on disk; the file keeps its bytes.', ...(then ? { then } : {}) }), last);+ const named = skipped.map(s => s.path);+ const indexed = new Set(git(root, ['ls-files', '-z', '--', ...literalPathspecs(named)]).stdout.split('\0').filter(Boolean));+ const atHead = new Set(git(root, ['ls-tree', '-z', '--name-only', 'HEAD', '--', ...literalPathspecs(named)]).stdout.split('\0').filter(Boolean));+ const removals = skipped.filter(s => s.reason === 'not_staged' && atHead.has(s.path) && !indexed.has(s.path) && existsSync(join(root, s.path))).map(s => s.path);+ if (removals.length && removals.length === skipped.length) {+ return opError('commit_paths_skipped', `git did not commit ${skipped.length} named path(s) in ${root}: ${list}. They are staged for removal from Git (git rm --cached) while the files stay on disk, and commit-push does not commit that removal. ${rest}`,+ `To stop tracking them and keep the files, run gbrain git commit-push --untrack -m <msg> -- ${removals.map(p => shellQuote([p])).join(' ')}; to keep them tracked, git -C ${shellQuote([root])} restore --staged -- ${removals.map(p => shellQuote([p])).join(' ')}.`,+ { docs: 'docs/guides/shared-checkout-git.md#untrack', detail });+ }const pages = managed ? skipped.filter(s => isSyncable(s.path)) : [];if (managed && pages.length) {const source = managed.sourceId ? { argv: ['--source-id', managed.sourceId], mcp: { source_id: managed.sourceId } } : { argv: [], mcp: {} };@@ -609,6 +625,7 @@ function commitPaths(root: string, rel: string[], message: string, scope: Commitconst dirtyBefore = directoryStatus(root, rel);const before = indexEntries(root, rel);const flagged = gitOk(root, ['ls-files', '-v', '-z', '--', ...literalPathspecs(rel)], 'ls-files -v').split('\0').filter(entry => /^[a-zS] /.test(entry));+ if (scope.untrack) return { sha: untrackPaths(root, rel, message, scope, before, flagged), skipped: [] };const skipWorktree = new Set(flagged.filter(entry => /^[sS] /.test(entry)).map(entry => entry.slice(2)));// GST-2118: git add refuses a named skip-worktree file that is on disk; it is left to the skipped-path check, so the other paths still commit.const sparse = new Set([...skipWorktree].filter(p => rel.includes(p) && existsSync(join(root, p))));@@ -661,6 +678,126 @@ function commitPaths(root: string, rel: string[], message: string, scope: Commitreturn { sha, skipped: unstagedPaths(root, landed.paths, landed.listed, dirtyBefore, sha) };}+/** #7753: the files HEAD holds under each of `rel`; a named path HEAD holds nothing under is refused before anything changes. */+function untrackTargets(root: string, rel: string[]): string[] {+ const out = new Set<string>();+ for (const path of rel) {+ const held = git(root, ['ls-tree', '-r', '--name-only', '-z', 'HEAD', '--', ...literalPathspecs([path])]).stdout.split('\0').filter(Boolean);+ if (!held.length) {+ throw opError('commit_paths_invalid', `${path} is not tracked: the last commit holds no file there, so nothing was untracked.`,+ 'Name files or directories the branch\'s last commit holds (git ls-tree -r --name-only HEAD -- <path> lists them).', { detail: path });+ }+ for (const file of held) out.add(file);+ }+ const sparse = git(root, ['ls-files', '-v', '-z', '--', ...literalPathspecs([...out])]).stdout.split('\0').filter(entry => /^[sS] /.test(entry)).map(entry => entry.slice(2));+ if (sparse.length) {+ const list = `${sparse.slice(0, 10).join(', ')}${sparse.length > 10 ? ', ...' : ''}`;+ throw opError('commit_paths_invalid', `${sparse.length} file(s) to untrack are marked skip-worktree, so git rm --cached would refuse them: ${list}. Nothing was untracked.`,+ `They sit outside of your sparse-checkout definition (or carry the skip-worktree bit). Widen the sparse checkout (git sparse-checkout add <dir>) or clear the bit (git update-index --no-skip-worktree -- <path>), then rerun.`,+ { detail: JSON.stringify({ paths: sparse }) });+ }+ return [...out];+}++/**+ * GST-2519: the files an untrack in a managed canonical worktree would remove, each under a storage.db_only dir that+ * gbrain.yml at HEAD declares (the database row is canonical there, so sync keeps the page when its file leaves Git)+ * and ignored by .gitignore (so no later commit adds it back). Anything else refuses `untrack_not_db_only` before the+ * index is touched: untracking any other page file would delete that page at the next sync.+ */+export function untrackAdmitted(root: string, rel: string[], managed: ManagedFilesystemRoot): string[] {+ const files = untrackTargets(root, rel);+ const base = relative(root, managed.root).split(sep).join('/');+ const prefix = base && !base.startsWith('..') ? `${base}/` : '';+ const yml = git(root, ['show', `HEAD:${prefix}gbrain.yml`]);+ let disk: string | null = null;+ try { disk = readFileSync(join(managed.root, 'gbrain.yml'), 'utf8'); } catch { disk = null; }+ const config = (text: string | null, label: string): StorageConfig | null => {+ if (text === null) return null;+ try {+ const parsed = storageConfigFromYaml(text, label);+ return parsed && !unresolvedDbOnlyIn(text, parsed) ? parsed : null;+ } catch { return null; }+ };+ const committed = config(yml.code === 0 ? yml.stdout : null, `HEAD:${prefix}gbrain.yml`), onDisk = config(disk, join(managed.root, 'gbrain.yml'));+ const ignored = new Set(git(root, ['check-ignore', '--no-index', '-z', '--stdin'], { input: files.map(f => `${f}\0`).join('') }).stdout.split('\0').filter(Boolean));+ const refused = files.filter(file => {+ if (!file.startsWith(prefix) || !ignored.has(file)) return true;+ const slug = resolveSlugForPath(file.slice(prefix.length));+ return !isDeclaredDbOnlySlug(slug, committed) || !isDeclaredDbOnlySlug(slug, onDisk);+ });+ if (refused.length) {+ const list = `${refused.slice(0, 10).join(', ')}${refused.length > 10 ? ', ...' : ''}`;+ throw opError('untrack_not_db_only', `${root} is the managed canonical worktree${managed.sourceId ? ` of source ${managed.sourceId}` : ''}, and ${refused.length} file(s) to untrack are not under a storage.db_only dir that gbrain.yml declares both at HEAD and on disk (matched by page slug, as sync matches it), or .gitignore does not ignore them: ${list}. Nothing was untracked.`,+ `Declare the folder first: add it under storage.db_only in gbrain.yml and its <dir>/ line to .gitignore, commit both (gbrain git commit-push -m <msg> -- gbrain.yml .gitignore), then rerun the untrack.`,+ { detail: JSON.stringify({ paths: refused }), docs: 'docs/guides/shared-checkout-git.md#untrack' });+ }+ return files;+}++/**+ * `--dry-run --untrack`: the real run's path checks (source roots, the files HEAD holds, and in a managed canonical+ * worktree the storage.db_only admission) with no lock taken and nothing written; each refusal is the real run's.+ */+export function previewUntrack(root: string, rel: string[], opts: { allowOutsideSourceRoot?: boolean } = {}): string[] {+ const managed = managedFilesystemRootFor(root);+ if (managed && opts.allowOutsideSourceRoot) {+ throw opError('commit_paths_invalid', `${root} is the managed canonical worktree${managed.sourceId ? ` of source ${managed.sourceId}` : ''}: commit-push there only commits the paths you name.`,+ `Run gbrain git commit-push with only -m and the page paths after --; gbrain sources refresh${managed.sourceId ? ` ${managed.sourceId}` : ''} brings remote commits in.`);+ }+ const roots = opts.allowOutsideSourceRoot ? [''] : configuredSourceRoots(root);+ const outside = rel.filter(p => !insideSourceRoots(p, roots));+ if (outside.length) throw outsideRootError(root, roots, outside, 'Refusing to commit');+ return managed ? untrackAdmitted(root, rel, managed) : untrackTargets(root, rel);+}++/**+ * #7753: commit the removal of `rel` from Git, keeping the files on disk, under the caller's commit lock. The index+ * loses the entries (`git rm --cached`), and the commit is built from HEAD in a temporary index (`commit --only` would+ * stage the files again), so nothing else staged rides along. It must change exactly the files HEAD held under `rel`,+ * each deleted: a commit carrying anything else (a pre-commit hook staging a sibling) is taken back before anything is+ * published, and the index is restored.+ */+function untrackPaths(root: string, rel: string[], message: string, scope: CommitScope, before: string[], flagged: string[]): string {+ const removed = scope.untrack === 'any' || !scope.untrack ? untrackTargets(root, rel) : untrackAdmitted(root, rel, scope.untrack.dbOnly);+ const parent = gitOk(root, ['rev-parse', 'HEAD'], 'rev-parse HEAD');+ const rm = withIndexRetry(root, ['rm', '--cached', '-r', '-q', '--ignore-unmatch', '--', ...literalPathspecs(rel)], 'git rm --cached');+ if (rm.code !== 0) {+ try { restoreIndex(root, rel, before, flagged); } catch { /* the refusal below still stands */ }+ throw opError('commit_paths_invalid', 'git rm --cached refused the given paths.', rm.stderr.trim().slice(0, 300) || 'Check the paths exist or are tracked.');+ }+ const dir = mkdtempSync(join(tmpdir(), 'gbrain-untrack-'));+ try {+ const env = { GIT_INDEX_FILE: join(dir, 'index') };+ gitOk(root, ['read-tree', parent], 'read-tree', { env });+ gitOk(root, ['update-index', '-z', '--force-remove', '--stdin'], 'update-index', { env, input: removed.map(p => `${p}\0`).join('') });+ recordIntent(root, { writer: 'commit_push', head_before: parent, message });+ const commit = git(root, ['commit', '-q', '-m', message], { timeoutMs: 120_000,+ env: { ...env, [COMMIT_VIA_ENV]: scope.lockPath, ...(scope.markHeld ? { [COMMIT_LOCK_ENV]: scope.lockPath } : {}) } });+ if (commit.code !== 0) {+ throw opError('git_unavailable', `git commit failed in ${root}; the paths are tracked again and keep their bytes.`,+ `${commit.stderr.trim().slice(0, 300)} A missing git identity (user.name, user.email) or a refusing pre-commit hook are common causes.`);+ }+ const head = gitOk(root, ['rev-parse', 'HEAD'], 'rev-parse HEAD');+ recordCommit(root, { sha: head, writer: 'commit_push' });+ const fields = git(root, ['diff-tree', '-r', '--no-renames', '--name-status', '-z', parent, head]).stdout.split('\0').filter(Boolean);+ const landed = new Set(fields.flatMap((status, i) => (i % 2 ? [] : [`${status}\t${fields[i + 1]}`])));+ const wanted = new Set(removed.map(p => `D\t${p}`));+ const extra = [...landed].filter(e => !wanted.has(e)).map(e => e.slice(e.indexOf('\t') + 1));+ const missing = removed.filter(p => !landed.has(`D\t${p}`));+ const first = git(root, ['rev-parse', '--verify', '--quiet', `${head}^1`]).stdout.trim();+ if (first === parent && !extra.length && !missing.length) return head;+ const undo = git(root, ['update-ref', '-m', 'gbrain: take back an untrack commit that changed other paths', 'HEAD', first, head]);+ throw opError('git_unavailable', `The untrack commit ${first !== parent ? 'was built on a HEAD that moved' : `changed ${[...extra, ...missing].slice(0, 10).join(', ')} beyond deleting the named paths`}, so ${undo.code === 0 ? 'it was taken back and nothing is committed' : `commit ${head.slice(0, 12)} is left unpublished`}.`,+ 'A pre-commit hook or another process changed the commit. Rerun the same gbrain git commit-push --untrack command once it is done.');+ } catch (e) {+ try { restoreIndex(root, rel, before, flagged); } catch { /* the index lock outlasted the retries; the error below still stands */ }+ throw e;+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+}+// ── Pending write-through ───────────────────────────────────────────────────export interface PendingWriteThrough { path: string; since: string }@@ -1293,7 +1430,7 @@ function commitManagedPaths(root: string, opts: CommitPushOptions, managed: Manathrow opError('commit_paths_invalid', `${where}: commit-push there only commits the paths you name.`,`Run gbrain git commit-push with only -m and the page paths after --; gbrain sources refresh${managed.sourceId ? ` ${managed.sourceId}` : ''} brings remote commits in.`);}- const { result: committed, skipped } = commitPathsOnly(root, opts, where, configuredSourceRoots(root), 'Leave the checkout to its owner; gbrain sources writer status names its state.');+ const { result: committed, skipped } = commitPathsOnly(root, opts, where, configuredSourceRoots(root), 'Leave the checkout to its owner; gbrain sources writer status names its state.', managed);const counted = git(root, ['rev-list', '--count', '@{upstream}..HEAD']);const upstream = git(root, ['for-each-ref', '--format=%(upstream:short)', `refs/heads/${committed.branch}`]).stdout.trim();const result: CommitPushResult = { ...committed, managed: true, unpublished: counted.code === 0 ? Number(counted.stdout.trim()) : null, upstream: upstream || null };@@ -1324,7 +1461,7 @@ function commitRemotelessPaths(root: string, opts: CommitPushOptions): CommitPus}/** Commit only the named paths under the commit lock and nothing more: no fetch, merge, push or checkout move. */-function commitPathsOnly(root: string, opts: CommitPushOptions, where: string, roots: string[], detachedFix: string): { result: CommitPushResult; skipped: SkippedPath[] } {+function commitPathsOnly(root: string, opts: CommitPushOptions, where: string, roots: string[], detachedFix: string, managed?: ManagedFilesystemRoot): { result: CommitPushResult; skipped: SkippedPath[] } {if (!opts.message?.trim()) throw opError('commit_paths_invalid', 'A commit message is required.', 'Pass the commit message with -m.');const rel = scopePaths(root, opts.paths ?? [], opts.cwd ?? process.cwd());if (!rel.length) throw opError('commit_paths_invalid', `${where}: name the paths to commit.`, 'Pass -- <paths> after the message.');@@ -1335,7 +1472,8 @@ function commitPathsOnly(root: string, opts: CommitPushOptions, where: string, rlet commit: ReturnType<typeof commitPaths>;try {assertNoOperationInProgress(root);- commit = commitPaths(root, rel, opts.message.trim(), { roots, lockPath: lock.lockPath, markHeld: true, bases: scopeBases(root, opts, rel) });+ commit = commitPaths(root, rel, opts.message.trim(), { roots, lockPath: lock.lockPath, markHeld: true, bases: scopeBases(root, opts, rel),+ ...(opts.untrack ? { untrack: managed ? { dbOnly: managed } : 'any' as const } : {}) });} finally {lock.release();}@@ -1347,6 +1485,7 @@ function commitPathsOnly(root: string, opts: CommitPushOptions, where: string, rexport function commitAndPush(opts: CommitPushOptions): CommitPushResult {const root = checkoutRoot(opts.repo);if (opts.keepCheckout && !opts.pushOnly) throw opError('commit_paths_invalid', 'keepCheckout publishes commits already on the branch; it commits nothing.', 'Use --push-only --keep-checkout.');+ if (opts.untrack && (opts.pushOnly || opts.pending)) throw opError('commit_paths_invalid', 'untrack removes the paths you name; it does not combine with push-only or pending.', 'Use --untrack -m <msg> -- <paths>.');const managed = opts.keepCheckout || opts.pushOnly ? null : managedFilesystemRootFor(root);if (managed && !hasFilesystemPublication(root)) return commitManagedPaths(root, opts, managed);if (!opts.keepCheckout) assertManagedFilesystemWrite(root);@@ -1370,7 +1509,8 @@ export function commitAndPush(opts: CommitPushOptions): CommitPushResult {const lock = acquireCommitLock(root, opts.lockWaitMs);try {assertNoOperationInProgress(root);- if (rel.length) ({ sha: committed, skipped } = commitPaths(root, rel, opts.message!.trim(), { roots: opts.allowOutsideSourceRoot ? [''] : roots, lockPath: lock.lockPath, markHeld: true, bases: scopeBases(root, opts, rel) }));+ if (rel.length) ({ sha: committed, skipped } = commitPaths(root, rel, opts.message!.trim(), { roots: opts.allowOutsideSourceRoot ? [''] : roots, lockPath: lock.lockPath, markHeld: true, bases: scopeBases(root, opts, rel),+ ...(opts.untrack ? { untrack: managed ? { dbOnly: managed } : 'any' as const } : {}) }));settlePending(root);} finally {lock.release();diff --git a/src/core/persistence/label-edit.ts b/src/core/persistence/label-edit.tsindex 9c6fd7792f..62e9ec623b 100644--- a/src/core/persistence/label-edit.ts+++ b/src/core/persistence/label-edit.ts@@ -50,6 +50,39 @@ const KEY_LINES: Record<string, RegExp> = {visibility: /^visibility[ \t]*:(?:[ \t]|\r?\n|$)/, access: /^access[ \t]*:(?:[ \t]|\r?\n|$)/, confidentiality: /^confidentiality[ \t]*:(?:[ \t]|\r?\n|$)/,readable_by: /^readable_by[ \t]*:(?:[ \t]|\r?\n|$)/,};+/**+ * GST-2519: `text`, a file under a declared storage.db_only path about to be imported over its page, with each privacy+ * label the stored page holds and the file does not state, so an import there never widens who reads the page; a label+ * the file states (narrower or wider) is the owner's and applies. Null when there is nothing to keep.+ */+export function withStoredLabels(text: string, stored: Record<string, unknown> | null | undefined, incoming: Record<string, unknown>): string | null {+ const kept = storedLabelsToKeep(stored, incoming);+ if (!kept.length) return null;+ const lines = kept.map(key => `${key}: ${JSON.stringify(stored![key])}\n`).join('');+ const bom = text.startsWith('\uFEFF') ? '\uFEFF' : '';+ const body = text.slice(bom.length);+ const lead = /^(?:[ \t\r]*\n)*/.exec(body)![0];+ const open = /^---[ \t]*\r?\n/.exec(body.slice(lead.length));+ const close = open ? /^---[ \t]*(?:\r?\n|$)/m.exec(body.slice(lead.length + open[0].length)) : null;+ let mapping = false;+ if (open && close) {+ try {+ const block = loadBoundedYaml(body.slice(lead.length + open[0].length, lead.length + open[0].length + close.index));+ mapping = block == null || (typeof block === 'object' && !Array.isArray(block));+ } catch { mapping = false; }+ }+ if (!open || !close || !mapping) return `${bom}---\n${lines}---\n${body}`;+ const from = lead.length + open[0].length, at = from + close.index;+ const blank = (line: string) => kept.some(key => new RegExp(`^${key}[ \\t]*:[ \\t]*(?:~|null|Null|NULL|''|"")?[ \\t]*\\r?$`).test(line));+ const block = body.slice(from, at).split('\n').filter((line, i, all) => !(i < all.length - 1 && blank(line))).join('\n');+ return bom + body.slice(0, from) + block + lines + body.slice(at);+}++/** GST-2519: the privacy labels the stored page holds that the incoming frontmatter does not state (absent, null or blank). */+export function storedLabelsToKeep(stored: Record<string, unknown> | null | undefined, incoming: Record<string, unknown>): string[] {+ return EDIT_KEYS.filter(key => stored?.[key] != null && (incoming[key] == null || incoming[key] === ''));+}+const listEntry = (entry: string) => (loadBoundedYaml(`[${entry}]`) as unknown[])[0] === entry ? entry : `'${entry}'`;const valueText = (value: string | string[]) => Array.isArray(value) ? `[${value.map(listEntry).join(', ')}]` : value;const keyLine = (key: string) => KEY_LINES[key] ?? /(?!)/;diff --git a/src/core/persistence/page-prepare.ts b/src/core/persistence/page-prepare.tsindex 4720613a21..a69c07b20e 100644--- a/src/core/persistence/page-prepare.ts+++ b/src/core/persistence/page-prepare.ts@@ -424,6 +424,11 @@ export async function prepareFileTarget(engine: BrainEngine, row: Pick<WriteRequoptions = { ...options, deleting: true };} else await assertLfsTarget(engine, row, root, path, options.remote === true);}+ // GST-2519: the live file check (liveFileDrift: no content) of a strict page declared git_ignored, whose path Git still+ // ignores, finds no file target, as its publication does; a page whose ignore rule is gone is still checked for its file.+ if (binding.canonical_git === true && content === null && options.deleting !== true && snapshot && !snapshot.page.deleted_at && !snapshot.page.source_path && !existsSync(path)+ && (await engine.executeRaw<{ reason: string | null }>('SELECT database_only_reason AS reason FROM pages WHERE id=$1', [snapshot.page.id]))[0]?.reason === 'git_ignored'+ && await waitingOnWhile(options.clock, 'git', () => ignoredTarget(root, path))) return undefined;if (options.newPageIgnoredDatabaseOnly && !snapshot && content !== null && !existsSync(path) && !isSourceDbOnlySlug(root, row.slug, 'not_db_only') && await waitingOnWhile(options.clock, 'git', () => gitIgnoresUntracked(root, relative(root, path).split(sep).join('/')))&& !(await gitDurabilityPolicy(binding, root)).durable) return undefined;if (options.excludeTombstone && snapshot?.page.deleted_at) {diff --git a/src/core/persistence/sync-classify.ts b/src/core/persistence/sync-classify.tsindex 240694eba6..f4442649c1 100644--- a/src/core/persistence/sync-classify.ts+++ b/src/core/persistence/sync-classify.ts@@ -259,7 +259,9 @@ function gitVerdict(state: SyncPathState): Matched {switch (rest.cls) {// G8a: a page no import record proves (legacy_unverified, typically the unknown side of a held drift) takes the commit too.case 'drift': case 'keep_db': case 'deleted_edited': case 'legacy_unverified': return wins({ cls: 'import', settled: false, action: 'import' });- case 'db_ahead': return rest.sub === 'pending' ? rest : wins({ cls: 'import', settled: false, action: 'import' });+ // GST-2519: a page under a declared storage.db_only dir is canonical in the database, so a version the database moved to+ // while Git did not move stays, as on a source that is not strict.+ case 'db_ahead': return rest.sub === 'pending' || state.dbOnly === true ? rest : wins({ cls: 'import', settled: false, action: 'import' });case 'delete': case 'delete_drift':if (state.originEvidence === undefined || rest.uncommitted === 'storage_invalid') return rest;if (state.originEvidence !== 'committed') return wins({ cls: 'kept', settled: true, action: 'none' });diff --git a/src/core/persistence/sync-prepare.ts b/src/core/persistence/sync-prepare.tsindex d31268a874..b4e91bf148 100644--- a/src/core/persistence/sync-prepare.ts+++ b/src/core/persistence/sync-prepare.ts@@ -38,6 +38,8 @@ import { preserveProtectedTakes } from './protected-takes.ts';import { getWorktreeBinding } from './ownership.ts';import { sourceMirrorReadOnly } from './mirror-read-only.ts';import { writeThroughConfigured } from './switches.ts';+import { isSourceDbOnlySlug } from './source-storage.ts';+import { withStoredLabels } from './label-edit.ts';import { assertConfiguredSyncRoot, assertSyncEntryOrigin, readSyncFile, syncGit, syncRawHash, type SyncRename } from './sync-discovery.ts';import { directoryAt } from './sync-entry-fault.ts';import { assertSyncPageOrigin, sameSyncOrigin, syncOriginPath, syncOriginScope, type SyncOriginScope } from './sync-origin.ts';@@ -688,6 +690,15 @@ async function syncWriteState(tx: BrainEngine, row: WriteRequest, page: Parametereturn { ...await sizeStateField(tx, row.source_id, row.slug, page), ...segmentedOutcome(segmented, isQuarantined(frontmatter)) };}+/**+ * GST-2519: a file under a declared storage.db_only path imports keeping the privacy labels its live page holds and the+ * file does not state (a label repair writes them to the database only there), so a commit to the file never widens it.+ */+function keepDbOnlyLabels(root: string, slug: string, base: Snapshot | undefined, text: string, incoming?: Record<string, unknown>): string {+ if (!base || base.page.deleted_at || !isSourceDbOnlySlug(root, slug, 'not_db_only')) return text;+ return withStoredLabels(text, base.page.frontmatter as Record<string, unknown>, incoming ?? parseMarkdown(text, `${slug}.md`).frontmatter) ?? text;+}+/** #8729: a screen (`screening`) publishes nothing, so the segmented staging its import opened is aborted (unbounded: past the screen's deadline too) as soon as the import hands it over, never left live beside the admitted write's. */async function prepareSyncMutation(unbounded: BrainEngine, row: WriteRequest, _config: GBrainConfig, clock: ClaimPhaseClock | undefined,screening: { unsaved: true } | undefined, at: { root?: string }): Promise<SyncPreparedMutation> {@@ -869,14 +880,14 @@ async function prepareSyncMutation(unbounded: BrainEngine, row: WriteRequest, _cthrow syncPublicationRefusal('source_changed', 'Newer working-tree bytes and the current page disagree with this pinned Git import.', row, p,`The working tree holds newer bytes for ${row.slug} that match neither the pinned import nor the current page; sync did not overwrite them. Preserve the local edit and commit it.`);}- let importContent = p.content;+ let importContent = keepDbOnlyLabels(root, row.slug, base, p.content, parsedInput.frontmatter);if (row.authority.remote) {const stored = base ? fenceBody(base.page) : null;const compiled_truth = preserveProtectedTakes(parsedInput.compiled_truth, stored?.compiled_truth ?? '');const timeline = preserveProtectedTakes(parsedInput.timeline ?? '', stored?.timeline ?? '');if (compiled_truth !== parsedInput.compiled_truth || timeline !== (parsedInput.timeline ?? '')) {- importContent = serializePageToMarkdown({ ...(base ? withoutBody(base.page) : { id: 0, source_id: row.source_id, created_at: new Date(), updated_at: new Date() }),- ...parsedInput, compiled_truth, timeline } as Page, parsedInput.tags);+ importContent = keepDbOnlyLabels(root, row.slug, base, serializePageToMarkdown({ ...(base ? withoutBody(base.page) : { id: 0, source_id: row.source_id,+ created_at: new Date(), updated_at: new Date() }), ...parsedInput, compiled_truth, timeline } as Page, parsedInput.tags));}}let prepared: PreparedContentImport | undefined;@@ -901,7 +912,7 @@ async function prepareSyncMutation(unbounded: BrainEngine, row: WriteRequest, _cthrow syncPublicationRefusal('revision_conflict', 'A different page already owns this file identity; resolve the duplicate before syncing.', row, p,`Page ${ready.slug} already holds the content identity of ${renamed?.slug ?? row.slug}; resolve the duplicate pages first.`);}- const parsed = parseMarkdown(p.content, `${row.slug}.md`, { activePack });+ const parsed = parseMarkdown(keepDbOnlyLabels(root, row.slug, base, p.content, parsedInput.frontmatter), `${row.slug}.md`, { activePack });resolveParsedSubtype(parsed, base?.page);keepGrandfatherStamp(parsed.frontmatter, base?.page);const tags = [...new Set([...(base?.tags ?? []), ...ready.parsedPage.tags])].sort();diff --git a/src/core/persistence/sync-streamed.ts b/src/core/persistence/sync-streamed.tsindex f9bad4f025..d60ea8bb67 100644--- a/src/core/persistence/sync-streamed.ts+++ b/src/core/persistence/sync-streamed.ts@@ -28,6 +28,8 @@ import { sizeStateField } from '../page-embedding-budget.ts';import { readPageBodyPolicy } from '../page-body/limits.ts';import { importStreamedMarkdownFile, type StreamedPreparedImport } from '../page-body/streamed-import.ts';import { ownerImportTrust } from '../trust/channel.ts';+import { isSourceDbOnlySlug } from './source-storage.ts';+import { storedLabelsToKeep } from './label-edit.ts';import { pipelined } from '../page-state/transactions.ts';import { sealSegmentedPage } from './segmented-apply.ts';import { enterClaimStep, type ClaimPhaseClock } from './claim-phase.ts';@@ -110,6 +112,12 @@ export async function prepareManagedSyncStreamed(engine: BrainEngine, row: Writeif (!ready) throw result.refusal ? ctx.contentRefusal(result.refusal) : refuse('invalid_params', result.error ?? 'The sync file could not be prepared.',`The file could not be prepared as page ${row.slug}.`);const prepared: StreamedPreparedImport = ready;+ // GST-2519: a streamed import cannot carry the db_only label keep (sync-prepare.ts withStoredLabels), so a file that+ // would drop a privacy label its page holds is held until the file states it.+ const kept = base && !base.page.deleted_at && isSourceDbOnlySlug(ctx.root, row.slug, 'not_db_only')+ ? storedLabelsToKeep(base.page.frontmatter as Record<string, unknown>, prepared.frontmatter as Record<string, unknown>) : [];+ if (kept.length) throw ctx.contentRefusal({ code: 'visibility_noncanonical',+ message: `Page ${row.slug} sits under a declared storage.db_only directory and holds privacy labels (${kept.join(', ')}) that ${p.sourcePath} does not state; a file this large imports without keeping them, so it is held instead of widening the page. State those labels in the file's frontmatter and commit.` });if (prepared.observedRevision !== (base?.revision ?? null)) throw refuse('revision_conflict', 'The page changed during sync preparation.',`Page ${renamed?.slug ?? row.slug} changed while this sync was being prepared.`);const source = { sourceId: row.source_id };diff --git a/test/db-only-labels-gst2519.test.ts b/test/db-only-labels-gst2519.test.tsnew file mode 100644index 0000000000..19dc65c65d--- /dev/null+++ b/test/db-only-labels-gst2519.test.ts@@ -0,0 +1,169 @@+/**+ * GST-2519: privacy labels on pages under a declared `storage.db_only` dir, on PGLite and Postgres.+ * - A strict (git-canonical) source keeps a label repair on a page whose file Git still tracks there: the sync no+ * longer imports the unchanged file over the database row (sync-classify.ts gitVerdict).+ * - A commit to such a file never widens its page, on strict and non-strict sources: a label the row holds and the+ * file does not state is kept (sync-prepare.ts, label-edit.ts withStoredLabels); a label the file states applies.+ * - A strict page stamped git_ignored (put_page under a path Git ignores, no file) takes a label repair in the+ * database, where it lives, instead of being held canonical_file_missing (page-prepare.ts).+ * Repo-less brains never reach these paths (no checkout, no managed sync).+ */+import { describe, expect, test } from 'bun:test';+import { randomUUID } from 'node:crypto';+import { mkdirSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import type { BrainEngine } from '../src/core/engine.ts';+import { operations } from '../src/core/operations.ts';+import { performManagedSync } from '../src/core/persistence/sync-run.ts';+import { readGitSourceHolds } from '../src/core/persistence/sync-holds.ts';+import { PAGE_MAX_BYTES } from '../src/core/page-size-policy.ts';+import { conversationPage } from './helpers/conversation-page.ts';+import { durableGitRepo } from './helpers/git-publication.ts';+import { managedBrain } from './helpers/managed-brain.ts';+import { requirePostgresTestDatabase, testBackends } from './helpers/test-backends.ts';+import { OWNER, commitFiles, drainEffects, git, labels, page, repairApply, seedMembers, unboundReads } from './helpers/label-repair.ts';++const OPTS = { sourceId: 'default', noPull: true, noEmbed: true, noExtract: true };+const D = 'sources/mail-dbonly-example/', SLUG = `${D}tracked-example`, CANARY = 'canarytracked';+const IGNORED = 'sources/mail-ignored-example/', IGNORED_SLUG = `${IGNORED}put-example`;+const sync = async (engine: BrainEngine, full = false) => { await performManagedSync(engine, { ...OPTS, ...(full ? { full: true } : {}) }); await drainEffects(engine); };+const strict = (engine: BrainEngine) => engine.executeRaw(`UPDATE sources SET config = config || '{"canonical":"git"}'::jsonb WHERE id='default'`);+const declareDbOnly = ({ root }: { root: string }) => {+ writeFileSync(join(root, '.gitignore'), `${D}\n${IGNORED}\n`);+ writeFileSync(join(root, 'gbrain.yml'), `storage:\n db_only:\n - ${D}\n`);+ durableGitRepo(root, ['.gitignore', 'gbrain.yml']);+ mkdirSync(join(root, D), { recursive: true });+ writeFileSync(join(root, `${SLUG}.md`), page(SLUG, CANARY));+ commitFiles(root, [`${SLUG}.md`], 'a file committed before its folder was declared db_only');+};++for (const backend of testBackends()) describe(`[${backend}] GST-2519 labels under storage.db_only`, () => {+ const databaseUrl = backend === 'postgres' ? requirePostgresTestDatabase() : undefined;++ test('strict source: a private label repair on a tracked page under storage.db_only survives every later sync', () => managedBrain(async ({ engine }) => {+ await sync(engine);+ await strict(engine);+ expect((await repairApply(engine, ['visibility', '--slug', SLUG])).applied).toBe(1);+ for (const full of [false, false, true]) {+ await sync(engine, full);+ expect((await labels(engine, SLUG))).toMatchObject({ visibility: 'private', deleted: false });+ }+ expect(await unboundReads(engine, SLUG, CANARY)).toBe(false);+ }, { databaseUrl, setup: declareDbOnly }), 180_000);++ test('strict source: a readers label repair on a tracked page under storage.db_only survives every later sync', () => managedBrain(async ({ engine }) => {+ await sync(engine);+ await strict(engine);+ await seedMembers(engine, ['assistant-example']);+ expect((await repairApply(engine, ['visibility', '--slug', SLUG, '--readers', `assistant-example,${OWNER}`])).applied).toBe(1);+ for (const full of [false, true]) {+ await sync(engine, full);+ expect((await labels(engine, SLUG))!.readable_by).toEqual(['assistant-example', OWNER]);+ }+ expect(await unboundReads(engine, SLUG, CANARY)).toBe(false);+ }, { databaseUrl, setup: declareDbOnly }), 180_000);++ for (const mode of ['strict', 'non-strict'] as const) {+ test(`${mode} source: a commit to a tracked file under storage.db_only keeps the labels the file does not state, and a label the file states applies`, () => managedBrain(async ({ engine, root }) => {+ await sync(engine);+ if (mode === 'strict') await strict(engine);+ await seedMembers(engine, ['assistant-example']);+ expect((await repairApply(engine, ['visibility', '--slug', SLUG])).applied).toBe(1);+ expect((await repairApply(engine, ['visibility', '--slug', SLUG, '--readers', `assistant-example,${OWNER}`])).applied).toBe(1);+ await sync(engine);+ // Another writer commits an edit to the file that states no label (its committed bytes never had one).+ writeFileSync(join(root, `${SLUG}.md`), page(SLUG, `${CANARY} edited upstream`));+ commitFiles(root, [`${SLUG}.md`], 'an edit that states no label');+ await sync(engine);+ const kept = await labels(engine, SLUG);+ expect(kept).toMatchObject({ visibility: 'private', readable_by: ['assistant-example', OWNER], deleted: false });+ expect((await engine.executeRaw<{ t: string }>("SELECT compiled_truth AS t FROM pages WHERE source_id='default' AND slug=$1", [SLUG]))[0]!.t).toContain('edited upstream');+ expect(await unboundReads(engine, SLUG, CANARY)).toBe(false);+ // The owner widens through the file by stating the wider label; it applies.+ writeFileSync(join(root, `${SLUG}.md`), page(SLUG, CANARY, ['visibility: world']));+ commitFiles(root, [`${SLUG}.md`], 'the owner states the wider label');+ await sync(engine);+ expect((await labels(engine, SLUG))!.visibility).toBe('world');+ expect((await labels(engine, SLUG))!.readable_by).toEqual(['assistant-example', OWNER]);+ }, { databaseUrl, setup: declareDbOnly }), 180_000);+ }++ test('strict source: a blank label line or blank lines before the fence never widen the page or move its frontmatter into the body', () => managedBrain(async ({ engine, root }) => {+ const slug = `${D}blank-example`;+ const shaped = (canary: string) => `\n\n${page(slug, canary, ['visibility:', 'tags: [alpha]'])}`;+ writeFileSync(join(root, `${slug}.md`), shaped('canaryblank'));+ commitFiles(root, [`${slug}.md`], 'a page with a blank visibility line');+ await sync(engine);+ await strict(engine);+ expect((await repairApply(engine, ['visibility', '--slug', slug])).applied).toBe(1);+ await sync(engine);+ writeFileSync(join(root, `${slug}.md`), shaped('canaryblank edited upstream'));+ commitFiles(root, [`${slug}.md`], 'a body edit that keeps the blank line');+ await sync(engine);+ expect(await labels(engine, slug)).toMatchObject({ visibility: 'private', deleted: false });+ const [row] = await engine.executeRaw<{ t: string; owner: string | null }>("SELECT compiled_truth AS t, frontmatter->>'owner_note' AS owner FROM pages WHERE source_id='default' AND slug=$1", [slug]);+ expect(row!.owner).toBe('kept');+ expect(row!.t).not.toContain('---');+ expect(row!.t).toContain('edited upstream');+ expect(await unboundReads(engine, slug, 'canaryblank')).toBe(false);+ }, { databaseUrl, setup: declareDbOnly }), 180_000);++ test('a file over the single-string ceiling that drops a label its db_only page holds is held, and the page keeps the label', () => managedBrain(async ({ engine, root }) => {+ const slug = `${D}huge-example`;+ const huge = conversationPage(PAGE_MAX_BYTES + 1024 * 1024, { seed: 19 });+ writeFileSync(join(root, `${slug}.md`), huge.replace('---\n', '---\nvisibility: private\n'));+ commitFiles(root, [`${slug}.md`], 'a large private page');+ await sync(engine);+ expect(await labels(engine, slug)).toMatchObject({ visibility: 'private', deleted: false });+ writeFileSync(join(root, `${slug}.md`), huge);+ commitFiles(root, [`${slug}.md`], 'the same page without its label line');+ await sync(engine);+ expect(await labels(engine, slug)).toMatchObject({ visibility: 'private', deleted: false });+ const holds = (await readGitSourceHolds(engine, { sourceIds: ['default'] })).flatMap(s => s.holds);+ expect(holds.map(h => [h.path, h.code])).toEqual([[`${slug}.md`, 'visibility_noncanonical']]);+ }, { databaseUrl, setup: declareDbOnly }), 300_000);++ test('a commit to a tracked file outside storage.db_only still imports as it stands (the file is canonical there)', () => managedBrain(async ({ engine, root }) => {+ const slug = 'notes/plain-example';+ mkdirSync(join(root, 'notes'), { recursive: true });+ writeFileSync(join(root, `${slug}.md`), page(slug, 'canaryplain', ['visibility: private']));+ commitFiles(root, [`${slug}.md`], 'a private note');+ await sync(engine);+ expect((await labels(engine, slug))!.visibility).toBe('private');+ writeFileSync(join(root, `${slug}.md`), page(slug, 'canaryplain'));+ commitFiles(root, [`${slug}.md`], 'the owner removes the label line');+ await sync(engine);+ expect((await labels(engine, slug))!.visibility).toBeNull();+ }, { databaseUrl, setup: declareDbOnly }), 180_000);++ test('strict source: a page stamped git_ignored takes a label repair in the database, and the label survives syncs', () => managedBrain(async ({ engine, ctx }) => {+ await sync(engine);+ await strict(engine);+ await operations.find(op => op.name === 'put_page')!.handler(ctx, { slug: IGNORED_SLUG, content: page(IGNORED_SLUG, 'canaryignored'), request_id: randomUUID(), wait_ms: 30_000 });+ await drainEffects(engine);+ expect((await engine.executeRaw<{ r: string }>("SELECT database_only_reason AS r FROM pages WHERE slug=$1", [IGNORED_SLUG]))[0]!.r).toBe('git_ignored');+ await seedMembers(engine, ['assistant-example']);+ const readers = await repairApply(engine, ['visibility', '--slug', IGNORED_SLUG, '--readers', `assistant-example,${OWNER}`]);+ expect(readers.outcome_items?.map(item => item.outcome)).toEqual(['readers_set']);+ expect(readers.applied).toBe(1);+ expect((await repairApply(engine, ['visibility', '--slug', IGNORED_SLUG])).applied).toBe(1);+ for (const full of [false, true]) {+ await sync(engine, full);+ expect(await labels(engine, IGNORED_SLUG)).toMatchObject({ visibility: 'private', readable_by: ['assistant-example', OWNER], deleted: false });+ }+ expect(await unboundReads(engine, IGNORED_SLUG, 'canaryignored')).toBe(false);+ }, { databaseUrl, setup: declareDbOnly }), 180_000);++ test('strict source: a git_ignored page whose ignore rule is gone is still held canonical_file_missing', () => managedBrain(async ({ engine, ctx, root }) => {+ await sync(engine);+ await strict(engine);+ await operations.find(op => op.name === 'put_page')!.handler(ctx, { slug: IGNORED_SLUG, content: page(IGNORED_SLUG, 'canaryignored'), request_id: randomUUID(), wait_ms: 30_000 });+ await drainEffects(engine);+ writeFileSync(join(root, '.gitignore'), `${D}\n`);+ commitFiles(root, ['.gitignore'], 'drop the ignore rule');+ const held = await repairApply(engine, ['visibility', '--slug', IGNORED_SLUG]);+ expect(held.applied).toBe(0);+ expect(held.outcome_items?.map(item => item.outcome)).toEqual(['canonical_file_missing']);+ expect(git(root, 'status', '--porcelain', '--', IGNORED).trim()).toBe('');+ }, { databaseUrl, setup: declareDbOnly }), 180_000);+});diff --git a/test/git-commit-push-untrack-gst2519.test.ts b/test/git-commit-push-untrack-gst2519.test.tsnew file mode 100644index 0000000000..eb5404d59a--- /dev/null+++ b/test/git-commit-push-untrack-gst2519.test.ts@@ -0,0 +1,338 @@+/**+ * GST-2519 item 1: `gbrain git commit-push --untrack`.+ * Protects:+ * - #7753 (ported unchanged from the wave 2 door): in an ordinary checkout `--untrack` removes exactly the named paths+ * from the index and Git, keeps the files on disk, and leaves through the same commit lock and publish as an ordinary+ * commit; a commit carrying anything else is taken back; the dry run refuses what the real run refuses.+ * - In a managed canonical worktree it untracks only files under a storage.db_only dir that gbrain.yml at HEAD declares+ * and .gitignore ignores (refused `untrack_not_db_only` otherwise, the index as it was), commits there and never+ * pushes. Every page stays live with its content hash, with no hold, after a sync and a full sync, on strict and+ * non-strict sources; `git revert` of the untrack commit brings the files back to Git with the pages still live.+ * Repo-less: commit-push needs a checkout; a directory that is not one refuses the same way with or without --untrack.+ * Seams: none; real repositories and bare remotes, the real CLI for the flags, managed sync on PGLite and Postgres.+ */+import { afterEach, describe, expect, test } from 'bun:test';+import { execFileSync } from 'node:child_process';+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, unlinkSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { dirname, join } from 'node:path';+import type { BrainEngine } from '../src/core/engine.ts';+import { acquireCommitLock, commitAndPush, previewUntrack, untrackAdmitted } from '../src/core/git/commit-push.ts';+import { gitChildEnv } from '../src/core/git-env.ts';+import { performManagedSync } from '../src/core/persistence/sync-run.ts';+import { readGitSourceHolds } from '../src/core/persistence/sync-holds.ts';+import { durableGitRepo } from './helpers/git-publication.ts';+import { managedBrain } from './helpers/managed-brain.ts';+import { requirePostgresTestDatabase, testBackends } from './helpers/test-backends.ts';+import { commitFiles, drainEffects, page } from './helpers/label-repair.ts';+import { runCli } from './helpers/cli-spawn.ts';++const env = gitChildEnv();+const git = (root: string, ...args: string[]) => execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], env }).trim();+const dirs: string[] = [];+const scratch = (name: string) => { const dir = realpathSync(mkdtempSync(join(tmpdir(), `gbrain-door2-${name}-`))); dirs.push(dir); return dir; };+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });++function put(root: string, path: string, body: string): void {+ mkdirSync(dirname(join(root, path)), { recursive: true });+ writeFileSync(join(root, path), body);+}++/** A checkout on main with `files` committed, its own core.hooksPath, and (unless `remote` is false) a bare origin it pushed to. */+function checkout(files: Record<string, string>, remote = true): { root: string; bare: string | null; hooks: string } {+ const dir = scratch('repo');+ const root = join(dir, 'work');+ const hooks = join(dir, 'hooks');+ git(dir, 'init', '-q', '-b', 'main', root);+ git(root, 'config', 'user.name', 'Example Writer'); git(root, 'config', 'user.email', '[email protected]');+ git(root, 'config', 'core.hooksPath', hooks);+ for (const [path, body] of Object.entries({ 'seed.md': 'seed\n', ...files })) put(root, path, body);+ git(root, 'add', '-A'); git(root, 'commit', '-qm', 'seed');+ if (!remote) return { root, bare: null, hooks };+ const bare = join(dir, 'origin.git');+ git(dir, 'init', '-q', '--bare', '-b', 'main', bare);+ git(root, 'remote', 'add', 'origin', bare);+ git(root, 'push', '-q', '-u', 'origin', 'main');+ return { root, bare, hooks };+}++const cli = (root: string, args: string[], extra: Record<string, string> = {}) =>+ runCli(['git', 'commit-push', '--path', root, '--json', ...args], { home: scratch('home'), env: { GBRAIN_GIT_ALLOW_FILE_TRANSPORT: '1', ...extra } });+const status = (root: string) => execFileSync('git', ['-C', root, 'status', '--porcelain', '--untracked-files=all'], { encoding: 'utf8', env }).split('\n').filter(Boolean).sort();+const changed = (root: string, rev = 'HEAD') => git(root, 'diff-tree', '-r', '--no-commit-id', '--no-renames', '--name-status', '-z', rev).split('\0').filter(Boolean);+const refusalOf = (fn: () => unknown): { code?: string; message?: string; fix?: { argv: string[] } } => {+ try { fn(); } catch (e) { return e as { code?: string; message?: string }; }+ throw new Error('expected a refusal');+};+const indexBytes = (root: string) => readFileSync(join(root, '.git', 'index')).toString('base64');++describe('#7753: --untrack keeps the files on disk', () => {+ test('removes only the named file from Git; other writers\' staged and unstaged files stay as they were', async () => {+ const { root, bare } = checkout({ 'gen/out.json': '{"generated":1}\n', 'notes/a.md': 'a v1\n', 'notes/b.md': 'b v1\n' });+ put(root, 'notes/a.md', 'a staged by another writer\n'); git(root, 'add', 'notes/a.md');+ put(root, 'notes/b.md', 'b half-written by another writer\n');+ const result = await cli(root, ['--untrack', '-m', 'untrack generated output', '--', 'gen/out.json']);+ expect(result.exitCode).toBe(0);+ expect(JSON.parse(result.stdout)).toMatchObject({ outcome: 'pushed', paths: ['gen/out.json'] });+ expect(changed(bare!, 'main')).toEqual(['D', 'gen/out.json']);+ expect(git(bare!, 'log', '-1', '--format=%s', 'main')).toBe('untrack generated output');+ expect(git(root, 'rev-parse', 'HEAD')).toBe(git(bare!, 'rev-parse', 'main'));+ expect(readFileSync(join(root, 'gen/out.json'), 'utf8')).toBe('{"generated":1}\n');+ expect(status(root)).toEqual([' M notes/b.md', '?? gen/out.json', 'M notes/a.md']);+ });++ test('a directory untracks every file Git holds under it; untracked files there are left alone', () => {+ const { root, bare } = checkout({ 'gen/a.json': 'a\n', 'gen/sub/b.json': 'b\n', 'general.md': 'decoy\n' });+ put(root, 'gen/scratch.tmp', 'never tracked\n');+ expect(commitAndPush({ repo: root, cwd: root, paths: ['gen'], message: 'untrack gen', untrack: true })).toMatchObject({ outcome: 'pushed', paths: ['gen'] });+ expect(changed(bare!, 'main')).toEqual(['D', 'gen/a.json', 'D', 'gen/sub/b.json']);+ expect(status(root)).toEqual(['?? gen/a.json', '?? gen/scratch.tmp', '?? gen/sub/b.json']);+ expect(git(bare!, 'show', 'main:general.md')).toBe('decoy');+ });++ test('a file already deleted on disk commits its deletion, like an ordinary commit of it', () => {+ const { root, bare } = checkout({ 'gone.md': 'gone\n' });+ unlinkSync(join(root, 'gone.md'));+ expect(commitAndPush({ repo: root, cwd: root, paths: ['gone.md'], message: 'untrack gone', untrack: true }).outcome).toBe('pushed');+ expect(changed(bare!, 'main')).toEqual(['D', 'gone.md']);+ expect(status(root)).toEqual([]);+ });++ test('a path Git does not hold, the whole checkout and a magic-looking name refuse before anything changes', () => {+ const { root, bare } = checkout({ 'notes/a.md': 'a\n', 'notes/b.md': 'b\n', 'kept.md': 'kept\n' });+ put(root, 'loose.md', 'never tracked\n');+ const head = git(root, 'rev-parse', 'HEAD');+ for (const paths of [['loose.md'], ['kept.md', 'loose.md'], ['notes/*.md'], [':(glob)notes/*.md'], ['.'], [root], []]) {+ expect(refusalOf(() => commitAndPush({ repo: root, cwd: root, paths, message: 'm', untrack: true })).code).toBe('commit_paths_invalid');+ }+ expect(git(root, 'rev-parse', 'HEAD')).toBe(head);+ expect(git(bare!, 'rev-parse', 'main')).toBe(head);+ expect(git(root, 'ls-files').split('\n')).toEqual(['kept.md', 'notes/a.md', 'notes/b.md', 'seed.md']);+ expect(status(root)).toEqual(['?? loose.md']);+ });++ test('a file named with glob characters untracks alone, never the files its glob reading matches', () => {+ const { root, bare } = checkout({ '[ab].md': 'literal\n', 'a.md': 'a\n', 'b.md': 'b\n' });+ expect(commitAndPush({ repo: root, cwd: root, paths: ['[ab].md'], message: 'untrack literal', untrack: true }).outcome).toBe('pushed');+ expect(changed(bare!, 'main')).toEqual(['D', '[ab].md']);+ expect(git(root, 'ls-files').split('\n')).toEqual(['a.md', 'b.md', 'seed.md']);+ });++ test('a commit that changes anything beyond the named paths (a pre-commit hook staging a sibling) is taken back; the index is restored', () => {+ const { root, bare, hooks } = checkout({ 'gen/out.json': 'out\n', 'sibling.md': 'sibling v1\n' });+ put(root, 'sibling.md', 'sibling edited by another writer\n');+ mkdirSync(hooks, { recursive: true });+ writeFileSync(join(hooks, 'pre-commit'), '#!/bin/sh\ngit add -- sibling.md\n');+ chmodSync(join(hooks, 'pre-commit'), 0o755);+ const head = git(root, 'rev-parse', 'HEAD');+ const refused = refusalOf(() => commitAndPush({ repo: root, cwd: root, paths: ['gen/out.json'], message: 'untrack', untrack: true }));+ expect(refused.code).toBe('git_unavailable');+ expect(refused.message).toContain('sibling.md');+ expect(git(root, 'rev-parse', 'HEAD')).toBe(head);+ expect(git(bare!, 'rev-parse', 'main')).toBe(head);+ expect(status(root)).toEqual([' M sibling.md']);+ expect(git(root, 'ls-files', '--', 'gen/out.json')).toBe('gen/out.json');+ });++ test('runs inside the checkout\'s commit lock: a held lock refuses commit_lock_busy and untracks nothing', async () => {+ const { root } = checkout({ 'gen/out.json': 'out\n' });+ const lock = acquireCommitLock(root, 0);+ try {+ const busy = await cli(root, ['--untrack', '-m', 'm', '--', 'gen/out.json'], { GBRAIN_COMMIT_LOCK_WAIT_SECONDS: '0' });+ expect(busy.exitCode).toBe(1);+ expect(JSON.parse(busy.stdout)).toMatchObject({ code: 'commit_lock_busy' });+ } finally { lock.release(); }+ expect(git(root, 'ls-files', '--', 'gen/out.json')).toBe('gen/out.json');+ });++ test('--dry-run --untrack previews without writing and refuses what the real run refuses, a sparse-excluded path included', async () => {+ const { root } = checkout({ 'gen/out.json': 'out\n', 'notes/b/two.md': 'two\n' });+ const head = git(root, 'rev-parse', 'HEAD');+ const index = indexBytes(root);+ const preview = await cli(root, ['--dry-run', '--untrack', '-m', 'm', '--', 'gen/out.json']);+ expect(preview.exitCode).toBe(0);+ expect(JSON.parse(preview.stdout)).toMatchObject({ dry_run: true, mode: 'untrack', paths: ['gen/out.json'] });+ put(root, 'loose.md', 'never tracked\n');+ const loose = await cli(root, ['--dry-run', '--untrack', '-m', 'm', '--', 'loose.md']);+ expect(loose.exitCode).toBe(1);+ expect(JSON.parse(loose.stdout)).toMatchObject({ code: 'commit_paths_invalid' });+ expect(indexBytes(root)).toBe(index);+ expect(git(root, 'rev-parse', 'HEAD')).toBe(head);++ git(root, 'sparse-checkout', 'set', '--no-cone', '/gen/');+ const outside = await cli(root, ['--dry-run', '--untrack', '-m', 'm', '--', 'notes/b/two.md']);+ expect(outside.exitCode).toBe(1);+ const previewed = JSON.parse(outside.stdout) as { code: string; suggestion: string };+ expect(previewed).toMatchObject({ code: 'commit_paths_invalid', suggestion: expect.stringContaining('outside of your sparse-checkout definition') });+ const real = await cli(root, ['--untrack', '-m', 'm', '--', 'notes/b/two.md']);+ expect(JSON.parse(real.stdout)).toMatchObject({ code: 'commit_paths_invalid', suggestion: previewed.suggestion });+ expect(git(root, 'rev-parse', 'HEAD')).toBe(head);+ expect(commitAndPush({ repo: root, cwd: root, paths: ['gen/out.json'], message: 'untrack inside the sparse definition', untrack: true }).outcome).toBe('pushed');+ expect(changed(root)).toEqual(['D', 'gen/out.json']);+ expect(git(root, 'ls-files', '--', 'notes/b/two.md')).toBe('notes/b/two.md');+ });++ test('a checkout with no Git remote untracks locally (committed_local, no_remote)', () => {+ const { root } = checkout({ 'gen/out.json': 'out\n' }, false);+ const r = commitAndPush({ repo: root, cwd: root, paths: ['gen/out.json'], message: 'untrack', untrack: true });+ expect(r).toMatchObject({ outcome: 'committed_local', no_remote: true });+ expect(changed(root)).toEqual(['D', 'gen/out.json']);+ expect(status(root)).toEqual(['?? gen/out.json']);+ });++ test('flags that do not combine with --untrack refuse; a directory that is no checkout refuses as without --untrack', async () => {+ const { root } = checkout({ 'gen/out.json': 'out\n' });+ for (const args of [['--untrack', '--push-only'], ['--untrack', '--pull'], ['--untrack', '--pending', '-m', 'm']]) {+ const r = await cli(root, args);+ expect(r.exitCode).toBe(1);+ expect(JSON.parse(r.stdout)).toMatchObject({ code: 'commit_paths_invalid' });+ }+ const plain = scratch('repo-less');+ const without = await cli(plain, ['-m', 'm', '--', 'x.md']);+ const withUntrack = await cli(plain, ['--untrack', '-m', 'm', '--', 'x.md']);+ expect(withUntrack.exitCode).toBe(without.exitCode);+ expect(JSON.parse(withUntrack.stdout)).toEqual(JSON.parse(without.stdout));+ expect(git(root, 'ls-files', '--', 'gen/out.json')).toBe('gen/out.json');+ });+});+++const OPTS = { sourceId: 'default', noPull: true, noEmbed: true, noExtract: true };+const D = 'sources/archive-example/', A = `${D}first-example`, B = `${D}sub/second-example`;+const D2 = 'sources/unignored-example/', C = `${D2}third-example`, PLAIN = 'notes/plain-example';+const syncAll = async (engine: BrainEngine, full = false) => {+ const result = await performManagedSync(engine, { ...OPTS, ...(full ? { full: true } : {}) });+ await drainEffects(engine);+ return result;+};+const strictSource = (engine: BrainEngine) => engine.executeRaw(`UPDATE sources SET config = config || '{"canonical":"git"}'::jsonb WHERE id='default'`);+const rows = async (engine: BrainEngine) => Object.fromEntries((await engine.executeRaw<{ slug: string; content_hash: string; deleted: boolean }>(+ "SELECT slug, content_hash, deleted_at IS NOT NULL AS deleted FROM pages WHERE source_id='default' ORDER BY slug")).map(r => [r.slug, { hash: r.content_hash, deleted: r.deleted }]));+const holdCount = async (engine: BrainEngine) => (await readGitSourceHolds(engine, { sourceIds: ['default'] })).reduce((n, s) => n + s.count, 0);+const tip = (bare: string) => git(bare, 'rev-parse', 'HEAD');+const staged = (root: string) => git(root, 'ls-files', '-s');++/** A managed brain whose checkout declares D (ignored) and D2 (not ignored) under storage.db_only, tracks a page in each and one outside, and pushed to a bare origin. */+function declared({ root }: { root: string }): void {+ writeFileSync(join(root, '.gitignore'), `${D}\n`);+ writeFileSync(join(root, 'gbrain.yml'), `storage:\n db_only:\n - ${D}\n - ${D2}\n`);+ durableGitRepo(root, ['.gitignore', 'gbrain.yml']);+ for (const slug of [A, B, C, PLAIN]) put(root, `${slug}.md`, page(slug, 'canary'));+ commitFiles(root, [A, B, C, PLAIN].map(slug => `${slug}.md`), 'pages, committed before their folders were declared db_only');+ const bare = join(dirname(root), 'origin.git');+ git(dirname(root), 'init', '-q', '--bare', bare);+ git(root, 'remote', 'add', 'origin', bare);+ git(root, 'push', '-q', '-u', 'origin', 'HEAD');+}+const bareOf = (root: string) => join(dirname(root), 'origin.git');++describe('GST-2519: a removal staged by hand (git rm --cached)', () => {+ test('the plain door names --untrack instead of a nested repository, and --untrack then commits the removal', () => {+ const { root, bare } = checkout({ 'arch/a.md': 'a\n', 'kept.md': 'kept\n' });+ put(root, '.gitignore', 'arch/\n'); git(root, 'add', '.gitignore'); git(root, 'commit', '-qm', 'ignore arch'); git(root, 'push', '-q');+ git(root, 'rm', '-q', '--cached', 'arch/a.md');+ const refused = refusalOf(() => commitAndPush({ repo: root, cwd: root, paths: ['arch/a.md'], message: 'm' })) as { code?: string; suggestion?: string; docs?: string };+ expect(refused.code).toBe('commit_paths_skipped');+ expect(refused.suggestion).toContain('gbrain git commit-push --untrack -m <msg> -- arch/a.md');+ expect(refused.docs).toBe('docs/guides/shared-checkout-git.md#untrack');+ expect(commitAndPush({ repo: root, cwd: root, paths: ['arch/a.md'], message: 'untrack arch', untrack: true }).outcome).toBe('pushed');+ expect(changed(bare!, 'main')).toEqual(['D', 'arch/a.md']);+ expect(readFileSync(join(root, 'arch/a.md'), 'utf8')).toBe('a\n');+ expect(status(root)).toEqual([]);+ });+});++describe('GST-2519: --untrack in a managed canonical worktree, with a page root below the checkout root', () => {+ test('the storage.db_only admission reads gbrain.yml and the slugs relative to the managed root', () => {+ const { root } = checkout({ 'brain/gbrain.yml': `storage:\n db_only:\n - ${D}\n`, [`brain/${A}.md`]: 'a\n', [`${A}.md`]: 'outside the managed root\n' });+ put(root, 'brain/.gitignore', `${D}\n`);+ put(root, '.gitignore', `${D}\n`);+ const managed = { root: join(root, 'brain'), evidence: 'test' };+ expect(untrackAdmitted(root, [`brain/${D.slice(0, -1)}`], managed)).toEqual([`brain/${A}.md`]);+ expect(refusalOf(() => untrackAdmitted(root, [`${A}.md`], managed)).code).toBe('untrack_not_db_only');+ });+});++for (const backend of testBackends()) describe(`[${backend}] GST-2519: --untrack in a managed canonical worktree`, () => {+ const databaseUrl = backend === 'postgres' ? requirePostgresTestDatabase() : undefined;++ for (const mode of ['strict', 'non-strict'] as const) {+ test(`${mode} source: untracking a declared, ignored db_only dir keeps every page live with its bytes, commits locally, and git revert undoes it`, () => managedBrain(async ({ engine, root }) => {+ await syncAll(engine);+ if (mode === 'strict') await strictSource(engine);+ const before = await rows(engine);+ const pushed = tip(bareOf(root));+ const result = commitAndPush({ repo: root, cwd: root, paths: [D.slice(0, -1)], message: 'untrack the archive', untrack: true });+ expect(result).toMatchObject({ outcome: 'committed_local', managed: true, unpublished: 1 });+ expect(changed(root)).toEqual(['D', `${A}.md`, 'D', `${B}.md`]);+ expect(git(root, 'ls-files', '--', D)).toBe('');+ expect(readFileSync(join(root, `${A}.md`), 'utf8')).toBe(page(A, 'canary'));+ expect(git(root, 'status', '--porcelain', '--untracked-files=all')).toBe('');+ expect(tip(bareOf(root))).toBe(pushed);+ for (const full of [false, false, true]) {+ const synced = await syncAll(engine, full);+ expect(synced.deleted).toBe(0);+ expect(await rows(engine)).toEqual(before);+ expect(await holdCount(engine)).toBe(0);+ }+ git(root, '-c', 'user.name=Example', '-c', '[email protected]', 'revert', '--no-edit', 'HEAD');+ expect(git(root, 'ls-files', '--', D).split('\n')).toEqual([`${A}.md`, `${B}.md`]);+ for (const full of [false, true]) {+ await syncAll(engine, full);+ expect(await rows(engine)).toEqual(before);+ expect(await holdCount(engine)).toBe(0);+ }+ expect(tip(bareOf(root))).toBe(pushed);+ }, { databaseUrl, setup: declared }), 180_000);+ }++ test('anything outside a declared, ignored db_only dir refuses untrack_not_db_only before the index changes; the dry run refuses the same', () => managedBrain(async ({ engine, root }) => {+ await syncAll(engine);+ await strictSource(engine);+ const before = await rows(engine);+ const head = git(root, 'rev-parse', 'HEAD');+ const index = staged(root);+ writeFileSync(join(root, 'gbrain.yml'), `storage:\n db_only:\n - ${D}\n - ${D2}\n - notes/\n`);+ writeFileSync(join(root, '.gitignore'), `${D}\nnotes/\n`);+ const cases: Array<[string[], string, string[]]> = [+ [[`${PLAIN}.md`], 'untrack_not_db_only', [`${PLAIN}.md`]],+ [[`${C}.md`], 'untrack_not_db_only', [`${C}.md`]],+ [[`${A}.md`, `${PLAIN}.md`], 'untrack_not_db_only', [`${PLAIN}.md`]],+ [[`${D}missing-example.md`], 'commit_paths_invalid', []],+ ];+ for (const [paths, code, refused] of cases) {+ const real = refusalOf(() => commitAndPush({ repo: root, cwd: root, paths, message: 'untrack', untrack: true })) as { code?: string; detail?: string; docs?: string };+ expect(real.code).toBe(code);+ if (refused.length) expect(JSON.parse(real.detail!)).toEqual({ paths: refused });+ if (refused.length) expect(real.docs).toBe('docs/guides/shared-checkout-git.md#untrack');+ expect(refusalOf(() => previewUntrack(root, paths)).code).toBe(code);+ expect(staged(root)).toBe(index);+ expect(git(root, 'rev-parse', 'HEAD')).toBe(head);+ }+ expect(refusalOf(() => commitAndPush({ repo: root, cwd: root, paths: [`${A}.md`], message: 'm', untrack: true, pending: true })).code).toBe('commit_paths_invalid');+ expect(refusalOf(() => previewUntrack(root, [`${A}.md`], { allowOutsideSourceRoot: true })).code).toBe('commit_paths_invalid');+ expect(previewUntrack(root, [D.slice(0, -1)])).toEqual([`${A}.md`, `${B}.md`]);+ expect(staged(root)).toBe(index);+ await syncAll(engine);+ expect(await rows(engine)).toEqual(before);+ }, { databaseUrl, setup: declared }), 180_000);++ test('a folder whose page slugs fall outside the declared spelling, or that only HEAD still declares, refuses; no page is deleted', () => managedBrain(async ({ engine, root }) => {+ const spaced = 'sources/Spaced Example/', slug = 'sources/spaced-example/one-example';+ writeFileSync(join(root, 'gbrain.yml'), `storage:\n db_only:\n - ${D}\n - ${D2}\n - ${spaced}\n`);+ writeFileSync(join(root, '.gitignore'), `${D}\n${spaced}\n`);+ put(root, `${spaced}one example.md`, page(slug, 'canary'));+ commitFiles(root, ['gbrain.yml', '.gitignore', `${spaced}one example.md`], 'a db_only folder spelled with a space');+ await syncAll(engine);+ await strictSource(engine);+ const before = await rows(engine);+ expect(before[slug]).toMatchObject({ deleted: false });+ expect(refusalOf(() => commitAndPush({ repo: root, cwd: root, paths: [spaced.slice(0, -1)], message: 'untrack', untrack: true })).code).toBe('untrack_not_db_only');+ writeFileSync(join(root, 'gbrain.yml'), `storage:\n db_only:\n - ${D2}\n`);+ expect(refusalOf(() => commitAndPush({ repo: root, cwd: root, paths: [D.slice(0, -1)], message: 'untrack', untrack: true })).code).toBe('untrack_not_db_only');+ expect(git(root, 'ls-files', '--', D).split('\n')).toEqual([`${A}.md`, `${B}.md`]);+ git(root, 'checkout', '--', 'gbrain.yml');+ await syncAll(engine);+ expect(await rows(engine)).toEqual(before);+ }, { databaseUrl, setup: declared }), 180_000);+});diff --git a/test/helpers/label-repair.ts b/test/helpers/label-repair.tsnew file mode 100644index 0000000000..872797639d--- /dev/null+++ b/test/helpers/label-repair.ts@@ -0,0 +1,75 @@+/**+ * GST-2519 test helpers: a label repair through the CLI entry (preview, then apply its hash), effect draining that leaves+ * parked effects parked, and what an unbound read key gets of a page over remote MCP dispatch.+ */+import { execFileSync } from 'node:child_process';+import type { BrainEngine } from '../../src/core/engine.ts';+import { runRepairCommand } from '../../src/commands/repair.ts';+import { _resetCliExitVerdictForTests } from '../../src/core/cli-force-exit.ts';+import { runPersistenceEffects } from '../../src/core/persistence/effects.ts';+import { localHostId } from '../../src/core/persistence/identity.ts';+import { addMember } from '../../src/core/access/members.ts';+import { setOwner } from '../../src/core/access/owner.ts';+import { GBrainOAuthProvider } from '../../src/core/oauth-provider.ts';+import { sqlQueryForEngine } from '../../src/core/sql-query.ts';+import { mintLegacyToken } from '../../src/core/token-mint.ts';+import { dispatchToolCall } from '../../src/mcp/dispatch.ts';+import { __resetPrivateVisibilityCacheForTests } from '../../src/core/search/private-visibility.ts';+import type { AuthInfo } from '../../src/core/ops/contract.ts';+import { withEnv } from './with-env.ts';++export const OWNER = 'owner-example';+export const git = (root: string, ...args: string[]) => execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });+export const commitFiles = (root: string, paths: string[], message: string) => {+ git(root, 'add', '-f', '--', ...paths);+ git(root, '-c', 'user.name=Example', '-c', '[email protected]', 'commit', '-qm', message);+};+export const page = (slug: string, canary: string, extra: string[] = []) => ['---', `title: Example ${slug}`, 'type: note', ...extra, 'owner_note: kept', '---', '',+ `Body of ${slug} ${canary}.`, ''].join('\n');++/** `gbrain repair <argv> --json`, previewed and then applied with the preview's hash; the applied result. */+export async function repairApply(engine: BrainEngine, argv: string[]): Promise<{ applied: number; outcome_items?: Array<{ item: string; outcome: string }> }> {+ const run = async (args: string[]) => {+ let out = '';+ const log = console.log;+ console.log = (...parts: unknown[]) => { out += parts.map(String).join(' ') + '\n'; };+ try { await withEnv({ GBRAIN_INTERACTIVE: '0', CI: '1' }, () => runRepairCommand(engine, [...args, '--json'])); } finally { console.log = log; _resetCliExitVerdictForTests(); }+ const parsed = JSON.parse(out);+ return parsed.results?.[0] ?? parsed;+ };+ const preview = await run(argv);+ return run([...argv, '--apply', '--expect', preview.preview_hash]);+}++/** Runs effect passes until no effect of the source is queued or running (parked and failed ones stay as they are). */+export async function drainEffects(engine: BrainEngine, sourceId = 'default'): Promise<void> {+ for (let i = 0; i < 200; i++) {+ await runPersistenceEffects(engine, { engine: engine.kind } as never, { hostId: localHostId(), limit: 20 });+ if (!(await engine.executeRaw("SELECT 1 FROM persistence_effects WHERE source_id=$1 AND state IN ('queued','running')", [sourceId])).length) return;+ await Bun.sleep(50);+ }+ throw new Error('effects still open after 200 passes');+}++export async function labels(engine: BrainEngine, slug: string) {+ const [row] = await engine.executeRaw<{ visibility: string | null; readable_by: unknown; deleted: boolean; content_hash: string }>(`SELECT frontmatter->>'visibility' AS visibility,+ frontmatter->'readable_by' AS readable_by, deleted_at IS NOT NULL AS deleted, content_hash FROM pages WHERE source_id='default' AND slug=$1`, [slug]);+ return row ?? null;+}++/** The brain owner and the named members exist; the readers setter refuses unknown members and lists without the owner. */+export async function seedMembers(engine: BrainEngine, others: string[] = []): Promise<void> {+ for (const id of [OWNER, ...others]) await addMember(engine, id);+ await setOwner(engine, OWNER);+}++/** Whether a read key bound to no member reads `canary` on get_page of `slug` through remote MCP dispatch. */+export async function unboundReads(engine: BrainEngine, slug: string, canary: string): Promise<boolean> {+ __resetPrivateVisibilityCacheForTests();+ const minted = await mintLegacyToken(engine, { name: `unbound-${crypto.randomUUID()}`, scopes: ['read'], takesHolders: ['world'], sourceGrant: ['default'] });+ const provider = new GBrainOAuthProvider({ sql: sqlQueryForEngine(engine), transaction: fn => engine.transaction(tx => fn(sqlQueryForEngine(tx))) });+ const auth = await provider.verifyAccessToken(minted.token) as unknown as AuthInfo;+ const out = await dispatchToolCall(engine, 'get_page', { slug }, { remote: true, transport: 'http', auth, sourceId: auth.sourceId ?? 'default',+ takesHoldersAllowList: auth.takesHoldersAllowList ?? ['world'] });+ return out.content.map(c => c.text).join('\n').includes(canary);+}diff --git a/test/postgres-unit-arms.txt b/test/postgres-unit-arms.txtindex 6f4a387bab..cf2606b0c3 100644--- a/test/postgres-unit-arms.txt+++ b/test/postgres-unit-arms.txt@@ -75,6 +75,7 @@ test/cycle/derived-write-through-commit.test.tstest/cycle/dream-reverse-write-commit.test.tstest/cycle/synthesize-concepts-merge.test.tstest/db-lock-reconnect.test.ts+test/db-only-labels-gst2519.test.tstest/decide/conflict-proposals-managed.test.tstest/declared-lineage-visibility.test.tstest/derived-link-reconciliation.test.ts@@ -129,6 +130,7 @@ test/git-canonical-conversion-progress.test.tstest/git-canonical-conversion-strict-pass-7866.test.tstest/git-canonical-declared-g7a.test.tstest/git-canonical-indexer-g3.test.ts+test/git-commit-push-untrack-gst2519.test.tstest/git-door-index-lock-7742.test.tstest/git-door-planned-state.test.tstest/git-door-plumbing-gbra133.test.tsdiff --git a/test/sync-classify-strict-g3.test.ts b/test/sync-classify-strict-g3.test.tsindex 99082381d7..596378c52c 100644--- a/test/sync-classify-strict-g3.test.ts+++ b/test/sync-classify-strict-g3.test.ts@@ -23,6 +23,13 @@ describe('G3: Git wins on a strict source', () => {expect(strict(pending)).toEqual(classifySyncPath(pending));});+ test('GST-2519: under a declared storage.db_only dir a database version stays; a commit that moved still imports', () => {+ const declared = { ...dbOnly, dbOnly: true };+ expect(strict(declared)).toEqual(classifySyncPath(declared));+ expect(strict(declared)).toMatchObject({ cls: 'db_ahead', settled: true, action: 'none' });+ expect(strict({ ...gitMoved, page: dbOnly.page, dbOnly: true })).toMatchObject({ cls: 'import', action: 'import', gitWins: 'drift' });+ });+test('drift on either side imports the commit', () => {const both = { ...gitMoved, page: dbOnly.page };expect(classifySyncPath(both)).toMatchObject({ cls: 'drift', action: 'hold', side: 'both' });