Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(e2e): planner-stats test 9 restores facts so a later VACUUM cannot list idx_facts_fts without statistics

garrytan56d850481408
diff --git a/test/e2e/planner-stats-postgres.test.ts b/test/e2e/planner-stats-postgres.test.ts
index 5c23dc2b13..5f5bf058d7 100644
--- a/test/e2e/planner-stats-postgres.test.ts
+++ b/test/e2e/planner-stats-postgres.test.ts
@@ -84,6 +84,11 @@ 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. With its 2,000 rows left behind and autovacuum back on, a
+ // VACUUM that lands before the item-6 tests gives idx_facts_fts a row count but no statistics,
+ // and they read it as a second expression index without statistics.
+ await engine.executeRaw("DELETE FROM facts WHERE source = 'test' AND fact LIKE 'pg claim %'");
+ await engine.executeRaw('VACUUM ANALYZE facts');
await engine.executeRaw('ALTER TABLE facts RESET (autovacuum_enabled)');
}
});