Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: pre-landing review fixes

garrytan4d8df0519458
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 575b88d47f..fa4b839bd1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,11 +12,11 @@ identifiers and attribution are available in the pre-removal Git revision
## [Unreleased]
-**A purged page's facts no longer come back.** When the 72-hour retention purge removed a soft-deleted page's row, it left the page's facts active, because facts have no foreign key to pages. Once the tombstone was gone, those facts showed up again for every reader, local and remote, and a new page written at the same slug picked them up. The purge now expires those facts in the same transaction as the page delete: the facts filed on the page, and the facts about it that no other live page holds. The rows are kept, expired, never deleted. Facts another live page holds about the slug stay active.
+**A purged page's facts no longer come back.** When the 72-hour retention purge removed a soft-deleted page's row, it left the page's facts active, because facts have no foreign key to pages. Once the tombstone was gone, those facts showed up again for every reader, local and remote, and a new page written at the same slug picked them up. The purge now expires those facts in the same transaction as the page delete: the facts filed on the page, and the facts about it that no page holds. The rows are kept, expired, never deleted. A fact another page holds about the slug stays active, even when that page is soft-deleted, so restoring it brings the fact back. An ontology observation about a live entity that was sourced from the purged page also stays active.
### Itemized changes
-- `src/core/facts/gone-page-facts.ts`: `expireGonePageFacts`, the one predicate for the facts a page takes with it.
+- `src/core/facts/gone-page-facts.ts`: `expireGonePageFacts`, the facts a purged page takes with it, as two updates that each use their slug index.
- `src/core/engine-sql/pages.ts` (`purgeDeletedPages`, the bulk purge) and `src/core/persistence/purge-deleted.ts` (`expireRecordedTombstones`, the belief-ledger purge of a recorded source) call it in the purge transaction. The managed purge already sweeps the facts filed on the page.
- Tests: `test/purge-expires-page-facts.test.ts` (PGLite and Postgres), which fails before the fix on the bulk and recorded purges.
diff --git a/docs/architecture/key-files/memory-purge.md b/docs/architecture/key-files/memory-purge.md
index 5bc5a84f09..3731c3fdda 100644
--- a/docs/architecture/key-files/memory-purge.md
+++ b/docs/architecture/key-files/memory-purge.md
@@ -8,7 +8,7 @@ User-facing contract: [expire versus purge](../../guides/memory-boundaries.md#pu
- `src/core/facts/purge-verify.ts` — receipts and verification. `verifyFactPurge` runs one bounded adapter per store (row bound, per-statement `statement_timeout`, a total deadline; `__setPurgeProbeLimitsForTests`): swept stores report `deleted`, `incomplete` (still holds the claim) or `unverified` (bound hit); page-text stores report remaining text as `out_of_scope: source_prose`; every `probed_reported` inventory table is probed and listed; derived rows are `retained_inactive`; model-derived pages without edges are `derived_legacy: unverified`. On-disk: page files (`canonical_markdown`), a quarantined `<file>.tmp` carrying the claim is deleted, the facts write-failure log is reported. `gitResidualCommits` scans `git log --all -p -- <page paths>` output in-process (the pattern never enters argv; byte and time bounded) and lists commits; `OUT_OF_REACH_RESIDUALS` lead every receipt. Links, timeline entries and raw data that still carry the claim are named row by row (`link:<id> <from> -> <to>`, `timeline:<id> <slug> <date>`, `raw_data:<id> <slug> <source>`, up to 20); queued `persistence_effects` whose data, outcome or recovery carry it are reported; `belief_events` and `fact_context` get ledger reports. The vector probe returns same-model neighbours as paraphrase candidates and is never a gate. `purgeCompletion` derives `committed | complete | incomplete` from effects (failed or parked = incomplete), a fingerprint probe and the receipt, with exit codes 10/0/75. A segmented page or version is probed segment by segment (`segmentedBodyContains`, a needle split by a cut is found; row and time bounded) and reported with the page stores; `page_segment_texts` gets an exact-bytes probe (an unreferenced text holding the claim is `incomplete`, a referenced one `out_of_scope`); the page purge probes the texts its manifests referenced (`PagePurgeContext.segmentShas`).
- `src/core/belief/purge.ts` — the purge half of the belief ledger (BELIEF_LEDGER.md 6.5). Every fact or page purge bumps `sources.purge_epoch` (`bumpPurgeEpoch`; an append prepared at an older epoch with `preparedEpoch` refuses `belief_stale_preparation`) and runs three passes inside the purge transaction: `redactPurgedKeys` (the purged keys, by `claim_fp` and page lifetime, keep skeletons: value, value_hash and prior_hash null, `purged`), `redactCarryingFields` (keyset batches of 1000 reading only the carrying fields of fact, take and link events, matched in JS by `quotes` over `claimForms`, never SQL `lower()`/`strpos`: each carrying field from `CARRYING_FIELDS` that quotes a purged claim, plain or fence-escaped, becomes `REDACTION_MARKER(<purge request>)` and is listed in `redacted_fields`; a later event's prior_hash naming the old hash names the new one) with `registerLiveCarriers` (a surviving row whose field quotes the claim enters `belief_redactions` with its field hash, so its next event writes the marker until an explicit owner edit sets a different value: `publicationBeliefOptions` marks `ownerEdit` only on a local `put_page`, `edit_page`, `takes_update` or `takes_resolve` with no internal intent kind, and append still needs `OWNER_TIER_FLOOR`) and, for a fact purge, `registerVersionCarriers` (the retained versions still quoting the claim, registered under the keys the backfill gives them). A claim shorter than 8 characters quotes a field only as a word in spaced scripts (`ceo` does not match `herbaceous`; CJK and markup still match), and `appendDerivedHidden` (one `derived.hidden` per key the derivation walk hid; `readBeliefHistory` then hides that key's earlier events and every backfill event of it). A page purge's claims come from `pagePurgeClaims`: the page's facts and takes, every retained version's fence rows and every claim in its lifetimes' events, unbounded. `releaseSuppressedFields` is the owner release `trust confirm` runs (`belief_redactions.released_hash`); every release, there or in an owner-edit append, appends one `redaction.released` (`redactionReleasedDraft`: fields, purge requests and released hashes, never the text) in the publication `released_by` names. The receipt's `ledger` block reports the counts and `derived_walk`; a truncated walk withholds certification of its coverage interval (`coverage-report.ts`). Purge-verify's ledger report is a JS keyset scan too: a missed carrying field is `incomplete`, another subject's recorded value quoting the claim is `out_of_scope` with `field@key` items. Seam: `__setPurgeRedactionFaultForTests`. Probes: `test/belief-ledger-purge.test.ts` (both engines).
- `src/core/belief/purge-mirror.ts` — the text-free purge mirror `<brain home>/.gbrain/purge-events.jsonl` (0600, fsynced): an `intent` line before the purge commits (`appendPurgeIntent`; request, source and incarnation, scope, fingerprints, content hashes, lifetimes, epoch; never claim text; an unwritable mirror refuses the purge with the typed `purge_mirror_unwritable`, with or without a ledger) and a `committed` line after (`appendPurgeCommitted`, best effort; a page purge writes it from the coordinator's `afterCommit`, so it does not depend on the op handler finishing). `restorePgliteBackup` (`gbrain backup restore --purge-mirror <absolute path>` names a mirror other than the brain home's) replays every committed purge newer than the archive inside its transaction (`replayPurgesInRestore`: tombstones, row removal (a fact-scope replay rewrites page bodies and versions through `rewritePageBodies` / `redactPageVersions`, then runs `purgeSegmentStorage` with each claim's `stagingsHoldingClaim`; a page-scope replay deletes the page through `deletePageWithSegments`, so segment texts that held the purged content go in the replay, as in the purge), the three passes, the derived rows hidden again with `derived.hidden` cause `restore_replay`, one `fact.purged`/`page.purged` with cause `restore_replay`; a page-scope replay matches pages by content hash or lifetime, never by slug alone; an archive from before the ledger, no `belief_events`, replays tombstones and row removal and reports `ledger: 'absent'`; an intent whose request already has tombstones is skipped), records each as `complete`, `partial` (no restored row held the text, or the derivation walk could not run) or `unverified` (intent without committed line, not replayed), returns `purge_replay` in the receipt and adds a reconnect warning unless the state is `none` or `complete`; an unreadable mirror is `unavailable`. `coverage.restored` carries the outcome, which `readRestorePurgeReplay` reads back for the doctor. A Postgres restore runs `gbrain beliefs replay-purges --archived-at <iso> (--purge-mirror <abs path> | --from-url-env <VAR>) [--apply]` (`src/commands/beliefs-replay-purges.ts`; dry run by default: `replayPurges` runs the replay in a transaction that rolls back), whose database source `purgeLinesFromDatabase` rebuilds the intents from every pre-restore tombstone (not bounded by `purged_at`, the purge transaction's start) and skips those the archive already holds. Seam: `__setPurgeReplayFaultForTests`. Probes: `test/belief-ledger-restore.test.ts`; segment storage after a replay: `test/large-pages/purge-replay-segments.test.ts` (both engines).
-- `src/core/facts/gone-page-facts.ts` — `expireGonePageFacts(exec, pages)`: in the transaction that removes a page row for good, expires (never deletes) the active facts filed on the page and the active facts about it no other live page holds, so they don't come back for readers once the tombstone is gone and a new page at the slug starts clean. Facts have no foreign key to pages. Called by the bulk retention purge (`engine-sql/pages.ts` `purgeDeletedPages`) and the belief-ledger purge of a recorded source (`persistence/purge-deleted.ts` `expireRecordedTombstones`).
+- `src/core/facts/gone-page-facts.ts` — `expireGonePageFacts(exec, pages)`: in the transaction that removes a page row for good, expires (never deletes) the active facts filed on the page (ontology observations excluded: their `source_markdown_slug` is provenance) and the active facts about it that no page row holds (a soft-deleted holder keeps its fact for a restore), so they don't come back for readers once the tombstone is gone and a new page at the slug starts clean. Two updates, one per slug index. Facts have no foreign key to pages. Called by the bulk retention purge (`engine-sql/pages.ts` `purgeDeletedPages`) and the belief-ledger purge of a recorded source (`persistence/purge-deleted.ts` `expireRecordedTombstones`).
- `src/core/facts/purge-overlay.ts` — purge mode of the import overlay: `dropPurgedFenceRows` drops facts-fence rows matching `fact_purges` and takes-fence rows matching `take_purges` (the takes fence re-renders with its reservation rows plus the dropped numbers reserved, so a purged number is never reused; pinned by `test/purge-overlay-reservations.test.ts`) (subject = page slug; malformed fences left to the withdrawal diagnostics, which refuse a purged claim inside one). Called first by `preserveWithdrawnFenceRows`, so `import-file.ts` needs no change; the snapshot overlay (`page-state/snapshot.ts`) and export (`export-snapshot.ts`) carry purge tombstones as `PageWithdrawal.purged`, which `overlayWithdrawalBody` drops instead of striking.
- `src/core/facts/purge-schema.ts` — `MEMORY_PURGE_SCHEMA_SQL` (schema.sql fragment: `fact_purges`, `take_purges`, `page_purges` keyed `(source_id, content_hash)`, `derivation_inputs`, `needs_rederive`) and `MEMORY_PURGE_GUARD_SQL` (migration only): `facts_refuse_purged`, `takes_refuse_purged` and `pages_refuse_purged` raise `P0001 purged_content: …` (mapped to typed `purged_content` by `persistence/publication-failure.ts`) instead of skipping the row, whatever `expired_at` says. The pages guard has no column list so it never pins columns. Since migration v264 `facts_refuse_purged` fires on UPDATE only; the facts insert check runs once per statement in `facts/insert-guard-schema.ts`. `FACT_PURGE_LOOKUP_INDEX_SQL` (migration v231, CONCURRENTLY on Postgres) adds `fact_purges_subject_idx` (a page's own tombstones, the '*' lookup by fingerprint) and the partial `fact_purges_all_subjects_idx` (subject '*' only, for the snapshot marker count).
- `src/core/facts/insert-guard-schema.ts` — `FACT_INSERT_GUARD_SQL` (migration v264, #7105): one statement-level `facts_guard_inserted` trigger (`AFTER INSERT ... REFERENCING NEW TABLE AS inserted_facts`, function `gbrain_guard_inserted_facts`) runs the purge refusal, and the withdrawal stamp of deferred inserts, once per statement instead of once per row. It takes `FOR SHARE` on each inserted source row, refuses a statement whose rows match a `fact_purges` tombstone with the same `P0001 purged_content` message and `{table, hash8}` detail (the first matching row in insertion order, whatever its `expired_at`), then stamps inserted active rows still matching `fact_withdrawals` (v2 or v1 fingerprint) with `expired_at = min(withdrawn_at)` and a clamped `valid_until`, by an UPDATE of just those rows, run under the transaction-local `gbrain.fact_withdrawal_stamp` setting (`FACT_WITHDRAWAL_STAMP_SETTING`, reset after the UPDATE) so `gbrain_stamp_write_attribution` keeps the `last_write_*` and `last_written_at` the INSERT stamped or supplied. By default an insert is stamped before it is written by the per-row `facts_preserve_withdrawal_insert` (`BEFORE INSERT ... WHEN (NEW.expired_at IS NULL AND <deferral off>)`, the original function), so `INSERT ... RETURNING` reads the stamp; the bulk fence insert (`engine-sql/facts.ts` `insertFactRows`) sets `gbrain.fact_withdrawal_stamp_deferred` (`FACT_WITHDRAWAL_STAMP_DEFERRED_SETTING`) around its INSERTs, so the WHEN clause, which calls no function, skips the trigger and the statement guard stamps instead. The setting moves the stamp and never skips it: the guard stamps every still-matching active row whoever set it. A ledger with no row for the inserted sources costs one index probe. Transition tables cannot take a column list, so `facts_refuse_purged` and `facts_preserve_withdrawal` stay per-row for UPDATE (`BEFORE UPDATE OF ...`). Differences from the per-row insert guards: (1) a row ON CONFLICT DO NOTHING skips is not checked (it is not written either); (2) a row that another per-row BEFORE trigger (for example `managed_writer_guard`) or a constraint also refuses reports that refusal first; (3) a deferred insert is stamped after its RETURNING, so `INSERT ... RETURNING expired_at, valid_until` (or a CTE reading it in the same query) made under the deferral setting sees a withdrawn row unstamped while storage and every later statement see the stamp (`insertFactRows` returns only ids, slugs and row numbers). Pinned by `test/facts-insert-guards-7105.test.ts` (guard calls and firings per statement, RETURNING with and without deferral, and the same refusals, stamps and attribution as the per-row guards re-installed in a rolled-back transaction, both engines). #7778 (migration v279, `FACT_INSERT_GUARD_FUNCTION_SQL`): the purge refusal skips an extraction outcome row (`isOutcomeMarker` / `outcomeMarkerSql` in `facts/audit-sources.ts`: a conversation-facts audit source AND the exact text `EXTRACTION_COMPLETE` or `EXTRACTION_NOT_APPLICABLE`), so a wildcard tombstone a page purge wrote before the fix no longer keeps pages from completing; a user claim with that text is still refused. Pinned by `test/conversation-facts-outcome-marker-purge-7778.test.ts`.
diff --git a/src/core/facts/gone-page-facts.ts b/src/core/facts/gone-page-facts.ts
index 2e880cb315..9ab99c82b8 100644
--- a/src/core/facts/gone-page-facts.ts
+++ b/src/core/facts/gone-page-facts.ts
@@ -1,23 +1,32 @@
/**
- * The facts a page takes with it when its row goes away for good, or a new page replaces its tombstone: the active
- * facts filed on the page, and the active facts about it that no other live page holds. They are expired (kept, never
- * deleted), because facts have no foreign key to pages: left active, they would come back for every reader once the
- * tombstone that hid them is gone, and a new page at the slug would inherit them. Facts another live page holds about
- * the slug stay that page's. One predicate for every caller (the retention purges here, and a put over a tombstone).
+ * The facts a page takes with it when a retention purge removes its row for good. Facts have no foreign key to pages,
+ * so left active they would come back for every reader once the tombstone that hid them is gone, and a new page at the
+ * slug would pick them up. They are expired (kept, never deleted):
+ *
+ * - the facts filed on the page (`source_markdown_slug` is the page). Ontology observations (`dimension` set) are not
+ * filed there: their `source_markdown_slug` is provenance, so an observation about a live entity sourced from the
+ * purged page stays;
+ * - the facts about the page (`entity_slug` is the page) that no page row holds. A fact held by another page, live or
+ * soft-deleted, stays that page's: a restore brings it back, and that page's own purge expires it.
+ *
+ * Each case is its own update, so each uses its slug index.
*/
/** `$1` source ids and `$2` slugs, paired by position. */
-const EXPIRE_GONE_PAGE_FACTS_SQL = `UPDATE facts f SET expired_at = now(), row_num = NULL
- FROM unnest($1::text[], $2::text[]) AS g(source_id, slug)
- WHERE f.source_id = g.source_id AND f.expired_at IS NULL
- AND (f.source_markdown_slug = g.slug OR (f.entity_slug = g.slug AND NOT EXISTS (SELECT 1 FROM pages lp
- WHERE lp.source_id = f.source_id AND lp.slug = f.source_markdown_slug AND lp.slug <> g.slug AND lp.deleted_at IS NULL)))`;
+const GONE = 'unnest($1::text[], $2::text[]) AS g(source_id, slug)';
+const EXPIRE_FILED_SQL = `UPDATE facts f SET expired_at = now(), row_num = NULL FROM ${GONE}
+ WHERE f.source_id = g.source_id AND f.source_markdown_slug = g.slug AND f.expired_at IS NULL AND f.dimension IS NULL`;
+const EXPIRE_ABOUT_SQL = `UPDATE facts f SET expired_at = now(), row_num = NULL FROM ${GONE}
+ WHERE f.source_id = g.source_id AND f.entity_slug = g.slug AND f.expired_at IS NULL
+ AND NOT EXISTS (SELECT 1 FROM pages hp WHERE hp.source_id = f.source_id AND hp.slug = f.source_markdown_slug AND hp.slug <> g.slug)`;
-/** Expires the gone pages' facts; run it in the transaction that removes or replaces the pages. */
+/** Expires the purged pages' facts; run it in the transaction that deletes the page rows, after the delete. */
export async function expireGonePageFacts(
exec: { executeRaw(sql: string, params?: unknown[]): Promise<unknown[]> },
pages: ReadonlyArray<{ source_id: string; slug: string }>,
): Promise<void> {
if (!pages.length) return;
- await exec.executeRaw(EXPIRE_GONE_PAGE_FACTS_SQL, [pages.map(p => p.source_id), pages.map(p => p.slug)]);
+ const params = [pages.map(p => p.source_id), pages.map(p => p.slug)];
+ await exec.executeRaw(EXPIRE_FILED_SQL, params);
+ await exec.executeRaw(EXPIRE_ABOUT_SQL, params);
}
diff --git a/test/purge-expires-page-facts.test.ts b/test/purge-expires-page-facts.test.ts
index df53fec847..103215d2e4 100644
--- a/test/purge-expires-page-facts.test.ts
+++ b/test/purge-expires-page-facts.test.ts
@@ -1,10 +1,11 @@
/**
* A retention purge of a soft-deleted page expires that page's active facts, in the same transaction as the purge.
*
- * 1. Protects: after the purge removes a deleted page's row, the facts the page held and the facts about it that no live
- * page holds are expired (kept, never deleted), so they don't come back for any reader, local or remote, and a new
- * page written at the slug starts clean. A fact a live page holds about the slug stays active, and so do facts about
- * other pages.
+ * 1. Protects: after the purge removes a deleted page's row, the facts filed on the page and the facts about it that no
+ * page row holds are expired (kept, never deleted), so they don't come back for any reader, local or remote, and a
+ * new page written at the slug starts clean. A fact another page holds about the slug stays active, live or
+ * soft-deleted (a restore brings it back), and so does an ontology observation about a live entity sourced from the
+ * purged page, and facts about other pages.
* 2. Fails when: a purge deletes the page row and leaves its facts with expired_at NULL (facts have no foreign key to
* pages), on the bulk purge (purgeDeletedPages) or the belief-ledger purge of a recorded source
* (expireRecordedTombstones); or the fix deletes a fact row instead of expiring it. The managed purge, which already
@@ -41,7 +42,7 @@ function vectorFor(text: string): number[] {
}
const text = (out: { content: Array<{ text: string }> }) => out.content.map(c => c.text).join('\n');
-const SLUG = 'people/carol-example', OTHER = 'people/dan-example';
+const SLUG = 'people/carol-example', OTHER = 'people/dan-example', SHELVED = 'people/erin-example';
const person = (title: string, body: string) => `---\ntype: person\ntitle: ${title}\n---\n# ${title}\n\n${body}`;
/** A fixture write outside coordination; on a managed brain the writer guard is paused around it. */
@@ -79,13 +80,21 @@ async function purgedPageScenario(engine: BrainEngine, source: string, purge: ()
'SELECT fact, expired_at IS NOT NULL AS expired FROM facts WHERE source_id = $1 ORDER BY fact', [source]);
await write('put_page', { slug: OTHER, content: person('Dan Example', 'Dan notes.') });
+ await write('put_page', { slug: SHELVED, content: person('Erin Example', 'Erin notes.') });
await write('put_page', { slug: SLUG, content: person('Carol Example', 'Carol notes.') });
await write('remember', { fact: 'Carol Example harbor canarypurgedfact', entity: SLUG, provenance: 'fixture', visibility: 'world' });
await write('remember', { fact: 'Carol Example harbor canaryheldelsewhere', entity: SLUG, provenance: 'fixture', visibility: 'world' });
await write('remember', { fact: 'Dan Example harbor canaryotherpage', entity: OTHER, provenance: 'fixture', visibility: 'world' });
- // A fact the live page OTHER holds about SLUG.
+ await write('remember', { fact: 'Carol Example harbor canarynoholder', entity: SLUG, provenance: 'fixture', visibility: 'world' });
+ await write('remember', { fact: 'Carol Example harbor canaryshelvedholder', entity: SLUG, provenance: 'fixture', visibility: 'world' });
+ await write('ontology_propose', { entity: OTHER, dimension: 'employer', value: 'harbor canaryobservation', source: SLUG, confidence: 0.9, visibility: 'world' });
+ // Facts about SLUG held by the live page OTHER, by no page, and by SHELVED (soft-deleted below, still restorable).
await fixture(engine, "UPDATE facts SET source_markdown_slug = $2 WHERE source_id = $1 AND fact LIKE '%canaryheldelsewhere'", [source, OTHER]);
- expect((await facts()).map(f => f.expired)).toEqual([false, false, false]);
+ await fixture(engine, "UPDATE facts SET source_markdown_slug = NULL WHERE source_id = $1 AND fact LIKE '%canarynoholder'", [source]);
+ await fixture(engine, "UPDATE facts SET source_markdown_slug = $2 WHERE source_id = $1 AND fact LIKE '%canaryshelvedholder'", [source, SHELVED]);
+ const shelvedRevision = async () => (JSON.parse(await write('get_page', { slug: SHELVED, include_deleted: true })) as { revision: string }).revision;
+ await write('delete_page', { slug: SHELVED, expected_revision: await shelvedRevision() });
+ expect((await facts()).every(f => !f.expired)).toBe(true);
await write('delete_page', { slug: SLUG, expected_revision: await revision() });
await fixture(engine, "UPDATE pages SET deleted_at = deleted_at - interval '100 hours' WHERE source_id = $1 AND slug = $2", [source, SLUG]);
@@ -93,12 +102,20 @@ async function purgedPageScenario(engine: BrainEngine, source: string, purge: ()
expect((await engine.executeRaw('SELECT 1 FROM pages WHERE source_id = $1 AND slug = $2', [source, SLUG])).length).toBe(0);
// The managed purge sweeps the facts filed on the page (page-purge.ts); the other purges keep the row, expired.
+ // The managed purge (page-purge.ts) sweeps the rows filed on the page and leaves facts held by no page alone.
const expected = [
{ fact: 'Carol Example harbor canaryheldelsewhere', expired: false },
+ { fact: 'Carol Example harbor canarynoholder', expired: !opts.sweepsFiled },
...(opts.sweepsFiled ? [] : [{ fact: 'Carol Example harbor canarypurgedfact', expired: true }]),
+ { fact: 'Carol Example harbor canaryshelvedholder', expired: false },
{ fact: 'Dan Example harbor canaryotherpage', expired: false },
+ // The managed purge also deletes the observations sourced from the page; the other purges keep them.
+ ...(opts.sweepsFiled ? [] : [{ fact: expect.stringContaining('canaryobservation'), expired: false }]),
];
expect(await facts()).toEqual(expected);
+ // The soft-deleted holder comes back with its fact about the purged page.
+ await write('restore_page', { slug: SHELVED, expected_revision: await shelvedRevision() });
+ expect((await facts()).find(f => f.fact.includes('canaryshelvedholder'))?.expired).toBe(false);
const reads = async () => {
const out = [['local', text(await local('recall', { entity: SLUG }))]];
if (remoteReader) out.push(['remote', text(await remote('recall', { entity: SLUG }))]);