Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
GBRA-161 PR 1a: probes 2-9, page input size for the atom floor, Decisions, goldens
garrytan5e5a5860bbb8
diff --git a/docs/architecture/generations.md b/docs/architecture/generations.mdindex 8e671848c1..221b4f4f65 100644--- a/docs/architecture/generations.md+++ b/docs/architecture/generations.md@@ -7,7 +7,7 @@ one can be undone.## The ledger-Migration v265 (a placeholder number, restamped when the change merges) adds three tables. Nothing existing changes.+Migration v265 (a placeholder number, restamped when the change merges) adds four tables. Nothing existing changes.- `derived_generations`: one row per generation of a key (source, kind, owner key). At most one is `live` and at mostone is `held`; earlier live rows become `superseded` and keep their items. A row records the input pin and size it@@ -17,6 +17,10 @@ Migration v265 (a placeholder number, restamped when the change merges) adds thrhash (a digest of what the page says, leaving out completion, extraction and retirement stamps) and, for an item itoverwrote or retired, a bounded preimage (at most the inline page size; none for a segmented page).- `derived_generation_valve`: retirements counted per run window, for the retirement valve.+- `derived_generation_attempts`: terminal publish failures counted per hold identity (key, input pin, policy, item+ set). The third holds the result `attempts_exhausted` with the last three error codes and clears the counter; a+ later run of the same result stops at that held row until `--mode release-held` publishes it. A fenced producer is+ not counted. Only error codes are stored.## Publishing@@ -28,7 +32,7 @@ Under the item page locks (slug order) and then the key's advisory lock, `publisthe key's origin metadata and either the result reproduces it or a retained page version the producer wrote shows itunedited (legacy adoption). Any other row naming the key is protected: never retired, listed in the outcome;4. holds the result instead of publishing it, in this order: `segmented_unsupported` (it would rewrite or retire a- segmented page), `no_proof` (an empty result without an empty-source proof, `proofs.ts`), `oversize` (more puts+ segmented page), `tie` (a strict-order adapter's result has a duplicate or missing rank, #6023), `no_proof` (an empty result without an empty-source proof, `proofs.ts`), `oversize` (more putsor retirements than `generations.max_items`), `shrunk` (a model-produced result keeping fewer than`generations.shrink_floor` of the owned items, scaled by how much the input shrank), `valve` (the run window wouldretire more than `generations.valve.max_per_run`, or more than 25 and over `generations.valve.max_ratio` of the@@ -73,3 +77,21 @@ proposal carrying the claim (`ledger-scrub.ts`). Restore then refuses that item| `generations.valve.max_ratio` | 0.5 | 0.01 to 1 |`gbrain config set` refuses a value out of range; a stored value out of range reads as the default.++## Decisions++- The valve's ratio half applies only above 25 retirements in a run window, because on a small brain a few legitimate+ retirements are already a large share of the owned items; `generations.valve.max_per_run` still bounds every window.+- 11 census rows stay `pending:inventory`, because this release moves only unmanaged atoms onto the primitive; the+ rows name the other derived writers so a new soft-delete site cannot land unreviewed while later PRs move them.+- A partial result (#6503) publishes additively, because an input cut at its cap cannot show which items are gone:+ writing what it has keeps new work, and retiring nothing keeps a truncated read from deleting the rest.+- v265 has no `source_incarnation` column and no `attempted` state: deleting a source cascades its ledger rows, so a+ recreated source starts clean with nothing to tell apart, and a publication is one transaction, so no row exists+ before it activates.+- The operation index is not unique and replay matches only the live row, because one result can be published again+ after a different one superseded it (same pin, A then B then A); matching a superseded row would report it+ `unchanged` while B stays live.+- Attempts have their own table instead of the held row's `attempts` column, because a held row means a result+ waits for the operator (doctor warns, release-held lists it) and a key has at most one; counting failures there+ would warn before any result is held and displace a real held result.diff --git a/docs/guides/repair.md b/docs/guides/repair.mdindex 9a5843a77c..f3347ddea1 100644--- a/docs/guides/repair.md+++ b/docs/guides/repair.md@@ -1518,8 +1518,8 @@ once to an instant the preview and apply carry), `--key <owner>`and nothing of that key changes.- `--mode release-held` publishes a held result once: `shrunk`, `valve` and`attempts_exhausted` always, `oversize` after `generations.max_items` was- raised. `no_proof`, `fence_absent` and `segmented_unsupported` are refused,- because releasing them would supply the proof they lack.+ raised. `no_proof`, `fence_absent`, `segmented_unsupported` and `tie` are+ refused, because releasing them would supply the proof they lack.The preview saves the set under its hash; `--apply --expect <hash> --yes`applies exactly that set and rechecks each key under its locksdiff --git a/src/core/generations/adapters/atoms.ts b/src/core/generations/adapters/atoms.tsindex d428c92651..701535f973 100644--- a/src/core/generations/adapters/atoms.ts+++ b/src/core/generations/adapters/atoms.ts@@ -61,7 +61,9 @@ export const atomGenerationAdapter: GenerationAdapter<AtomGenerationContext> = {const origin = originOf(key);if (origin.field === 'source_path') return context?.transcriptInput ?? null;const [row] = await engine.executeRaw<{ id: number; content_hash: string | null; revision: string | null; body_bytes: number | null }>(- 'SELECT id, content_hash, knowledge_revision::text AS revision, body_bytes FROM pages WHERE source_id=$1 AND slug=$2 AND deleted_at IS NULL', [key.sourceId, origin.value]);+ `SELECT id, content_hash, knowledge_revision::text AS revision,+ COALESCE(body_bytes, octet_length(COALESCE(compiled_truth, '')) + octet_length(COALESCE(timeline, ''))) AS body_bytes+ FROM pages WHERE source_id=$1 AND slug=$2 AND deleted_at IS NULL`, [key.sourceId, origin.value]);return row?.content_hash ? { pin: atomPagePin(row.content_hash, row.revision ? { pageId: Number(row.id), revision: row.revision } : undefined), size: Number(row.body_bytes ?? 0) } : null;},async readItems(engine, key, itemKeys) {diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.jsonindex b040d51b92..a5e540513b 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json@@ -60,12 +60,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -630,6 +632,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1080,6 +1085,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -2047,6 +2054,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.jsonindex e58ddf2029..783a33ec57 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json@@ -60,12 +60,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -630,6 +632,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1080,6 +1085,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -2047,6 +2054,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.jsonindex 647157f524..2533fd2ffc 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json@@ -60,12 +60,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -630,6 +632,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1080,6 +1085,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -2043,6 +2050,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json b/test/fixtures/goldens/catalog/pglite-schema-blob-default.jsonindex 32207c9bfd..e88a938498 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json@@ -40,12 +40,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -465,6 +467,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -824,6 +829,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -1557,6 +1564,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.jsonindex 6459b8ea52..254853ca90 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json@@ -40,12 +40,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -465,6 +467,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -824,6 +829,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -1557,6 +1564,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.jsonindex c1e5b89596..2450953906 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json@@ -40,12 +40,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -465,6 +467,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -824,6 +829,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -1556,6 +1563,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/postgres-db-initschema.json b/test/fixtures/goldens/catalog/postgres-db-initschema.jsonindex b7212869eb..9286a47513 100644--- a/test/fixtures/goldens/catalog/postgres-db-initschema.json+++ b/test/fixtures/goldens/catalog/postgres-db-initschema.json@@ -49,12 +49,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -482,6 +484,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -842,6 +847,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -1607,6 +1614,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-default.json b/test/fixtures/goldens/catalog/postgres-engine-init-default.jsonindex 4664812d51..e31a51bf54 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json@@ -60,12 +60,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -634,6 +636,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1081,6 +1086,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -2048,6 +2055,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.jsonindex eec460e3d3..399a830b7e 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json@@ -60,12 +60,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -634,6 +636,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1081,6 +1086,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -2048,6 +2055,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.jsonindex af393d4c7a..11be85d513 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json@@ -60,12 +60,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -634,6 +636,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1081,6 +1086,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -2044,6 +2051,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/fixtures/goldens/doctor/content-pglite-human.json b/test/fixtures/goldens/doctor/content-pglite-human.jsonindex 4ded754291..df87a6faa8 100644--- a/test/fixtures/goldens/doctor/content-pglite-human.json+++ b/test/fixtures/goldens/doctor/content-pglite-human.json@@ -78,8 +78,8 @@" [OK] pglite_scale: PGLite at 5 pages — comfortable below the 1000-page threshold"," [OK] rls: Skipped (PGLite — no PostgREST exposure, RLS not applicable)"," [OK] schema_version: Version <latest> (latest: <latest>)",- " [OK] schema_columns: 1329 column(s) verified against live schema",- " [OK] schema_missing_tables: All 155 table(s) the applied migrations create exist.",+ " [OK] schema_columns: 1336 column(s) verified against live schema",+ " [OK] schema_missing_tables: All 156 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 97da0545f6..31038eb5f6 100644--- a/test/fixtures/goldens/doctor/content-pglite-json.json+++ b/test/fixtures/goldens/doctor/content-pglite-json.json@@ -1036,14 +1036,14 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "1329 column(s) verified against live schema",+ "message": "1336 column(s) verified against live schema","name": "schema_columns","status": "ok"},{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 155 table(s) the applied migrations create exist.",+ "message": "All 156 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 d9dfa43fa7..a7a4712fe5 100644--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json@@ -1107,14 +1107,14 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "1329 column(s) verified against live schema",+ "message": "1336 column(s) verified against live schema","name": "schema_columns","status": "ok"},{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 155 table(s) the applied migrations create exist.",+ "message": "All 156 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},@@ -5676,14 +5676,14 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "1329 column(s) verified against live schema",+ "message": "1336 column(s) verified against live schema","name": "schema_columns","status": "ok"},{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 155 table(s) the applied migrations create exist.",+ "message": "All 156 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 4efa858d5c..d38e42f5a8 100644--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json@@ -1089,7 +1089,7 @@{"category": "ops","elapsed_ms": "<volatile>",- "message": "RLS enabled on 154/154 public tables",+ "message": "RLS enabled on 155/155 public tables","name": "rls","status": "ok"},@@ -1103,14 +1103,14 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "1335 column(s) verified against live schema",+ "message": "1342 column(s) verified against live schema","name": "schema_columns","status": "ok"},{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 154 table(s) the applied migrations create exist.",+ "message": "All 155 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},@@ -5659,7 +5659,7 @@{"category": "ops","elapsed_ms": "<volatile>",- "message": "RLS enabled on 154/154 public tables",+ "message": "RLS enabled on 155/155 public tables","name": "rls","status": "ok"},@@ -5673,14 +5673,14 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "1335 column(s) verified against live schema",+ "message": "1342 column(s) verified against live schema","name": "schema_columns","status": "ok"},{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 154 table(s) the applied migrations create exist.",+ "message": "All 155 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 1f1940d7eb..3a8cb7405e 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -949,14 +949,14 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "1329 column(s) verified against live schema",+ "message": "1336 column(s) verified against live schema","name": "schema_columns","status": "ok"},{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 155 table(s) the applied migrations create exist.",+ "message": "All 156 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 38829a5c93..0453410d80 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -996,14 +996,14 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "1329 column(s) verified against live schema",+ "message": "1336 column(s) verified against live schema","name": "schema_columns","status": "ok"},{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 155 table(s) the applied migrations create exist.",+ "message": "All 156 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 d4d1d3d8bb..c04c1eea06 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -978,7 +978,7 @@{"category": "ops","elapsed_ms": "<volatile>",- "message": "RLS enabled on 154/154 public tables",+ "message": "RLS enabled on 155/155 public tables","name": "rls","status": "ok"},@@ -992,14 +992,14 @@{"category": "meta","elapsed_ms": "<volatile>",- "message": "1335 column(s) verified against live schema",+ "message": "1342 column(s) verified against live schema","name": "schema_columns","status": "ok"},{"category": "meta","elapsed_ms": "<volatile>",- "message": "All 154 table(s) the applied migrations create exist.",+ "message": "All 155 table(s) the applied migrations create exist.","name": "schema_missing_tables","status": "ok"},diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.jsonindex 35737a6a1c..cb26ad8192 100644--- a/test/fixtures/goldens/migrations/records.json+++ b/test/fixtures/goldens/migrations/records.json@@ -4207,8 +4207,8 @@"idempotent": true,"name": "derived_generations","sql": {- "length": 2337,- "sha256": "2a5b53563f732d056acc660cf3e91bc1a1c72fd1f5bbb1f68960f6e66c7f1800"+ "length": 2832,+ "sha256": "8f07eb75b6de03f1be543c4236cb47d50bb85bbd5e8d9e47c9f776e0cb514872"},"sqlFor": "absent","transaction": "absent",diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.jsonindex 4400283234..3f879f8740 100644--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json@@ -60,12 +60,14 @@"decision_receipts.decision_receipts_pkey": "p PRIMARY KEY (id)","derivation_inputs.derivation_inputs_pkey": "p PRIMARY KEY (derived_table, derived_id, input_table, input_id)","derivation_inputs.derivation_inputs_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",+ "derived_generation_attempts.derived_generation_attempts_pkey": "p PRIMARY KEY (hold_id)",+ "derived_generation_attempts.derived_generation_attempts_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_action_check": "c CHECK ((action = ANY (ARRAY['published'::text, 'retired'::text, 'revived'::text, 'kept'::text, 'adopted'::text])))","derived_generation_items.derived_generation_items_generation_id_fkey": "f FOREIGN KEY (generation_id) REFERENCES derived_generations(id) ON DELETE CASCADE","derived_generation_items.derived_generation_items_pkey": "p PRIMARY KEY (generation_id, item_key)","derived_generation_valve.derived_generation_valve_pkey": "p PRIMARY KEY (source_id, kind, window_key)","derived_generation_valve.derived_generation_valve_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",- "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text]))))",+ "derived_generations.derived_generations_held_reason_check": "c CHECK (((held_reason IS NULL) OR (held_reason = ANY (ARRAY['shrunk'::text, 'oversize'::text, 'valve'::text, 'no_proof'::text, 'fence_absent'::text, 'attempts_exhausted'::text, 'segmented_unsupported'::text, 'tie'::text]))))","derived_generations.derived_generations_pkey": "p PRIMARY KEY (id)","derived_generations.derived_generations_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","derived_generations.derived_generations_state_check": "c CHECK ((state = ANY (ARRAY['live'::text, 'held'::text, 'superseded'::text])))",@@ -630,6 +632,9 @@"derivation_inputs": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "derived_generation_attempts": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"derived_generation_items": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -1080,6 +1085,8 @@"decision_receipts_pkey": "CREATE UNIQUE INDEX decision_receipts_pkey ON public.decision_receipts USING btree (id)","decision_receipts_slot_created_idx": "CREATE INDEX decision_receipts_slot_created_idx ON public.decision_receipts USING btree (slot, created_at)","derivation_inputs_pkey": "CREATE UNIQUE INDEX derivation_inputs_pkey ON public.derivation_inputs USING btree (derived_table, derived_id, input_table, input_id)",+ "derived_generation_attempts_key": "CREATE INDEX derived_generation_attempts_key ON public.derived_generation_attempts USING btree (source_id, kind, owner_key)",+ "derived_generation_attempts_pkey": "CREATE UNIQUE INDEX derived_generation_attempts_pkey ON public.derived_generation_attempts USING btree (hold_id)","derived_generation_items_key": "CREATE INDEX derived_generation_items_key ON public.derived_generation_items USING btree (item_key)","derived_generation_items_pkey": "CREATE UNIQUE INDEX derived_generation_items_pkey ON public.derived_generation_items USING btree (generation_id, item_key)","derived_generation_valve_pkey": "CREATE UNIQUE INDEX derived_generation_valve_pkey ON public.derived_generation_valve USING btree (source_id, kind, window_key)",@@ -2047,6 +2054,18 @@],"flags": "relkind=r rls=true force_rls=false"},+ "derived_generation_attempts": {+ "columns": [+ "1 hold_id text/text NOT NULL",+ "2 source_id text/text NOT NULL",+ "3 kind text/text NOT NULL",+ "4 owner_key text/text NOT NULL",+ "5 attempts integer/int4 NOT NULL DEFAULT 0",+ "6 codes jsonb/jsonb NOT NULL DEFAULT '[]'::jsonb",+ "7 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=false force_rls=false"+ },"derived_generation_items": {"columns": ["1 generation_id bigint/int8 NOT NULL",diff --git a/test/pathological/g1-atom-generations.test.ts b/test/pathological/g1-atom-generations.test.tsindex 44c574fb3a..0677458f06 100644--- a/test/pathological/g1-atom-generations.test.ts+++ b/test/pathological/g1-atom-generations.test.ts@@ -4,7 +4,9 @@* Protects: (a) a failed publication (here the provenance edges) writes no atom at all, provisional or final, and the* retry publishes the atoms, their edges and the completion stamp together; (b) a re-extraction that keeps one of four* atoms is held `shrunk` and the four stay live (pre-fix: three were retired on a model's say-so); (c) an atom naming- * the origin with no retained extractor evidence (a hand-written or hand-edited one) is protected, not retired.+ * the origin with no retained extractor evidence (a hand-written or hand-edited one) is protected, not retired; (d) a page+ * whose body halves and whose re-extraction returns half the atoms clears the input-relative floor: the result publishes+ * and the stale atoms retire.* Fails when: the atom loop writes outside the generation transaction, or retirement ignores the floor or ownership.* Seams: the extract_atoms phase's `_pages` / `_transcripts` / `_chat` inputs (no paid call). PGLite always,* Postgres when DATABASE_URL is set.@@ -90,6 +92,31 @@ for (const { backend, databaseUrl } of pathologicalArms()) {});}, 120_000);+ test('a page whose body halves and whose re-extraction keeps half the atoms publishes and retires the stale ones', async () => {+ await withBrain(databaseUrl, async engine => {+ const source = 'meetings/2026-09-07-source-a';+ const extractPage = async (content: string, titles: string[]) => {+ await engine.putPage(source, { type: 'meeting', title: 'Source A', compiled_truth: content, timeline: '' });+ const [stored] = await engine.executeRaw<{ content_hash: string }>('SELECT content_hash FROM pages WHERE slug=$1', [source]);+ return runPhaseExtractAtoms(engine, { _transcripts: [], _pages: [{ slug: source, content, contentHash: stored!.content_hash }], _chat: chat(titles) });+ };+ const paragraph = (claim: string) => `${claim} ${'Context for the claim, kept the same length on purpose. '.repeat(8)}++`;+ const full = ['Ship smaller', 'Measure first', 'Hire slowly', 'Write it down'];+ expect((await extractPage(full.map(paragraph).join(''), full)).status).toBe('ok');+ const before = await liveAtoms(engine);+ expect(before).toHaveLength(4);+ expect((await extractPage(full.slice(0, 2).map(paragraph).join(''), full.slice(0, 2))).status).toBe('ok');+ const after = await liveAtoms(engine);+ expect(after).toHaveLength(2);+ expect(before.filter(atom => !after.includes(atom))).toHaveLength(2);+ expect(await engine.executeRaw("SELECT 1 FROM derived_generations WHERE state='held'")).toEqual([]);+ const [stamped] = await engine.executeRaw<{ n: number }>("SELECT count(*)::int AS n FROM pages WHERE type='atom' AND deleted_at IS NOT NULL");+ expect(Number(stamped!.n)).toBe(2);+ });+ }, 120_000);+test('an atom naming the origin without retained extractor evidence is protected, not retired', async () => {await withBrain(databaseUrl, async engine => {const hand = 'atoms/2026-09-07/hand-written-example';diff --git a/test/pathological/g1-generation-probes.test.ts b/test/pathological/g1-generation-probes.test.tsindex e0851a5cf5..04a1de38a8 100644--- a/test/pathological/g1-generation-probes.test.ts+++ b/test/pathological/g1-generation-probes.test.ts@@ -101,7 +101,7 @@ for (const { backend, databaseUrl } of pathologicalArms()) {expect(await publish(engine, FOUR, 'pin-1', { expectedGeneration: 0 })).toMatchObject({ state: 'published', generation: 1 });const stale = await publish(engine, { a: 'Alpha claim.', b: 'Beta claim.', c: 'Gamma claim.', e: 'Epsilon claim.' }, 'pin-1', { expectedGeneration: 0 }).catch(error => error);expect(codeOf(stale)).toBe('generation_fenced');- expect((stale as OperationError).details?.reason ?? (stale as { reason?: string }).reason).toBe('stale_generation');+ expect((stale as OperationError).reason).toBe('stale_generation');expect(await publish(engine, FOUR, 'pin-1', { expectedGeneration: 0 })).toMatchObject({ state: 'unchanged', generation: 1 });const next = await publish(engine, { a: 'Alpha claim.', b: 'Beta claim.', c: 'Gamma claim.', e: 'Epsilon claim.' }, 'pin-1', { expectedGeneration: 1 });expect(next).toMatchObject({ state: 'published', generation: 2, retired: [slug('d')] });diff --git a/test/postgres-unit-arms.txt b/test/postgres-unit-arms.txtindex 10d146e04d..5314e2b09e 100644--- a/test/postgres-unit-arms.txt+++ b/test/postgres-unit-arms.txt@@ -315,6 +315,8 @@ test/pathological/d9-dream-summary-overwrite.test.tstest/pathological/facts-mirror-failures.test.tstest/pathological/g0-derived-retirement-hold.test.tstest/pathological/g1-atom-generations.test.ts+test/pathological/g1-generation-crash.test.ts+test/pathological/g1-generation-probes.test.tstest/pathological/g1-generations.test.tstest/pathological/h1-zero-yield-atom-reextract.test.tstest/pathological/h2-git-effect-moved-remote.test.ts