Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(e2e): planner-stats cleans up the 2,000 facts rows it inserts so the expression-index test never sees idx_facts_fts

garrytan5e3d18c3741b
diff --git a/test/e2e/planner-stats-postgres.test.ts b/test/e2e/planner-stats-postgres.test.ts
index 5c23dc2b13..829ab6fb05 100644
--- a/test/e2e/planner-stats-postgres.test.ts
+++ b/test/e2e/planner-stats-postgres.test.ts
@@ -84,7 +84,12 @@ d('planner stats on Postgres', () => {
const after = (await readPostgresPlannerStats(engine)).find(t => t.table === 'facts')!;
expect(after.stale).toBe(false);
} finally {
+ // Leave facts as the test found it: 2,000 rows left behind give idx_facts_fts index tuples, and
+ // whenever autovacuum vacuums them before it analyzes, the expression-index test below sees that
+ // index without statistics too.
+ await engine.executeRaw("DELETE FROM facts WHERE source = 'test' AND fact LIKE 'pg claim %'");
await engine.executeRaw('ALTER TABLE facts RESET (autovacuum_enabled)');
+ await engine.executeRaw('ANALYZE facts');
}
});