Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(schema): exercise v121 bootstrap coverage (#3489)

cybernaut64042ac6959b462e
diff --git a/test/schema-bootstrap-coverage.test.ts b/test/schema-bootstrap-coverage.test.ts
index 5bda62e0d9..11419ccbf4 100644
--- a/test/schema-bootstrap-coverage.test.ts
+++ b/test/schema-bootstrap-coverage.test.ts
@@ -256,6 +256,11 @@ test('applyForwardReferenceBootstrap covers every forward reference declared in
ALTER TABLE pages DROP COLUMN IF EXISTS generation;
ALTER TABLE pages DROP COLUMN IF EXISTS contextual_retrieval_mode;
ALTER TABLE pages DROP COLUMN IF EXISTS corpus_generation;
+
+ DROP INDEX IF EXISTS idx_timeline_event_dedup;
+ DROP INDEX IF EXISTS idx_timeline_event_page;
+ ALTER TABLE timeline_entries DROP CONSTRAINT IF EXISTS timeline_entries_event_page_id_fkey;
+ ALTER TABLE timeline_entries DROP COLUMN IF EXISTS event_page_id;
`);
// Note: we don't strip sources.archived* here because they're inline in the
@@ -264,6 +269,14 @@ test('applyForwardReferenceBootstrap covers every forward reference declared in
// The bootstrap's needsPagesBootstrap branch recreates sources without the
// archive columns; the new needsSourcesArchive probe adds them.
+ const { rows: preBootstrapTimelineEventPageId } = await db.query(`
+ SELECT 1 FROM information_schema.columns
+ WHERE table_schema = 'public'
+ AND table_name = 'timeline_entries'
+ AND column_name = 'event_page_id'
+ `);
+ expect(preBootstrapTimelineEventPageId).toHaveLength(0);
+
// Run bootstrap in isolation (NOT initSchema). This is what we're testing.
await (engine as any).applyForwardReferenceBootstrap();
@@ -328,6 +341,11 @@ test('after bootstrap, PGLITE_SCHEMA_SQL replays without crashing on missing for
ALTER TABLE pages DROP COLUMN IF EXISTS import_filename;
ALTER TABLE pages DROP COLUMN IF EXISTS salience_touched_at;
ALTER TABLE pages DROP COLUMN IF EXISTS emotional_weight;
+
+ DROP INDEX IF EXISTS idx_timeline_event_dedup;
+ DROP INDEX IF EXISTS idx_timeline_event_page;
+ ALTER TABLE timeline_entries DROP CONSTRAINT IF EXISTS timeline_entries_event_page_id_fkey;
+ ALTER TABLE timeline_entries DROP COLUMN IF EXISTS event_page_id;
`);
// Bootstrap, then schema replay. Either step crashing fails the test.