Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(graph): goldens, e2e map and op area for wanted pages and similar pages

garrytanffff63e9d975
diff --git a/scripts/e2e-test-map.ts b/scripts/e2e-test-map.ts
index 722f3dd6f3..12682c6261 100644
--- a/scripts/e2e-test-map.ts
+++ b/scripts/e2e-test-map.ts
@@ -609,12 +609,17 @@ export const E2E_TEST_MAP: Record<string, string[]> = {
// Doctor check modules peeled from doctor.ts feed the same e2e surface.
"src/commands/doctor/**": ["test/e2e/doctor-progress.test.ts", "test/e2e/recovery-layer.test.ts", "test/e2e/fix-wave-3-integration.test.ts", "test/e2e/doctor-json-golden.test.ts", "test/e2e/agent-journey-postgres.test.ts"],
// Knowledge graph layer feeds graph-quality.
- "src/core/link-extraction.ts": ["test/e2e/graph-quality.test.ts", "test/e2e/attendance-retrieval-postgres.test.ts"],
+ "src/core/link-extraction.ts": ["test/e2e/graph-quality.test.ts", "test/e2e/attendance-retrieval-postgres.test.ts", "test/e2e/wanted-links-postgres.test.ts"],
"src/core/attendance-repair.ts": ["test/e2e/attendance-repair-postgres.test.ts"],
"src/core/extract-timeline-from-meetings.ts": ["test/e2e/extract-timeline-attendance-postgres.test.ts"],
- "src/core/derived-links.ts": ["test/e2e/attendance-retrieval-postgres.test.ts", "test/e2e/attendance-repair-postgres.test.ts"],
+ "src/core/derived-links.ts": ["test/e2e/attendance-retrieval-postgres.test.ts", "test/e2e/attendance-repair-postgres.test.ts", "test/e2e/wanted-links-postgres.test.ts"],
+ // Wanted pages (unresolved authored links) and the stale-for-extraction wake-up.
+ "src/core/wanted-links*.ts": ["test/e2e/wanted-links-postgres.test.ts"],
+ "src/core/line-grammar.ts": ["test/e2e/wanted-links-postgres.test.ts"],
+ "src/core/similar-pages.ts": ["test/e2e/p5-graph-postgres.test.ts"],
+ "src/core/persistence/page-advisories.ts": ["test/e2e/p5-graph-postgres.test.ts"],
"src/core/link-reconciliation.ts": ["test/e2e/attendance-retrieval-postgres.test.ts"],
- "src/core/persistence/links-preparation.ts": ["test/e2e/attendance-retrieval-postgres.test.ts"],
+ "src/core/persistence/links-preparation.ts": ["test/e2e/attendance-retrieval-postgres.test.ts", "test/e2e/wanted-links-postgres.test.ts"],
"src/core/sweep.ts": ["test/e2e/attendance-retrieval-postgres.test.ts", "test/e2e/fix-wave-5-integration.test.ts"],
// v0.38 ingestion substrate. POST /ingest lives inside serve-http.ts
// (per the plan-eng-review E1 decision); the daemon + built-in sources
diff --git a/src/core/operations.ts b/src/core/operations.ts
index 183da64120..9858d2c651 100644
--- a/src/core/operations.ts
+++ b/src/core/operations.ts
@@ -256,6 +256,7 @@ const OP_AREAS: Record<string, string> = {
add_link: 'links', remove_link: 'links', get_links: 'links',
get_backlinks: 'links', list_link_sources: 'links', traverse_graph: 'links',
find_orphans: 'links',
+ wanted_pages: 'links',
// timeline
add_timeline_entry: 'timeline', get_timeline: 'timeline',
// life chronicle
diff --git a/test/fixtures/goldens/catalog/postgres-db-initschema.json b/test/fixtures/goldens/catalog/postgres-db-initschema.json
index 49158bae10..92515fa02a 100644
--- a/test/fixtures/goldens/catalog/postgres-db-initschema.json
+++ b/test/fixtures/goldens/catalog/postgres-db-initschema.json
@@ -238,7 +238,13 @@
"think_ab_results.think_ab_results_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_event_page_id_fkey": "f FOREIGN KEY (event_page_id) REFERENCES pages(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE",
- "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)"
+ "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_origin_page_id_fkey": "f FOREIGN KEY (origin_page_id) REFERENCES pages(id) ON DELETE CASCADE",
+ "wanted_links.wanted_links_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_producer_check": "c CHECK ((producer = ANY (ARRAY['body'::text, 'frontmatter'::text])))",
+ "wanted_links.wanted_links_ref_kind_check": "c CHECK ((ref_kind = ANY (ARRAY['slug'::text, 'name'::text])))",
+ "wanted_links.wanted_links_reference_unique": "u UNIQUE (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links.wanted_links_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE"
},
"extensions": [
"pg_trgm",
@@ -513,6 +519,9 @@
],
"timeline_entries": [
"<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
+ ],
+ "wanted_links": [
+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
]
},
"indexes": {
@@ -628,6 +637,7 @@
"idx_oauth_tokens_expiry": "CREATE INDEX idx_oauth_tokens_expiry ON public.oauth_tokens USING btree (expires_at)",
"idx_pages_frontmatter": "CREATE INDEX idx_pages_frontmatter ON public.pages USING gin (frontmatter)",
"idx_pages_search": "CREATE INDEX idx_pages_search ON public.pages USING gin (search_vector)",
+ "idx_pages_slug_basename": "CREATE INDEX idx_pages_slug_basename ON public.pages USING btree (source_id, regexp_replace(slug, '^.*/'::text, ''::text))",
"idx_pages_source_id": "CREATE INDEX idx_pages_source_id ON public.pages USING btree (source_id)",
"idx_pages_trgm": "CREATE INDEX idx_pages_trgm ON public.pages USING gin (title gin_trgm_ops)",
"idx_pages_type": "CREATE INDEX idx_pages_type ON public.pages USING btree (type)",
@@ -756,7 +766,11 @@
"timeline_entries_pkey": "CREATE UNIQUE INDEX timeline_entries_pkey ON public.timeline_entries USING btree (id)",
"uniq_minion_attachments_job_filename": "CREATE UNIQUE INDEX uniq_minion_attachments_job_filename ON public.minion_attachments USING btree (job_id, filename)",
"uniq_minion_jobs_idempotency": "CREATE UNIQUE INDEX uniq_minion_jobs_idempotency ON public.minion_jobs USING btree (idempotency_key) WHERE (idempotency_key IS NOT NULL)",
- "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)"
+ "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)",
+ "wanted_links_pkey": "CREATE UNIQUE INDEX wanted_links_pkey ON public.wanted_links USING btree (id)",
+ "wanted_links_reference_unique": "CREATE UNIQUE INDEX wanted_links_reference_unique ON public.wanted_links USING btree (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links_source_idx": "CREATE INDEX wanted_links_source_idx ON public.wanted_links USING btree (source_id)",
+ "wanted_links_target_idx": "CREATE INDEX wanted_links_target_idx ON public.wanted_links USING btree (target_source_id, target_ref)"
},
"policies": {},
"sequences": {
@@ -797,7 +811,8 @@
"take_nudge_log_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=take_nudge_log.id",
"take_proposals_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=take_proposals.id",
"think_ab_results_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=think_ab_results.id",
- "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id"
+ "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id",
+ "wanted_links_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=wanted_links.id"
},
"tables": {
"access_tokens": {
@@ -2118,6 +2133,22 @@
"8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"
],
"flags": "relkind=r rls=true force_rls=false"
+ },
+ "wanted_links": {
+ "columns": [
+ "1 id bigint/int8 NOT NULL DEFAULT nextval('wanted_links_id_seq'::regclass)",
+ "2 origin_page_id integer/int4 NOT NULL",
+ "3 source_id text/text NOT NULL",
+ "4 producer text/text NOT NULL",
+ "5 ref_kind text/text NOT NULL",
+ "6 target_source_id text/text NOT NULL",
+ "7 target_ref text/text NOT NULL",
+ "8 link_type text/text NOT NULL DEFAULT ''::text",
+ "9 context text/text NOT NULL DEFAULT ''::text",
+ "10 checked_at timestamp with time zone/timestamptz NOT NULL",
+ "11 first_seen_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"
+ ],
+ "flags": "relkind=r rls=true force_rls=false"
}
},
"triggers": {
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-default.json b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
index 65013754c1..c8cf5fdb11 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
@@ -295,7 +295,13 @@
"think_ab_results.think_ab_results_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_event_page_id_fkey": "f FOREIGN KEY (event_page_id) REFERENCES pages(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE",
- "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)"
+ "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_origin_page_id_fkey": "f FOREIGN KEY (origin_page_id) REFERENCES pages(id) ON DELETE CASCADE",
+ "wanted_links.wanted_links_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_producer_check": "c CHECK ((producer = ANY (ARRAY['body'::text, 'frontmatter'::text])))",
+ "wanted_links.wanted_links_ref_kind_check": "c CHECK ((ref_kind = ANY (ARRAY['slug'::text, 'name'::text])))",
+ "wanted_links.wanted_links_reference_unique": "u UNIQUE (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links.wanted_links_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE"
},
"extensions": [
"pg_trgm",
@@ -642,6 +648,9 @@
],
"timeline_entries": [
"<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
+ ],
+ "wanted_links": [
+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
]
},
"indexes": {
@@ -799,6 +808,7 @@
"idx_pages_frontmatter": "CREATE INDEX idx_pages_frontmatter ON public.pages USING gin (frontmatter)",
"idx_pages_projection_pending": "CREATE INDEX idx_pages_projection_pending ON public.pages USING btree (source_id, page_kind, slug) WHERE ((deleted_at IS NULL) AND (text_projection_revision IS DISTINCT FROM knowledge_revision))",
"idx_pages_search": "CREATE INDEX idx_pages_search ON public.pages USING gin (search_vector)",
+ "idx_pages_slug_basename": "CREATE INDEX idx_pages_slug_basename ON public.pages USING btree (source_id, regexp_replace(slug, '^.*/'::text, ''::text))",
"idx_pages_source_id": "CREATE INDEX idx_pages_source_id ON public.pages USING btree (source_id)",
"idx_pages_trgm": "CREATE INDEX idx_pages_trgm ON public.pages USING gin (title gin_trgm_ops)",
"idx_pages_type": "CREATE INDEX idx_pages_type ON public.pages USING btree (type)",
@@ -979,7 +989,11 @@
"timeline_entries_pkey": "CREATE UNIQUE INDEX timeline_entries_pkey ON public.timeline_entries USING btree (id)",
"uniq_minion_attachments_job_filename": "CREATE UNIQUE INDEX uniq_minion_attachments_job_filename ON public.minion_attachments USING btree (job_id, filename)",
"uniq_minion_jobs_idempotency": "CREATE UNIQUE INDEX uniq_minion_jobs_idempotency ON public.minion_jobs USING btree (idempotency_key) WHERE (idempotency_key IS NOT NULL)",
- "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)"
+ "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)",
+ "wanted_links_pkey": "CREATE UNIQUE INDEX wanted_links_pkey ON public.wanted_links USING btree (id)",
+ "wanted_links_reference_unique": "CREATE UNIQUE INDEX wanted_links_reference_unique ON public.wanted_links USING btree (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links_source_idx": "CREATE INDEX wanted_links_source_idx ON public.wanted_links USING btree (source_id)",
+ "wanted_links_target_idx": "CREATE INDEX wanted_links_target_idx ON public.wanted_links USING btree (target_source_id, target_ref)"
},
"policies": {},
"sequences": {
@@ -1031,7 +1045,8 @@
"take_proposals_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=take_proposals.id",
"takes_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=takes.id",
"think_ab_results_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=think_ab_results.id",
- "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id"
+ "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id",
+ "wanted_links_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=wanted_links.id"
},
"tables": {
"access_tokens": {
@@ -2739,6 +2754,22 @@
"15 last_written_at timestamp with time zone/timestamptz NULL"
],
"flags": "relkind=r rls=true force_rls=false"
+ },
+ "wanted_links": {
+ "columns": [
+ "1 id bigint/int8 NOT NULL DEFAULT nextval('wanted_links_id_seq'::regclass)",
+ "2 origin_page_id integer/int4 NOT NULL",
+ "3 source_id text/text NOT NULL",
+ "4 producer text/text NOT NULL",
+ "5 ref_kind text/text NOT NULL",
+ "6 target_source_id text/text NOT NULL",
+ "7 target_ref text/text NOT NULL",
+ "8 link_type text/text NOT NULL DEFAULT ''::text",
+ "9 context text/text NOT NULL DEFAULT ''::text",
+ "10 checked_at timestamp with time zone/timestamptz NOT NULL",
+ "11 first_seen_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"
+ ],
+ "flags": "relkind=r rls=true force_rls=false"
}
},
"triggers": {
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
index ecdff86800..f08ea1fec1 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
@@ -295,7 +295,13 @@
"think_ab_results.think_ab_results_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_event_page_id_fkey": "f FOREIGN KEY (event_page_id) REFERENCES pages(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE",
- "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)"
+ "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_origin_page_id_fkey": "f FOREIGN KEY (origin_page_id) REFERENCES pages(id) ON DELETE CASCADE",
+ "wanted_links.wanted_links_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_producer_check": "c CHECK ((producer = ANY (ARRAY['body'::text, 'frontmatter'::text])))",
+ "wanted_links.wanted_links_ref_kind_check": "c CHECK ((ref_kind = ANY (ARRAY['slug'::text, 'name'::text])))",
+ "wanted_links.wanted_links_reference_unique": "u UNIQUE (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links.wanted_links_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE"
},
"extensions": [
"pg_trgm",
@@ -642,6 +648,9 @@
],
"timeline_entries": [
"<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
+ ],
+ "wanted_links": [
+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
]
},
"indexes": {
@@ -799,6 +808,7 @@
"idx_pages_frontmatter": "CREATE INDEX idx_pages_frontmatter ON public.pages USING gin (frontmatter)",
"idx_pages_projection_pending": "CREATE INDEX idx_pages_projection_pending ON public.pages USING btree (source_id, page_kind, slug) WHERE ((deleted_at IS NULL) AND (text_projection_revision IS DISTINCT FROM knowledge_revision))",
"idx_pages_search": "CREATE INDEX idx_pages_search ON public.pages USING gin (search_vector)",
+ "idx_pages_slug_basename": "CREATE INDEX idx_pages_slug_basename ON public.pages USING btree (source_id, regexp_replace(slug, '^.*/'::text, ''::text))",
"idx_pages_source_id": "CREATE INDEX idx_pages_source_id ON public.pages USING btree (source_id)",
"idx_pages_trgm": "CREATE INDEX idx_pages_trgm ON public.pages USING gin (title gin_trgm_ops)",
"idx_pages_type": "CREATE INDEX idx_pages_type ON public.pages USING btree (type)",
@@ -979,7 +989,11 @@
"timeline_entries_pkey": "CREATE UNIQUE INDEX timeline_entries_pkey ON public.timeline_entries USING btree (id)",
"uniq_minion_attachments_job_filename": "CREATE UNIQUE INDEX uniq_minion_attachments_job_filename ON public.minion_attachments USING btree (job_id, filename)",
"uniq_minion_jobs_idempotency": "CREATE UNIQUE INDEX uniq_minion_jobs_idempotency ON public.minion_jobs USING btree (idempotency_key) WHERE (idempotency_key IS NOT NULL)",
- "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)"
+ "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)",
+ "wanted_links_pkey": "CREATE UNIQUE INDEX wanted_links_pkey ON public.wanted_links USING btree (id)",
+ "wanted_links_reference_unique": "CREATE UNIQUE INDEX wanted_links_reference_unique ON public.wanted_links USING btree (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links_source_idx": "CREATE INDEX wanted_links_source_idx ON public.wanted_links USING btree (source_id)",
+ "wanted_links_target_idx": "CREATE INDEX wanted_links_target_idx ON public.wanted_links USING btree (target_source_id, target_ref)"
},
"policies": {},
"sequences": {
@@ -1031,7 +1045,8 @@
"take_proposals_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=take_proposals.id",
"takes_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=takes.id",
"think_ab_results_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=think_ab_results.id",
- "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id"
+ "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id",
+ "wanted_links_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=wanted_links.id"
},
"tables": {
"access_tokens": {
@@ -2739,6 +2754,22 @@
"15 last_written_at timestamp with time zone/timestamptz NULL"
],
"flags": "relkind=r rls=true force_rls=false"
+ },
+ "wanted_links": {
+ "columns": [
+ "1 id bigint/int8 NOT NULL DEFAULT nextval('wanted_links_id_seq'::regclass)",
+ "2 origin_page_id integer/int4 NOT NULL",
+ "3 source_id text/text NOT NULL",
+ "4 producer text/text NOT NULL",
+ "5 ref_kind text/text NOT NULL",
+ "6 target_source_id text/text NOT NULL",
+ "7 target_ref text/text NOT NULL",
+ "8 link_type text/text NOT NULL DEFAULT ''::text",
+ "9 context text/text NOT NULL DEFAULT ''::text",
+ "10 checked_at timestamp with time zone/timestamptz NOT NULL",
+ "11 first_seen_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"
+ ],
+ "flags": "relkind=r rls=true force_rls=false"
}
},
"triggers": {
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
index a815cd1c99..f0a83c9780 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
@@ -295,7 +295,13 @@
"think_ab_results.think_ab_results_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_event_page_id_fkey": "f FOREIGN KEY (event_page_id) REFERENCES pages(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE",
- "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)"
+ "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_origin_page_id_fkey": "f FOREIGN KEY (origin_page_id) REFERENCES pages(id) ON DELETE CASCADE",
+ "wanted_links.wanted_links_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_producer_check": "c CHECK ((producer = ANY (ARRAY['body'::text, 'frontmatter'::text])))",
+ "wanted_links.wanted_links_ref_kind_check": "c CHECK ((ref_kind = ANY (ARRAY['slug'::text, 'name'::text])))",
+ "wanted_links.wanted_links_reference_unique": "u UNIQUE (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links.wanted_links_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE"
},
"extensions": [
"pg_trgm",
@@ -642,6 +648,9 @@
],
"timeline_entries": [
"<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
+ ],
+ "wanted_links": [
+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
]
},
"indexes": {
@@ -797,6 +806,7 @@
"idx_pages_frontmatter": "CREATE INDEX idx_pages_frontmatter ON public.pages USING gin (frontmatter)",
"idx_pages_projection_pending": "CREATE INDEX idx_pages_projection_pending ON public.pages USING btree (source_id, page_kind, slug) WHERE ((deleted_at IS NULL) AND (text_projection_revision IS DISTINCT FROM knowledge_revision))",
"idx_pages_search": "CREATE INDEX idx_pages_search ON public.pages USING gin (search_vector)",
+ "idx_pages_slug_basename": "CREATE INDEX idx_pages_slug_basename ON public.pages USING btree (source_id, regexp_replace(slug, '^.*/'::text, ''::text))",
"idx_pages_source_id": "CREATE INDEX idx_pages_source_id ON public.pages USING btree (source_id)",
"idx_pages_trgm": "CREATE INDEX idx_pages_trgm ON public.pages USING gin (title gin_trgm_ops)",
"idx_pages_type": "CREATE INDEX idx_pages_type ON public.pages USING btree (type)",
@@ -975,7 +985,11 @@
"timeline_entries_pkey": "CREATE UNIQUE INDEX timeline_entries_pkey ON public.timeline_entries USING btree (id)",
"uniq_minion_attachments_job_filename": "CREATE UNIQUE INDEX uniq_minion_attachments_job_filename ON public.minion_attachments USING btree (job_id, filename)",
"uniq_minion_jobs_idempotency": "CREATE UNIQUE INDEX uniq_minion_jobs_idempotency ON public.minion_jobs USING btree (idempotency_key) WHERE (idempotency_key IS NOT NULL)",
- "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)"
+ "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)",
+ "wanted_links_pkey": "CREATE UNIQUE INDEX wanted_links_pkey ON public.wanted_links USING btree (id)",
+ "wanted_links_reference_unique": "CREATE UNIQUE INDEX wanted_links_reference_unique ON public.wanted_links USING btree (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links_source_idx": "CREATE INDEX wanted_links_source_idx ON public.wanted_links USING btree (source_id)",
+ "wanted_links_target_idx": "CREATE INDEX wanted_links_target_idx ON public.wanted_links USING btree (target_source_id, target_ref)"
},
"policies": {},
"sequences": {
@@ -1027,7 +1041,8 @@
"take_proposals_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=take_proposals.id",
"takes_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=takes.id",
"think_ab_results_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=think_ab_results.id",
- "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id"
+ "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id",
+ "wanted_links_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=wanted_links.id"
},
"tables": {
"access_tokens": {
@@ -2735,6 +2750,22 @@
"15 last_written_at timestamp with time zone/timestamptz NULL"
],
"flags": "relkind=r rls=true force_rls=false"
+ },
+ "wanted_links": {
+ "columns": [
+ "1 id bigint/int8 NOT NULL DEFAULT nextval('wanted_links_id_seq'::regclass)",
+ "2 origin_page_id integer/int4 NOT NULL",
+ "3 source_id text/text NOT NULL",
+ "4 producer text/text NOT NULL",
+ "5 ref_kind text/text NOT NULL",
+ "6 target_source_id text/text NOT NULL",
+ "7 target_ref text/text NOT NULL",
+ "8 link_type text/text NOT NULL DEFAULT ''::text",
+ "9 context text/text NOT NULL DEFAULT ''::text",
+ "10 checked_at timestamp with time zone/timestamptz NOT NULL",
+ "11 first_seen_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"
+ ],
+ "flags": "relkind=r rls=true force_rls=false"
}
},
"triggers": {
diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.json
index 22c4a12451..a69ad54b8c 100644
--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json
+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json
@@ -507,13 +507,13 @@
},
{
"category": "meta",
- "message": "Version 200 (latest: 200)",
+ "message": "Version 201 (latest: 201)",
"name": "schema_version",
"status": "ok"
},
{
"category": "meta",
- "message": "853 column(s) verified against live schema",
+ "message": "863 column(s) verified against live schema",
"name": "schema_columns",
"status": "ok"
},
@@ -1542,7 +1542,7 @@
},
{
"category": "brain",
- "message": "No retrieval-affecting files changed in working tree.",
+ "message": "1 retrieval-affecting file(s) changed since HEAD: src/core/operations.ts. Re-run `gbrain eval run-all` after committing these changes.",
"name": "eval_drift",
"status": "ok"
},
diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.json
index 153d996111..8e74839ac8 100644
--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json
@@ -510,13 +510,13 @@
},
{
"category": "meta",
- "message": "Version 200 (latest: 200)",
+ "message": "Version 201 (latest: 201)",
"name": "schema_version",
"status": "ok"
},
{
"category": "meta",
- "message": "853 column(s) verified against live schema",
+ "message": "863 column(s) verified against live schema",
"name": "schema_columns",
"status": "ok"
},
@@ -1619,7 +1619,7 @@
},
{
"category": "brain",
- "message": "No retrieval-affecting files changed in working tree.",
+ "message": "1 retrieval-affecting file(s) changed since HEAD: src/core/operations.ts. Re-run `gbrain eval run-all` after committing these changes.",
"name": "eval_drift",
"status": "ok"
},
diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.json
index 9ebd3e303b..738c04a1be 100644
--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json
+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json
@@ -497,19 +497,19 @@
},
{
"category": "ops",
- "message": "RLS enabled on 103/103 public tables",
+ "message": "RLS enabled on 104/104 public tables",
"name": "rls",
"status": "ok"
},
{
"category": "meta",
- "message": "Version 200 (latest: 200)",
+ "message": "Version 201 (latest: 201)",
"name": "schema_version",
"status": "ok"
},
{
"category": "meta",
- "message": "859 column(s) verified against live schema",
+ "message": "869 column(s) verified against live schema",
"name": "schema_columns",
"status": "ok"
},
@@ -1611,7 +1611,7 @@
},
{
"category": "brain",
- "message": "No retrieval-affecting files changed in working tree.",
+ "message": "1 retrieval-affecting file(s) changed since HEAD: src/core/operations.ts. Re-run `gbrain eval run-all` after committing these changes.",
"name": "eval_drift",
"status": "ok"
},
diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.json
index fb4aa5732c..73c77e8dcb 100644
--- a/test/fixtures/goldens/exports/types.json
+++ b/test/fixtures/goldens/exports/types.json
@@ -4014,7 +4014,7 @@
"kind": "function",
"name": "extractLinksFromFile",
"signature": [
- "(content: string, relPath: string, allSlugs: Set<string>, opts?: { includeFrontmatter?: boolean; globalBasename?: boolean; pack?: LinkExtractionPack | null; pageTypes?: ReadonlyMap<string, string>; aliases?: ReadonlyMap<string, string>; }) => Promise<ExtractedLink[]>"
+ "(content: string, relPath: string, allSlugs: Set<string>, opts?: { includeFrontmatter?: boolean; globalBasename?: boolean; pack?: LinkExtractionPack | null; pageTypes?: ReadonlyMap<string, string>; aliases?: ReadonlyMap<string, string>; lineGrammar?: { enabled?: boolean; allowUndeclaredTypes?: boolean; }; }) => Promise<ExtractedLink[]>"
]
},
{
@@ -4482,6 +4482,16 @@
}
],
"./link-extraction": [
+ {
+ "kind": "interface",
+ "members": [
+ "key: string",
+ "kind: \"slug\" | \"name\"",
+ "target: string",
+ "targetSourceId?: string | undefined"
+ ],
+ "name": "AuthoredRef"
+ },
{
"kind": "interface",
"members": [
@@ -4505,6 +4515,18 @@
],
"name": "EntityRef"
},
+ {
+ "kind": "interface",
+ "members": [
+ "globalBasename?: boolean | undefined",
+ "lineGrammar?: { enabled?: boolean; allowUndeclaredTypes?: boolean; } | undefined",
+ "onResolvedFrontmatterTarget?: ((slug: string) => void) | undefined",
+ "pack?: LinkExtractionPack | null | undefined",
+ "skipFrontmatter?: boolean | undefined",
+ "targetType?: ((slug: string, sourceId?: string) => string | undefined) | undefined"
+ ],
+ "name": "ExtractPageLinksOptions"
+ },
{
"kind": "variable",
"name": "FRONTMATTER_LINK_MAP",
@@ -4551,6 +4573,7 @@
{
"kind": "interface",
"members": [
+ "authoredRef?: AuthoredRef | undefined",
"canonicalAttendance?: boolean | undefined",
"context: string",
"fromSlug?: string | undefined",
@@ -4692,7 +4715,7 @@
"kind": "function",
"name": "extractPageLinks",
"signature": [
- "(slug: string, content: string, frontmatter: Record<string, unknown>, pageType: PageType, resolver: SlugResolver, opts?: { globalBasename?: boolean; skipFrontmatter?: boolean; pack?: LinkExtractionPack | null; targetType?: (slug: string, sourceId?: string) => string | undefined; onResolvedFrontmatterTarget?: (slug: string) => void; }) => Promise<PageLinksResult>"
+ "(slug: string, content: string, frontmatter: Record<string, unknown>, pageType: PageType, resolver: SlugResolver, opts?: ExtractPageLinksOptions) => Promise<PageLinksResult>"
]
},
{
diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
index 40df5ecbfd..958afbadf7 100644
--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
@@ -293,7 +293,13 @@
"think_ab_results.think_ab_results_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_event_page_id_fkey": "f FOREIGN KEY (event_page_id) REFERENCES pages(id) ON DELETE CASCADE",
"timeline_entries.timeline_entries_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE",
- "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)"
+ "timeline_entries.timeline_entries_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_origin_page_id_fkey": "f FOREIGN KEY (origin_page_id) REFERENCES pages(id) ON DELETE CASCADE",
+ "wanted_links.wanted_links_pkey": "p PRIMARY KEY (id)",
+ "wanted_links.wanted_links_producer_check": "c CHECK ((producer = ANY (ARRAY['body'::text, 'frontmatter'::text])))",
+ "wanted_links.wanted_links_ref_kind_check": "c CHECK ((ref_kind = ANY (ARRAY['slug'::text, 'name'::text])))",
+ "wanted_links.wanted_links_reference_unique": "u UNIQUE (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links.wanted_links_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE"
},
"extensions": [
"pg_trgm",
@@ -641,6 +647,9 @@
],
"timeline_entries": [
"<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
+ ],
+ "wanted_links": [
+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"
]
},
"indexes": {
@@ -796,6 +805,7 @@
"idx_pages_frontmatter": "CREATE INDEX idx_pages_frontmatter ON public.pages USING gin (frontmatter)",
"idx_pages_projection_pending": "CREATE INDEX idx_pages_projection_pending ON public.pages USING btree (source_id, page_kind, slug) WHERE ((deleted_at IS NULL) AND (text_projection_revision IS DISTINCT FROM knowledge_revision))",
"idx_pages_search": "CREATE INDEX idx_pages_search ON public.pages USING gin (search_vector)",
+ "idx_pages_slug_basename": "CREATE INDEX idx_pages_slug_basename ON public.pages USING btree (source_id, regexp_replace(slug, '^.*/'::text, ''::text))",
"idx_pages_source_id": "CREATE INDEX idx_pages_source_id ON public.pages USING btree (source_id)",
"idx_pages_trgm": "CREATE INDEX idx_pages_trgm ON public.pages USING gin (title gin_trgm_ops)",
"idx_pages_type": "CREATE INDEX idx_pages_type ON public.pages USING btree (type)",
@@ -977,7 +987,11 @@
"timeline_entries_pkey": "CREATE UNIQUE INDEX timeline_entries_pkey ON public.timeline_entries USING btree (id)",
"uniq_minion_attachments_job_filename": "CREATE UNIQUE INDEX uniq_minion_attachments_job_filename ON public.minion_attachments USING btree (job_id, filename)",
"uniq_minion_jobs_idempotency": "CREATE UNIQUE INDEX uniq_minion_jobs_idempotency ON public.minion_jobs USING btree (idempotency_key) WHERE (idempotency_key IS NOT NULL)",
- "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)"
+ "uniq_subagent_messages_idx": "CREATE UNIQUE INDEX uniq_subagent_messages_idx ON public.subagent_messages USING btree (job_id, message_idx)",
+ "wanted_links_pkey": "CREATE UNIQUE INDEX wanted_links_pkey ON public.wanted_links USING btree (id)",
+ "wanted_links_reference_unique": "CREATE UNIQUE INDEX wanted_links_reference_unique ON public.wanted_links USING btree (origin_page_id, producer, ref_kind, target_source_id, target_ref)",
+ "wanted_links_source_idx": "CREATE INDEX wanted_links_source_idx ON public.wanted_links USING btree (source_id)",
+ "wanted_links_target_idx": "CREATE INDEX wanted_links_target_idx ON public.wanted_links USING btree (target_source_id, target_ref)"
},
"policies": {},
"sequences": {
@@ -1030,7 +1044,8 @@
"take_proposals_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=take_proposals.id",
"takes_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=takes.id",
"think_ab_results_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=think_ab_results.id",
- "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id"
+ "timeline_entries_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=timeline_entries.id",
+ "wanted_links_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=wanted_links.id"
},
"tables": {
"access_tokens": {
@@ -2744,6 +2759,22 @@
"15 last_written_at timestamp with time zone/timestamptz NULL"
],
"flags": "relkind=r rls=false force_rls=false"
+ },
+ "wanted_links": {
+ "columns": [
+ "1 id bigint/int8 NOT NULL DEFAULT nextval('wanted_links_id_seq'::regclass)",
+ "2 origin_page_id integer/int4 NOT NULL",
+ "3 source_id text/text NOT NULL",
+ "4 producer text/text NOT NULL",
+ "5 ref_kind text/text NOT NULL",
+ "6 target_source_id text/text NOT NULL",
+ "7 target_ref text/text NOT NULL",
+ "8 link_type text/text NOT NULL DEFAULT ''::text",
+ "9 context text/text NOT NULL DEFAULT ''::text",
+ "10 checked_at timestamp with time zone/timestamptz NOT NULL",
+ "11 first_seen_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"
+ ],
+ "flags": "relkind=r rls=true force_rls=false"
}
},
"triggers": {
diff --git a/test/fixtures/goldens/sql-text/pages.json b/test/fixtures/goldens/sql-text/pages.json
index a53dbc235b..0f38fde4e4 100644
--- a/test/fixtures/goldens/sql-text/pages.json
+++ b/test/fixtures/goldens/sql-text/pages.json
@@ -10,8 +10,8 @@
"string",
"string"
],
- "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR links_extracted_at < $1::timestamptz OR updated_at > links_extracted_at) AND source_id = $2 AND links_attendance_blocked_revision = knowledge_revision",
- "textSha256": "be4f84c6281e3977a29eab4c2d35b5cab52a54f87936fb84eed35ac55b5a3bf3"
+ "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR links_extracted_at < $1::timestamptz OR updated_at > links_extracted_at OR id IN (SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND t.slug = w.target_ref AND t.deleted_at IS NULL WHERE t.updated_at > w.checked_at UNION SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND regexp_replace(t.slug, '^.*/', '') = w.target_ref AND t.deleted_at IS NULL WHERE w.ref_kind = 'name' AND t.updated_at > w.checked_at)) AND source_id = $2 AND links_attendance_blocked_revision = knowledge_revision",
+ "textSha256": "bcdc72f48530635a4b8db91ba0f824aba03d83fe223ce1220f6d93b816f38353"
}
],
"attendance-exclude": [
@@ -20,16 +20,16 @@
"params": [
"string"
],
- "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR links_extracted_at < $1::timestamptz OR updated_at > links_extracted_at) AND links_attendance_blocked_revision IS DISTINCT FROM knowledge_revision",
- "textSha256": "ac18ba62c816b3be4564d5a24bdc69304c45d24022c7ade0de8a81d0b36e3123"
+ "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR links_extracted_at < $1::timestamptz OR updated_at > links_extracted_at OR id IN (SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND t.slug = w.target_ref AND t.deleted_at IS NULL WHERE t.updated_at > w.checked_at UNION SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND regexp_replace(t.slug, '^.*/', '') = w.target_ref AND t.deleted_at IS NULL WHERE w.ref_kind = 'name' AND t.updated_at > w.checked_at)) AND links_attendance_blocked_revision IS DISTINCT FROM knowledge_revision",
+ "textSha256": "4f36f46e2e698e8ff1fc46efb3026fdb71f0d8be893c1cdfa2572d453aefeeda"
}
],
"default": [
{
"lane": "pool",
"params": [],
- "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR updated_at > links_extracted_at)",
- "textSha256": "3f9c86c575246f3a4f112b931aa51361c5e7b4c165330c026843dcb614072c94"
+ "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR updated_at > links_extracted_at OR id IN (SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND t.slug = w.target_ref AND t.deleted_at IS NULL WHERE t.updated_at > w.checked_at UNION SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND regexp_replace(t.slug, '^.*/', '') = w.target_ref AND t.deleted_at IS NULL WHERE w.ref_kind = 'name' AND t.updated_at > w.checked_at))",
+ "textSha256": "499866fec60ad4c64ed01fef287a6c63bcabfeaa9170969a560ce4296554afc3"
}
],
"versionTs+sourceId": [
@@ -39,8 +39,8 @@
"string",
"string"
],
- "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR links_extracted_at < $1::timestamptz OR updated_at > links_extracted_at) AND source_id = $2",
- "textSha256": "fb4400e83c4a8ed0cf977fad5a1bd11c8336d3be942ba26f6e15486c2561dc3a"
+ "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR links_extracted_at < $1::timestamptz OR updated_at > links_extracted_at OR id IN (SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND t.slug = w.target_ref AND t.deleted_at IS NULL WHERE t.updated_at > w.checked_at UNION SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND regexp_replace(t.slug, '^.*/', '') = w.target_ref AND t.deleted_at IS NULL WHERE w.ref_kind = 'name' AND t.updated_at > w.checked_at)) AND source_id = $2",
+ "textSha256": "8fe8e241a5f7eaba51b12975460431f21f886ed318a72a8ef976c2f28a66549e"
}
]
},
@@ -615,8 +615,8 @@
"number",
"number"
],
- "sql": "SELECT id, slug, source_id, type, title, compiled_truth, timeline, frontmatter, updated_at, to_char(updated_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS updated_at_iso FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR links_extracted_at < $1::timestamptz OR updated_at > links_extracted_at) AND source_id = $2 AND id > $3 ORDER BY id LIMIT $4",
- "textSha256": "02f69476257e0b3f3c2b8526ef5d8c92b84039ab79fe2a86c69cc9670b4603a8"
+ "sql": "SELECT id, slug, source_id, type, title, compiled_truth, timeline, frontmatter, updated_at, to_char(updated_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS updated_at_iso FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR links_extracted_at < $1::timestamptz OR updated_at > links_extracted_at OR id IN (SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND t.slug = w.target_ref AND t.deleted_at IS NULL WHERE t.updated_at > w.checked_at UNION SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND regexp_replace(t.slug, '^.*/', '') = w.target_ref AND t.deleted_at IS NULL WHERE w.ref_kind = 'name' AND t.updated_at > w.checked_at)) AND source_id = $2 AND id > $3 ORDER BY id LIMIT $4",
+ "textSha256": "7526d404e57e5724991d62594d6144f4a88954151d0b0cfaa102e95fc2eeb9fe"
}
],
"default": [
@@ -625,8 +625,8 @@
"params": [
"number"
],
- "sql": "SELECT id, slug, source_id, type, title, compiled_truth, timeline, frontmatter, updated_at, to_char(updated_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS updated_at_iso FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR updated_at > links_extracted_at) ORDER BY id LIMIT $1",
- "textSha256": "5caf4d2f7968dbdcb18b553c3d4c7e05bb474dbb338ed171071ccaadce8b0188"
+ "sql": "SELECT id, slug, source_id, type, title, compiled_truth, timeline, frontmatter, updated_at, to_char(updated_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS updated_at_iso FROM pages WHERE deleted_at IS NULL AND (links_extracted_at IS NULL OR updated_at > links_extracted_at OR id IN (SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND t.slug = w.target_ref AND t.deleted_at IS NULL WHERE t.updated_at > w.checked_at UNION SELECT w.origin_page_id FROM wanted_links w JOIN pages t ON t.source_id = w.target_source_id AND regexp_replace(t.slug, '^.*/', '') = w.target_ref AND t.deleted_at IS NULL WHERE w.ref_kind = 'name' AND t.updated_at > w.checked_at)) ORDER BY id LIMIT $1",
+ "textSha256": "93aa0563d8be26fed0f4f1659d84d722cbc73232da783346541080b925558e95"
}
]
},
@@ -1162,8 +1162,8 @@
"params": [
"string"
],
- "sql": "UPDATE pages SET deleted_at = NULL WHERE slug = $1 AND deleted_at IS NOT NULL RETURNING slug",
- "textSha256": "acd1c51520605f0e6825a414c68860b9f4b74c9cbbfd6ce8b33a2ac454de6f09"
+ "sql": "UPDATE pages SET deleted_at = NULL, updated_at = now() WHERE slug = $1 AND deleted_at IS NOT NULL RETURNING slug",
+ "textSha256": "e657e4a81c518ed0669a4f80ce47e3114b42aaa4aa13667cdc35bb516e4d37cd"
}
],
"sourceId": [
@@ -1173,8 +1173,8 @@
"string",
"string"
],
- "sql": "UPDATE pages SET deleted_at = NULL WHERE slug = $1 AND deleted_at IS NOT NULL AND source_id = $2 RETURNING slug",
- "textSha256": "090e0cc13e4a8f75a1b0348c64728d42d1e3f6d57c91b0957679599af7ca3f3f"
+ "sql": "UPDATE pages SET deleted_at = NULL, updated_at = now() WHERE slug = $1 AND deleted_at IS NOT NULL AND source_id = $2 RETURNING slug",
+ "textSha256": "d36ab3e3d4968ce3e210fbbc3a1e9247e4d6065537b380001da3285a3dc6054b"
}
]
},