Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Classify page_label_guards in the graduation and deletion inventories and update the schema goldens
garrytan65f11efb82b5
diff --git a/src/core/deletion-inventory.ts b/src/core/deletion-inventory.tsindex e234c0d0ce..868c4ef99f 100644--- a/src/core/deletion-inventory.ts+++ b/src/core/deletion-inventory.ts@@ -133,6 +133,7 @@ const ROWS: readonly Row[] = [['page_embedding_budget', 'out_of_scope', 'no_memory_text', 'state reason embedding_signature'],['page_extraction_state', 'out_of_scope', 'no_memory_text', 'pipeline watermark_sha256 input_truncated'],['page_facts_reconcile', 'out_of_scope', 'no_memory_text', 'outcome'],+ ['page_label_guards', 'out_of_scope', 'no_memory_text', 'tier'],['page_mention_state', 'out_of_scope', 'no_memory_text', 'source_id'],['page_projection_jobs', 'out_of_scope', 'no_memory_text', 'slug reason'],['page_purges', 'out_of_scope', 'text_free_ledger', 'source_id content_hash slug'],diff --git a/src/core/persistence/graduation-inventory.ts b/src/core/persistence/graduation-inventory.tsindex 66acbf428f..6b20c0928b 100644--- a/src/core/persistence/graduation-inventory.ts+++ b/src/core/persistence/graduation-inventory.ts@@ -135,6 +135,7 @@ export const GRADUATION_INVENTORY: Inventory = {carry('page_extraction_state', 'operational', 'Extraction watermarks and partial-input receipts per page and pipeline; without them the next extraction of a large page reads its head again and records the receipt anew.'),carry('page_facts_reconcile', 'operational', 'Facts reconcile watermark: per-page revision extract_facts last reconciled; without it every page is due again.'),carry('page_generation_clock', 'operational', 'Page generation clock (derived side table, verified equal).'),+ carry('page_label_guards', 'security', 'The tier the owner\'s label repairs set on a page (GST-2521); dropping it would let an agent write at the page\'s own tier widen the labels the owner set.'),carry('page_mention_state', 'operational', 'Entity mention index: per-page mention watermark; without it every page is due for a rescan.'),carry('page_projection_jobs', 'operational', 'Pending page projection work (derived side table, verified equal).'),carry('page_purges', 'user_data', 'Text-free page purge tombstones (#5575); dropping them would let purged pages re-import.'),diff --git a/test/fixtures/goldens/doctor/content-pglite-human.json b/test/fixtures/goldens/doctor/content-pglite-human.jsonindex 6999174fb0..1f55c28d9e 100644--- a/test/fixtures/goldens/doctor/content-pglite-human.json+++ b/test/fixtures/goldens/doctor/content-pglite-human.json@@ -98,7 +98,7 @@" [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 177 table(s) the applied migrations create exist.",+ " [OK] schema_missing_tables: All 178 table(s) the applied migrations create exist."," [OK] rls_event_trigger: Skipped (PGLite — no event trigger support)"," [INFO] embeddings: Not applicable: embeddings are disabled on this brain (keyword search keeps working)."," [INFO] embedding_provider: Not probed: embeddings are disabled on this brain by choice (keyword search keeps working).",diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.jsonindex b6ab165229..476e0da683 100644--- a/test/fixtures/goldens/doctor/content-pglite-json.json+++ b/test/fixtures/goldens/doctor/content-pglite-json.json@@ -1149,7 +1149,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 177 table(s) the applied migrations create exist.",+ "message": "All 178 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 f0eadab295..4859b9cc1d 100644--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json@@ -1220,7 +1220,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 177 table(s) the applied migrations create exist.",+ "message": "All 178 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},@@ -6332,7 +6332,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 177 table(s) the applied migrations create exist.",+ "message": "All 178 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.jsonindex 322ec838d6..1b62213b63 100644--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json@@ -1181,7 +1181,7 @@{"category": "ops","elapsed_ms": "<volatile>",- "message": "RLS enabled on 176/176 public tables",+ "message": "RLS enabled on 177/177 public tables","name": "rls","status": "ok"},@@ -1223,7 +1223,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 176 table(s) the applied migrations create exist.",+ "message": "All 177 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},@@ -6301,7 +6301,7 @@{"category": "ops","elapsed_ms": "<volatile>",- "message": "RLS enabled on 176/176 public tables",+ "message": "RLS enabled on 177/177 public tables","name": "rls","status": "ok"},@@ -6343,7 +6343,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 176 table(s) the applied migrations create exist.",+ "message": "All 177 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex e97b9d794b..659f3c633e 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -1062,7 +1062,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 177 table(s) the applied migrations create exist.",+ "message": "All 178 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex 62d8b75e86..ebf412ad8b 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -1109,7 +1109,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 177 table(s) the applied migrations create exist.",+ "message": "All 178 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex 5a180ab54e..777e0373ea 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -1070,7 +1070,7 @@{"category": "ops","elapsed_ms": "<volatile>",- "message": "RLS enabled on 176/176 public tables",+ "message": "RLS enabled on 177/177 public tables","name": "rls","status": "ok"},@@ -1112,7 +1112,7 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 176 table(s) the applied migrations create exist.",+ "message": "All 177 table(s) the applied migrations create exist.","name": "schema_missing_tables","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 e640cb7cb9..02f453f14e 100644--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json@@ -316,6 +316,9 @@"page_facts_reconcile.page_facts_reconcile_pkey": "p PRIMARY KEY (page_id)","page_generation_clock.page_generation_clock_id_check": "c CHECK ((id = 1))","page_generation_clock.page_generation_clock_pkey": "p PRIMARY KEY (id)",+ "page_label_guards.page_label_guards_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE",+ "page_label_guards.page_label_guards_pkey": "p PRIMARY KEY (page_id)",+ "page_label_guards.page_label_guards_tier_check": "c CHECK ((tier = ANY (ARRAY['user_confirmed'::text, 'operator_curated'::text, 'tool_observed'::text, 'agent_written'::text, 'unknown'::text, 'external_untrusted'::text])))","page_mention_state.page_mention_state_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE","page_mention_state.page_mention_state_pkey": "p PRIMARY KEY (page_id)","page_mention_state.page_mention_state_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",@@ -950,6 +953,9 @@"page_generation_clock": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "page_label_guards": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"page_links": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1522,6 +1528,7 @@"page_extraction_state_truncated_idx": "CREATE INDEX page_extraction_state_truncated_idx ON public.page_extraction_state USING btree (pipeline, page_id) WHERE (input_truncated IS NOT NULL)","page_facts_reconcile_pkey": "CREATE UNIQUE INDEX page_facts_reconcile_pkey ON public.page_facts_reconcile USING btree (page_id)","page_generation_clock_pkey": "CREATE UNIQUE INDEX page_generation_clock_pkey ON public.page_generation_clock USING btree (id)",+ "page_label_guards_pkey": "CREATE UNIQUE INDEX page_label_guards_pkey ON public.page_label_guards USING btree (page_id)","page_mention_state_pkey": "CREATE UNIQUE INDEX page_mention_state_pkey ON public.page_mention_state USING btree (page_id)","page_mention_state_source_idx": "CREATE INDEX page_mention_state_source_idx ON public.page_mention_state USING btree (source_id, mention_version)","page_projection_jobs_pkey": "CREATE UNIQUE INDEX page_projection_jobs_pkey ON public.page_projection_jobs USING btree (source_incarnation, slug)",@@ -3412,6 +3419,14 @@],"flags": "relkind=r rls=false force_rls=false"},+ "page_label_guards": {+ "columns": [+ "1 page_id integer/int4 NOT NULL",+ "2 tier text/text NOT NULL",+ "3 set_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"page_mention_state": {"columns": ["1 page_id integer/int4 NOT NULL",diff --git a/test/graduation-inventory.test.ts b/test/graduation-inventory.test.tsindex f4384c52bc..b5d0f1e8ed 100644--- a/test/graduation-inventory.test.ts+++ b/test/graduation-inventory.test.ts@@ -60,7 +60,7 @@ describe('graduation inventory', () => {expect(new Set(names).size).toBe(names.length);const counts: Record<string, number> = {};for (const e of GRADUATION_INVENTORY.entries) counts[e.class] = (counts[e.class] ?? 0) + 1;- expect(counts).toEqual({ carry: 161, rebind: 2, rebuild: 3, discard: 9, schema_owned: 4 });+ expect(counts).toEqual({ carry: 162, rebind: 2, rebuild: 3, discard: 9, schema_owned: 4 });for (const e of GRADUATION_INVENTORY.entries) {expect({ relation: e.relation, reason: e.reason.length > 5, present: e.engines.pglite || e.engines.postgres }).toEqual({ relation: e.relation, reason: true, present: true });@@ -70,7 +70,7 @@ describe('graduation inventory', () => {expect(GRADUATION_INVENTORY.entries.filter(e => e.lossKind === 'security').map(e => e.relation).sort()).toEqual(['access_group_members', 'access_groups', 'access_member_links', 'access_member_sources', 'access_members', 'access_pending_coverage', 'access_policy_revisions','access_policy_state', 'access_rules', 'access_tokens', 'oauth_clients', 'oauth_codes', 'oauth_grant_audit', 'oauth_tokens',- 'persistence_local_writers', 'shared_skill_state', 'slug_rename_history']);+ 'page_label_guards', 'persistence_local_writers', 'shared_skill_state', 'slug_rename_history']);});test('every relation of a fresh schema has a row on each engine', async () => {