Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Part 1 gate fixes: owner-phrase parity in the backend matrix, v243 bootstrap exemptions, regenerated upgrade-replay and doctor goldens
garrytanb5def80d20c5
diff --git a/scripts/e2e-backend-matrix.txt b/scripts/e2e-backend-matrix.txtindex e408a69ea0..bd82bf7cdd 100644--- a/scripts/e2e-backend-matrix.txt+++ b/scripts/e2e-backend-matrix.txt@@ -67,3 +67,4 @@ test/e2e/fts-cjk-boundary-postgres.test.tstest/e2e/oauth-client-registered-via-postgres.test.tstest/e2e/oauth-owner-consent-source-postgres.test.tstest/e2e/entity-names-parity-postgres.test.ts+test/e2e/owner-phrase-parity.test.tsdiff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.jsonindex 7c25f59bf4..11918451a2 100644--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json@@ -523,7 +523,7 @@},{"category": "ops",- "message": "RLS enabled on 134/134 public tables",+ "message": "RLS enabled on 137/137 public tables","name": "rls","status": "ok"},@@ -3608,7 +3608,7 @@},{"category": "ops",- "message": "RLS enabled on 134/134 public tables",+ "message": "RLS enabled on 137/137 public tables","name": "rls","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex c2ffa4f953..3d7170d9ef 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -2149,7 +2149,7 @@},{"category": "brain",- "message": "8 retrieval-affecting file(s) changed since HEAD: src/core/search/hybrid/degraded.ts, src/core/search/lean-rows.ts, src/core/search/mode-advice.ts, …. Re-run `gbrain eval run-all` after committing these changes.",+ "message": "No retrieval-affecting files changed in working tree.","name": "eval_drift","status": "ok"},diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.jsonindex 8723216ee8..1eabe5a28c 100644--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json@@ -124,7 +124,7 @@"links.links_assertion_tense_check": "c CHECK (((assertion_tense IS NULL) OR (assertion_tense = ANY (ARRAY['present'::text, 'past'::text]))))","links.links_from_page_id_fkey": "f FOREIGN KEY (from_page_id) REFERENCES pages(id) ON DELETE CASCADE","links.links_from_to_type_source_origin_unique": "u UNIQUE NULLS NOT DISTINCT (from_page_id, to_page_id, link_type, link_source, origin_page_id)",- "links.links_link_kind_check": "c CHECK (((link_kind IS NULL) OR (link_kind = ANY (ARRAY['plain'::text, 'typed_ner'::text]))))",+ "links.links_link_kind_check": "c CHECK (((link_kind IS NULL) OR (link_kind = ANY (ARRAY['plain'::text, 'typed_ner'::text, 'owner_phrase'::text]))))","links.links_link_source_check": "c CHECK (((link_source IS NULL) OR ((link_source ~ '^[a-z][a-z0-9]*(-[a-z0-9]+)*$'::text) AND (char_length(link_source) <= 64))))","links.links_origin_page_id_fkey": "f FOREIGN KEY (origin_page_id) REFERENCES pages(id) ON DELETE SET NULL","links.links_pkey": "p PRIMARY KEY (id)",@@ -201,6 +201,15 @@"open_loops.open_loops_pkey": "p PRIMARY KEY (id)","open_loops.open_loops_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","open_loops.open_loops_status_check": "c CHECK ((status = ANY (ARRAY['open'::text, 'done'::text, 'dropped'::text, 'stale'::text])))",+ "owner_phrase_page_state.owner_phrase_page_state_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE",+ "owner_phrase_page_state.owner_phrase_page_state_pkey": "p PRIMARY KEY (page_id)",+ "owner_phrase_page_state.owner_phrase_page_state_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "owner_phrase_status.owner_phrase_status_pkey": "p PRIMARY KEY (source_id)",+ "owner_phrase_status.owner_phrase_status_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "owner_phrase_status.owner_phrase_status_state_check": "c CHECK ((state = ANY (ARRAY['complete'::text, 'pending'::text, 'failed'::text])))",+ "owner_phrase_windows.owner_phrase_windows_pkey": "p PRIMARY KEY (id)",+ "owner_phrase_windows.owner_phrase_windows_private_page_id_fkey": "f FOREIGN KEY (private_page_id) REFERENCES pages(id) ON DELETE SET NULL",+ "owner_phrase_windows.owner_phrase_windows_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","page_aliases.page_aliases_origin_check": "c CHECK ((origin = ANY (ARRAY['frontmatter'::text, 'declared'::text, 'subject'::text])))","page_aliases.page_aliases_origin_uniq": "u UNIQUE (source_id, alias_norm, slug, origin)","page_aliases.page_aliases_pkey": "p PRIMARY KEY (id)",@@ -673,6 +682,15 @@"open_loops": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "owner_phrase_page_state": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],+ "owner_phrase_status": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],+ "owner_phrase_windows": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"page_aliases": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1132,6 +1150,12 @@"open_loops_pkey": "CREATE UNIQUE INDEX open_loops_pkey ON public.open_loops USING btree (id)","open_loops_status_idx": "CREATE INDEX open_loops_status_idx ON public.open_loops USING btree (source_id, status, last_activity_at DESC)","open_loops_thread_idx": "CREATE INDEX open_loops_thread_idx ON public.open_loops USING btree (source_id, thread_id) WHERE (status = 'open'::text)",+ "owner_phrase_page_state_pkey": "CREATE UNIQUE INDEX owner_phrase_page_state_pkey ON public.owner_phrase_page_state USING btree (page_id)",+ "owner_phrase_page_state_source_idx": "CREATE INDEX owner_phrase_page_state_source_idx ON public.owner_phrase_page_state USING btree (source_id)",+ "owner_phrase_status_pkey": "CREATE UNIQUE INDEX owner_phrase_status_pkey ON public.owner_phrase_status USING btree (source_id)",+ "owner_phrase_windows_accounts_idx": "CREATE INDEX owner_phrase_windows_accounts_idx ON public.owner_phrase_windows USING gin (account_slugs)",+ "owner_phrase_windows_group_idx": "CREATE INDEX owner_phrase_windows_group_idx ON public.owner_phrase_windows USING btree (source_id, group_key)",+ "owner_phrase_windows_pkey": "CREATE UNIQUE INDEX owner_phrase_windows_pkey ON public.owner_phrase_windows USING btree (id)","page_aliases_lookup_idx": "CREATE INDEX page_aliases_lookup_idx ON public.page_aliases USING btree (source_id, alias_norm)","page_aliases_origin_uniq": "CREATE UNIQUE INDEX page_aliases_origin_uniq ON public.page_aliases USING btree (source_id, alias_norm, slug, origin)","page_aliases_pkey": "CREATE UNIQUE INDEX page_aliases_pkey ON public.page_aliases USING btree (id)",@@ -1328,6 +1352,7 @@"minion_self_fix_log_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=minion_self_fix_log.id","oauth_grant_audit_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=oauth_grant_audit.id","open_loops_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=open_loops.id",+ "owner_phrase_windows_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=owner_phrase_windows.id","page_aliases_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=page_aliases.id","page_generation_clock_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=-","page_versions_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=page_versions.id",@@ -2509,6 +2534,61 @@],"flags": "relkind=r rls=false force_rls=false"},+ "owner_phrase_page_state": {+ "columns": [+ "1 page_id integer/int4 NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 revision uuid/uuid NULL",+ "4 version integer/int4 NOT NULL",+ "5 page_date date/date NULL",+ "6 readings ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "7 agent boolean/bool NOT NULL DEFAULT false",+ "8 cues jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "9 descriptors ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "10 hits jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "11 statements jsonb/jsonb NULL",+ "12 statements_key text/text NULL",+ "13 scanned_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },+ "owner_phrase_status": {+ "columns": [+ "1 source_id text/text NOT NULL",+ "2 state text/text NOT NULL",+ "3 generation bigint/int8 NOT NULL DEFAULT 0",+ "4 window_hash text/text NULL",+ "5 inputs_hash text/text NULL",+ "6 windows integer/int4 NOT NULL DEFAULT 0",+ "7 links integer/int4 NOT NULL DEFAULT 0",+ "8 documents integer/int4 NOT NULL DEFAULT 0",+ "9 unresolved integer/int4 NOT NULL DEFAULT 0",+ "10 ambiguous integer/int4 NOT NULL DEFAULT 0",+ "11 last_pass_at timestamp with time zone/timestamptz NULL",+ "12 error text/text NULL",+ "13 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },+ "owner_phrase_windows": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('owner_phrase_windows_id_seq'::regclass)",+ "2 source_id text/text NOT NULL",+ "3 group_key text/text NOT NULL",+ "4 account_slugs ARRAY/_text NOT NULL",+ "5 owner_key text/text NOT NULL",+ "6 owner_name text/text NOT NULL",+ "7 descriptors ARRAY/_text NOT NULL DEFAULT '{}'::text[]",+ "8 valid_from date/date NULL",+ "9 valid_to date/date NULL",+ "10 start_known boolean/bool NOT NULL",+ "11 evidence jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "12 evidence_page_ids ARRAY/_int4 NOT NULL DEFAULT '{}'::integer[]",+ "13 private_page_id integer/int4 NULL",+ "14 generation bigint/int8 NOT NULL DEFAULT 0"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"page_aliases": {"columns": ["1 id bigint/int8 NOT NULL DEFAULT nextval('page_aliases_id_seq'::regclass)",diff --git a/test/schema-bootstrap-coverage.test.ts b/test/schema-bootstrap-coverage.test.tsindex 9fc3242bb4..20cfd0b786 100644--- a/test/schema-bootstrap-coverage.test.ts+++ b/test/schema-bootstrap-coverage.test.ts@@ -1115,6 +1115,12 @@ const COLUMN_EXEMPTIONS = new Set<string>([// doctor reader probes for the column on older brains.'pages.links_attendance_blocked_revision','pages.links_attendance_blocked_at',+ // Owner phrases (v243): migration-only tables created with these columns in+ // the same migration; the ADD COLUMN IF NOT EXISTS lines only widen tables an+ // unreleased build created earlier. No schema blob references them.+ 'owner_phrase_page_state.statements',+ 'owner_phrase_page_state.statements_key',+ 'owner_phrase_status.inputs_hash',]);test('every ALTER TABLE ADD COLUMN in MIGRATIONS is covered by applyForwardReferenceBootstrap (column-only class)', async () => {