Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(goldens): regenerate catalog, doctor, export, migration and SQL-text goldens for v189 and the ontology visibility filter
garrytane0f35f0b9d9d
diff --git a/test/fixtures/e2e-unmapped-baseline.txt b/test/fixtures/e2e-unmapped-baseline.txtindex 25335faa6b..077e7ac517 100644--- a/test/fixtures/e2e-unmapped-baseline.txt+++ b/test/fixtures/e2e-unmapped-baseline.txt@@ -53,7 +53,6 @@ test/e2e/eval-replay-column.test.tstest/e2e/eval-takes-quality.test.tstest/e2e/extract-atoms-discovery-sql.test.tstest/e2e/extraction-review-postgres.test.ts-test/e2e/facts-context-injection-postgres.test.tstest/e2e/facts-cross-source-isolation.test.tstest/e2e/facts-forget.test.tstest/e2e/facts-notability-roundtrip.test.ts@@ -97,7 +96,6 @@ test/e2e/salience-pglite.test.tstest/e2e/schema-cathedral.test.tstest/e2e/self-upgrade-binary-swap.test.tstest/e2e/self-upgrade-marker.test.ts-test/e2e/serve-http-meta.test.tstest/e2e/serve-http-takes-holders.test.tstest/e2e/skill-brain-first.test.tstest/e2e/skillpack-third-party.test.tsdiff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.jsonindex e5088dfc24..d70f3b99e2 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json@@ -706,7 +706,7 @@"idx_facts_entity_active": "CREATE INDEX idx_facts_entity_active ON public.facts USING btree (source_id, entity_slug, valid_from DESC) WHERE (expired_at IS NULL)","idx_facts_extract_conversation_session": "CREATE INDEX idx_facts_extract_conversation_session ON public.facts USING btree (source_id, source_session) WHERE (source ~~ 'cli:extract-conversation-facts%'::text)","idx_facts_fence_key": "CREATE UNIQUE INDEX idx_facts_fence_key ON public.facts USING btree (source_id, source_markdown_slug, row_num) WHERE (row_num IS NOT NULL)",- "idx_facts_ontology_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE (dimension IS NOT NULL)",+ "idx_facts_ontology_stint_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_stint_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE (dimension IS NOT NULL)","idx_facts_session": "CREATE INDEX idx_facts_session ON public.facts USING btree (source_id, source_session, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since": "CREATE INDEX idx_facts_since ON public.facts USING btree (source_id, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since_event_time": "CREATE INDEX idx_facts_since_event_time ON public.facts USING btree (source_id, COALESCE(valid_from, created_at) DESC) WHERE (expired_at IS NULL)",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.jsonindex 8e0f536cca..37ea0ce779 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json@@ -706,7 +706,7 @@"idx_facts_entity_active": "CREATE INDEX idx_facts_entity_active ON public.facts USING btree (source_id, entity_slug, valid_from DESC) WHERE (expired_at IS NULL)","idx_facts_extract_conversation_session": "CREATE INDEX idx_facts_extract_conversation_session ON public.facts USING btree (source_id, source_session) WHERE (source ~~ 'cli:extract-conversation-facts%'::text)","idx_facts_fence_key": "CREATE UNIQUE INDEX idx_facts_fence_key ON public.facts USING btree (source_id, source_markdown_slug, row_num) WHERE (row_num IS NOT NULL)",- "idx_facts_ontology_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE (dimension IS NOT NULL)",+ "idx_facts_ontology_stint_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_stint_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE (dimension IS NOT NULL)","idx_facts_session": "CREATE INDEX idx_facts_session ON public.facts USING btree (source_id, source_session, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since": "CREATE INDEX idx_facts_since ON public.facts USING btree (source_id, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since_event_time": "CREATE INDEX idx_facts_since_event_time ON public.facts USING btree (source_id, COALESCE(valid_from, created_at) DESC) WHERE (expired_at IS NULL)",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.jsonindex 6405adc63c..59e41fbc3a 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json@@ -704,7 +704,7 @@"idx_facts_entity_active": "CREATE INDEX idx_facts_entity_active ON public.facts USING btree (source_id, entity_slug, valid_from DESC) WHERE (expired_at IS NULL)","idx_facts_extract_conversation_session": "CREATE INDEX idx_facts_extract_conversation_session ON public.facts USING btree (source_id, source_session) WHERE (source ~~ 'cli:extract-conversation-facts%'::text)","idx_facts_fence_key": "CREATE UNIQUE INDEX idx_facts_fence_key ON public.facts USING btree (source_id, source_markdown_slug, row_num) WHERE (row_num IS NOT NULL)",- "idx_facts_ontology_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE (dimension IS NOT NULL)",+ "idx_facts_ontology_stint_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_stint_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE (dimension IS NOT NULL)","idx_facts_session": "CREATE INDEX idx_facts_session ON public.facts USING btree (source_id, source_session, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since": "CREATE INDEX idx_facts_since ON public.facts USING btree (source_id, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since_event_time": "CREATE INDEX idx_facts_since_event_time ON public.facts USING btree (source_id, COALESCE(valid_from, created_at) DESC) WHERE (expired_at IS NULL)",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-default.json b/test/fixtures/goldens/catalog/postgres-engine-init-default.jsonindex f115d320f5..448635bc6c 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json@@ -717,7 +717,7 @@"idx_facts_entity_active": "CREATE INDEX idx_facts_entity_active ON public.facts USING btree (source_id, entity_slug, valid_from DESC) WHERE (expired_at IS NULL)","idx_facts_extract_conversation_session": "CREATE INDEX idx_facts_extract_conversation_session ON public.facts USING btree (source_id, source_session) WHERE (source ~~ 'cli:extract-conversation-facts%'::text)","idx_facts_fence_key": "CREATE UNIQUE INDEX idx_facts_fence_key ON public.facts USING btree (source_id, source_markdown_slug, row_num) WHERE (row_num IS NOT NULL)",- "idx_facts_ontology_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE (dimension IS NOT NULL)",+ "idx_facts_ontology_stint_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_stint_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE (dimension IS NOT NULL)","idx_facts_session": "CREATE INDEX idx_facts_session ON public.facts USING btree (source_id, source_session, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since": "CREATE INDEX idx_facts_since ON public.facts USING btree (source_id, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since_event_time": "CREATE INDEX idx_facts_since_event_time ON public.facts USING btree (source_id, COALESCE(valid_from, created_at) DESC) WHERE (expired_at IS NULL)",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.jsonindex c9e3d4053d..5032a08993 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json@@ -717,7 +717,7 @@"idx_facts_entity_active": "CREATE INDEX idx_facts_entity_active ON public.facts USING btree (source_id, entity_slug, valid_from DESC) WHERE (expired_at IS NULL)","idx_facts_extract_conversation_session": "CREATE INDEX idx_facts_extract_conversation_session ON public.facts USING btree (source_id, source_session) WHERE (source ~~ 'cli:extract-conversation-facts%'::text)","idx_facts_fence_key": "CREATE UNIQUE INDEX idx_facts_fence_key ON public.facts USING btree (source_id, source_markdown_slug, row_num) WHERE (row_num IS NOT NULL)",- "idx_facts_ontology_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE (dimension IS NOT NULL)",+ "idx_facts_ontology_stint_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_stint_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE (dimension IS NOT NULL)","idx_facts_session": "CREATE INDEX idx_facts_session ON public.facts USING btree (source_id, source_session, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since": "CREATE INDEX idx_facts_since ON public.facts USING btree (source_id, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since_event_time": "CREATE INDEX idx_facts_since_event_time ON public.facts USING btree (source_id, COALESCE(valid_from, created_at) DESC) WHERE (expired_at IS NULL)",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.jsonindex ff0a15749c..7104f01a33 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json@@ -715,7 +715,7 @@"idx_facts_entity_active": "CREATE INDEX idx_facts_entity_active ON public.facts USING btree (source_id, entity_slug, valid_from DESC) WHERE (expired_at IS NULL)","idx_facts_extract_conversation_session": "CREATE INDEX idx_facts_extract_conversation_session ON public.facts USING btree (source_id, source_session) WHERE (source ~~ 'cli:extract-conversation-facts%'::text)","idx_facts_fence_key": "CREATE UNIQUE INDEX idx_facts_fence_key ON public.facts USING btree (source_id, source_markdown_slug, row_num) WHERE (row_num IS NOT NULL)",- "idx_facts_ontology_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE (dimension IS NOT NULL)",+ "idx_facts_ontology_stint_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_stint_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE (dimension IS NOT NULL)","idx_facts_session": "CREATE INDEX idx_facts_session ON public.facts USING btree (source_id, source_session, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since": "CREATE INDEX idx_facts_since ON public.facts USING btree (source_id, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since_event_time": "CREATE INDEX idx_facts_since_event_time ON public.facts USING btree (source_id, COALESCE(valid_from, created_at) DESC) WHERE (expired_at IS NULL)",diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex f2d51150a4..41e9b5cb79 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -381,7 +381,7 @@},{"category": "meta",- "message": "Version 186 (latest: 186)",+ "message": "Version 189 (latest: 189)","name": "schema_version","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex d3975d0980..0f9dd9599d 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -381,7 +381,7 @@},{"category": "meta",- "message": "Version 186 (latest: 186)",+ "message": "Version 189 (latest: 189)","name": "schema_version","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex 3d3b4b6be5..934d601847 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -387,7 +387,7 @@},{"category": "meta",- "message": "Version 186 (latest: 186)",+ "message": "Version 189 (latest: 189)","name": "schema_version","status": "ok"},diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.jsonindex 5944223737..257a456f77 100644--- a/test/fixtures/goldens/exports/types.json+++ b/test/fixtures/goldens/exports/types.json@@ -77,7 +77,7 @@"findByTitleFuzzy: (name: string, dirPrefix?: string, minSimilarity?: number, sourceId?: string) => Promise<{ slug: string; similarity: number; } | null>","findCandidateDuplicates: (source_id: string, entitySlug: string, factText: string, opts?: { k?: number; embedding?: Float32Array; embeddingModel?: string | null; }) => Promise<FactRow[]>","findDuplicatePage?: ((sourceId: string, opts: { hash: string; frontmatterId?: string | null; excludeSlug?: string; }) => Promise<{ slug: string; id: number; } | null>) | undefined",- "findOntologyConflicts: (opts?: PageReadScope & { minConfidence?: number; }) => Promise<OntologyConflict[]>",+ "findOntologyConflicts: (opts?: PageReadScope & { minConfidence?: number; visibility?: OntologyReadOpts[\"visibility\"]; }) => Promise<OntologyConflict[]>","findOrphanPages: (opts?: PageReadScope & { sourceId?: string; sourceIds?: string[]; mode?: \"inbound\" | \"islanded\"; }) => Promise<Array<{ slug: string; title: string; domain: string | null; type?: string | null; quarantined?: boolean; }>>","findTrajectory: (opts: TrajectoryOpts) => Promise<TrajectoryPoint[]>","getAdjacencyBoosts: (pageIds: number[], opts?: PageReadScope) => Promise<Map<number, AdjacencyRow>>",@@ -785,7 +785,8 @@"minConfidence?: number | undefined","requireSafeChunks?: boolean | undefined","sourceId?: string | undefined",- "sourceIds?: string[] | undefined"+ "sourceIds?: string[] | undefined",+ "visibility?: (\"private\" | \"world\")[] | undefined"],"name": "OntologyReadOpts"},@@ -975,7 +976,7 @@"findByTitleFuzzy: (name: string, dirPrefix?: string, minSimilarity?: number, sourceId?: string) => Promise<{ slug: string; similarity: number; } | null>","findCandidateDuplicates: (source_id: string, entitySlug: string, factText: string, opts?: { k?: number; embedding?: Float32Array; embeddingModel?: string | null; }) => Promise<FactRow[]>","findDuplicatePage: (sourceId: string, opts: { hash: string; frontmatterId?: string | null; excludeSlug?: string; }) => Promise<{ slug: string; id: number; } | null>",- "findOntologyConflicts: (opts?: PageReadScope & { minConfidence?: number; }) => Promise<OntologyConflict[]>",+ "findOntologyConflicts: (opts?: PageReadScope & { minConfidence?: number; visibility?: OntologyReadOpts[\"visibility\"]; }) => Promise<OntologyConflict[]>","findOrphanPages: (opts?: { sourceId?: string; sourceIds?: string[]; excludePrivate?: boolean; mode?: \"inbound\" | \"islanded\"; }) => Promise<Array<{ slug: string; title: string; domain: string | null; type?: string | null; quarantined?: boolean; }>>","findTrajectory: (opts: TrajectoryOpts) => Promise<TrajectoryPoint[]>","getAdjacencyBoosts: (pageIds: number[], opts?: PageReadScope) => Promise<Map<number, AdjacencyRow>>",@@ -3036,7 +3037,7 @@"findByTitleFuzzy: (name: string, dirPrefix?: string, minSimilarity?: number, sourceId?: string) => Promise<{ slug: string; similarity: number; } | null>","findCandidateDuplicates: (source_id: string, entitySlug: string, factText: string, opts?: { k?: number; embedding?: Float32Array; embeddingModel?: string | null; }) => Promise<FactRow[]>","findDuplicatePage?: ((sourceId: string, opts: { hash: string; frontmatterId?: string | null; excludeSlug?: string; }) => Promise<{ slug: string; id: number; } | null>) | undefined",- "findOntologyConflicts: (opts?: PageReadScope & { minConfidence?: number; }) => Promise<OntologyConflict[]>",+ "findOntologyConflicts: (opts?: PageReadScope & { minConfidence?: number; visibility?: OntologyReadOpts[\"visibility\"]; }) => Promise<OntologyConflict[]>","findOrphanPages: (opts?: PageReadScope & { sourceId?: string; sourceIds?: string[]; mode?: \"inbound\" | \"islanded\"; }) => Promise<Array<{ slug: string; title: string; domain: string | null; type?: string | null; quarantined?: boolean; }>>","findTrajectory: (opts: TrajectoryOpts) => Promise<TrajectoryPoint[]>","getAdjacencyBoosts: (pageIds: number[], opts?: PageReadScope) => Promise<Map<number, AdjacencyRow>>",@@ -5604,7 +5605,7 @@"findByTitleFuzzy: (name: string, dirPrefix?: string, minSimilarity?: number, sourceId?: string) => Promise<{ slug: string; similarity: number; } | null>","findCandidateDuplicates: (source_id: string, entitySlug: string, factText: string, opts?: { k?: number; embedding?: Float32Array; embeddingModel?: string | null; }) => Promise<FactRow[]>","findDuplicatePage: (sourceId: string, opts: { hash: string; frontmatterId?: string | null; excludeSlug?: string; }) => Promise<{ slug: string; id: number; } | null>",- "findOntologyConflicts: (opts?: PageReadScope & { minConfidence?: number; }) => Promise<OntologyConflict[]>",+ "findOntologyConflicts: (opts?: PageReadScope & { minConfidence?: number; visibility?: OntologyReadOpts[\"visibility\"]; }) => Promise<OntologyConflict[]>","findOrphanPages: (opts?: { sourceId?: string; sourceIds?: string[]; excludePrivate?: boolean; mode?: \"inbound\" | \"islanded\"; }) => Promise<Array<{ slug: string; title: string; domain: string | null; type?: string | null; quarantined?: boolean; }>>","findTrajectory: (opts: TrajectoryOpts) => Promise<TrajectoryPoint[]>","getAdjacencyBoosts: (pageIds: number[], opts?: PageReadScope) => Promise<Map<number, AdjacencyRow>>",@@ -7603,7 +7604,8 @@"minConfidence?: number | undefined","requireSafeChunks?: boolean | undefined","sourceId?: string | undefined",- "sourceIds?: string[] | undefined"+ "sourceIds?: string[] | undefined",+ "visibility?: (\"private\" | \"world\")[] | undefined"],"name": "OntologyReadOpts"},diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.jsonindex c769f251be..49359b6b9e 100644--- a/test/fixtures/goldens/migrations/records.json+++ b/test/fixtures/goldens/migrations/records.json@@ -1,11 +1,13 @@{"golden": {- "count": 181,+ "count": 182,"gaps": [17,18,19,- 100+ 100,+ 187,+ 188],"helpers": {"PERSISTENCE_DATABASE_PENDING_INDEX_SQL": "6e0f618be33d037454933ea4dea11438413d45aef35d3bd4f33e89624d6e199e",@@ -25,7 +27,7 @@"slugifyPath": "401dbca23580865d8b168dd8d84db4a6c708c6610d7cb61abafc7d0ee9809063","verifyProjectionStatistics": "59d9ccfea1c53384d8607874a51209a9c2dfd51b2b85a2cb6269fa4120faf1f3"},- "latest": 186,+ "latest": 189,"records": [{"handler": {@@ -2751,6 +2753,19 @@"transaction": "absent","verify": "absent","version": 186+ },+ {+ "handler": "absent",+ "idempotent": true,+ "name": "facts_ontology_stint_dedup",+ "sql": {+ "length": 264,+ "sha256": "4b1e09f341664813647809462824659f7eea74998e3a4be8600d251428127bf5"+ },+ "sqlFor": "absent",+ "transaction": "absent",+ "verify": "absent",+ "version": 189}],"versions": [@@ -2934,7 +2949,8 @@183,184,185,- 186+ 186,+ 189]},"normalizer": "migrations-record-v1"diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.jsonindex a1443765b2..57d3eb7c37 100644--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json@@ -706,7 +706,7 @@"idx_facts_entity_active": "CREATE INDEX idx_facts_entity_active ON public.facts USING btree (source_id, entity_slug, valid_from DESC) WHERE (expired_at IS NULL)","idx_facts_extract_conversation_session": "CREATE INDEX idx_facts_extract_conversation_session ON public.facts USING btree (source_id, source_session) WHERE (source ~~ 'cli:extract-conversation-facts%'::text)","idx_facts_fence_key": "CREATE UNIQUE INDEX idx_facts_fence_key ON public.facts USING btree (source_id, source_markdown_slug, row_num) WHERE (row_num IS NOT NULL)",- "idx_facts_ontology_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE (dimension IS NOT NULL)",+ "idx_facts_ontology_stint_dedup": "CREATE UNIQUE INDEX idx_facts_ontology_stint_dedup ON public.facts USING btree (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE (dimension IS NOT NULL)","idx_facts_session": "CREATE INDEX idx_facts_session ON public.facts USING btree (source_id, source_session, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since": "CREATE INDEX idx_facts_since ON public.facts USING btree (source_id, created_at DESC) WHERE (expired_at IS NULL)","idx_facts_since_event_time": "CREATE INDEX idx_facts_since_event_time ON public.facts USING btree (source_id, COALESCE(valid_from, created_at) DESC) WHERE (expired_at IS NULL)",diff --git a/test/fixtures/goldens/sql-text/_driver.json b/test/fixtures/goldens/sql-text/_driver.jsonindex 7d4dd10320..9ebbb07170 100644--- a/test/fixtures/goldens/sql-text/_driver.json+++ b/test/fixtures/goldens/sql-text/_driver.json@@ -1654,6 +1654,10 @@"paramCount": 3,"via": "tagged"},+ {+ "paramCount": 6,+ "via": "tagged"+ },{"paramCount": 14,"via": "tagged"diff --git a/test/fixtures/goldens/sql-text/facts.json b/test/fixtures/goldens/sql-text/facts.jsonindex df951a5711..a0250c1207 100644--- a/test/fixtures/goldens/sql-text/facts.json+++ b/test/fixtures/goldens/sql-text/facts.json@@ -141,7 +141,7 @@"null"],"sql": "WITH cur AS ( SELECT entity_slug, dimension, value, source_markdown_slug AS source, confidence, id AS fact_id FROM facts WHERE dimension IS NOT NULL AND expired_at IS NULL AND valid_until IS NULL AND (dim_status IS NULL OR dim_status = 'active') AND confidence >= $1 AND ($2::text IS NULL OR source_id = $3) ) SELECT entity_slug, dimension, json_agg(json_build_object('value', value, 'source', source, 'confidence', confidence, 'fact_id', fact_id)) AS values FROM cur GROUP BY entity_slug, dimension HAVING count(DISTINCT value) >= 2 AND count(DISTINCT source) >= 2 ORDER BY entity_slug, dimension",- "textSha256": "046baefce6f4ca3f8b4ed07a50bdf0e54be851cc25d07392a9058035c2e618bb"+ "textSha256": "0fa36872be345c8a16b8d862ef3c94d292173b6a03a91c0094347682cd9859f2"}],"sourceIds+excludePrivate": [@@ -152,7 +152,7 @@"array<string>"],"sql": "WITH cur AS ( SELECT entity_slug, dimension, value, source_markdown_slug AS source, confidence, id AS fact_id FROM facts WHERE dimension IS NOT NULL AND expired_at IS NULL AND valid_until IS NULL AND (dim_status IS NULL OR dim_status = 'active') AND confidence >= $1 AND source_id = ANY($2) AND NOT EXISTS (SELECT 1 FROM pages pp WHERE pp.source_id = facts.source_id AND pp.slug = facts.source_markdown_slug AND NOT ((COALESCE(pp.frontmatter->>'visibility', CASE WHEN (pp.type = 'atom' OR (pp.type = 'concept' AND pp.frontmatter->>'synthesized_by' IS NOT NULL)) THEN 'private' ELSE 'world' END) <> 'private' AND NOT (CASE WHEN pp.type = 'atom' THEN EXISTS (SELECT 1 FROM pages derived_origin WHERE derived_origin.source_id = pp.source_id AND derived_origin.slug = pp.frontmatter->>'source_slug' AND derived_origin.frontmatter->>'visibility' = 'private') WHEN (pp.type = 'atom' OR (pp.type = 'concept' AND pp.frontmatter->>'synthesized_by' IS NOT NULL)) THEN EXISTS (SELECT 1 FROM links derived_input_link JOIN pages derived_input ON derived_input.id = derived_input_link.to_page_id WHERE derived_input_link.from_page_id = pp.id AND derived_input_link.link_source = 'concept-provenance' AND derived_input_link.link_type = 'synthesized_from' AND (COALESCE(derived_input.frontmatter->>'visibility', CASE WHEN derived_input.type = 'atom' THEN 'private' ELSE 'world' END) = 'private' OR EXISTS (SELECT 1 FROM pages derived_input_origin WHERE derived_input_origin.source_id = derived_input.source_id AND derived_input_origin.slug = derived_input.frontmatter->>'source_slug' AND derived_input_origin.frontmatter->>'visibility' = 'private'))) ELSE false END)))) ) SELECT entity_slug, dimension, json_agg(json_build_object('value', value, 'source', source, 'confidence', confidence, 'fact_id', fact_id)) AS values FROM cur GROUP BY entity_slug, dimension HAVING count(DISTINCT value) >= 2 AND count(DISTINCT source) >= 2 ORDER BY entity_slug, dimension",- "textSha256": "c2a08d786115e48bae908eda10f5c62296a5dc73cb48b6e78ad8c4718aa23820"+ "textSha256": "61485f1c8d0fa69a697de77b825fdcc27f42b98b0c2059153f7c5949f519c8d2"}]},@@ -231,7 +231,7 @@"boolean"],"sql": "SELECT DISTINCT ON (dimension) dimension, value, confidence, source_markdown_slug AS source, valid_from, valid_until AS valid_to, COALESCE(dim_status, 'active') AS status, id AS fact_id FROM facts WHERE entity_slug = $1 AND dimension IS NOT NULL AND expired_at IS NULL AND ($2::text IS NULL OR source_id = $3) AND COALESCE(valid_from, '-infinity'::timestamptz) <= COALESCE($4::timestamptz, now()) AND COALESCE(valid_until, 'infinity'::timestamptz) > COALESCE($5::timestamptz, now()) AND confidence >= $6 AND ($7::boolean OR dim_status IS NULL OR dim_status = 'active') ORDER BY dimension, valid_from DESC NULLS LAST, confidence DESC, id DESC",- "textSha256": "d65572cb339f4eb834da99c66ca30eb392b1a4ae94244324a2e092c4a86080ac"+ "textSha256": "34084e478b807600e07f3aa6927ca19ac466e57d70fee3c09eef553b86c6b73d"}],"sourceIds+excludePrivate": [@@ -246,7 +246,7 @@"boolean"],"sql": "SELECT DISTINCT ON (dimension) dimension, value, confidence, source_markdown_slug AS source, valid_from, valid_until AS valid_to, COALESCE(dim_status, 'active') AS status, id AS fact_id FROM facts WHERE entity_slug = $1 AND dimension IS NOT NULL AND expired_at IS NULL AND source_id = ANY($2) AND NOT EXISTS (SELECT 1 FROM pages pp WHERE pp.source_id = facts.source_id AND pp.slug = facts.source_markdown_slug AND NOT ((COALESCE(pp.frontmatter->>'visibility', CASE WHEN (pp.type = 'atom' OR (pp.type = 'concept' AND pp.frontmatter->>'synthesized_by' IS NOT NULL)) THEN 'private' ELSE 'world' END) <> 'private' AND NOT (CASE WHEN pp.type = 'atom' THEN EXISTS (SELECT 1 FROM pages derived_origin WHERE derived_origin.source_id = pp.source_id AND derived_origin.slug = pp.frontmatter->>'source_slug' AND derived_origin.frontmatter->>'visibility' = 'private') WHEN (pp.type = 'atom' OR (pp.type = 'concept' AND pp.frontmatter->>'synthesized_by' IS NOT NULL)) THEN EXISTS (SELECT 1 FROM links derived_input_link JOIN pages derived_input ON derived_input.id = derived_input_link.to_page_id WHERE derived_input_link.from_page_id = pp.id AND derived_input_link.link_source = 'concept-provenance' AND derived_input_link.link_type = 'synthesized_from' AND (COALESCE(derived_input.frontmatter->>'visibility', CASE WHEN derived_input.type = 'atom' THEN 'private' ELSE 'world' END) = 'private' OR EXISTS (SELECT 1 FROM pages derived_input_origin WHERE derived_input_origin.source_id = derived_input.source_id AND derived_input_origin.slug = derived_input.frontmatter->>'source_slug' AND derived_input_origin.frontmatter->>'visibility' = 'private'))) ELSE false END)))) AND COALESCE(valid_from, '-infinity'::timestamptz) <= COALESCE($3::timestamptz, now()) AND COALESCE(valid_until, 'infinity'::timestamptz) > COALESCE($4::timestamptz, now()) AND confidence >= $5 AND ($6::boolean OR dim_status IS NULL OR dim_status = 'active') ORDER BY dimension, valid_from DESC NULLS LAST, confidence DESC, id DESC",- "textSha256": "138e45f5bf9fc66e016190db39eda2bfb92ff5a15a45c171aa509dd53b27f4df"+ "textSha256": "8ea858aeae23151b6c853aac64d174230f3c358e9e9d0d11ccec14dedb3412d2"}]},@@ -689,6 +689,19 @@"sql": "SELECT id, value_hash, valid_from FROM facts WHERE source_id = $1 AND entity_slug = $2 AND dimension = $3 AND expired_at IS NULL AND valid_until IS NULL AND (dim_status IS NULL OR dim_status = 'active') ORDER BY valid_from DESC NULLS LAST, confidence DESC, id DESC LIMIT 1","textSha256": "544aef14bce5c7faa5738cf7462c2d860cdbc4227a890b12080729d99682a63f"},+ {+ "lane": "pool",+ "params": [+ "string",+ "string",+ "string",+ "string",+ "string",+ "null"+ ],+ "sql": "SELECT 1 FROM facts WHERE source_id = $1 AND entity_slug = $2 AND dimension = $3 AND value_hash = $4 AND source_markdown_slug = $5 AND COALESCE(valid_from, '-infinity'::timestamptz) >= COALESCE($6::timestamptz, '-infinity'::timestamptz) LIMIT 1",+ "textSha256": "c0c2eba9c475159185bad82aa9f69dc50e886a302bfcd48a731bc9c928529996"+ },{"lane": "pool","params": [@@ -707,8 +720,8 @@"null","number"],- "sql": "INSERT INTO facts (source_id, entity_slug, fact, kind, visibility, dimension, value, value_hash, dim_status, confidence, source, source_markdown_slug, valid_from, valid_until, expired_at, consolidated_into) VALUES ($1, $2, $3, 'fact', $4, $5, $6, $7, $8, $9, $10, $11, COALESCE($12::timestamptz, now()), $13, now(), $14) ON CONFLICT (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE dimension IS NOT NULL DO NOTHING RETURNING id",- "textSha256": "4e528f6ba2b1a21de927264b3d815d1ac5f6f76050405e3c8608ffd8650ab24b"+ "sql": "INSERT INTO facts (source_id, entity_slug, fact, kind, visibility, dimension, value, value_hash, dim_status, confidence, source, source_markdown_slug, valid_from, valid_until, expired_at, consolidated_into) VALUES ($1, $2, $3, 'fact', $4, $5, $6, $7, $8, $9, $10, $11, COALESCE($12::timestamptz, now()), $13, now(), $14) ON CONFLICT (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE dimension IS NOT NULL DO NOTHING RETURNING id",+ "textSha256": "eee69b1f24c9d807286751d465e4c3554a02c791c005f44910b9051ff154b27e"}],"insert": [@@ -739,8 +752,8 @@"null","null"],- "sql": "INSERT INTO facts (source_id, entity_slug, fact, kind, visibility, dimension, value, value_hash, dim_status, confidence, source, source_markdown_slug, valid_from, valid_until) VALUES ($1, $2, $3, 'fact', $4, $5, $6, $7, $8, $9, $10, $11, COALESCE($12::timestamptz, now()), $13) ON CONFLICT (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE dimension IS NOT NULL DO NOTHING RETURNING id",- "textSha256": "c75878cb1dbe439a990a0d153014d47f0a2ea390be8f5d5ba2109ae531ddc214"+ "sql": "INSERT INTO facts (source_id, entity_slug, fact, kind, visibility, dimension, value, value_hash, dim_status, confidence, source, source_markdown_slug, valid_from, valid_until) VALUES ($1, $2, $3, 'fact', $4, $5, $6, $7, $8, $9, $10, $11, COALESCE($12::timestamptz, now()), $13) ON CONFLICT (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE dimension IS NOT NULL DO NOTHING RETURNING id",+ "textSha256": "e4dc11b7834659b03a715161d988838ae5f07aa3cdaa8bb1982a4545085ab9d4"}],"supersede": [@@ -771,8 +784,8 @@"null","null"],- "sql": "INSERT INTO facts (source_id, entity_slug, fact, kind, visibility, dimension, value, value_hash, dim_status, confidence, source, source_markdown_slug, valid_from, valid_until) VALUES ($1, $2, $3, 'fact', $4, $5, $6, $7, $8, $9, $10, $11, COALESCE($12::timestamptz, now()), $13) ON CONFLICT (source_id, entity_slug, dimension, value_hash, source_markdown_slug) WHERE dimension IS NOT NULL DO NOTHING RETURNING id",- "textSha256": "c75878cb1dbe439a990a0d153014d47f0a2ea390be8f5d5ba2109ae531ddc214"+ "sql": "INSERT INTO facts (source_id, entity_slug, fact, kind, visibility, dimension, value, value_hash, dim_status, confidence, source, source_markdown_slug, valid_from, valid_until) VALUES ($1, $2, $3, 'fact', $4, $5, $6, $7, $8, $9, $10, $11, COALESCE($12::timestamptz, now()), $13) ON CONFLICT (source_id, entity_slug, dimension, value_hash, source_markdown_slug, valid_from) WHERE dimension IS NOT NULL DO NOTHING RETURNING id",+ "textSha256": "e4dc11b7834659b03a715161d988838ae5f07aa3cdaa8bb1982a4545085ab9d4"},{"lane": "pool",