Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
G3.1 #6511: Postgres doctor goldens and the remaining readRequestIndexStates pins list the third online index
garrytan113f4741e072
diff --git a/test/fix-wave-4-integration.test.ts b/test/fix-wave-4-integration.test.tsindex 589a4a8bda..760c5539b1 100644--- a/test/fix-wave-4-integration.test.ts+++ b/test/fix-wave-4-integration.test.ts@@ -77,7 +77,8 @@ test('X1: an upgrade from v178 builds the request indexes; managed working-treeawait engine.executeRaw('DROP INDEX IF EXISTS persistence_requests_sync_run_committed');await engine.setConfig('version', '178');expect(await runMigrations(engine)).toEqual({ applied: LATEST_VERSION - 178, current: LATEST_VERSION });- expect((await readRequestIndexStates(engine)).map(index => index.state)).toEqual(['valid', 'valid']);+ // #6511: the online-built set is the checkpoint pair plus the purge slug index.+ expect((await readRequestIndexStates(engine)).map(index => index.state)).toEqual(['valid', 'valid', 'valid']);expect((await requestIndexesCheck(engine)).status).toBe('ok');const id = `x1-${randomUUID().slice(0, 8)}`, root = join(home, id);@@ -229,7 +230,7 @@ test('X11: the remediation run reaches every new repair kind, runs the free onesconst byKind = Object.fromEntries(run.repairs.map((r: { kind: string }) => [r.kind, r]));expect(byKind['request-indexes']).toMatchObject({ status: 'completed' });expect(byKind['orphan-bindings']).toMatchObject({ status: 'completed' });- expect((await readRequestIndexStates(engine)).map(index => index.state)).toEqual(['valid', 'valid']);+ expect((await readRequestIndexStates(engine)).map(index => index.state)).toEqual(['valid', 'valid', 'valid']);expect(await engine.executeRaw("SELECT 1 FROM persistence_source_bindings WHERE source_id='x11-orphan'")).toEqual([]);const replanned = (await planRepairSteps(engine, { noEmbed: true })).map(step => step.kind);expect(replanned).not.toContain('request-indexes');diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.jsonindex 956f43374d..4184ea3d86 100644--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json@@ -849,6 +849,10 @@{"name": "persistence_requests_sync_run_committed","state": "valid"+ },+ {+ "name": "persistence_requests_slug_intent",+ "state": "valid"}],"repair": "request-indexes"@@ -3917,6 +3921,10 @@{"name": "persistence_requests_sync_run_committed","state": "valid"+ },+ {+ "name": "persistence_requests_slug_intent",+ "state": "valid"}],"repair": "request-indexes"diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex efdc376260..ed72025d95 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -780,6 +780,10 @@{"name": "persistence_requests_sync_run_committed","state": "valid"+ },+ {+ "name": "persistence_requests_slug_intent",+ "state": "valid"}],"repair": "request-indexes"diff --git a/test/persistence-request-indexes.test.ts b/test/persistence-request-indexes.test.tsindex 7b54bb5c88..8cbec83d2b 100644--- a/test/persistence-request-indexes.test.ts+++ b/test/persistence-request-indexes.test.ts@@ -46,7 +46,8 @@ test('#5762 gbrain repair request-indexes rebuilds a dropped index inline on PGLconst scope = await resolveRepairScope(engine);expect(await runRepair(ctx(), requestIndexesRepair, scope, { apply: false })).toMatchObject({ affected: 1, sample: [`(brain):${NAMES[1]}`], cost: { lifetime_ids: 0, embedding_pages: 0 } });expect(await runRepair(ctx(), requestIndexesRepair, scope, { apply: true })).toMatchObject({ applied: 1, complete: true });- expect((await readRequestIndexStates(engine)).map(index => index.state)).toEqual(['valid', 'valid']);+ // #6511: the online-built set is the checkpoint pair plus the purge slug index.+ expect((await readRequestIndexStates(engine)).map(index => index.state)).toEqual(['valid', 'valid', 'valid']);expect(await runRepair(ctx(), requestIndexesRepair, scope, { apply: true })).toMatchObject({ affected: 0, applied: 0 });}, 60_000);diff --git a/test/persistence-sync-checkpoint-validation.test.ts b/test/persistence-sync-checkpoint-validation.test.tsindex d3c0cf4654..feff486f31 100644--- a/test/persistence-sync-checkpoint-validation.test.ts+++ b/test/persistence-sync-checkpoint-validation.test.ts@@ -196,11 +196,12 @@ test('#5762 the hint names one of three index states and keeps the saved process});test('#5762 a dropped index reads as missing and the hint then names the rebuild command', async () => each(async engine => {- expect((await readRequestIndexStates(engine)).map(index => index.state)).toEqual(['valid', 'valid']);+ // #6511 added the purge slug index to the online-built set; the default read lists it after the checkpoint pair.+ expect((await readRequestIndexStates(engine)).map(index => index.state)).toEqual(['valid', 'valid', 'valid']);await engine.executeRaw('DROP INDEX persistence_requests_sync_run_committed');try {expect(await readRequestIndexStates(engine)).toEqual([{ name: 'persistence_requests_sync_run_open', state: 'valid' },- { name: 'persistence_requests_sync_run_committed', state: 'missing' }]);+ { name: 'persistence_requests_sync_run_committed', state: 'missing' }, { name: 'persistence_requests_slug_intent', state: 'valid' }]);} finally {const { PERSISTENCE_SYNC_RUN_COMMITTED_INDEX_SQL } = await import('../src/core/persistence/schema.ts');await engine.executeRaw(PERSISTENCE_SYNC_RUN_COMMITTED_INDEX_SQL);