Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(#6865): CI after the wave18a merge: fault-table text matches the runbook, writer inventory +1 for the slug-line alias, doctor goldens link repair.md, fixtures whose stray slug line must stay held
garrytanb9dc3e6d5079
diff --git a/docs/architecture/canonical-writers.tsv b/docs/architecture/canonical-writers.tsvindex 94057b0f8f..6caea92175 100644--- a/docs/architecture/canonical-writers.tsv+++ b/docs/architecture/canonical-writers.tsv@@ -181,7 +181,7 @@ src/core/shared-skills/optimizer.ts 0 coordinator Shared optimization preservessrc/core/persistence/import-prepare.ts 2 coordinator The prepared local import updates source_path only inside canonical publication; owner, input and target hashes, source confinement and knowledge-versus-skill boundary revalidate before apply. Its importFromContent calls carry prepare and run inside the coordinator publication.src/core/persistence/grandfather.ts 2 coordinator Private migration intents preserve exact page/source/incarnation/revision identity and rollback snapshots; frontmatter/hash and existing text seals change only inside canonical file publication, without new embedding or fact-backstop effects.src/core/mentions/pass.ts 7 coordinator Derived page_aliases rows (origin declared/subject) are replaced per page; on a managed brain the mention pass runs each alias batch inside withCoordinatedWrite for its source after re-reading page revisions, import writes them inside the caller's coordinated import transaction, and reindex --aliases holds the coordinated write itself. Frontmatter alias rows are never touched; unmanaged brains keep the SQL guard.-src/core/page-state/rename-alias.ts 12 engine_guard Rename aliases (slug_aliases), moveSlugBindings (facts entity/fence slugs, page_aliases, withdrawal subjects) and movePageIdReferences (#5431: versions, timeline, links deduplicated on the links key) run inside the rename's maintenanceTransaction; the canonical table SQL trigger requires coordinator capability, so legacy calls fail before publication.+src/core/page-state/rename-alias.ts 13 engine_guard Rename aliases (slug_aliases), moveSlugBindings (facts entity/fence slugs, page_aliases, withdrawal subjects) and movePageIdReferences (#5431: versions, timeline, links deduplicated on the links key) run inside the rename's maintenanceTransaction; the canonical table SQL trigger requires coordinator capability, so legacy calls fail before publication. #6865: recordSlugLineAlias writes the removed slug: line's alias inside the content-repair publication transaction (coordinated managed file repair).src/core/timeline-extract.ts 1 engine_guard Retracting removed markdown timeline rows is canonical table SQL; the trigger requires coordinator capability, so legacy calls fail before canonical DB publication.src/core/persistence/connector-google-receipts.ts 1 coordinator Account and message-owned Gmail receipt metadata changes only under canonical source/page locks, identity/revision and file guards; guarded projection installation preserves withdrawal overlays without replaying bodies or extracting facts.src/core/persistence/purge-deleted.ts 3 coordinator Unmanaged brains keep the engine bulk purge; a managed brain purges each expired tombstone through submitPageMutation delete_page purge bound to its revision. The second engine reference is the dry-run count for the D6 consent request (#6114), read-only. W1 (BELIEF_LEDGER.md 6.5): the third reference is the unmanaged per-tombstone expiry for sources the belief ledger records; it deletes one expired tombstone under its page key inside a belief batch (page.expired), the same retention rule as the bulk purge.diff --git a/src/core/persistence/sync-fault-class.ts b/src/core/persistence/sync-fault-class.tsindex 600561e7b6..369c6efe8e 100644--- a/src/core/persistence/sync-fault-class.ts+++ b/src/core/persistence/sync-fault-class.ts@@ -60,7 +60,7 @@ export const SYNC_FAULT_TABLE: ReadonlyArray<SyncFaultRule> = [escalate: `${ESCALATE_AFTER}, or writer status names a step that never finishes`, human_reason: 'The write owner cannot finish preparing this file; writer status names the step, fix or report it.' },{ code: 'invalid_fence', class: 'page', safe_actions: ['repair'], needs_human: false, escalate: 'the fence repair preview offers no plan (a manual reason)', human_reason: 'Edit the facts or takes table the hold names and commit.' },{ code: 'invalid_frontmatter', class: 'page', safe_actions: ['repair'], needs_human: false, escalate: 'the repair preview needs an interpretation (--include-ambiguous)', human_reason: 'Approve the proposed frontmatter fix or edit the file.' },- { code: 'frontmatter_slug_conflict', class: 'page', safe_actions: ['repair'], needs_human: false, escalate: 'the content-repair lane recorded what it could not do (an existing named page, other frontmatter fixes, a hand edit)', human_reason: 'The content-repair lane could not clear the hold; its recorded verdict names the page, edit or setting.' },+ { code: 'frontmatter_slug_conflict', class: 'page', safe_actions: ['repair'], needs_human: false, escalate: 'the lane recorded why it could not decide', human_reason: 'The content-repair lane could not clear the hold; its recorded verdict names the page, edit or setting.' },{ code: 'rename_held', class: 'page', safe_actions: ['repair'], needs_human: false, escalate: 'the repair preview needs an interpretation', human_reason: 'Approve re-binding the rename to the current page.' },{ code: 'file_too_large', class: 'page', safe_actions: ['none'], needs_human: true, escalate: 'always', human_reason: 'The file is over the page size limit; exclude it with sync.exclude, or split it into files under the limit.' },{ code: 'content_rejected', class: 'page', safe_actions: ['none'], needs_human: true, escalate: 'always', human_reason: 'The content-sanity gate rejected the file; remove the junk or change junk_disposition.' },diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.jsonindex 0d5fb03edb..9303af2cd2 100644--- a/test/fixtures/goldens/doctor/content-pglite-json.json+++ b/test/fixtures/goldens/doctor/content-pglite-json.json@@ -2927,7 +2927,7 @@{"category": "brain","details": {- "docs": "docs/guides/troubleshooting.md#unindexed-files",+ "docs": "docs/guides/repair.md#unindexed-files","sources": [{"source_id": "default",@@ -2953,7 +2953,7 @@],"command": "gbrain sources retry-held default --unindexed --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"then": {@@ -2969,7 +2969,7 @@],"command": "gbrain sync --source default --no-pull --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"verify": {diff --git a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json b/test/fixtures/goldens/doctor/hot-checks-pglite-json.jsonindex 81308115a3..14d42395ff 100644--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json@@ -3058,7 +3058,7 @@{"category": "brain","details": {- "docs": "docs/guides/troubleshooting.md#unindexed-files",+ "docs": "docs/guides/repair.md#unindexed-files","sources": [{"source_id": "default",@@ -3088,7 +3088,7 @@],"command": "gbrain sources retry-held default --unindexed --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"then": {@@ -3104,7 +3104,7 @@],"command": "gbrain sync --source default --no-pull --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"verify": {@@ -7094,7 +7094,7 @@{"category": "brain","details": {- "docs": "docs/guides/troubleshooting.md#unindexed-files",+ "docs": "docs/guides/repair.md#unindexed-files","sources": [{"source_id": "default",@@ -7124,7 +7124,7 @@],"command": "gbrain sources retry-held default --unindexed --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"then": {@@ -7140,7 +7140,7 @@],"command": "gbrain sync --source default --no-pull --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"verify": {diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.jsonindex 46db6acfd4..b74036be81 100644--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json@@ -3061,7 +3061,7 @@{"category": "brain","details": {- "docs": "docs/guides/troubleshooting.md#unindexed-files",+ "docs": "docs/guides/repair.md#unindexed-files","sources": [{"source_id": "default",@@ -3091,7 +3091,7 @@],"command": "gbrain sources retry-held default --unindexed --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"then": {@@ -3107,7 +3107,7 @@],"command": "gbrain sync --source default --no-pull --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"verify": {@@ -7098,7 +7098,7 @@{"category": "brain","details": {- "docs": "docs/guides/troubleshooting.md#unindexed-files",+ "docs": "docs/guides/repair.md#unindexed-files","sources": [{"source_id": "default",@@ -7128,7 +7128,7 @@],"command": "gbrain sources retry-held default --unindexed --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"then": {@@ -7144,7 +7144,7 @@],"command": "gbrain sync --source default --no-pull --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"verify": {diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex cbd76855e3..0e9a381d53 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -2684,7 +2684,7 @@{"category": "brain","details": {- "docs": "docs/guides/troubleshooting.md#unindexed-files",+ "docs": "docs/guides/repair.md#unindexed-files","sources": [{"source_id": "default",@@ -2706,7 +2706,7 @@],"command": "gbrain sources retry-held default --unindexed --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"then": {@@ -2722,7 +2722,7 @@],"command": "gbrain sync --source default --no-pull --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"verify": {diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex a4dce39211..d5959024ea 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -2729,7 +2729,7 @@{"category": "brain","details": {- "docs": "docs/guides/troubleshooting.md#unindexed-files",+ "docs": "docs/guides/repair.md#unindexed-files","sources": [{"source_id": "default",@@ -2751,7 +2751,7 @@],"command": "gbrain sources retry-held default --unindexed --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"then": {@@ -2767,7 +2767,7 @@],"command": "gbrain sync --source default --no-pull --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"verify": {diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex ad93aeec42..4a9d8c2588 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -2732,7 +2732,7 @@{"category": "brain","details": {- "docs": "docs/guides/troubleshooting.md#unindexed-files",+ "docs": "docs/guides/repair.md#unindexed-files","sources": [{"source_id": "default",@@ -2754,7 +2754,7 @@],"command": "gbrain sources retry-held default --unindexed --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"then": {@@ -2770,7 +2770,7 @@],"command": "gbrain sync --source default --no-pull --brain host","consent": [],- "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#unindexed-files",+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#unindexed-files","next": "run","requires_exclusive": false,"verify": {diff --git a/test/helpers/doctor-hot-checks-fixture.ts b/test/helpers/doctor-hot-checks-fixture.tsindex 3aab6be94d..a4bc42cd1b 100644--- a/test/helpers/doctor-hot-checks-fixture.ts+++ b/test/helpers/doctor-hot-checks-fixture.ts@@ -145,6 +145,8 @@ export async function buildHotCheckFixture(h: DoctorHome, sql: Sql): Promise<{ sgit(src, 'commit', '-q', '-m', 'broken files');const utcDay = () => new Date().toISOString().slice(0, 10);const before = utcDay();+ // The fixture keeps fm/slug-mismatch.md held for the frontmatter findings, so the sync-time stray slug: line heal (#6865) is off.+ await gbrain(h, ['config', 'set', 'sync.slug_conflicts.auto_remove', 'false']);await runGbrain(h, ['sync', '--source', 'notes', '--no-pull', '--no-embed']);const syncDays: [string, string] = [before, utcDay()];// After the sync (a full catch-up re-imports changed pages): database-only timeline rows, one materializable and one that cannot round-trip (comment markup).diff --git a/test/managed-sync-bulk.test.ts b/test/managed-sync-bulk.test.tsindex d3755b8684..10960dbb1c 100644--- a/test/managed-sync-bulk.test.ts+++ b/test/managed-sync-bulk.test.ts@@ -124,7 +124,7 @@ test('#6712: a failing member is attributed to its own page; the members beforetest('a held file ends the group before it: it is held without a request and every other page commits (#5988)', async () => withEnv({ GBRAIN_HOME: home }, async () => {if (!engine) return;- const f = await fixture(engine, notes(10, i => i === 3 ? '---\ntitle: Conflict\nslug: notes/other\n---\nA conflicting identity must not be imported.\n' : null));+ const f = await fixture(engine, notes(10, i => i === 3 ? '---\ntitle: Conflict\nslug: notes/n1\n---\nA conflicting identity must not be imported.\n' : null));const result = await performSync(engine, { sourceId: f.id, noPull: true, noEmbed: true, noExtract: true, drain: true });expect(result.drain).toMatchObject({ outcome: 'synced' });expect(result).toMatchObject({ holds_outstanding: 1 });