Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Record guest notes in the write, privacy and CLI inventories (GBRA-504)
garrytan2c183b797800
diff --git a/docs/architecture/canonical-writers.tsv b/docs/architecture/canonical-writers.tsvindex af935bdf48..9a6cad1da1 100644--- a/docs/architecture/canonical-writers.tsv+++ b/docs/architecture/canonical-writers.tsv@@ -301,3 +301,4 @@ src/core/meetings/meetings-source.ts 1 coordinator Meetings connector (GBRA-220)src/core/slack/slack-source.ts 1 coordinator Slack channel connector (GBRA-220): the one sources.last_sync_at/newest_content_at stamp (never page content) runs only for unmanaged sources; managed runs stamp through the connector checkpoint save in connector-sync.ts.src/core/access/attest-sources.ts 1 projection GST-1113: applyAttestSources sets only sources.config.qm_scope (and federated false) on a source a credential first lists in attest_sources, under the sources row lock in the binding transaction. It writes no page column, revision, content hash, generation, checkpoint or topology column, so gbrain_require_managed_writer passes it on a managed brain, as with policy.ts writeAccessStore; the mark only hides.src/core/storage-manifest/source.ts 1 contract markRole sets role and federated in the config of the storage source that addSource or hostRepo created in the same storage init or first repo-less register; it writes source configuration only, never page content.+src/core/guests/sources.ts 1 projection GBRA-504 guest source setup (initGuestSource, the trusted local gbrain guests init): merges the guest, federated and trust_ceiling keys into sources.config in the transaction that writes the guest_sources row; a settings field, not page content, and canonical columns stay guarded by SQL triggers.diff --git a/docs/architecture/managed-mutating-writers.tsv b/docs/architecture/managed-mutating-writers.tsvindex db77ef8b7d..7a9c64b6b9 100644--- a/docs/architecture/managed-mutating-writers.tsv+++ b/docs/architecture/managed-mutating-writers.tsv@@ -14,6 +14,7 @@ op storage_update coordinator submitPageMutation through the storage door boundop delete_page coordinator submitPageMutation soft delete or trusted-local purge.op restore_page coordinator submitPageMutation restores a recorded version.op purge_deleted_pages coordinator purgeDeletedPagesCoordinated purges each expired tombstone through delete_page purge.+op promote_guest_note coordinator Writes the owner page through submitPageMutation put_page and records the link in guest_promotions; the guest note is never changed.op capture coordinator submitPageMutation admits a journaled page mutation.op cancel_write_request no_canonical_write Cancels a queued journal request; no canonical row changes.op add_tag coordinator submitPageMutation admits a journaled page mutation.diff --git a/docs/architecture/system-of-record.md b/docs/architecture/system-of-record.mdindex 3670ab6d89..15cd31e0b8 100644--- a/docs/architecture/system-of-record.md+++ b/docs/architecture/system-of-record.md@@ -300,7 +300,7 @@ or a physical projection that leaves attribution untouched):- `src/core/persistence/forget-prepare.ts` (1): `forget` / `forget_fact` request preparer; the struck page files publish first, then the withdrawal's rows in the same publication.- `src/core/persistence/memory-prepare.ts` (2): `remember` request preparer; the fence row and its facts row go through `prepareFenceFactAppend`.- `src/core/persistence/page-append.ts` (1): segmented `append_page` / `edit_page` request preparer; the splice versions the page inside its request's publication.-- `src/core/persistence/page-prepare.ts` (12): page request preparer (including the restore of a segmented page over 24 MiB, which flips `deleted_at` without re-serializing, and the tag flip of a segmented page, which versions it and changes its tag rows and `content_hash` without re-serializing).+- `src/core/persistence/page-prepare.ts` (14): page request preparer (including the restore of a guest note (GBRA-504), which versions and restores the page inside its publication transaction, the restore of a segmented page over 24 MiB, which flips `deleted_at` without re-serializing, and the tag flip of a segmented page, which versions it and changes its tag rows and `content_hash` without re-serializing).- `src/core/persistence/page-purge.ts` (2): the purge's in-transaction recheck (GST-2689) versions and soft-deletes a live page whose derived page was written mid-purge; it runs inside the `delete_page` request's coordinated publication (`page-prepare.ts` apply) and carries that request.- `src/core/persistence/prepared-maintenance.ts` (5): managed maintenance request preparer (consolidation closes an unfenced fact in the database and a fenced one from its published fence cell; a held move clears the row number of the struck held rows it removes from their holding page).- `src/core/persistence/semantic-pages.ts` (1): `add_timeline_entry` request preparer.diff --git a/src/commands/guests.ts b/src/commands/guests.tsindex cce301ccad..e1f5dcaa63 100644--- a/src/commands/guests.ts+++ b/src/commands/guests.ts@@ -10,6 +10,7 @@ import { GUEST_TRUST_CEILING, GUEST_WRITER_FORMAT, initGuestSource, isGuestWriteimport { grantOwnerCredentials, ownerCredentials } from '../core/guests/owner-credentials.ts';import { exitCliError } from '../cli/cli-error.ts';import { loadConfig } from '../core/config.ts';+import { setCliExitVerdict } from '../core/cli-force-exit.ts';export const GUESTS_USAGE = `Usage: gbrain guests init [--source <id>] [--writer ${GUEST_WRITER_FORMAT}]... [--yes]gbrain guests promote <guest-slug> [--to <slug>] [--source <id>] [--guest-source <id>] [--json]@@ -150,5 +151,5 @@ async function runGrantOwnerClients(engine: BrainEngine, rest: string[]): Promisconsole.log(` ${o.kind} ${o.name} (${o.id}): ${o.outcome === 'granted' ? `now reads "${sourceId}"` : o.outcome === 'conflict'? 'not changed: its grant changed since this preview; run the command again' : `not changed: ${o.detail}`}`);}- if (outcomes.some(o => o.outcome === 'conflict')) process.exitCode = 1;+ if (outcomes.some(o => o.outcome === 'conflict')) setCliExitVerdict(1);}diff --git a/test/cli-thin-client-refusal-matrix.test.ts b/test/cli-thin-client-refusal-matrix.test.tsindex 02bc056370..2069cd935b 100644--- a/test/cli-thin-client-refusal-matrix.test.ts+++ b/test/cli-thin-client-refusal-matrix.test.ts@@ -104,8 +104,8 @@ describe('A16b thin-client refusal matrix', () => {routing = await run(ROUTING_ROWS);}, 300_000);- test('the matrix covers all 73 handleCliOnly cases', () => {- expect(CASES.length).toBe(73);+ test('the matrix covers all 74 handleCliOnly cases', () => {+ expect(CASES.length).toBe(74);});test('every handleCliOnly case, run bare on a thin client, matches the golden', () => {diff --git a/test/fixtures/goldens/cli/thin-client-cases.json b/test/fixtures/goldens/cli/thin-client-cases.jsonindex c8243b538d..05c358fcb7 100644--- a/test/fixtures/goldens/cli/thin-client-cases.json+++ b/test/fixtures/goldens/cli/thin-client-cases.json@@ -802,6 +802,16 @@],"stdout": []},+ {+ "argv": "guests",+ "exitCode": 1,+ "stderr": [+ "Error [requires_local_engine]: `gbrain guests` requires a local engine. This install is a thin client of http://127.0.0.1:1/mcp.",+ "Fix: gbrain guests",+ "Docs: https://github.com/garrytan/gbrain/blob/master/docs/guides/error-codes.md#requires_local_engine"+ ],+ "stdout": []+ },{"argv": "trust","exitCode": 1,diff --git a/test/fixtures/goldens/doctor/content-pglite-human.json b/test/fixtures/goldens/doctor/content-pglite-human.jsonindex fa2d873fb5..94bc831d2e 100644--- a/test/fixtures/goldens/doctor/content-pglite-human.json+++ b/test/fixtures/goldens/doctor/content-pglite-human.json@@ -98,12 +98,13 @@" [INFO] access_members_read_lineage: Not applicable: access.members_read_lineage is off; derived pages and facts of a page that names readers or sits under a rule are hidden from every member but the owner."," [INFO] access_labelled_only_members: Not applicable: no member is labelled-only (gbrain access member labelled-only <id> on)."," [INFO] attest_read_shared_scope: Not applicable: no attest credential reads named sources as the person (--attest-read person).",+ " [INFO] guest_source: Not applicable: this brain has no guest source (gbrain guests init)."," [OK] rls: Skipped (PGLite — no PostgREST exposure, RLS not applicable)"," [OK] function_search_path: Every gbrain function that pins a search_path ends it with pg_temp"," [OK] database_encoding: Skipped (PGLite is always UTF8)"," [OK] schema_version: Version <latest> (latest: <latest>)"," [OK] schema_columns: 1393 column(s) verified against live schema",- " [OK] schema_missing_tables: All 179 table(s) the applied migrations create exist.",+ " [OK] schema_missing_tables: All 182 table(s) the applied migrations create exist."," [OK] schema_function_bodies: Every function this gbrain's schema defines has its body"," [OK] rls_event_trigger: Skipped (PGLite — no event trigger support)"," [INFO] embeddings: Not applicable: embeddings are disabled on this brain (keyword search keeps working).",diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.jsonindex f026769021..4911688ee2 100644--- a/test/fixtures/goldens/doctor/content-pglite-json.json+++ b/test/fixtures/goldens/doctor/content-pglite-json.json@@ -1175,6 +1175,15 @@"severity": "info","status": "ok"},+ {+ "category": "brain",+ "elapsed_ms": "<volatile>",+ "message": "Not applicable: this brain has no guest source (gbrain guests init).",+ "name": "guest_source",+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"+ },{"category": "ops","elapsed_ms": "<volatile>",@@ -1213,7 +1222,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 179 table(s) the applied migrations create exist.",+ "message": "All 182 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},diff --git a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json b/test/fixtures/goldens/doctor/hot-checks-pglite-json.jsonindex f31f5cabc7..d84452fe8a 100644--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json@@ -1246,6 +1246,15 @@"severity": "info","status": "ok"},+ {+ "category": "brain",+ "elapsed_ms": "<volatile>",+ "message": "Not applicable: this brain has no guest source (gbrain guests init).",+ "name": "guest_source",+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"+ },{"category": "ops","elapsed_ms": "<volatile>",@@ -1284,7 +1293,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 179 table(s) the applied migrations create exist.",+ "message": "All 182 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},@@ -6605,6 +6614,15 @@"severity": "info","status": "ok"},+ {+ "category": "brain",+ "elapsed_ms": "<volatile>",+ "message": "Not applicable: this brain has no guest source (gbrain guests init).",+ "name": "guest_source",+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"+ },{"category": "ops","elapsed_ms": "<volatile>",@@ -6643,7 +6661,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 179 table(s) the applied migrations create exist.",+ "message": "All 182 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},diff --git a/test/fixtures/goldens/sql-text/pages.json b/test/fixtures/goldens/sql-text/pages.jsonindex 2fb399a8a1..820b3af588 100644--- a/test/fixtures/goldens/sql-text/pages.json+++ b/test/fixtures/goldens/sql-text/pages.json@@ -61,8 +61,8 @@"string","string"],- "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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 AND NOT EXISTS (SELECT 1 FROM guest_sources guest_src WHERE guest_src.source_id = pages.source_id)",- "textSha256": "8892f5fbcb64737dd5dd3d5b24f2c86d935e15f574b5e6d5875d7823d063f764"+ "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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 AND NOT EXISTS (SELECT 1 FROM sources guest_src WHERE guest_src.id = pages.source_id AND (COALESCE(guest_src.config->>'guest' = 'true', false) OR EXISTS (SELECT 1 FROM guest_sources gs WHERE gs.source_id = guest_src.id)))",+ "textSha256": "4f272d869a9d854de93cd1ad43265ac46e64461ddc1df87b12870925b720ec97"}],"attendance-exclude": [@@ -71,16 +71,16 @@"params": ["string"],- "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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 AND NOT EXISTS (SELECT 1 FROM guest_sources guest_src WHERE guest_src.source_id = pages.source_id)",- "textSha256": "d78d41c22ff31f42821a8224184caa7e08d54dd1cf325822db794b79caf242b9"+ "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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 AND NOT EXISTS (SELECT 1 FROM sources guest_src WHERE guest_src.id = pages.source_id AND (COALESCE(guest_src.config->>'guest' = 'true', false) OR EXISTS (SELECT 1 FROM guest_sources gs WHERE gs.source_id = guest_src.id)))",+ "textSha256": "398364f077186f00dd83da8ffd616f01c508faf3529d6285dad1d61cc9c4821b"}],"default": [{"lane": "pool","params": [],- "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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)) AND NOT EXISTS (SELECT 1 FROM guest_sources guest_src WHERE guest_src.source_id = pages.source_id)",- "textSha256": "e108c9f4ec8e75ab4ae25b9d1c7aa0022175ec64599a4ad0e4b3cacc8aa55dbe"+ "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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)) AND NOT EXISTS (SELECT 1 FROM sources guest_src WHERE guest_src.id = pages.source_id AND (COALESCE(guest_src.config->>'guest' = 'true', false) OR EXISTS (SELECT 1 FROM guest_sources gs WHERE gs.source_id = guest_src.id)))",+ "textSha256": "ae74edfdee2b9dbd58ee55a27201e56979fbccc122568b07c6d2a5e80488d89a"}],"versionTs+sourceId": [@@ -90,8 +90,8 @@"string","string"],- "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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 NOT EXISTS (SELECT 1 FROM guest_sources guest_src WHERE guest_src.source_id = pages.source_id)",- "textSha256": "c247759eaffef0a8f5b5840a1f04a7443302a8522e78a5f811d37905625f90f1"+ "sql": "SELECT count(*)::int AS count FROM pages WHERE deleted_at IS NULL AND NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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 NOT EXISTS (SELECT 1 FROM sources guest_src WHERE guest_src.id = pages.source_id AND (COALESCE(guest_src.config->>'guest' = 'true', false) OR EXISTS (SELECT 1 FROM guest_sources gs WHERE gs.source_id = guest_src.id)))",+ "textSha256": "bc90edfc97a3b65c610f18e29235cfd7622e1be6856f56ee6c6fb8245925e2c9"}]},@@ -756,8 +756,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 NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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 NOT EXISTS (SELECT 1 FROM guest_sources guest_src WHERE guest_src.source_id = pages.source_id) AND id > $3 ORDER BY id LIMIT $4",- "textSha256": "c5392d1114a1041dba9a874c501cc31182fab4a30fd133527c80ab597a5827c4"+ "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 NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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 NOT EXISTS (SELECT 1 FROM sources guest_src WHERE guest_src.id = pages.source_id AND (COALESCE(guest_src.config->>'guest' = 'true', false) OR EXISTS (SELECT 1 FROM guest_sources gs WHERE gs.source_id = guest_src.id))) AND id > $3 ORDER BY id LIMIT $4",+ "textSha256": "5f9182a84461de144712758439bb9897f3f8b3d4b7256f9badeee7dd832b4141"}],"default": [@@ -766,8 +766,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 NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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)) AND NOT EXISTS (SELECT 1 FROM guest_sources guest_src WHERE guest_src.source_id = pages.source_id) ORDER BY id LIMIT $1",- "textSha256": "eb5a092049ba72338135fdbe81657e57c91db6c031266feeac756ea2023cfa00"+ "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 NOT (COALESCE(pages.frontmatter, '{}'::jsonb) ? 'quarantine') 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)) AND NOT EXISTS (SELECT 1 FROM sources guest_src WHERE guest_src.id = pages.source_id AND (COALESCE(guest_src.config->>'guest' = 'true', false) OR EXISTS (SELECT 1 FROM guest_sources gs WHERE gs.source_id = guest_src.id))) ORDER BY id LIMIT $1",+ "textSha256": "00249985f24e8528ec57f08bdea39f6107a98f7dfb513e4e314de4fef2d568f5"}]},diff --git a/test/guest-derived-registry.test.ts b/test/guest-derived-registry.test.tsindex d0ed9bd436..184c0d48de 100644--- a/test/guest-derived-registry.test.ts+++ b/test/guest-derived-registry.test.ts@@ -36,6 +36,7 @@ describe('guest derived-producer registry', () => {});test('each skip site calls a guest helper with its own key; the cycle gate covers the cycle.ts sites', () => {+ // test-reads-source-ok[structural]: the registry names the code sites that skip guest pages, so the test checks each site calls its helper.const cycle = readFileSync(join(ROOT, 'src/core/cycle.ts'), 'utf8');expect(cycle).toContain('guestSkippedPhases()');const viaCycle: string[] = [];diff --git a/test/remote-privacy-sweep.test.ts b/test/remote-privacy-sweep.test.tsindex 9e627a48c1..84ee7354ee 100644--- a/test/remote-privacy-sweep.test.ts+++ b/test/remote-privacy-sweep.test.ts@@ -387,6 +387,8 @@ const EXPECTED_OUTCOME: Record<string, Outcome> = {unpurge_page: 'error',// Owner confirmation needs a memory_confirm grant; the sweep's connection has none (refused before any read).confirm_memory: 'error',+ // GBRA-504: promoting a guest note is the brain owner's call; the sweep's connection is refused before any read.+ promote_guest_note: 'error',// rate_answer with no answer_id is a validation error; a real answer id only// ever names pages that answer returned to the same client.rate_answer: 'error',