Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
feat(f1a): write attribution columns and stamping triggers (f1_write_attribution)
garrytan9a1b55a1ed33
diff --git a/src/core/persistence/attribution-schema.ts b/src/core/persistence/attribution-schema.tsnew file mode 100644index 0000000000..cb82f258b4--- /dev/null+++ b/src/core/persistence/attribution-schema.ts@@ -0,0 +1,164 @@+/**+ * Write attribution (Foundations 1, F1): which journal request and principal+ * wrote each content row and each live page revision. One canonical copy used+ * by the f1_write_attribution schema migration. Like the facts/takes DDL it+ * is not in the schema blob: a fresh install replays every migration, so the+ * columns land after every migration-added column on fresh and upgraded+ * brains alike, and no trigger can run before the columns it names exist.+ *+ * The actor reaches the database as three transaction-local settings that+ * withCoordinatedWrite / withWriteAttribution set (persistence/context.ts):+ * gbrain.write_request (persistence_requests.id, empty for maintenance),+ * gbrain.write_principal_kind and gbrain.write_principal_id. BEFORE ROW+ * triggers copy them into the rows, so no INSERT/UPDATE site carries+ * attribution itself. Every column is nullable with no default (metadata-only+ * ADD COLUMN on both engines, #5216). All-NULL reads as "unrecorded".+ *+ * A column added to facts, takes or timeline_entries must be classified here+ * (content or projection) and the trigger function re-created by that+ * migration (re-run WRITE_ATTRIBUTION_SCHEMA_SQL, as v192 re-runs the writer+ * guard); the classification test in test/write-attribution.test.ts fails+ * until it is.+ */++/** created_by and last_mutated_by on facts, takes and timeline_entries. */+export const ROW_ATTRIBUTION_COLUMNS = [+ 'write_request_id', 'write_principal_kind', 'write_principal_id',+ 'last_write_request_id', 'last_write_principal_kind', 'last_write_principal_id', 'last_written_at',+] as const;+/** The actor that wrote the live page revision (pages.knowledge_revision). */+export const REVISION_ATTRIBUTION_COLUMNS = ['revision_write_request_id', 'revision_principal_kind', 'revision_principal_id'] as const;+/** page_versions: origin of the snapshotted revision, and the write that archived it. */+export const VERSION_ATTRIBUTION_COLUMNS = [+ 'write_request_id', 'write_principal_kind', 'write_principal_id',+ 'archived_write_request_id', 'archived_principal_kind', 'archived_principal_id',+] as const;++export type AttributedTable = 'facts' | 'takes' | 'timeline_entries';+/** A change to any of these is a canonical mutation and moves last_write_*. */+export const WRITE_ATTRIBUTION_CONTENT_COLUMNS: Record<AttributedTable, readonly string[]> = {+ facts: ['id', 'source_id', 'entity_slug', 'fact', 'kind', 'visibility', 'notability', 'context', 'valid_from',+ 'valid_until', 'expired_at', 'superseded_by', 'consolidated_at', 'consolidated_into', 'source', 'source_session',+ 'confidence', 'created_at', 'row_num', 'source_markdown_slug', 'claim_metric', 'claim_value', 'claim_unit',+ 'claim_period', 'event_type', 'dimension', 'value', 'value_hash', 'dim_status'],+ takes: ['id', 'page_id', 'row_num', 'claim', 'kind', 'holder', 'weight', 'since_date', 'until_date', 'source',+ 'superseded_by', 'active', 'resolved_at', 'resolved_outcome', 'resolved_value', 'resolved_unit', 'resolved_source',+ 'resolved_by', 'created_at', 'resolved_quality'],+ timeline_entries: ['id', 'page_id', 'date', 'source', 'summary', 'detail', 'event_page_id', 'created_at'],+};+/** Physical projections (embeddings and their identity): changing them leaves attribution untouched. */+export const WRITE_ATTRIBUTION_PROJECTION_COLUMNS: Record<AttributedTable, readonly string[]> = {+ facts: ['embedding', 'embedded_at', 'embedding_model', 'embedded_text_hash'],+ takes: ['embedding', 'embedded_at', 'updated_at', 'embedding_model', 'embedded_text_hash'],+ timeline_entries: [],+};++const ATTRIBUTED_TABLES = Object.keys(WRITE_ATTRIBUTION_CONTENT_COLUMNS) as AttributedTable[];+const SETTINGS = `+ req := NULLIF(current_setting('gbrain.write_request', true), '')::uuid;+ principal_kind := NULLIF(current_setting('gbrain.write_principal_kind', true), '');+ principal_id := NULLIF(current_setting('gbrain.write_principal_id', true), '');`;+const tuple = (row: 'NEW' | 'OLD', columns: readonly string[]) => `(${columns.map(column => `${row}.${column}`).join(', ')})`;+const contentChanged = (table: AttributedTable) => {+ const columns = WRITE_ATTRIBUTION_CONTENT_COLUMNS[table];+ return `${tuple('NEW', columns)} IS DISTINCT FROM ${tuple('OLD', columns)}`;+};+const typed = (column: string) => column.endsWith('request_id') ? 'UUID' : column.endsWith('_at') ? 'TIMESTAMPTZ' : 'TEXT';+const addColumns = (table: string, columns: readonly string[]) =>+ `ALTER TABLE ${table} ${columns.map(column => `ADD COLUMN IF NOT EXISTS ${column} ${typed(column)}`).join(', ')}`;++/**+ * INSERT: stamp created_by and last_mutated_by from the settings; without+ * settings keep supplied values (engine copy, backfill). UPDATE: created_by is+ * immutable once set; last_mutated_by moves only when a content column+ * changed (to NULL when no actor is set: an unattributed writer mutated it).+ * Either pair may be filled while it is still NULL (journal backfill).+ */+const STAMP_ROW_FUNCTION = `CREATE OR REPLACE FUNCTION gbrain_stamp_write_attribution() RETURNS trigger LANGUAGE plpgsql AS $fn$+DECLARE req uuid; principal_kind text; principal_id text; changed boolean;+BEGIN${SETTINGS}+ IF TG_OP = 'INSERT' THEN+ IF principal_kind IS NOT NULL THEN+ NEW.write_request_id := req; NEW.write_principal_kind := principal_kind; NEW.write_principal_id := principal_id;+ NEW.last_write_request_id := req; NEW.last_write_principal_kind := principal_kind; NEW.last_write_principal_id := principal_id;+ NEW.last_written_at := now();+ END IF;+ RETURN NEW;+ END IF;+ IF (OLD.write_request_id, OLD.write_principal_kind, OLD.write_principal_id) IS DISTINCT FROM (NULL::uuid, NULL::text, NULL::text) THEN+ NEW.write_request_id := OLD.write_request_id; NEW.write_principal_kind := OLD.write_principal_kind; NEW.write_principal_id := OLD.write_principal_id;+ END IF;+ ${ATTRIBUTED_TABLES.map((table, index) => `${index === 0 ? 'IF' : 'ELSIF'} TG_TABLE_NAME = '${table}' THEN+ changed := ${contentChanged(table)};`).join('\n ')}+ ELSE+ RAISE EXCEPTION 'gbrain_stamp_write_attribution is not classified for table %', TG_TABLE_NAME;+ END IF;+ IF changed THEN+ NEW.last_write_request_id := req; NEW.last_write_principal_kind := principal_kind; NEW.last_write_principal_id := principal_id;+ NEW.last_written_at := now();+ ELSIF (OLD.last_write_request_id, OLD.last_write_principal_kind, OLD.last_write_principal_id, OLD.last_written_at)+ IS DISTINCT FROM (NULL::uuid, NULL::text, NULL::text, NULL::timestamptz) THEN+ NEW.last_write_request_id := OLD.last_write_request_id; NEW.last_write_principal_kind := OLD.last_write_principal_kind;+ NEW.last_write_principal_id := OLD.last_write_principal_id; NEW.last_written_at := OLD.last_written_at;+ END IF;+ RETURN NEW;+END $fn$`;++/**+ * Sorts after pages_knowledge_revision, which assigns the new revision. Tag+ * writes bump the revision through an update of the page row, so they are+ * attributed too.+ */+const STAMP_REVISION_FUNCTION = `CREATE OR REPLACE FUNCTION gbrain_stamp_revision_attribution() RETURNS trigger LANGUAGE plpgsql AS $fn$+DECLARE req uuid; principal_kind text; principal_id text;+BEGIN${SETTINGS}+ IF TG_OP = 'INSERT' THEN+ IF principal_kind IS NOT NULL THEN+ NEW.revision_write_request_id := req; NEW.revision_principal_kind := principal_kind; NEW.revision_principal_id := principal_id;+ END IF;+ ELSIF NEW.knowledge_revision IS DISTINCT FROM OLD.knowledge_revision THEN+ NEW.revision_write_request_id := req; NEW.revision_principal_kind := principal_kind; NEW.revision_principal_id := principal_id;+ ELSIF (OLD.revision_write_request_id, OLD.revision_principal_kind, OLD.revision_principal_id) IS DISTINCT FROM (NULL::uuid, NULL::text, NULL::text) THEN+ NEW.revision_write_request_id := OLD.revision_write_request_id; NEW.revision_principal_kind := OLD.revision_principal_kind;+ NEW.revision_principal_id := OLD.revision_principal_id;+ END IF;+ RETURN NEW;+END $fn$`;++/**+ * A version row snapshots the page before the archiving write changes it, in+ * the same transaction, so the page row still carries the snapshotted+ * revision and its writer. The archiving actor comes from the settings.+ */+const STAMP_VERSION_FUNCTION = `CREATE OR REPLACE FUNCTION gbrain_stamp_version_attribution() RETURNS trigger LANGUAGE plpgsql AS $fn$+DECLARE req uuid; principal_kind text; principal_id text;+BEGIN${SETTINGS}+ IF (NEW.write_request_id, NEW.write_principal_kind, NEW.write_principal_id) IS NOT DISTINCT FROM (NULL::uuid, NULL::text, NULL::text) THEN+ SELECT p.revision_write_request_id, p.revision_principal_kind, p.revision_principal_id+ INTO NEW.write_request_id, NEW.write_principal_kind, NEW.write_principal_id+ FROM pages p WHERE p.id = NEW.page_id AND p.knowledge_revision = NEW.knowledge_revision;+ END IF;+ IF principal_kind IS NOT NULL THEN+ NEW.archived_write_request_id := req; NEW.archived_principal_kind := principal_kind; NEW.archived_principal_id := principal_id;+ END IF;+ RETURN NEW;+END $fn$`;++export const WRITE_ATTRIBUTION_SCHEMA_STATEMENTS = [+ addColumns('pages', REVISION_ATTRIBUTION_COLUMNS),+ addColumns('page_versions', VERSION_ATTRIBUTION_COLUMNS),+ ...ATTRIBUTED_TABLES.map(table => addColumns(table, ROW_ATTRIBUTION_COLUMNS)),+ STAMP_ROW_FUNCTION,+ STAMP_REVISION_FUNCTION,+ STAMP_VERSION_FUNCTION,+ ...ATTRIBUTED_TABLES.flatMap(table => [+ `DROP TRIGGER IF EXISTS gbrain_write_attribution ON ${table}`,+ `CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON ${table} FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()`,+ ]),+ `DROP TRIGGER IF EXISTS pages_revision_attribution ON pages`,+ `CREATE TRIGGER pages_revision_attribution BEFORE INSERT OR UPDATE ON pages FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_revision_attribution()`,+ `DROP TRIGGER IF EXISTS page_versions_write_attribution ON page_versions`,+ `CREATE TRIGGER page_versions_write_attribution BEFORE INSERT ON page_versions FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_version_attribution()`,+] as const;++export const WRITE_ATTRIBUTION_SCHEMA_SQL = `${WRITE_ATTRIBUTION_SCHEMA_STATEMENTS.join(';\n')};\n`;diff --git a/src/core/persistence/writer-guard-schema.ts b/src/core/persistence/writer-guard-schema.tsindex 81fddc4a7d..574de90dcc 100644--- a/src/core/persistence/writer-guard-schema.ts+++ b/src/core/persistence/writer-guard-schema.ts@@ -1,3 +1,5 @@+import { ROW_ATTRIBUTION_COLUMNS } from './attribution-schema.ts';+const ROW_ATTRIBUTION_KEYS = `ARRAY[${ROW_ATTRIBUTION_COLUMNS.map(column => `'${column}'`).join(',')}]`;/** Defense in depth for inventoried legacy writers. Manual SQL is outside the protocol. */export const MANAGED_WRITER_GUARD_SQL = `CREATE OR REPLACE FUNCTION gbrain_require_managed_writer() RETURNS trigger LANGUAGE plpgsql AS $fn$@@ -28,9 +30,10 @@ BEGINEND IF;IF TG_OP='DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF;ELSIF TG_TABLE_NAME IN ('facts','takes') AND TG_OP='UPDATE' THEN- row_data := row_data - ARRAY['embedding_model','embedded_text_hash'];- old_data := old_data - ARRAY['embedding_model','embedded_text_hash'];- -- Embedding completion and retrieval telemetry are physical projections.+ row_data := row_data - ARRAY['embedding_model','embedded_text_hash'] - ${ROW_ATTRIBUTION_KEYS};+ old_data := old_data - ARRAY['embedding_model','embedded_text_hash'] - ${ROW_ATTRIBUTION_KEYS};+ -- Embedding completion, retrieval telemetry and write attribution+ -- (attribution-schema.ts; a journal backfill fills it) are physical projections.IF (row_data - ARRAY['embedding','embedded_at','last_retrieved_at','retrieval_count','updated_at'])= (old_data - ARRAY['embedding','embedded_at','last_retrieved_at','retrieval_count','updated_at']) THEN RETURN NEW; END IF;END IF;diff --git a/src/core/pglite-schema.generated.ts b/src/core/pglite-schema.generated.tsindex 24451f0f17..a0e4b4348f 100644--- a/src/core/pglite-schema.generated.ts+++ b/src/core/pglite-schema.generated.ts@@ -1229,9 +1229,10 @@ BEGINEND IF;IF TG_OP='DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF;ELSIF TG_TABLE_NAME IN ('facts','takes') AND TG_OP='UPDATE' THEN- row_data := row_data - ARRAY['embedding_model','embedded_text_hash'];- old_data := old_data - ARRAY['embedding_model','embedded_text_hash'];- -- Embedding completion and retrieval telemetry are physical projections.+ row_data := row_data - ARRAY['embedding_model','embedded_text_hash'] - ARRAY['write_request_id','write_principal_kind','write_principal_id','last_write_request_id','last_write_principal_kind','last_write_principal_id','last_written_at'];+ old_data := old_data - ARRAY['embedding_model','embedded_text_hash'] - ARRAY['write_request_id','write_principal_kind','write_principal_id','last_write_request_id','last_write_principal_kind','last_write_principal_id','last_written_at'];+ -- Embedding completion, retrieval telemetry and write attribution+ -- (attribution-schema.ts; a journal backfill fills it) are physical projections.IF (row_data - ARRAY['embedding','embedded_at','last_retrieved_at','retrieval_count','updated_at'])= (old_data - ARRAY['embedding','embedded_at','last_retrieved_at','retrieval_count','updated_at']) THEN RETURN NEW; END IF;END IF;@@ -1759,6 +1760,7 @@ DO \$rls\$ BEGINEND \$rls\$;+`;export function getPGLiteSchema(diff --git a/src/core/schema-embedded.generated.ts b/src/core/schema-embedded.generated.tsindex 278e3da555..6f867314f1 100644--- a/src/core/schema-embedded.generated.ts+++ b/src/core/schema-embedded.generated.ts@@ -1932,9 +1932,10 @@ BEGINEND IF;IF TG_OP='DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF;ELSIF TG_TABLE_NAME IN ('facts','takes') AND TG_OP='UPDATE' THEN- row_data := row_data - ARRAY['embedding_model','embedded_text_hash'];- old_data := old_data - ARRAY['embedding_model','embedded_text_hash'];- -- Embedding completion and retrieval telemetry are physical projections.+ row_data := row_data - ARRAY['embedding_model','embedded_text_hash'] - ARRAY['write_request_id','write_principal_kind','write_principal_id','last_write_request_id','last_write_principal_kind','last_write_principal_id','last_written_at'];+ old_data := old_data - ARRAY['embedding_model','embedded_text_hash'] - ARRAY['write_request_id','write_principal_kind','write_principal_id','last_write_request_id','last_write_principal_kind','last_write_principal_id','last_written_at'];+ -- Embedding completion, retrieval telemetry and write attribution+ -- (attribution-schema.ts; a journal backfill fills it) are physical projections.IF (row_data - ARRAY['embedding','embedded_at','last_retrieved_at','retrieval_count','updated_at'])= (old_data - ARRAY['embedding','embedded_at','last_retrieved_at','retrieval_count','updated_at']) THEN RETURN NEW; END IF;END IF;@@ -2481,4 +2482,5 @@ END \$rls\$;ALTER TABLE sources ADD COLUMN IF NOT EXISTS upstream_checked_at TIMESTAMPTZ;ALTER TABLE sources ADD COLUMN IF NOT EXISTS upstream_commit TEXT;ALTER TABLE sources ADD COLUMN IF NOT EXISTS upstream_behind INTEGER;+`;diff --git a/src/core/schema-migrations/registry.generated.ts b/src/core/schema-migrations/registry.generated.tsindex a15abb5b68..6e717c42b0 100644--- a/src/core/schema-migrations/registry.generated.ts+++ b/src/core/schema-migrations/registry.generated.ts@@ -193,6 +193,7 @@ import { v189 } from './v189-pages-credential-projection-pending.ts';import { v190 } from './v190-sources-upstream-observation.ts';import { v191 } from './v191-alias-source-cascade.ts';import { v192 } from './v192-take-embedding-identity.ts';+import { v193 } from './v193-f1-write-attribution.ts';// Array order is historical (see HISTORICAL_ARRAY_ORDER in the generator); the// runner sorts by version before applying.@@ -384,4 +385,5 @@ export const MIGRATIONS: Migration[] = [v190,v191,v192,+ v193,];diff --git a/src/core/schema-migrations/v193-f1-write-attribution.ts b/src/core/schema-migrations/v193-f1-write-attribution.tsnew file mode 100644index 0000000000..b0740be388--- /dev/null+++ b/src/core/schema-migrations/v193-f1-write-attribution.ts@@ -0,0 +1,21 @@+import type { Migration } from './types.ts';+import { WRITE_ATTRIBUTION_SCHEMA_SQL } from '../persistence/attribution-schema.ts';+import { MANAGED_WRITER_GUARD_SQL } from '../persistence/writer-guard-schema.ts';++// Applied by src/core/migrate.ts on the next initSchema(); see docs/ENGINES.md+// ("Canonical schema sources") for when schema.sql or a TS fragment also changes.+//+// Foundations 1 (F1) write attribution: nullable attribution columns on pages,+// page_versions, facts, takes and timeline_entries plus the BEFORE ROW+// triggers that stamp them from the coordinator's transaction-local actor+// (DDL in src/core/persistence/attribution-schema.ts). No backfill: existing+// rows read as "unrecorded". The writer guard is re-installed so an+// attribution-only facts/takes update is not a canonical change.+// Placeholder version: the Foundations integrator renumbers it.+export const v193: Migration = {+ version: 193,+ name: 'f1_write_attribution',+ idempotent: true,+ sql: `${WRITE_ATTRIBUTION_SCHEMA_SQL}+ ${MANAGED_WRITER_GUARD_SQL}`,+};diff --git a/src/schema.sql b/src/schema.sqlindex a557d8d739..306fc3a238 100644--- a/src/schema.sql+++ b/src/schema.sql@@ -1928,9 +1928,10 @@ BEGINEND IF;IF TG_OP='DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF;ELSIF TG_TABLE_NAME IN ('facts','takes') AND TG_OP='UPDATE' THEN- row_data := row_data - ARRAY['embedding_model','embedded_text_hash'];- old_data := old_data - ARRAY['embedding_model','embedded_text_hash'];- -- Embedding completion and retrieval telemetry are physical projections.+ row_data := row_data - ARRAY['embedding_model','embedded_text_hash'] - ARRAY['write_request_id','write_principal_kind','write_principal_id','last_write_request_id','last_write_principal_kind','last_write_principal_id','last_written_at'];+ old_data := old_data - ARRAY['embedding_model','embedded_text_hash'] - ARRAY['write_request_id','write_principal_kind','write_principal_id','last_write_request_id','last_write_principal_kind','last_write_principal_id','last_written_at'];+ -- Embedding completion, retrieval telemetry and write attribution+ -- (attribution-schema.ts; a journal backfill fills it) are physical projections.IF (row_data - ARRAY['embedding','embedded_at','last_retrieved_at','retrieval_count','updated_at'])= (old_data - ARRAY['embedding','embedded_at','last_retrieved_at','retrieval_count','updated_at']) THEN RETURN NEW; END IF;END IF;@@ -2477,3 +2478,4 @@ END $rls$;ALTER TABLE sources ADD COLUMN IF NOT EXISTS upstream_checked_at TIMESTAMPTZ;ALTER TABLE sources ADD COLUMN IF NOT EXISTS upstream_commit TEXT;ALTER TABLE sources ADD COLUMN IF NOT EXISTS upstream_behind INTEGER;+diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.jsonindex 7bb9733603..38be677957 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json@@ -304,8 +304,11 @@"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf","gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa","gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e35a67bb4bbcb2555e88ff14c0be82245d5090062da28cf4a63eb13150089b55",+ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=763764b9806792f869d68bb422dcdc0ad3498f975799c55e3823123c5f1fb9a5","gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",+ "gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",+ "gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",+ "gbrain_stamp_write_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=022ddf5754968b6a6647f32a0c42db94b7aa4e680e739b79c1ec8931d06cfb92","update_chunk_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e12c37d5489202aaf708560db42e6c0c7c8886d198d412e1c5d915c3ae782559","update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=1ff2515e6d6626907c0a6b660e31bd13bf51fe38fc585f7380d57ed746dc3357"},@@ -1530,7 +1533,14 @@"30 value_hash text/text NULL","31 dim_status text/text NULL","32 embedding_model text/text NULL",- "33 embedded_text_hash text/text NULL"+ "33 embedded_text_hash text/text NULL",+ "34 write_request_id uuid/uuid NULL",+ "35 write_principal_kind text/text NULL",+ "36 write_principal_id text/text NULL",+ "37 last_write_request_id uuid/uuid NULL",+ "38 last_write_principal_kind text/text NULL",+ "39 last_write_principal_id text/text NULL",+ "40 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1940,7 +1950,13 @@"9 type text/text NULL","10 tags jsonb/jsonb NULL","11 is_deleted boolean/bool NULL",- "12 source_path text/text NULL"+ "12 source_path text/text NULL",+ "13 write_request_id uuid/uuid NULL",+ "14 write_principal_kind text/text NULL",+ "15 write_principal_id text/text NULL",+ "16 archived_write_request_id uuid/uuid NULL",+ "17 archived_principal_kind text/text NULL",+ "18 archived_principal_id text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1989,7 +2005,10 @@"34 source_kind text/text NULL","35 embedding_signature text/text NULL","36 links_attendance_blocked_revision uuid/uuid NULL",- "37 links_attendance_blocked_at timestamp with time zone/timestamptz NULL"+ "37 links_attendance_blocked_at timestamp with time zone/timestamptz NULL",+ "38 revision_write_request_id uuid/uuid NULL",+ "39 revision_principal_kind text/text NULL",+ "40 revision_principal_id text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -2560,7 +2579,14 @@"22 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()","23 resolved_quality text/text NULL","24 embedding_model text/text NULL",- "25 embedded_text_hash text/text NULL"+ "25 embedded_text_hash text/text NULL",+ "26 write_request_id uuid/uuid NULL",+ "27 write_principal_kind text/text NULL",+ "28 write_principal_id text/text NULL",+ "29 last_write_request_id uuid/uuid NULL",+ "30 last_write_principal_kind text/text NULL",+ "31 last_write_principal_id text/text NULL",+ "32 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -2588,7 +2614,14 @@"5 summary text/text NOT NULL","6 detail text/text NOT NULL DEFAULT ''::text","7 event_page_id integer/int4 NULL",- "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "9 write_request_id uuid/uuid NULL",+ "10 write_principal_kind text/text NULL",+ "11 write_principal_id text/text NULL",+ "12 last_write_request_id uuid/uuid NULL",+ "13 last_write_principal_kind text/text NULL",+ "14 last_write_principal_id text/text NULL",+ "15 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"}@@ -2596,15 +2629,18 @@"triggers": {"content_chunks.chunk_search_vector_trigger": "CREATE TRIGGER chunk_search_vector_trigger BEFORE INSERT OR UPDATE OF chunk_text, doc_comment, symbol_name_qualified ON public.content_chunks FOR EACH ROW EXECUTE FUNCTION update_chunk_search_vector()","facts.facts_preserve_withdrawal": "CREATE TRIGGER facts_preserve_withdrawal BEFORE INSERT OR UPDATE OF fact, source_id, visibility, entity_slug, expired_at ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_preserve_fact_withdrawal()",+ "facts.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","facts.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","minion_jobs.minion_queue_protocol": "CREATE TRIGGER minion_queue_protocol BEFORE INSERT OR UPDATE ON public.minion_jobs FOR EACH ROW EXECUTE FUNCTION enforce_minion_queue_protocol()","page_aliases.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.page_aliases FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()",+ "page_versions.page_versions_write_attribution": "CREATE TRIGGER page_versions_write_attribution BEFORE INSERT ON public.page_versions FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_version_attribution()","pages.bump_page_generation_clock_trg": "CREATE TRIGGER bump_page_generation_clock_trg AFTER INSERT OR DELETE OR UPDATE ON public.pages FOR EACH STATEMENT EXECUTE FUNCTION bump_page_generation_clock_fn()","pages.bump_page_generation_trg": "CREATE TRIGGER bump_page_generation_trg BEFORE INSERT OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION bump_page_generation_fn()","pages.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","pages.pages_clear_atom_scan_state": "CREATE TRIGGER pages_clear_atom_scan_state AFTER UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_clear_atom_page_state()","pages.pages_knowledge_revision": "CREATE TRIGGER pages_knowledge_revision BEFORE UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_advance_page_revision()","pages.pages_projection_queue": "CREATE TRIGGER pages_projection_queue AFTER INSERT OR DELETE OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_queue_page_projection()",+ "pages.pages_revision_attribution": "CREATE TRIGGER pages_revision_attribution BEFORE INSERT OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_revision_attribution()","pages.trg_pages_search_vector": "CREATE TRIGGER trg_pages_search_vector BEFORE INSERT OR UPDATE OF title, timeline ON public.pages FOR EACH ROW EXECUTE FUNCTION update_page_search_vector()","persistence_brain.gbrain_protocol_activation": "CREATE TRIGGER gbrain_protocol_activation BEFORE UPDATE ON public.persistence_brain FOR EACH ROW EXECUTE FUNCTION gbrain_guard_protocol_activation()","persistence_effects.gbrain_effect_protocol": "CREATE TRIGGER gbrain_effect_protocol BEFORE INSERT OR DELETE OR UPDATE ON public.persistence_effects FOR EACH ROW EXECUTE FUNCTION gbrain_guard_effect_protocol()",@@ -2617,7 +2653,9 @@"sources.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.sources FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","tags.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","tags.tags_knowledge_revision": "CREATE TRIGGER tags_knowledge_revision AFTER INSERT OR DELETE OR UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION gbrain_advance_tag_revision()",+ "takes.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.takes FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","takes.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.takes FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()",+ "timeline_entries.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.timeline_entries FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","timeline_entries.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.timeline_entries FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()"},"viewColumns": {diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.jsonindex 7447ae5006..8b45a98900 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json@@ -304,8 +304,11 @@"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf","gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa","gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e35a67bb4bbcb2555e88ff14c0be82245d5090062da28cf4a63eb13150089b55",+ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=763764b9806792f869d68bb422dcdc0ad3498f975799c55e3823123c5f1fb9a5","gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",+ "gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",+ "gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",+ "gbrain_stamp_write_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=022ddf5754968b6a6647f32a0c42db94b7aa4e680e739b79c1ec8931d06cfb92","update_chunk_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e099e8a1d30bd74b7632b6055d3edffe753c00c00183e3bdac34d28d23347555","update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=078bd418f597924b56e631887aaddc41d98c231b3d27c6a52a9460b0ef252dd9"},@@ -1530,7 +1533,14 @@"30 value_hash text/text NULL","31 dim_status text/text NULL","32 embedding_model text/text NULL",- "33 embedded_text_hash text/text NULL"+ "33 embedded_text_hash text/text NULL",+ "34 write_request_id uuid/uuid NULL",+ "35 write_principal_kind text/text NULL",+ "36 write_principal_id text/text NULL",+ "37 last_write_request_id uuid/uuid NULL",+ "38 last_write_principal_kind text/text NULL",+ "39 last_write_principal_id text/text NULL",+ "40 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1940,7 +1950,13 @@"9 type text/text NULL","10 tags jsonb/jsonb NULL","11 is_deleted boolean/bool NULL",- "12 source_path text/text NULL"+ "12 source_path text/text NULL",+ "13 write_request_id uuid/uuid NULL",+ "14 write_principal_kind text/text NULL",+ "15 write_principal_id text/text NULL",+ "16 archived_write_request_id uuid/uuid NULL",+ "17 archived_principal_kind text/text NULL",+ "18 archived_principal_id text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1989,7 +2005,10 @@"34 source_kind text/text NULL","35 embedding_signature text/text NULL","36 links_attendance_blocked_revision uuid/uuid NULL",- "37 links_attendance_blocked_at timestamp with time zone/timestamptz NULL"+ "37 links_attendance_blocked_at timestamp with time zone/timestamptz NULL",+ "38 revision_write_request_id uuid/uuid NULL",+ "39 revision_principal_kind text/text NULL",+ "40 revision_principal_id text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -2560,7 +2579,14 @@"22 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()","23 resolved_quality text/text NULL","24 embedding_model text/text NULL",- "25 embedded_text_hash text/text NULL"+ "25 embedded_text_hash text/text NULL",+ "26 write_request_id uuid/uuid NULL",+ "27 write_principal_kind text/text NULL",+ "28 write_principal_id text/text NULL",+ "29 last_write_request_id uuid/uuid NULL",+ "30 last_write_principal_kind text/text NULL",+ "31 last_write_principal_id text/text NULL",+ "32 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -2588,7 +2614,14 @@"5 summary text/text NOT NULL","6 detail text/text NOT NULL DEFAULT ''::text","7 event_page_id integer/int4 NULL",- "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "9 write_request_id uuid/uuid NULL",+ "10 write_principal_kind text/text NULL",+ "11 write_principal_id text/text NULL",+ "12 last_write_request_id uuid/uuid NULL",+ "13 last_write_principal_kind text/text NULL",+ "14 last_write_principal_id text/text NULL",+ "15 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"}@@ -2596,15 +2629,18 @@"triggers": {"content_chunks.chunk_search_vector_trigger": "CREATE TRIGGER chunk_search_vector_trigger BEFORE INSERT OR UPDATE OF chunk_text, doc_comment, symbol_name_qualified ON public.content_chunks FOR EACH ROW EXECUTE FUNCTION update_chunk_search_vector()","facts.facts_preserve_withdrawal": "CREATE TRIGGER facts_preserve_withdrawal BEFORE INSERT OR UPDATE OF fact, source_id, visibility, entity_slug, expired_at ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_preserve_fact_withdrawal()",+ "facts.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","facts.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","minion_jobs.minion_queue_protocol": "CREATE TRIGGER minion_queue_protocol BEFORE INSERT OR UPDATE ON public.minion_jobs FOR EACH ROW EXECUTE FUNCTION enforce_minion_queue_protocol()","page_aliases.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.page_aliases FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()",+ "page_versions.page_versions_write_attribution": "CREATE TRIGGER page_versions_write_attribution BEFORE INSERT ON public.page_versions FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_version_attribution()","pages.bump_page_generation_clock_trg": "CREATE TRIGGER bump_page_generation_clock_trg AFTER INSERT OR DELETE OR UPDATE ON public.pages FOR EACH STATEMENT EXECUTE FUNCTION bump_page_generation_clock_fn()","pages.bump_page_generation_trg": "CREATE TRIGGER bump_page_generation_trg BEFORE INSERT OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION bump_page_generation_fn()","pages.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","pages.pages_clear_atom_scan_state": "CREATE TRIGGER pages_clear_atom_scan_state AFTER UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_clear_atom_page_state()","pages.pages_knowledge_revision": "CREATE TRIGGER pages_knowledge_revision BEFORE UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_advance_page_revision()","pages.pages_projection_queue": "CREATE TRIGGER pages_projection_queue AFTER INSERT OR DELETE OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_queue_page_projection()",+ "pages.pages_revision_attribution": "CREATE TRIGGER pages_revision_attribution BEFORE INSERT OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_revision_attribution()","pages.trg_pages_search_vector": "CREATE TRIGGER trg_pages_search_vector BEFORE INSERT OR UPDATE OF title, timeline ON public.pages FOR EACH ROW EXECUTE FUNCTION update_page_search_vector()","persistence_brain.gbrain_protocol_activation": "CREATE TRIGGER gbrain_protocol_activation BEFORE UPDATE ON public.persistence_brain FOR EACH ROW EXECUTE FUNCTION gbrain_guard_protocol_activation()","persistence_effects.gbrain_effect_protocol": "CREATE TRIGGER gbrain_effect_protocol BEFORE INSERT OR DELETE OR UPDATE ON public.persistence_effects FOR EACH ROW EXECUTE FUNCTION gbrain_guard_effect_protocol()",@@ -2617,7 +2653,9 @@"sources.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.sources FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","tags.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","tags.tags_knowledge_revision": "CREATE TRIGGER tags_knowledge_revision AFTER INSERT OR DELETE OR UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION gbrain_advance_tag_revision()",+ "takes.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.takes FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","takes.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.takes FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()",+ "timeline_entries.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.timeline_entries FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","timeline_entries.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.timeline_entries FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()"},"viewColumns": {diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.jsonindex c228f4da8d..abfebcbf41 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json@@ -304,8 +304,11 @@"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf","gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa","gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e35a67bb4bbcb2555e88ff14c0be82245d5090062da28cf4a63eb13150089b55",+ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=763764b9806792f869d68bb422dcdc0ad3498f975799c55e3823123c5f1fb9a5","gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",+ "gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",+ "gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",+ "gbrain_stamp_write_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=022ddf5754968b6a6647f32a0c42db94b7aa4e680e739b79c1ec8931d06cfb92","update_chunk_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e12c37d5489202aaf708560db42e6c0c7c8886d198d412e1c5d915c3ae782559","update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=1ff2515e6d6626907c0a6b660e31bd13bf51fe38fc585f7380d57ed746dc3357"},@@ -1526,7 +1529,14 @@"30 value_hash text/text NULL","31 dim_status text/text NULL","32 embedding_model text/text NULL",- "33 embedded_text_hash text/text NULL"+ "33 embedded_text_hash text/text NULL",+ "34 write_request_id uuid/uuid NULL",+ "35 write_principal_kind text/text NULL",+ "36 write_principal_id text/text NULL",+ "37 last_write_request_id uuid/uuid NULL",+ "38 last_write_principal_kind text/text NULL",+ "39 last_write_principal_id text/text NULL",+ "40 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1936,7 +1946,13 @@"9 type text/text NULL","10 tags jsonb/jsonb NULL","11 is_deleted boolean/bool NULL",- "12 source_path text/text NULL"+ "12 source_path text/text NULL",+ "13 write_request_id uuid/uuid NULL",+ "14 write_principal_kind text/text NULL",+ "15 write_principal_id text/text NULL",+ "16 archived_write_request_id uuid/uuid NULL",+ "17 archived_principal_kind text/text NULL",+ "18 archived_principal_id text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1985,7 +2001,10 @@"34 source_kind text/text NULL","35 embedding_signature text/text NULL","36 links_attendance_blocked_revision uuid/uuid NULL",- "37 links_attendance_blocked_at timestamp with time zone/timestamptz NULL"+ "37 links_attendance_blocked_at timestamp with time zone/timestamptz NULL",+ "38 revision_write_request_id uuid/uuid NULL",+ "39 revision_principal_kind text/text NULL",+ "40 revision_principal_id text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -2556,7 +2575,14 @@"23 resolved_quality text/text NULL","24 embedding USER-DEFINED/vector NULL","25 embedding_model text/text NULL",- "26 embedded_text_hash text/text NULL"+ "26 embedded_text_hash text/text NULL",+ "27 write_request_id uuid/uuid NULL",+ "28 write_principal_kind text/text NULL",+ "29 write_principal_id text/text NULL",+ "30 last_write_request_id uuid/uuid NULL",+ "31 last_write_principal_kind text/text NULL",+ "32 last_write_principal_id text/text NULL",+ "33 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -2584,7 +2610,14 @@"5 summary text/text NOT NULL","6 detail text/text NOT NULL DEFAULT ''::text","7 event_page_id integer/int4 NULL",- "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "9 write_request_id uuid/uuid NULL",+ "10 write_principal_kind text/text NULL",+ "11 write_principal_id text/text NULL",+ "12 last_write_request_id uuid/uuid NULL",+ "13 last_write_principal_kind text/text NULL",+ "14 last_write_principal_id text/text NULL",+ "15 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"}@@ -2592,15 +2625,18 @@"triggers": {"content_chunks.chunk_search_vector_trigger": "CREATE TRIGGER chunk_search_vector_trigger BEFORE INSERT OR UPDATE OF chunk_text, doc_comment, symbol_name_qualified ON public.content_chunks FOR EACH ROW EXECUTE FUNCTION update_chunk_search_vector()","facts.facts_preserve_withdrawal": "CREATE TRIGGER facts_preserve_withdrawal BEFORE INSERT OR UPDATE OF fact, source_id, visibility, entity_slug, expired_at ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_preserve_fact_withdrawal()",+ "facts.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","facts.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","minion_jobs.minion_queue_protocol": "CREATE TRIGGER minion_queue_protocol BEFORE INSERT OR UPDATE ON public.minion_jobs FOR EACH ROW EXECUTE FUNCTION enforce_minion_queue_protocol()","page_aliases.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.page_aliases FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()",+ "page_versions.page_versions_write_attribution": "CREATE TRIGGER page_versions_write_attribution BEFORE INSERT ON public.page_versions FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_version_attribution()","pages.bump_page_generation_clock_trg": "CREATE TRIGGER bump_page_generation_clock_trg AFTER INSERT OR DELETE OR UPDATE ON public.pages FOR EACH STATEMENT EXECUTE FUNCTION bump_page_generation_clock_fn()","pages.bump_page_generation_trg": "CREATE TRIGGER bump_page_generation_trg BEFORE INSERT OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION bump_page_generation_fn()","pages.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","pages.pages_clear_atom_scan_state": "CREATE TRIGGER pages_clear_atom_scan_state AFTER UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_clear_atom_page_state()","pages.pages_knowledge_revision": "CREATE TRIGGER pages_knowledge_revision BEFORE UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_advance_page_revision()","pages.pages_projection_queue": "CREATE TRIGGER pages_projection_queue AFTER INSERT OR DELETE OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_queue_page_projection()",+ "pages.pages_revision_attribution": "CREATE TRIGGER pages_revision_attribution BEFORE INSERT OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_revision_attribution()","pages.trg_pages_search_vector": "CREATE TRIGGER trg_pages_search_vector BEFORE INSERT OR UPDATE OF title, timeline ON public.pages FOR EACH ROW EXECUTE FUNCTION update_page_search_vector()","persistence_brain.gbrain_protocol_activation": "CREATE TRIGGER gbrain_protocol_activation BEFORE UPDATE ON public.persistence_brain FOR EACH ROW EXECUTE FUNCTION gbrain_guard_protocol_activation()","persistence_effects.gbrain_effect_protocol": "CREATE TRIGGER gbrain_effect_protocol BEFORE INSERT OR DELETE OR UPDATE ON public.persistence_effects FOR EACH ROW EXECUTE FUNCTION gbrain_guard_effect_protocol()",@@ -2613,7 +2649,9 @@"sources.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.sources FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","tags.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","tags.tags_knowledge_revision": "CREATE TRIGGER tags_knowledge_revision AFTER INSERT OR DELETE OR UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION gbrain_advance_tag_revision()",+ "takes.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.takes FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","takes.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.takes FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()",+ "timeline_entries.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.timeline_entries FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","timeline_entries.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.timeline_entries FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()"},"viewColumns": {diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json b/test/fixtures/goldens/catalog/pglite-schema-blob-default.jsonindex 5713375a5c..59ac8a4295 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json@@ -239,7 +239,7 @@"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9","gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf","gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e35a67bb4bbcb2555e88ff14c0be82245d5090062da28cf4a63eb13150089b55",+ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=763764b9806792f869d68bb422dcdc0ad3498f975799c55e3823123c5f1fb9a5","gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058","update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=8e2e253471f22c3e70b2fa2e67ba9162ee3d2c764d175cb5b674db2b907d1e9d"},diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.jsonindex df29c05ed7..bf651e0674 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json@@ -239,7 +239,7 @@"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9","gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf","gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e35a67bb4bbcb2555e88ff14c0be82245d5090062da28cf4a63eb13150089b55",+ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=763764b9806792f869d68bb422dcdc0ad3498f975799c55e3823123c5f1fb9a5","gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058","update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=3d98cc6ce4387bd742c1588ddc2133d036c7c5c8c64f7d33d1909c9ae44e73a6"},diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.jsonindex 3a97f0e912..c78478dd89 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json@@ -239,7 +239,7 @@"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9","gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf","gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e35a67bb4bbcb2555e88ff14c0be82245d5090062da28cf4a63eb13150089b55",+ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=763764b9806792f869d68bb422dcdc0ad3498f975799c55e3823123c5f1fb9a5","gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058","update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=8e2e253471f22c3e70b2fa2e67ba9162ee3d2c764d175cb5b674db2b907d1e9d"},diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.jsonindex 62e8b3e37c..af9d0466d5 100644--- a/test/fixtures/goldens/migrations/records.json+++ b/test/fixtures/goldens/migrations/records.json@@ -1,6 +1,6 @@{"golden": {- "count": 187,+ "count": 188,"gaps": [17,18,@@ -28,7 +28,7 @@"slugifyPath": "401dbca23580865d8b168dd8d84db4a6c708c6610d7cb61abafc7d0ee9809063","verifyProjectionStatistics": "59d9ccfea1c53384d8607874a51209a9c2dfd51b2b85a2cb6269fa4120faf1f3"},- "latest": 192,+ "latest": 193,"records": [{"handler": {@@ -2222,8 +2222,8 @@"idempotent": true,"name": "durable_concurrent_persistence","sql": {- "length": 8771,- "sha256": "2dab6c2b2b8c067470b95ee6dc9e126cc7223264bfd1e2d9dcf1124548b78614"+ "length": 9186,+ "sha256": "21a98206b5bbc4223d0aafcaaaeb674b528eb81df67e3ba2c70bc5ae530f1246"},"sqlFor": "absent","transaction": "absent",@@ -2287,8 +2287,8 @@"idempotent": true,"name": "managed_alias_and_source_checkpoint_guards","sql": {- "length": 3922,- "sha256": "d25f72b13d5e79d9eccb7f6b80dcf7cd5a3b9f9fe1e939beb693acfa8bb16cce"+ "length": 4337,+ "sha256": "8866c1c22107bcfbd69ad9b11eb75771fd1c5fbdf96eb580b1e4ed1ba004f531"},"sqlFor": "absent","transaction": "absent",@@ -2446,8 +2446,8 @@"idempotent": true,"name": "fact_embedding_identity","sql": {- "length": 4067,- "sha256": "08197d572339bb3303d318d24c021d6b97e9aa5fc77e7f6910e0bc0447f367c1"+ "length": 4482,+ "sha256": "04a5eb5a5338d5b4db9cc2947316b49d6fa3330e776bef81f209a78f7821c56d"},"sqlFor": "absent","transaction": "absent",@@ -2845,13 +2845,26 @@"idempotent": true,"name": "take_embedding_identity","sql": {- "length": 4067,- "sha256": "be92a11e45a3b9cd7fcdc51c9372daa1c362c3af99d6d827476933701bab4ddf"+ "length": 4482,+ "sha256": "c3192c2ababd73606034a0bc4d2b384ef7f42bdf1c2916e7349223d162442549"},"sqlFor": "absent","transaction": "absent","verify": "absent","version": 192+ },+ {+ "handler": "absent",+ "idempotent": true,+ "name": "f1_write_attribution",+ "sql": {+ "length": 13179,+ "sha256": "14a8b29806b434b992d5fa365c1cdb3e55b4e39f144fdd1630c660b8151c410c"+ },+ "sqlFor": "absent",+ "transaction": "absent",+ "verify": "absent",+ "version": 193}],"versions": [@@ -3041,7 +3054,8 @@189,190,191,- 192+ 192,+ 193]},"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 9d2f29e0c0..9ef9335a5d 100644--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json@@ -304,8 +304,11 @@"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf","gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa","gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=6c544b9c129b6a17dcabeb5ee8d44a2b0e0af9d02ca3fe47c7d7f22ec313042c",- "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e35a67bb4bbcb2555e88ff14c0be82245d5090062da28cf4a63eb13150089b55",+ "gbrain_require_managed_writer()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=763764b9806792f869d68bb422dcdc0ad3498f975799c55e3823123c5f1fb9a5","gbrain_require_persistence_protocol(required integer)": "RETURNS void kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=af07b7fac60dec0a4fe568217931ac449d32f73b3a53a047b3b02a5f59cb5058",+ "gbrain_stamp_revision_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=d446ed1145d8bb9c93cb0ca4aa076a5dc7a5fe07b3e79518adaf1b17b0a51216",+ "gbrain_stamp_version_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=1b28a0e5769198d86490dc20b2aee80b7e6595670428a63ac9c6825cd2a35b10",+ "gbrain_stamp_write_attribution()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=022ddf5754968b6a6647f32a0c42db94b7aa4e680e739b79c1ec8931d06cfb92","update_chunk_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e12c37d5489202aaf708560db42e6c0c7c8886d198d412e1c5d915c3ae782559","update_page_search_vector()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=8e2e253471f22c3e70b2fa2e67ba9162ee3d2c764d175cb5b674db2b907d1e9d"},@@ -1530,7 +1533,14 @@"30 value_hash text/text NULL","31 dim_status text/text NULL","32 embedding_model text/text NULL",- "33 embedded_text_hash text/text NULL"+ "33 embedded_text_hash text/text NULL",+ "34 write_request_id uuid/uuid NULL",+ "35 write_principal_kind text/text NULL",+ "36 write_principal_id text/text NULL",+ "37 last_write_request_id uuid/uuid NULL",+ "38 last_write_principal_kind text/text NULL",+ "39 last_write_principal_id text/text NULL",+ "40 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1940,7 +1950,13 @@"9 type text/text NULL","10 tags jsonb/jsonb NULL","11 is_deleted boolean/bool NULL",- "12 source_path text/text NULL"+ "12 source_path text/text NULL",+ "13 write_request_id uuid/uuid NULL",+ "14 write_principal_kind text/text NULL",+ "15 write_principal_id text/text NULL",+ "16 archived_write_request_id uuid/uuid NULL",+ "17 archived_principal_kind text/text NULL",+ "18 archived_principal_id text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1989,7 +2005,10 @@"34 source_kind text/text NULL","35 embedding_signature text/text NULL","36 links_attendance_blocked_revision uuid/uuid NULL",- "37 links_attendance_blocked_at timestamp with time zone/timestamptz NULL"+ "37 links_attendance_blocked_at timestamp with time zone/timestamptz NULL",+ "38 revision_write_request_id uuid/uuid NULL",+ "39 revision_principal_kind text/text NULL",+ "40 revision_principal_id text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -2560,7 +2579,14 @@"22 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()","23 resolved_quality text/text NULL","24 embedding_model text/text NULL",- "25 embedded_text_hash text/text NULL"+ "25 embedded_text_hash text/text NULL",+ "26 write_request_id uuid/uuid NULL",+ "27 write_principal_kind text/text NULL",+ "28 write_principal_id text/text NULL",+ "29 last_write_request_id uuid/uuid NULL",+ "30 last_write_principal_kind text/text NULL",+ "31 last_write_principal_id text/text NULL",+ "32 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -2588,7 +2614,14 @@"5 summary text/text NOT NULL","6 detail text/text NOT NULL DEFAULT ''::text","7 event_page_id integer/int4 NULL",- "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "9 write_request_id uuid/uuid NULL",+ "10 write_principal_kind text/text NULL",+ "11 write_principal_id text/text NULL",+ "12 last_write_request_id uuid/uuid NULL",+ "13 last_write_principal_kind text/text NULL",+ "14 last_write_principal_id text/text NULL",+ "15 last_written_at timestamp with time zone/timestamptz NULL"],"flags": "relkind=r rls=false force_rls=false"}@@ -2596,15 +2629,18 @@"triggers": {"content_chunks.chunk_search_vector_trigger": "CREATE TRIGGER chunk_search_vector_trigger BEFORE INSERT OR UPDATE OF chunk_text, doc_comment, symbol_name_qualified ON public.content_chunks FOR EACH ROW EXECUTE FUNCTION update_chunk_search_vector()","facts.facts_preserve_withdrawal": "CREATE TRIGGER facts_preserve_withdrawal BEFORE INSERT OR UPDATE OF fact, source_id, visibility, entity_slug, expired_at ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_preserve_fact_withdrawal()",+ "facts.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","facts.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.facts FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","minion_jobs.minion_queue_protocol": "CREATE TRIGGER minion_queue_protocol BEFORE INSERT OR UPDATE ON public.minion_jobs FOR EACH ROW EXECUTE FUNCTION enforce_minion_queue_protocol()","page_aliases.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.page_aliases FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()",+ "page_versions.page_versions_write_attribution": "CREATE TRIGGER page_versions_write_attribution BEFORE INSERT ON public.page_versions FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_version_attribution()","pages.bump_page_generation_clock_trg": "CREATE TRIGGER bump_page_generation_clock_trg AFTER INSERT OR DELETE OR UPDATE ON public.pages FOR EACH STATEMENT EXECUTE FUNCTION bump_page_generation_clock_fn()","pages.bump_page_generation_trg": "CREATE TRIGGER bump_page_generation_trg BEFORE INSERT OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION bump_page_generation_fn()","pages.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","pages.pages_clear_atom_scan_state": "CREATE TRIGGER pages_clear_atom_scan_state AFTER UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_clear_atom_page_state()","pages.pages_knowledge_revision": "CREATE TRIGGER pages_knowledge_revision BEFORE UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_advance_page_revision()","pages.pages_projection_queue": "CREATE TRIGGER pages_projection_queue AFTER INSERT OR DELETE OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_queue_page_projection()",+ "pages.pages_revision_attribution": "CREATE TRIGGER pages_revision_attribution BEFORE INSERT OR UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_revision_attribution()","pages.trg_pages_search_vector": "CREATE TRIGGER trg_pages_search_vector BEFORE INSERT OR UPDATE OF title, timeline ON public.pages FOR EACH ROW EXECUTE FUNCTION update_page_search_vector()","persistence_brain.gbrain_protocol_activation": "CREATE TRIGGER gbrain_protocol_activation BEFORE UPDATE ON public.persistence_brain FOR EACH ROW EXECUTE FUNCTION gbrain_guard_protocol_activation()","persistence_effects.gbrain_effect_protocol": "CREATE TRIGGER gbrain_effect_protocol BEFORE INSERT OR DELETE OR UPDATE ON public.persistence_effects FOR EACH ROW EXECUTE FUNCTION gbrain_guard_effect_protocol()",@@ -2617,7 +2653,9 @@"sources.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.sources FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","tags.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()","tags.tags_knowledge_revision": "CREATE TRIGGER tags_knowledge_revision AFTER INSERT OR DELETE OR UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION gbrain_advance_tag_revision()",+ "takes.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.takes FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","takes.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.takes FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()",+ "timeline_entries.gbrain_write_attribution": "CREATE TRIGGER gbrain_write_attribution BEFORE INSERT OR UPDATE ON public.timeline_entries FOR EACH ROW EXECUTE FUNCTION gbrain_stamp_write_attribution()","timeline_entries.managed_writer_guard": "CREATE TRIGGER managed_writer_guard BEFORE INSERT OR DELETE OR UPDATE ON public.timeline_entries FOR EACH ROW EXECUTE FUNCTION gbrain_require_managed_writer()"},"viewColumns": {