Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

A member's save on its own page no longer reveals that a claim it never read was withdrawn

garrytanaf79d86e9669
diff --git a/src/core/access/member-facts.ts b/src/core/access/member-facts.ts
index 6fc36c9533..2538736888 100644
--- a/src/core/access/member-facts.ts
+++ b/src/core/access/member-facts.ts
@@ -181,8 +181,19 @@ export function factWithdrawalSubjectSql(alias: string): string {
return `CASE WHEN ${onOwnedMemoryPageSql(alias)} THEN ${alias}.source_markdown_slug ELSE COALESCE(${alias}.entity_slug, '*') END`;
}
-/** Whether withdrawal row `w` covers fact `f`, as SQL: every subject ('*'), the fact's entity, or the owned memory page it sits on. */
+/**
+ * Whether withdrawal row `w` covers fact `f`, as SQL: every subject ('*'), the fact's entity, or the owned memory page it
+ * sits on. GST-2346: a fact on a member page is covered by that page's own withdrawals alone, as the insert guards
+ * judge it (facts/withdrawal-schema.ts): a withdrawal of another subject expired it when it was made, or the row is one
+ * its member saved since, checked against the claims that member reads.
+ */
export function withdrawalCoversFactSql(w: string, f: string): string {
+ return `(CASE WHEN starts_with(COALESCE(${f}.source_markdown_slug, ''), '${MEMBER_PAGE_PREFIX}') THEN ${w}.subject = ${f}.source_markdown_slug
+ ELSE ${withdrawalReachedFactSql(w, f)} END)`;
+}
+
+/** Whether withdrawal row `w` expired fact `f` when it was made (recordFactWithdrawal's reach), as SQL: every subject ('*'), the fact's entity, or the owned memory page it sits on. */
+export function withdrawalReachedFactSql(w: string, f: string): string {
return `(${w}.subject = '*' OR ${w}.subject = COALESCE(${f}.entity_slug, '*') OR (${onOwnedMemoryPageSql(f)} AND ${w}.subject = ${f}.source_markdown_slug))`;
}
diff --git a/src/core/facts/embedding-identity.ts b/src/core/facts/embedding-identity.ts
index 65c72b2aed..278b90e1a2 100644
--- a/src/core/facts/embedding-identity.ts
+++ b/src/core/facts/embedding-identity.ts
@@ -3,6 +3,10 @@ import { AUDIT_ROW_SOURCES } from './audit-sources.ts';
import { EMBED_MAX_CHARS } from '../ai/embed-batch-plan.ts';
import { estimateTokens } from '../chunkers/token-estimate.ts';
+// GST-2346: the withdrawal subjects that cover a fact (access/member-facts.ts withdrawalCoversFactSql): a fact on a member
+// page is covered by its page's own withdrawals alone.
+const WITHDRAWAL_SUBJECTS = "CASE WHEN starts_with(COALESCE(f.source_markdown_slug, ''), 'memory/members/') THEN ARRAY[f.source_markdown_slug] ELSE ARRAY['*', f.entity_slug] END";
+
// #6960: one anti-join per fingerprint, each an equality on fact_hash, so the
// planner hashes or index-probes the fingerprint once per fact. A single
// `fact_hash IN (fp, fp_v1)` left both fingerprints in the join filter,
@@ -11,10 +15,10 @@ export const retainedFactEmbedding = `f.expired_at IS NULL AND f.superseded_by I
AND (f.valid_until IS NULL OR f.valid_until>now())
AND NOT (f.source = ANY($2::text[]))
AND NOT EXISTS (SELECT 1 FROM fact_withdrawals w WHERE w.source_id=f.source_id
- AND w.visibility=f.visibility AND w.subject = ANY(ARRAY['*', f.entity_slug])
+ AND w.visibility=f.visibility AND w.subject = ANY(${WITHDRAWAL_SUBJECTS})
AND w.fact_hash = gbrain_fact_fingerprint(f.fact))
AND NOT EXISTS (SELECT 1 FROM fact_withdrawals w WHERE w.source_id=f.source_id
- AND w.visibility=f.visibility AND w.subject = ANY(ARRAY['*', f.entity_slug])
+ AND w.visibility=f.visibility AND w.subject = ANY(${WITHDRAWAL_SUBJECTS})
AND w.fact_hash = gbrain_fact_fingerprint_v1(f.fact))`;
export const eligibleFactEmbedding = `${retainedFactEmbedding}
diff --git a/src/core/facts/insert-guard-schema.ts b/src/core/facts/insert-guard-schema.ts
index 887d6b9f1f..d8f38c0567 100644
--- a/src/core/facts/insert-guard-schema.ts
+++ b/src/core/facts/insert-guard-schema.ts
@@ -14,6 +14,9 @@
* `gbrain_preserve_fact_withdrawal`): an inserted active row matching a
* fact_withdrawals row (v2 or v1 fingerprint) is stamped expired_at =
* min(withdrawn_at) and valid_until = LEAST(valid_until, withdrawn_at).
+ * GST-2346: a row on a member page (memory/members/<id>) is stamped only
+ * by that page's own withdrawals, as in gbrain_preserve_fact_withdrawal
+ * (withdrawal-schema.ts).
* By default the per-row BEFORE INSERT trigger facts_preserve_withdrawal_insert
* stamps the row before it is written, so `INSERT ... RETURNING` reads the
* stamp. An insert made under FACT_WITHDRAWAL_STAMP_DEFERRED_SETTING (the
@@ -81,13 +84,14 @@ CREATE OR REPLACE FUNCTION gbrain_guard_inserted_facts() RETURNS trigger
stamp_setting := current_setting('${FACT_WITHDRAWAL_STAMP_SETTING}', true);
PERFORM set_config('${FACT_WITHDRAWAL_STAMP_SETTING}', 'on', true);
WITH n AS MATERIALIZED (
- SELECT i.id, i.source_id, i.visibility, i.entity_slug,
+ SELECT i.id, i.source_id, i.visibility, i.entity_slug, i.source_markdown_slug,
gbrain_fact_fingerprint(i.fact) AS fact_hash, gbrain_fact_fingerprint_v1(i.fact) AS fact_hash_v1
FROM inserted_facts i WHERE i.expired_at IS NULL),
m AS (
SELECT n.id, min(w.withdrawn_at) AS withdrawn_at FROM n JOIN fact_withdrawals w
ON w.source_id = n.source_id AND w.visibility = n.visibility
- AND w.subject IN ('*', n.entity_slug) AND w.fact_hash IN (n.fact_hash, n.fact_hash_v1)
+ AND w.subject = ANY(CASE WHEN starts_with(COALESCE(n.source_markdown_slug, ''), 'memory/members/') THEN ARRAY[n.source_markdown_slug]
+ ELSE ARRAY['*', n.entity_slug] END) AND w.fact_hash IN (n.fact_hash, n.fact_hash_v1)
GROUP BY n.id)
UPDATE facts f SET expired_at = m.withdrawn_at, valid_until = LEAST(COALESCE(f.valid_until, m.withdrawn_at), m.withdrawn_at)
FROM m WHERE f.id = m.id;
diff --git a/src/core/facts/single-prepare.ts b/src/core/facts/single-prepare.ts
index 10a5112671..eb543db4c5 100644
--- a/src/core/facts/single-prepare.ts
+++ b/src/core/facts/single-prepare.ts
@@ -7,10 +7,14 @@ import { assertFactNotPurged } from './withdrawal.ts';
import { cosineVerdict } from './capture-dedup.ts';
import { interleaveFusion } from '../search/fusion-lists.ts';
import { readSupersessionThreshold } from './supersession-threshold.ts';
-import { privateProvenanceFilterFragment } from '../search/private-visibility.ts';
+import { ownerReadPolicyFragment, privateProvenanceFilterFragment, readPolicyFragment } from '../search/private-visibility.ts';
+import { folderAccessForAll } from '../access/caller.ts';
+import { memberIdentity } from '../access/members.ts';
+import { ownerMemberId } from '../access/owner.ts';
+import { MEMBER_PAGE_PREFIX } from '../access/principals.ts';
import { pageNotVisibleError } from '../persistence/page-visibility.ts';
import { slugUnderBoundPrefixes } from '../ops/context.ts';
-import { ownedPageWithdrawalSubject, onOwnedMemoryPageSql, withdrawalCoversFactSql } from '../access/member-facts.ts';
+import { ownedPageWithdrawalSubject, onOwnedMemoryPageSql, withdrawalCoversFactSql, withdrawalReachedFactSql } from '../access/member-facts.ts';
import { UNATTRIBUTED_MEMORY_SLUG } from './extract-from-fence.ts';
import { sameClaimSlot } from './typed-claim.ts';
@@ -53,12 +57,52 @@ export async function prepareFactEmbedding(fact: string, signal?: AbortSignal, d
/**
* `excludePrivate`: the caller cannot read private pages. A withdrawal whose withdrawn rows all sit on pages it
* cannot read is refused exactly as a page it may not see is, so the refusal never confirms a claim it cannot see.
+ * `remote`: GST-2346, a remote save onto a member page meets only memberPageWithdrawal's withdrawals.
*/
-export async function assertFactNotWithdrawn(engine: BrainEngine, sourceId: string, input: SingleFactIntent, opts: { excludePrivate?: boolean } = {}): Promise<void> {
+export async function assertFactNotWithdrawn(engine: BrainEngine, sourceId: string, input: SingleFactIntent, opts: { excludePrivate?: boolean; remote?: boolean } = {}): Promise<void> {
await assertFactNotPurged(engine, sourceId, input);
+ if (opts.remote && input.page_slug?.startsWith(MEMBER_PAGE_PREFIX)) {
+ const met = await memberPageWithdrawal(engine, sourceId, input, input.page_slug);
+ if (met) throw withdrawnRefusal(met);
+ return;
+ }
if (await isFactWithdrawn(engine, sourceId, input.visibility, input.fact, input.entity_slug, ownedPageWithdrawalSubject(input.page_slug))) throw await factWithdrawnRefusal(engine, sourceId, input, opts);
}
+type WithdrawalRow = { subject: string; withdrawn_at: string; visibility: 'world' | 'private' };
+
+function withdrawnRefusal(row: WithdrawalRow | undefined): OperationError {
+ const error = verbError('invalid_params', FACT_WITHDRAWN_MESSAGE, FACT_WITHDRAWN_SUGGESTION);
+ if (row) error.withdrawn = { at: new Date(row.withdrawn_at).toISOString(), subject: row.subject === '*' ? 'all_entities' : row.subject, visibility: row.visibility };
+ return error;
+}
+
+/**
+ * GST-2346: the withdrawal a remote save onto member page `page` meets, or null. What the member gets back never depends
+ * on a claim it could not read, so the save meets the page's own withdrawals and a withdrawal of another subject only
+ * when a row it withdrew is one the page's member reads: a row on that page, or a row on pages it reads (a shared one,
+ * or for the enabled brain owner any one, under GST-2490's owner read rule). Otherwise the save is the member's own
+ * row, which the insert guards leave active (facts/withdrawal-schema.ts). Judged by the page's member, live: a member
+ * disabled or removed reads nothing.
+ */
+async function memberPageWithdrawal(engine: BrainEngine, sourceId: string, input: SingleFactIntent, page: string): Promise<WithdrawalRow | null> {
+ const memberId = page.slice(MEMBER_PAGE_PREFIX.length);
+ const identity = (await memberIdentity(engine, memberId).catch(() => null))?.identity ?? [];
+ const satisfied = identity.length ? (await folderAccessForAll(engine, [identity])).satisfiedRuleIds : [];
+ const owner = identity.length > 0 && await ownerMemberId(engine) === memberId;
+ const reads = (alias: string) => owner ? ownerReadPolicyFragment(alias, identity, satisfied) : readPolicyFragment(alias, identity, true, satisfied);
+ const readable = `(f.source_markdown_slug = $5::text OR (${owner ? 'TRUE' : `f.visibility = 'world'`}
+ AND NOT EXISTS (SELECT 1 FROM pages pp WHERE pp.source_id = f.source_id AND pp.slug = f.source_markdown_slug AND NOT ${reads('pp')})
+ AND NOT EXISTS (SELECT 1 FROM pages ep WHERE ep.source_id = f.source_id AND ep.slug = f.entity_slug AND NOT ${reads('ep')})))`;
+ const [row] = await engine.executeRaw<WithdrawalRow>(`SELECT w.subject,w.visibility,w.withdrawn_at::text AS withdrawn_at FROM fact_withdrawals w
+ WHERE w.source_id=$1 AND w.visibility=$2 AND w.fact_hash IN (gbrain_fact_fingerprint($3),gbrain_fact_fingerprint_v1($3))
+ AND (w.subject=$5::text OR ((w.subject='*' OR w.subject=$4::text) AND EXISTS (SELECT 1 FROM facts f
+ WHERE f.source_id=w.source_id AND f.visibility=w.visibility AND f.expired_at IS NOT NULL
+ AND gbrain_fact_fingerprint(f.fact)=gbrain_fact_fingerprint($3) AND ${withdrawalReachedFactSql('w', 'f')} AND ${readable})))
+ ORDER BY (w.subject<>'*') DESC, w.withdrawn_at DESC LIMIT 1`, [sourceId, input.visibility, input.fact, input.entity_slug, page]);
+ return row ?? null;
+}
+
/**
* The refusal for a claim `isFactWithdrawn` matched. `withdrawn` comes from the withdrawal ledger alone (never a purge):
* the most specific subject first, then the newest withdrawal, among withdrawals the caller can see the withdrawn rows of
@@ -73,24 +117,22 @@ export async function factWithdrawnRefusal(engine: BrainEngine, sourceId: string
COALESCE(bool_or(NOT ${seen(5)}), false) AS hidden
FROM facts f JOIN fact_withdrawals w ON w.source_id=f.source_id AND w.visibility=f.visibility
AND w.fact_hash IN (gbrain_fact_fingerprint(f.fact),gbrain_fact_fingerprint_v1(f.fact))
- AND ${withdrawalCoversFactSql('w', 'f')}
+ AND ${withdrawalReachedFactSql('w', 'f')}
WHERE f.source_id=$1 AND f.visibility=$2 AND f.expired_at IS NOT NULL
AND gbrain_fact_fingerprint(f.fact)=gbrain_fact_fingerprint($3) AND (w.subject='*' OR w.subject=$4::text OR w.subject=$5::text)`,
[sourceId, input.visibility, input.fact, input.entity_slug, ownedPageWithdrawalSubject(input.page_slug)]);
if (backing?.hidden && !backing.visible) return pageNotVisibleError();
}
- const [row] = await engine.executeRaw<{ subject: string; withdrawn_at: string; visibility: 'world' | 'private' }>(`SELECT w.subject,w.visibility,w.withdrawn_at::text AS withdrawn_at
+ const [row] = await engine.executeRaw<WithdrawalRow>(`SELECT w.subject,w.visibility,w.withdrawn_at::text AS withdrawn_at
FROM fact_withdrawals w LEFT JOIN facts f ON f.source_id=w.source_id AND f.visibility=w.visibility AND f.expired_at IS NOT NULL
- AND w.fact_hash IN (gbrain_fact_fingerprint(f.fact),gbrain_fact_fingerprint_v1(f.fact)) AND ${withdrawalCoversFactSql('w', 'f')}
+ AND w.fact_hash IN (gbrain_fact_fingerprint(f.fact),gbrain_fact_fingerprint_v1(f.fact)) AND ${withdrawalReachedFactSql('w', 'f')}
WHERE w.source_id=$1 AND w.visibility=$2 AND w.fact_hash IN (gbrain_fact_fingerprint($3),gbrain_fact_fingerprint_v1($3))
AND (w.subject='*' OR w.subject=$4::text OR w.subject=$6::text)
GROUP BY w.subject,w.visibility,w.withdrawn_at
HAVING $5::boolean=false OR COALESCE(bool_or(${seen(6)}), false) OR NOT COALESCE(bool_or(f.id IS NOT NULL), false)
ORDER BY (w.subject<>'*') DESC, w.withdrawn_at DESC LIMIT 1`,
[sourceId, input.visibility, input.fact, input.entity_slug, opts.excludePrivate === true, ownedPageWithdrawalSubject(input.page_slug)]);
- const error = verbError('invalid_params', FACT_WITHDRAWN_MESSAGE, FACT_WITHDRAWN_SUGGESTION);
- if (row) error.withdrawn = { at: new Date(row.withdrawn_at).toISOString(), subject: row.subject === '*' ? 'all_entities' : row.subject, visibility: row.visibility };
- return error;
+ return withdrawnRefusal(row);
}
export const CANDIDATE_FUSION_KEY = 'facts.candidate_fusion';
export type CandidateFusion = 'rrf_free' | 'interleave';
diff --git a/src/core/facts/withdrawal-schema.ts b/src/core/facts/withdrawal-schema.ts
index a07bfefeb7..3a13bf6b78 100644
--- a/src/core/facts/withdrawal-schema.ts
+++ b/src/core/facts/withdrawal-schema.ts
@@ -47,17 +47,13 @@ export const FACT_FINGERPRINT_FUNCTION_STATEMENTS = [
* ledger rows written earlier carry the exact v1 fingerprint and keep
* matching through gbrain_fact_fingerprint_v1.
*/
-export const FACT_WITHDRAWAL_SCHEMA_STATEMENTS = [
- `CREATE TABLE IF NOT EXISTS fact_withdrawals (
- source_id TEXT NOT NULL REFERENCES sources(id) ON DELETE CASCADE,
- visibility TEXT NOT NULL CHECK (visibility IN ('private','world')),
- subject TEXT NOT NULL DEFAULT '*',
- fact_hash TEXT NOT NULL,
- withdrawn_at TIMESTAMPTZ NOT NULL DEFAULT now(),
- PRIMARY KEY (source_id, visibility, subject, fact_hash)
- )`,
- ...FACT_FINGERPRINT_FUNCTION_STATEMENTS,
- `CREATE OR REPLACE FUNCTION gbrain_preserve_fact_withdrawal() RETURNS trigger
+/**
+ * The insert and update guard that stamps a row matching a withdrawal as withdrawn. GST-2346: a row on a member page
+ * (memory/members/<id>) matches only that page's own withdrawals: it is its member's own, a withdrawal made later still expires it, and the member's
+ * save checks the withdrawals of claims that member reads (facts/single-prepare.ts), so a claim it never read cannot
+ * expire the row it saves. Re-created alone by the member_page_withdrawal_scope migration.
+ */
+export const FACT_WITHDRAWAL_PRESERVE_FUNCTION_SQL = `CREATE OR REPLACE FUNCTION gbrain_preserve_fact_withdrawal() RETURNS trigger
LANGUAGE plpgsql SET search_path = pg_catalog, public AS $fn$
DECLARE withdrawn TIMESTAMPTZ;
BEGIN
@@ -67,7 +63,8 @@ export const FACT_WITHDRAWAL_SCHEMA_STATEMENTS = [
PERFORM id FROM sources WHERE id = NEW.source_id FOR SHARE;
SELECT min(withdrawn_at) INTO withdrawn FROM fact_withdrawals
WHERE source_id = NEW.source_id AND visibility = NEW.visibility
- AND (subject = '*' OR subject = NEW.entity_slug)
+ AND (CASE WHEN starts_with(COALESCE(NEW.source_markdown_slug, ''), 'memory/members/') THEN subject = NEW.source_markdown_slug
+ ELSE subject = '*' OR subject = NEW.entity_slug END)
AND fact_hash IN (gbrain_fact_fingerprint(NEW.fact), gbrain_fact_fingerprint_v1(NEW.fact));
IF withdrawn IS NOT NULL THEN
NEW.expired_at := withdrawn;
@@ -76,7 +73,19 @@ export const FACT_WITHDRAWAL_SCHEMA_STATEMENTS = [
END IF;
RETURN NEW;
END
- $fn$`,
+ $fn$`;
+
+export const FACT_WITHDRAWAL_SCHEMA_STATEMENTS = [
+ `CREATE TABLE IF NOT EXISTS fact_withdrawals (
+ source_id TEXT NOT NULL REFERENCES sources(id) ON DELETE CASCADE,
+ visibility TEXT NOT NULL CHECK (visibility IN ('private','world')),
+ subject TEXT NOT NULL DEFAULT '*',
+ fact_hash TEXT NOT NULL,
+ withdrawn_at TIMESTAMPTZ NOT NULL DEFAULT now(),
+ PRIMARY KEY (source_id, visibility, subject, fact_hash)
+ )`,
+ ...FACT_FINGERPRINT_FUNCTION_STATEMENTS,
+ FACT_WITHDRAWAL_PRESERVE_FUNCTION_SQL,
`DROP TRIGGER IF EXISTS facts_preserve_withdrawal ON facts`,
`CREATE TRIGGER facts_preserve_withdrawal BEFORE INSERT OR UPDATE OF fact, source_id, visibility, entity_slug, expired_at ON facts
FOR EACH ROW EXECUTE FUNCTION gbrain_preserve_fact_withdrawal()`,
diff --git a/src/core/ops/qm-memory.ts b/src/core/ops/qm-memory.ts
index 6aeb377e17..13a63b0acb 100644
--- a/src/core/ops/qm-memory.ts
+++ b/src/core/ops/qm-memory.ts
@@ -305,7 +305,7 @@ const memory_write: Operation = {
const intent = scopeSource === undefined
? { fact: item.fact as string, kind: (item.kind ?? 'fact') as never, visibility: 'private' as const, entity_slug: null, page_slug: memberPageSlug(actor.member) }
: { fact: item.fact as string, kind: (item.kind ?? 'fact') as never, visibility: 'world' as const, entity_slug: null, page_slug: SCOPE_PAGE_SLUG };
- try { await assertFactNotWithdrawn(ctx.engine, writeCtx.sourceId ?? 'default', intent, { excludePrivate }); } catch (e) {
+ try { await assertFactNotWithdrawn(ctx.engine, writeCtx.sourceId ?? 'default', intent, { excludePrivate, remote: ctx.remote !== false }); } catch (e) {
if (e instanceof OperationError) e.message = `facts[${index}]: ${e.message} Nothing was saved.`;
throw e;
}
diff --git a/src/core/persistence/memory-prepare.ts b/src/core/persistence/memory-prepare.ts
index 871d3be88c..2f3ddc2cf8 100644
--- a/src/core/persistence/memory-prepare.ts
+++ b/src/core/persistence/memory-prepare.ts
@@ -96,7 +96,7 @@ export async function prepareMemoryMutation(engine: BrainEngine, row: WriteReque
if (p.expected_revision !== undefined) assertPageRevision(snapshot, engineMutationPrecondition(parseMutationPrecondition(p)));
const observedRevision = snapshot?.revision ?? null;
const excludePrivate = await resolveExcludePrivatePages(engine, row.authority.remote === true);
- await assertFactNotWithdrawn(engine, row.source_id, input, { excludePrivate });
+ await assertFactNotWithdrawn(engine, row.source_id, input, { excludePrivate, remote: row.authority.remote === true });
signal?.throwIfAborted();
const embeddingConfigSql = "SELECT key,value FROM config WHERE key IN ('embedding_model','embedding_dimensions') ORDER BY key";
const observedEmbeddingConfig = JSON.stringify(await engine.executeRaw(embeddingConfigSql));
@@ -134,7 +134,7 @@ export async function prepareMemoryMutation(engine: BrainEngine, row: WriteReque
const lexicalOld = await lexical(engine);
const contestedOld = contested ? decision.candidate! : lexicalOld;
const validate = async (tx: BrainEngine) => {
- await assertFactNotWithdrawn(tx, row.source_id, input, { excludePrivate });
+ await assertFactNotWithdrawn(tx, row.source_id, input, { excludePrivate, remote: row.authority.remote === true });
if (embedding && JSON.stringify(await tx.executeRaw(`${embeddingConfigSql} FOR SHARE`)) !== observedEmbeddingConfig) conflict(row);
const current = await decide(tx, true);
if (candidateState(current) !== candidateState(decision)) conflict(row);
diff --git a/src/core/schema-migrations/latest.generated.ts b/src/core/schema-migrations/latest.generated.ts
index 06933be159..e228ee6a8c 100644
--- a/src/core/schema-migrations/latest.generated.ts
+++ b/src/core/schema-migrations/latest.generated.ts
@@ -4,4 +4,4 @@
// The highest schema migration version (migrate.ts LATEST_VERSION), importable without
// loading the migrations themselves.
-export const LATEST_SCHEMA_VERSION = 304;
+export const LATEST_SCHEMA_VERSION = 305;
diff --git a/src/core/schema-migrations/registry.generated.ts b/src/core/schema-migrations/registry.generated.ts
index eb09b0133a..38111bdda9 100644
--- a/src/core/schema-migrations/registry.generated.ts
+++ b/src/core/schema-migrations/registry.generated.ts
@@ -305,6 +305,7 @@ import { v301 } from './v301-member-email.ts';
import { v302 } from './v302-link-transitions-source.ts';
import { v303 } from './v303-access-page-rules.ts';
import { v304 } from './v304-access-owner-origin.ts';
+import { v305 } from './v305-member-page-withdrawal-scope.ts';
// Array order is historical (see HISTORICAL_ARRAY_ORDER in the generator); the
// runner sorts by version before applying.
@@ -608,4 +609,5 @@ export const MIGRATIONS: Migration[] = [
v302,
v303,
v304,
+ v305,
];
diff --git a/src/core/schema-migrations/v305-member-page-withdrawal-scope.ts b/src/core/schema-migrations/v305-member-page-withdrawal-scope.ts
new file mode 100644
index 0000000000..a2e46f0913
--- /dev/null
+++ b/src/core/schema-migrations/v305-member-page-withdrawal-scope.ts
@@ -0,0 +1,21 @@
+import type { Migration } from './types.ts';
+import { FACT_WITHDRAWAL_PRESERVE_FUNCTION_SQL } from '../facts/withdrawal-schema.ts';
+import { FACT_INSERT_GUARD_FUNCTION_SQL } from '../facts/insert-guard-schema.ts';
+
+// Applied by src/core/migrate.ts on the next initSchema(); see docs/ENGINES.md
+// ("Canonical schema sources") for when schema.sql or a TS fragment also changes.
+//
+// GST-2346: a member's save on its own member page no longer reveals that a claim it never read was withdrawn. The two
+// insert guards that stamp a row matching a withdrawal as withdrawn (gbrain_preserve_fact_withdrawal per row,
+// gbrain_guard_inserted_facts per statement) mark a row on a member page (memory/members/<id>) only by that page's own
+// withdrawals; the member's save checks the withdrawals of claims that member reads instead (facts/single-prepare.ts).
+// A withdrawal still expires every matching row, member pages included, when it is made. Replaces only the functions: their triggers already call them,
+// and re-creating a trigger would take an ACCESS EXCLUSIVE lock on facts. The migration run's search_path hardening
+// (function-search-path.ts) appends pg_temp again. No row is read or written. Provisional number: renumbered at the
+// merge slot.
+export const v305: Migration = {
+ version: 305,
+ name: 'member_page_withdrawal_scope',
+ idempotent: true,
+ sql: `${FACT_WITHDRAWAL_PRESERVE_FUNCTION_SQL};\n${FACT_INSERT_GUARD_FUNCTION_SQL}`,
+};
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.json
index 365b1cc774..be5af0ae59 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json
@@ -618,13 +618,13 @@
"gbrain_graduation_fence()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=cd4642fe8deee2a3c14ef41f53862f0a449b2d8a10e47177bd4f5d2e05ce8803",
"gbrain_guard_deferred_request()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=edf066d51ee76d4037663393271883a12d7fdf4f0f01b7d1faa9e979d552c6c6",
"gbrain_guard_effect_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=aa01528006dd7029eac6808e0233991524c9de9dc14aaf41f44160d67a747042",
- "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=027c16bf0f61101510f54966dfa7d3c5f90112cef52a51861adc36103a0bc02b",
+ "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=78fe53917ec54c7627df4961a7669e0d65f8adfa7e249da1beeb58dc37978a66",
"gbrain_guard_protocol_activation()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=bb477ec66ecac06e6edba773a94a2834ef4286a0b9e5cfa8b9b8646e003b0b9e",
"gbrain_guard_request_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=2709686143e064b577e2b3c8e3e2b1009d52a836a2bc709f5f003a251eb004d2",
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_mark_derivation_scope_entry()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=72ac0027fd37ecc4c72ad2e294ae3a98564736339b9ac917ea5d4112ec3cd35f",
- "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
+ "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=6677571f69ebfb82f183514caf6b94ccaaa0fda3a4326cf7601d21f155936c15",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=dc7a279205df83f00b9147adea8e609a410d0484d04648ea3fdb4344a5caf259",
"gbrain_refuse_purged_fact()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=d1d584b91ceea7f4e63c235b790ef89c958c578e635f77ddd644918bc36d33f1",
"gbrain_refuse_purged_page()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=8aaaf7c22fc9acb4b1e84fe75f11ae6c889949b78de1ef6bdba1db54ef43844e",
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
index f5f37f52ab..1b9f91f655 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
@@ -618,13 +618,13 @@
"gbrain_graduation_fence()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=cd4642fe8deee2a3c14ef41f53862f0a449b2d8a10e47177bd4f5d2e05ce8803",
"gbrain_guard_deferred_request()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=edf066d51ee76d4037663393271883a12d7fdf4f0f01b7d1faa9e979d552c6c6",
"gbrain_guard_effect_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=aa01528006dd7029eac6808e0233991524c9de9dc14aaf41f44160d67a747042",
- "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=027c16bf0f61101510f54966dfa7d3c5f90112cef52a51861adc36103a0bc02b",
+ "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=78fe53917ec54c7627df4961a7669e0d65f8adfa7e249da1beeb58dc37978a66",
"gbrain_guard_protocol_activation()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=bb477ec66ecac06e6edba773a94a2834ef4286a0b9e5cfa8b9b8646e003b0b9e",
"gbrain_guard_request_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=2709686143e064b577e2b3c8e3e2b1009d52a836a2bc709f5f003a251eb004d2",
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_mark_derivation_scope_entry()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=72ac0027fd37ecc4c72ad2e294ae3a98564736339b9ac917ea5d4112ec3cd35f",
- "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
+ "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=6677571f69ebfb82f183514caf6b94ccaaa0fda3a4326cf7601d21f155936c15",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=dc7a279205df83f00b9147adea8e609a410d0484d04648ea3fdb4344a5caf259",
"gbrain_refuse_purged_fact()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=d1d584b91ceea7f4e63c235b790ef89c958c578e635f77ddd644918bc36d33f1",
"gbrain_refuse_purged_page()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=8aaaf7c22fc9acb4b1e84fe75f11ae6c889949b78de1ef6bdba1db54ef43844e",
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
index 717dd57ead..8d3b6d8d7e 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
@@ -618,13 +618,13 @@
"gbrain_graduation_fence()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=cd4642fe8deee2a3c14ef41f53862f0a449b2d8a10e47177bd4f5d2e05ce8803",
"gbrain_guard_deferred_request()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=edf066d51ee76d4037663393271883a12d7fdf4f0f01b7d1faa9e979d552c6c6",
"gbrain_guard_effect_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=aa01528006dd7029eac6808e0233991524c9de9dc14aaf41f44160d67a747042",
- "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=027c16bf0f61101510f54966dfa7d3c5f90112cef52a51861adc36103a0bc02b",
+ "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=78fe53917ec54c7627df4961a7669e0d65f8adfa7e249da1beeb58dc37978a66",
"gbrain_guard_protocol_activation()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=bb477ec66ecac06e6edba773a94a2834ef4286a0b9e5cfa8b9b8646e003b0b9e",
"gbrain_guard_request_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=2709686143e064b577e2b3c8e3e2b1009d52a836a2bc709f5f003a251eb004d2",
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_mark_derivation_scope_entry()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=72ac0027fd37ecc4c72ad2e294ae3a98564736339b9ac917ea5d4112ec3cd35f",
- "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
+ "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=6677571f69ebfb82f183514caf6b94ccaaa0fda3a4326cf7601d21f155936c15",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=dc7a279205df83f00b9147adea8e609a410d0484d04648ea3fdb4344a5caf259",
"gbrain_refuse_purged_fact()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=d1d584b91ceea7f4e63c235b790ef89c958c578e635f77ddd644918bc36d33f1",
"gbrain_refuse_purged_page()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=8aaaf7c22fc9acb4b1e84fe75f11ae6c889949b78de1ef6bdba1db54ef43844e",
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-default.json b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
index 15cdeb704a..fbac6a07b8 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
@@ -621,13 +621,13 @@
"gbrain_graduation_fence()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=cd4642fe8deee2a3c14ef41f53862f0a449b2d8a10e47177bd4f5d2e05ce8803",
"gbrain_guard_deferred_request()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=edf066d51ee76d4037663393271883a12d7fdf4f0f01b7d1faa9e979d552c6c6",
"gbrain_guard_effect_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=aa01528006dd7029eac6808e0233991524c9de9dc14aaf41f44160d67a747042",
- "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=027c16bf0f61101510f54966dfa7d3c5f90112cef52a51861adc36103a0bc02b",
+ "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=78fe53917ec54c7627df4961a7669e0d65f8adfa7e249da1beeb58dc37978a66",
"gbrain_guard_protocol_activation()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=bb477ec66ecac06e6edba773a94a2834ef4286a0b9e5cfa8b9b8646e003b0b9e",
"gbrain_guard_request_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=2709686143e064b577e2b3c8e3e2b1009d52a836a2bc709f5f003a251eb004d2",
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_mark_derivation_scope_entry()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=72ac0027fd37ecc4c72ad2e294ae3a98564736339b9ac917ea5d4112ec3cd35f",
- "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
+ "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=6677571f69ebfb82f183514caf6b94ccaaa0fda3a4326cf7601d21f155936c15",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=dc7a279205df83f00b9147adea8e609a410d0484d04648ea3fdb4344a5caf259",
"gbrain_refuse_purged_fact()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=d1d584b91ceea7f4e63c235b790ef89c958c578e635f77ddd644918bc36d33f1",
"gbrain_refuse_purged_page()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=8aaaf7c22fc9acb4b1e84fe75f11ae6c889949b78de1ef6bdba1db54ef43844e",
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
index 9a39a88413..989ba472df 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
@@ -621,13 +621,13 @@
"gbrain_graduation_fence()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=cd4642fe8deee2a3c14ef41f53862f0a449b2d8a10e47177bd4f5d2e05ce8803",
"gbrain_guard_deferred_request()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=edf066d51ee76d4037663393271883a12d7fdf4f0f01b7d1faa9e979d552c6c6",
"gbrain_guard_effect_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=aa01528006dd7029eac6808e0233991524c9de9dc14aaf41f44160d67a747042",
- "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=027c16bf0f61101510f54966dfa7d3c5f90112cef52a51861adc36103a0bc02b",
+ "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=78fe53917ec54c7627df4961a7669e0d65f8adfa7e249da1beeb58dc37978a66",
"gbrain_guard_protocol_activation()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=bb477ec66ecac06e6edba773a94a2834ef4286a0b9e5cfa8b9b8646e003b0b9e",
"gbrain_guard_request_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=2709686143e064b577e2b3c8e3e2b1009d52a836a2bc709f5f003a251eb004d2",
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_mark_derivation_scope_entry()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=72ac0027fd37ecc4c72ad2e294ae3a98564736339b9ac917ea5d4112ec3cd35f",
- "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
+ "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=6677571f69ebfb82f183514caf6b94ccaaa0fda3a4326cf7601d21f155936c15",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=dc7a279205df83f00b9147adea8e609a410d0484d04648ea3fdb4344a5caf259",
"gbrain_refuse_purged_fact()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=d1d584b91ceea7f4e63c235b790ef89c958c578e635f77ddd644918bc36d33f1",
"gbrain_refuse_purged_page()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=8aaaf7c22fc9acb4b1e84fe75f11ae6c889949b78de1ef6bdba1db54ef43844e",
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
index 2eff9fb9a0..5a4917c866 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
@@ -621,13 +621,13 @@
"gbrain_graduation_fence()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=cd4642fe8deee2a3c14ef41f53862f0a449b2d8a10e47177bd4f5d2e05ce8803",
"gbrain_guard_deferred_request()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=edf066d51ee76d4037663393271883a12d7fdf4f0f01b7d1faa9e979d552c6c6",
"gbrain_guard_effect_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=aa01528006dd7029eac6808e0233991524c9de9dc14aaf41f44160d67a747042",
- "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=027c16bf0f61101510f54966dfa7d3c5f90112cef52a51861adc36103a0bc02b",
+ "gbrain_guard_inserted_facts()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=78fe53917ec54c7627df4961a7669e0d65f8adfa7e249da1beeb58dc37978a66",
"gbrain_guard_protocol_activation()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=bb477ec66ecac06e6edba773a94a2834ef4286a0b9e5cfa8b9b8646e003b0b9e",
"gbrain_guard_request_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=2709686143e064b577e2b3c8e3e2b1009d52a836a2bc709f5f003a251eb004d2",
"gbrain_guard_skill_publication()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=e854c0d058e75a65c3a90127c5c417380975100e83fc34288f6085e786df10a9",
"gbrain_lease_shared_skill_delivery()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=5e493c1ac8dce8cb025a736629e563437c4b214744137c302c532c20bf7e7acf",
"gbrain_mark_derivation_scope_entry()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=72ac0027fd37ecc4c72ad2e294ae3a98564736339b9ac917ea5d4112ec3cd35f",
- "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=9beb118551a08451a228146373f50f2aa2ce0cfe89937e937d361b33224aa0aa",
+ "gbrain_preserve_fact_withdrawal()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=6677571f69ebfb82f183514caf6b94ccaaa0fda3a4326cf7601d21f155936c15",
"gbrain_queue_page_projection()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=dc7a279205df83f00b9147adea8e609a410d0484d04648ea3fdb4344a5caf259",
"gbrain_refuse_purged_fact()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=d1d584b91ceea7f4e63c235b790ef89c958c578e635f77ddd644918bc36d33f1",
"gbrain_refuse_purged_page()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public, pg_temp] body_sha256=8aaaf7c22fc9acb4b1e84fe75f11ae6c889949b78de1ef6bdba1db54ef43844e",
diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.json
index 22feb54248..0ac52ada97 100644
--- a/test/fixtures/goldens/migrations/records.json
+++ b/test/fixtures/goldens/migrations/records.json
@@ -1,6 +1,6 @@
{
"golden": {
- "count": 299,
+ "count": 300,
"gaps": [
17,
18,
@@ -103,7 +103,7 @@
"widenIdentityIndex": "86a6176bd7637d964dbc1d3cd3b1bdfa3ca0161e1ee248c37d7380a1471282e6",
"withSchemaLockTimeout": "95605bd3004955e11e936c7a4aa6889319b401098abf9db18ef3e48da2c3fc59"
},
- "latest": 304,
+ "latest": 305,
"records": [
{
"handler": {
@@ -2258,8 +2258,8 @@
"idempotent": true,
"name": "durable_fact_withdrawals",
"sql": {
- "length": 3221,
- "sha256": "e9e527dac29fc5b4fe57f9aba168b5aab56726d725b25ec089794f5221d8b01e"
+ "length": 3365,
+ "sha256": "615a0a02b211f1cea2f5e8ce79199c6f23beca5dd7f861adb6688357e1e895a9"
},
"sqlFor": "absent",
"transaction": "absent",
@@ -2560,8 +2560,8 @@
"idempotent": true,
"name": "fact_withdrawal_subject",
"sql": {
- "length": 3193,
- "sha256": "d6d5fdfcea9c4deae6debb67760cbf7c29b1747c62dce3ad721ea93e73972dc1"
+ "length": 3337,
+ "sha256": "3227800d437fa2b78926ee66de00a997d5069ce54b90ab8e920bd1bc448b5526"
},
"sqlFor": "absent",
"transaction": "absent",
@@ -2644,8 +2644,8 @@
"idempotent": true,
"name": "fact_withdrawal_normalized_fingerprint",
"sql": {
- "length": 3937,
- "sha256": "68db3dc02333d00847d9d8ce4c47d484b5a67cbbf5ce619eba8b6a263eb07663"
+ "length": 4081,
+ "sha256": "b606aa563097e13b8d6cc3c8f6ac54aa58a317ee20325b3f5a1f0364718de444"
},
"sqlFor": "absent",
"transaction": "absent",
@@ -4225,8 +4225,8 @@
"idempotent": true,
"name": "set_based_fact_insert_guards",
"sql": {
- "length": 8575,
- "sha256": "7a76b08224ef82c7034f93c983b82effc7e5bb54a4b734182541967bb478caec"
+ "length": 8743,
+ "sha256": "42ae4b8dd158fab9d4e111e4b741d6a00658798742b00cfa7903c24aaaecfd54"
},
"sqlFor": "absent",
"transaction": "absent",
@@ -4535,8 +4535,8 @@
"idempotent": true,
"name": "outcome_markers_skip_purge_guard",
"sql": {
- "length": 2560,
- "sha256": "95449fe0798457014873642724ad5da8fc97db0bb9cbb94d3b8c22c01b303a3b"
+ "length": 2728,
+ "sha256": "4b83038eda2952a9c1fbe327a865f6a1343678cea4a4207ea4259b819e0955ba"
},
"sqlFor": "absent",
"transaction": "absent",
@@ -4963,6 +4963,19 @@
"transaction": "absent",
"verify": "absent",
"version": 304
+ },
+ {
+ "handler": "absent",
+ "idempotent": true,
+ "name": "member_page_withdrawal_scope",
+ "sql": {
+ "length": 3850,
+ "sha256": "bffe7dad87a3f4d4b6068a107410e90d7af4fb70dd98e8575a9ed5026ec3ab3d"
+ },
+ "sqlFor": "absent",
+ "transaction": "absent",
+ "verify": "absent",
+ "version": 305
}
],
"versions": [
@@ -5264,7 +5277,8 @@
301,
302,
303,
- 304
+ 304,
+ 305
]
},
"normalizer": "migrations-record-v1"