Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(storage): treat the drift phase report as a derive-phase database-only page (#8054)
garrytan0344761141ba
diff --git a/docs/storage-tiering.md b/docs/storage-tiering.mdindex 41bd94d4e3..1457e126a7 100644--- a/docs/storage-tiering.md+++ b/docs/storage-tiering.md@@ -70,8 +70,8 @@ When storage configuration is present, `gbrain sync` automatically manages `.gitRelated doctor coverage: `undeclared_db_only_pages` warns about DB pages with nobacking file that sit outside every declared `db_only` path. The engine's own-derive-phase output prefixes (`life/events/`, `atoms/`, `extracts/`,-`dream-cycle-summaries/`) count as implicitly declared for that check, so healthy+derive-phase output prefixes (`life/events/`, `atoms/`, `concepts/`, `extracts/`,+`dream-cycle-summaries/`, and the drift phase's `reports/drift-<date>` report) count as implicitly declared for that check, so healthybrains stay quiet without adding them to `gbrain.yml`. They are NOT auto-added to`.gitignore` — only explicitly declared `db_only` dirs are. Google and GitHubconnector sources running under managed persistence without a worktree bindingdiff --git a/src/core/storage-config.ts b/src/core/storage-config.tsindex 0a97a93044..9e75513a6f 100644--- a/src/core/storage-config.ts+++ b/src/core/storage-config.ts@@ -476,6 +476,9 @@ export const DERIVE_PHASE_DB_ONLY_DEFAULTS: readonly string[] = ['concepts/','extracts/','dream-cycle-summaries/',+ // The drift phase's nightly report (cycle/drift.ts) publishes without a+ // file; only that slug shape, so the rest of a user's reports/ keeps its files.+ 'reports/drift-',];/**diff --git a/test/doctor-silent-death-checks.test.ts b/test/doctor-silent-death-checks.test.tsindex 0c443dba92..691d9360a7 100644--- a/test/doctor-silent-death-checks.test.ts+++ b/test/doctor-silent-death-checks.test.ts@@ -21,6 +21,7 @@ import {effectiveDbOnlyDirs,findDbOnlyCollisions,} from '../src/core/storage-config.ts';+import { publishesDatabaseOnly } from '../src/core/persistence/page-prepare.ts';let engine: PGLiteEngine;const tempDirs: string[] = [];@@ -297,6 +298,20 @@ describe('undeclared_db_only_pages (#2784)', () => {expect(c.status).toBe('ok');});+ test('#8054: the drift phase report is implicitly declared, the rest of reports/ is not', async () => {+ const repo = makeRepo();+ await addSource('src-a', repo);+ await addPage('reports/drift-2026-10-01', { sourceId: 'src-a' });+ expect((await checkUndeclaredDbOnlyPages(engine)).status).toBe('ok');+ expect(publishesDatabaseOnly(repo, 'reports/drift-2026-10-01', { page: { deleted_at: null, source_path: null, source_uri: null } })).toBe(true);+ expect(publishesDatabaseOnly(repo, 'reports/drift-2026-10-01', { page: { deleted_at: null, source_path: 'reports/drift-2026-10-01.md', source_uri: null } })).toBe(false);+ await addPage('reports/weekly-review', { sourceId: 'src-a' });+ const c = await checkUndeclaredDbOnlyPages(engine);+ expect(c.status).toBe('warn');+ expect(c.details).toMatchObject({ total: 1, sample_slugs: ['reports/weekly-review (src=src-a)'] });+ expect(publishesDatabaseOnly(repo, 'reports/weekly-review', { page: { deleted_at: null, source_path: null, source_uri: null } })).toBe(false);+ });+test('declared db_only prefix in gbrain.yml keeps the check quiet', async () => {const repo = makeRepo();writeFileSync(join(repo, 'gbrain.yml'), 'storage:\n db_only:\n - notes/\n');