Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(page-body): check a retired generation against the size read with it; pin a re-export's body to its snapshot (GBRA-287 /ship step 11)
garrytan0978ca57e076
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 623f7654d2..79310e3dde 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,7 +14,7 @@ identifiers and attribution are available in the pre-removal Git revision**A page stored in segments no longer stops a source's sync.** A managed sync re-importing a Git-tracked page stored in segments (`pages.segmented_storage`) whose working-tree bytes differ from the pinned commit, as on a live checkout, compared the file against the stored page with a whole-body read. That read refused with `page_body_segmented`, recorded as a run failure in the freeze phase, and every later sync stopped `sync_blocked` at the same file, with a retry command that could not help. The freeze now compares a segmented page up to 24 MiB read back whole, as its publication already did, so the page gets the outcome an inline page gets. A page whose stored body can't be read at the freeze (`page_body_segmented`, or `page_body_rows_unreadable`) is held `page_write_failed`, naming its code, and the rest of the source syncs. `gbrain sync status` classifies such a hold by that code (`page_body_rows_unreadable`: retry, no person needed), not as an unplaced `page_write_failed`. A run that does stop before any write request is admitted (discovery, freeze or admission) now shows `last_error.request_id: null` in `gbrain sync status --json` instead of leaving the field out: there is no receipt, root request or `write_error_detail` to look for, and the phase, code and message name the error.-A full sync's DB-only reconcile (#2426) now re-exports a page stored in segments instead of refusing it: the file is measured from the segments of one generation, then streamed through the staging writer the withdrawal mirror and restore_page use, written under an in-progress name and renamed once whole, with the bytes `gbrain export` writes and the existing file's mode. A file over the pre-push secret-scan cap is skipped before the page's `source_path` is bound (a body already over the cap is not streamed to measure it) and listed as `over_push_scan_cap`, with a fix that does not send the agent back into the same full sync. Pages whose re-export fails are listed in the result's `reexport_failures`, and the run completes. A segmented read no longer refuses a healthy page `page_body_rows_unreadable` because a new body published between its reads.+A full sync's DB-only reconcile (#2426) now re-exports a page stored in segments instead of refusing it: the file is measured from the segments of one generation, then streamed through the staging writer the withdrawal mirror and restore_page use, written under an in-progress name and renamed once whole, with the bytes `gbrain export` writes and the existing file's mode. A file over the pre-push secret-scan cap is skipped before the page's `source_path` is bound (a body already over the cap is not streamed to measure it) and listed as `over_push_scan_cap`, with a fix that does not send the agent back into the same full sync. Pages whose re-export fails are listed in the result's `reexport_failures`, and the run completes. A segmented read no longer refuses a healthy page `page_body_rows_unreadable` because a new body published between its reads, and a read whose generation a publish retired meanwhile is checked against the size it read with that generation, so the rows the new body still shares never pass as the whole old body. A re-export streams the body of the revision whose frontmatter it writes: a publish in between fails that page's re-export, listed in `reexport_failures`, instead of writing one revision's frontmatter over the next one's body.### Itemized changes@@ -26,8 +26,10 @@ A full sync's DB-only reconcile (#2426) now re-exports a page stored in segments- `src/core/persistence/page-prepare.ts` (`fileMatchesSnapshot`): a segmented snapshot is compared read back whole, so the freeze drift screen no longer reads a format-only difference as drift.- `src/core/cycle/derived-write-through.ts` (`writeDerivedFile`): a generated page stored in segments is skipped (`segmented_page`, `writePageThrough`'s `inlineOnly`), since the batch rollback compares file strings.- `src/commands/sync/full.ts`: the DB-only re-export no longer refuses segmented pages, and each failed re-export is returned in `reexport_failures` (slug, path, code, message, fix).-- `src/core/page-body/body-tiling.ts` (`readTiledManifest`), `ingest.ts`, `read-range.ts`, `projection.ts`, `segment-rewrite.ts`: a live read names its generation first and checks that generation's rows against that generation's size; a live read whose generation a publish retired meanwhile reads the new live generation (up to 3 attempts).-- Tests: `test/large-pages/managed-sync-segmented-freeze.test.ts` (the live-checkout freeze, with its inline twin, and a page whose rows don't tile held while the rest of the commit imports), `test/sync-reconcile-db-only-segmented.test.ts` (2 MiB and over-24 MiB re-exports byte-equal to `gbrain export`, one failing page listed while the run advances, a plain-directory source, a write inside a transaction keeping the file's mode, frontmatter overrides refused, a file over the scan cap left unbound, the derived skip), `test/segmented-fault-classes-gbra287.test.ts` (hold and receipt classes), `test/segmented-read-concurrent-publish.test.ts` (a forced publish between a reader's statements). Every case but the plain-directory one fails on master.+- `src/core/page-body/body-tiling.ts` (`readTiledManifest`), `ingest.ts`, `read-range.ts`, `projection.ts`, `segment-rewrite.ts`: a live read names its generation first and checks that generation's rows against that generation's size; a live read whose generation a publish retired meanwhile reads the new live generation (up to 3 attempts), and is checked against the body_bytes read with the generation (`assertGenerationTiles`'s `bodyBytes`), never against a missing size.+- `src/core/export-snapshot.ts` (`segmentedExportMarkdown`), `page-prepare.ts` (`unreadPageFile`): the body is opened pinned to the snapshot's revision, so a publish after the snapshot refuses the file instead of mixing revisions.+- `docs/guides/sync-unblock-runbook.md`: the two `freeze_*` fault-table rows.+- Tests: `test/large-pages/managed-sync-segmented-freeze.test.ts` (the live-checkout freeze, with its inline twin, and a page whose rows don't tile held while the rest of the commit imports), `test/sync-reconcile-db-only-segmented.test.ts` (2 MiB and over-24 MiB re-exports byte-equal to `gbrain export`, one failing page listed while the run advances, a plain-directory source, a write inside a transaction keeping the file's mode, frontmatter overrides refused, a file over the scan cap left unbound, the derived skip), `test/segmented-fault-classes-gbra287.test.ts` (hold and receipt classes), `test/segmented-read-concurrent-publish.test.ts` (a forced publish between a reader's statements, a retired generation leaving only a shared prefix, a publish between a snapshot and its streamed file), `test/pathological/d15-sync-reexport-overwrite.test.ts` (a segmented DB-only page is re-exported, not held). Every case but the plain-directory one fails on master.## [0.60.559.0] - 2026-11-03diff --git a/docs/guides/sync-unblock-runbook.md b/docs/guides/sync-unblock-runbook.mdindex 55aa25ddea..1542615ed1 100644--- a/docs/guides/sync-unblock-runbook.md+++ b/docs/guides/sync-unblock-runbook.md@@ -148,6 +148,8 @@ Every hold and error has three fields, from one table| `write_gate_rejected` | page | none | yes | always: write_gate.external_mode=reject is the user's setting || `legacy_slug_conflict` | page | none | yes | always: only a person decides which legacy page the file takes over || `settle_mismatch` | page | none | yes | always: the pass cannot tell why the path does not settle |+| `freeze_page_body_segmented` | page | upgrade | yes | always: a sync path read a page stored in segments whole |+| `freeze_page_body_rows_unreadable` | page | retry | no | the page stays unreadable across syncs (a grant or row-level security policy hides its segment rows) || `page_write_failed` | page | upgrade | yes | always: the writer cannot place the failure || `file_unreadable` | page | none | yes | always: only a change to the checkout makes the file readable || `visibility_noncanonical` | page | none | yes | always: only an edit to the file clears it |diff --git a/src/core/export-snapshot.ts b/src/core/export-snapshot.tsindex 17d023b853..e63a42c52c 100644--- a/src/core/export-snapshot.ts+++ b/src/core/export-snapshot.ts@@ -108,14 +108,16 @@ function applicableWithdrawals(slug: string, withdrawals: ExportWithdrawal[]): P/*** The Markdown file of a segmented page, piece by piece: `head` (serializeMarkdown's frontmatter and blank line), the- * truth, TIMELINE_SEPARATOR before the first timeline byte, the timeline and the final newline. Each segment is read+ * truth, TIMELINE_SEPARATOR before the first timeline byte, the timeline and the final newline. With `revision` (the+ * snapshot `head` was rendered from), a page that moved since refuses `revision_changed` (GBRA-287: the head and the body+ * are one revision's). Each segment is read* once (readBodyRange, trusted stored body) under `ledger` (export: `exportBodyLedger`, the overlay readExportPage gives* an inline page; a restore: the page snapshot's), so the bytes are those serializeMarkdown gives the same page read inline. A full collection every EXPORT_COLLECT_BYTES read keeps the* reads' garbage (protocol buffers, decoded texts) from piling up as in the streamed import (ingest.ts): a 127 MiB page* peaked ~700 MiB above a 2 MiB one without it, 8-55 MiB with it.*/-export async function* segmentedExportMarkdown(tx: BrainEngine, page: Pick<Page, 'id'>, ledger: BodyLedger, head: string): AsyncIterable<Uint8Array | string> {- const body = await openSegmentedBody(tx, { pageId: page.id, ledger });+export async function* segmentedExportMarkdown(tx: BrainEngine, page: Pick<Page, 'id'>, ledger: BodyLedger, head: string, revision?: string): AsyncIterable<Uint8Array | string> {+ const body = await openSegmentedBody(tx, { pageId: page.id, ledger, ...(revision !== undefined ? { pin: { revision } } : {}) });let uncollected = 0;const collect = (bytes: number) => {uncollected += bytes;diff --git a/src/core/page-body/body-tiling.ts b/src/core/page-body/body-tiling.tsindex db44e6b6a2..d2160cdf03 100644--- a/src/core/page-body/body-tiling.ts+++ b/src/core/page-body/body-tiling.ts@@ -49,13 +49,13 @@ export const LIVE_READ_ATTEMPTS = 3;*/export async function readTiledManifest(engine: Pick<BrainEngine, 'executeRaw' | 'readManifest'>, pageId: number,generation?: number): Promise<{ generation: number | null; rows: ManifestRow[] }> {- const live = async () => (await engine.executeRaw<{ body_generation: unknown }>('SELECT body_generation FROM pages WHERE id=$1', [pageId]))[0];+ const live = async () => (await engine.executeRaw<{ body_generation: unknown; body_bytes: unknown }>('SELECT body_generation, body_bytes FROM pages WHERE id=$1', [pageId]))[0];for (let attempt = 1; ; attempt++) {const page = generation === undefined ? await live() : null;const at = generation ?? (page ? Number(page.body_generation) : null);const rows = await engine.readManifest(pageId, at === null ? {} : { generation: at });try {- await assertGenerationTiles(engine, pageId, at ?? undefined, rows);+ await assertGenerationTiles(engine, pageId, at ?? undefined, rows, page ? Number(page.body_bytes ?? 0) : undefined);return { generation: at, rows };} catch (error) {const now = generation === undefined && attempt < LIVE_READ_ATTEMPTS ? await live() : undefined;@@ -64,11 +64,16 @@ export async function readTiledManifest(engine: Pick<BrainEngine, 'executeRaw' |}}-/** The tiling check for a reader that read `rows` of `generation` (default live) through readManifest. */-export async function assertGenerationTiles(engine: Pick<BrainEngine, 'executeRaw'>, pageId: number, generation: number | undefined, rows: readonly RowSpan[]): Promise<void> {+/**+ * The tiling check for a reader that read `rows` of `generation` (default live) through readManifest. `bodyBytes`: the+ * size the reader read with the generation (a live generation's page body_bytes), so a generation a publish retired+ * meanwhile, whose size nothing records any more, is still checked whole and never passes on a surviving prefix.+ */+export async function assertGenerationTiles(engine: Pick<BrainEngine, 'executeRaw'>, pageId: number, generation: number | undefined, rows: readonly RowSpan[],+ bodyBytes?: number): Promise<void> {const [page] = await engine.executeRaw<{ id: number; slug: string; source_id: string; body_generation: unknown; body_bytes: unknown }>('SELECT id, slug, source_id, body_generation, body_bytes FROM pages WHERE id=$1', [pageId]);if (!page) return;const at = generation ?? Number(page.body_generation);- assertRowsTile(rows, { slug: page.slug, sourceId: page.source_id, total: await generationBodyBytes(engine, { ...page, id: pageId }, at) });+ assertRowsTile(rows, { slug: page.slug, sourceId: page.source_id, total: bodyBytes ?? await generationBodyBytes(engine, { ...page, id: pageId }, at) });}diff --git a/src/core/page-body/projection.ts b/src/core/page-body/projection.tsindex 6b31c4f493..cdbad80709 100644--- a/src/core/page-body/projection.ts+++ b/src/core/page-body/projection.ts@@ -45,12 +45,12 @@ import { assertGenerationTiles } from './body-tiling.ts';export interface SegmentedProjectionResult { chunks: number; retired: number; sealed: boolean; claimLost?: true }interface ProjectionPage {- id: number; body_generation: number | string; knowledge_revision: string; text_projection_revision: string | null;+ id: number; body_generation: number | string; body_bytes: number | string; knowledge_revision: string; text_projection_revision: string | null;title: string; frontmatter: JsonObject | null; body_flags: JsonObject | null; timeline_lead: string | null;}async function readProjectionPage(engine: Pick<BrainEngine, 'executeRaw'>, ref: { sourceId: string; slug: string }): Promise<ProjectionPage | null> {- const [page] = await engine.executeRaw<ProjectionPage>(`SELECT id, body_generation, knowledge_revision::text AS knowledge_revision,+ const [page] = await engine.executeRaw<ProjectionPage>(`SELECT id, body_generation, body_bytes, knowledge_revision::text AS knowledge_revision,text_projection_revision::text AS text_projection_revision, title, frontmatter, body_flags, timeline_leadFROM pages WHERE source_id=$1 AND slug=$2 AND deleted_at IS NULL AND body_storage='segmented'`, [ref.sourceId, ref.slug]);return page ?? null;@@ -188,7 +188,7 @@ async function buildClaimedProjection(engine: BrainEngine, ref: { sourceId: striconst generation = Number(page.body_generation);const pageId = Number(page.id);const liveRows = await engine.readManifest(pageId, { generation });- await assertGenerationTiles(engine, pageId, generation, liveRows);+ await assertGenerationTiles(engine, pageId, generation, liveRows, Number(page.body_bytes));const { retired, moved } = await retireStaleChunks(engine, ref, pageId, generation, liveRows.map(row => Number(row.occurrenceId)));if (moved) return { chunks: 0, retired, sealed: false };const frontmatter = page.frontmatter ?? {};diff --git a/src/core/page-body/segment-rewrite.ts b/src/core/page-body/segment-rewrite.tsindex 6feaf161b5..22365731c9 100644--- a/src/core/page-body/segment-rewrite.ts+++ b/src/core/page-body/segment-rewrite.ts@@ -172,15 +172,15 @@ export interface LiveFenceRewrite {*/export async function rewriteLiveSegmentedFences(tx: BrainEngine, pageId: number, transform: FenceTransform): Promise<LiveFenceRewrite | null> {const [page] = await tx.executeRaw<{ id: number; slug: string; source_id: string; title: string; type: string; page_kind: string; frontmatter: JsonObject | null;- body_generation: number | string; body_flags: JsonObject | null; body_storage: string; deleted_at: string | null; tags: string[];+ body_generation: number | string; body_bytes: number | string; body_flags: JsonObject | null; body_storage: string; deleted_at: string | null; tags: string[];contextual_retrieval_mode: string | null; corpus_generation: string | null }>(`SELECT p.id,p.slug,p.source_id,p.title,- p.type,p.page_kind,p.frontmatter,p.body_generation,p.body_flags,p.body_storage,p.deleted_at,p.contextual_retrieval_mode,p.corpus_generation,+ p.type,p.page_kind,p.frontmatter,p.body_generation,p.body_bytes,p.body_flags,p.body_storage,p.deleted_at,p.contextual_retrieval_mode,p.corpus_generation,COALESCE((SELECT jsonb_agg(t.tag ORDER BY t.tag) FROM tags t WHERE t.page_id=p.id),'[]'::jsonb) AS tags FROM pages p WHERE p.id=$1`, [pageId]);if (page?.body_storage !== 'segmented') return null;const sourceId = page.source_id, slug = page.slug, frontmatter = page.frontmatter ?? {};const generation = Number(page.body_generation);const rows = await tx.readManifest(pageId, { generation });- await assertGenerationTiles(tx, pageId, generation, rows);+ await assertGenerationTiles(tx, pageId, generation, rows, Number(page.body_bytes));const units = await changedUnits(tx, sourceId, rows, transform);if (!units.length) return null;const prepared = await prepareSegmentedBody(tx, { sourceId, slug, title: page.title, type: page.type, frontmatter, tags: page.tags,diff --git a/src/core/persistence/page-prepare.ts b/src/core/persistence/page-prepare.tsindex a9edd1c45c..c98cdd7627 100644--- a/src/core/persistence/page-prepare.ts+++ b/src/core/persistence/page-prepare.ts@@ -680,7 +680,7 @@ async function prepareUnreadRestore(engine: BrainEngine, row: WriteRequest, snapexport async function unreadPageFile(engine: BrainEngine, snapshot: PageSnapshot, between?: () => Promise<void>): Promise<StreamedFileContent> {const head = serializePageToMarkdown({ ...withoutBody(snapshot.page), compiled_truth: '', timeline: '' }, snapshot.tags).slice(0, -1);const ledger = snapshotLedger(snapshot);- const produce = (exec: BrainEngine) => segmentedExportMarkdown(exec, snapshot.page, ledger, head);+ const produce = (exec: BrainEngine) => segmentedExportMarkdown(exec, snapshot.page, ledger, head, snapshot.revision);return StreamedFileContent.measure(engine, !between ? produce : async function* (exec) { for await (const piece of produce(exec)) { yield piece; await between(); } });}diff --git a/test/pathological/d15-sync-reexport-overwrite.test.ts b/test/pathological/d15-sync-reexport-overwrite.test.tsindex 2d9761f29e..f5c3ae409f 100644--- a/test/pathological/d15-sync-reexport-overwrite.test.ts+++ b/test/pathological/d15-sync-reexport-overwrite.test.ts@@ -105,16 +105,17 @@ for (const { backend, databaseUrl } of pathologicalArms()) {});}, 180_000);- test('D-15 segmented pages are held without mutation while inline siblings restore', async () => {+ // GBRA-287: a segmented page is re-exported from its segments (streamed), no longer held as page_body_segmented.+ test('D-15 segmented pages are re-exported from their segments without mutation while inline siblings restore', async () => {await withBrain(databaseUrl, async b => {const fixture = await segmentPage(b.engine, ALICE, { generation: 1,occurrences: [{ id: 1, byteStart: 0, genFrom: 1, chunks: [{ text: 'Synthetic segmented body.' }] }] });const before = await segmentedPageState(b.engine, fixture.pageId);const lines = await expectUnitNotAborted(() => b.sync());expect(await segmentedPageState(b.engine, fixture.pageId)).toEqual(before);- expect(existsSync(b.file(ALICE))).toBe(false);+ expect(readFileSync(b.file(ALICE), 'utf8')).toContain('Synthetic segmented body.');expect(readFileSync(b.file(BOB), 'utf8')).toBe(await b.rendered(BOB));- expect(lines.some(line => line.includes(ALICE) && line.includes('page_body_segmented'))).toBe(true);+ expect(lines.some(line => line.includes(ALICE) && line.includes('page_body_segmented'))).toBe(false);});}, 180_000);diff --git a/test/segmented-read-concurrent-publish.test.ts b/test/segmented-read-concurrent-publish.test.tsindex e7b67e96f1..f5cda77165 100644--- a/test/segmented-read-concurrent-publish.test.ts+++ b/test/segmented-read-concurrent-publish.test.ts@@ -4,9 +4,12 @@* 1. Protects: a reader of a page stored in segments never refuses a healthy page `page_body_rows_unreadable` because a* publish landed between its statements. A live read names its generation first and checks that generation's rows* against that generation's size (`readSegmentedBody`, behind readPageSnapshot's read-back), and a live open whose- * generation a publish retired before its rows were read opens the new live generation (`openSegmentedBody`).+ * generation a publish retired before its rows were read opens the new live generation (`openSegmentedBody`). A live read+ * whose retired generation left only the rows the new body shares is checked against the size read with it, and a+ * snapshot's streamed file never puts its frontmatter over a later revision's body (`unreadPageFile`).* 2. Fails when: the rows of one generation are checked against the next generation's body_bytes, or a retired- * generation's missing rows refuse the read instead of reading the live body.+ * generation's missing rows refuse the read instead of reading the live body, or a surviving prefix passes as a whole+ * body, or the streamed body is opened live rather than at the snapshot's revision.* 3. PGLite. The interleaving is forced by an engine wrapper that publishes a new body (and, for the open, retires the old* generation's rows as segment maintenance does once no version references them) at the exact point between reads.*/@@ -21,6 +24,7 @@ import { importFromFile } from '../src/core/import-file.ts';import { readPageBodyPolicy } from '../src/core/page-body/limits.ts';import { materializeSegmentedBody } from '../src/core/page-body/ingest.ts';import { openSegmentedBody } from '../src/core/page-body/read-range.ts';+import { readTiledManifest } from '../src/core/page-body/body-tiling.ts';import { parseMarkdown } from '../src/core/markdown.ts';let engine: PGLiteEngine;@@ -32,10 +36,10 @@ const truth = (tag: string, bytes: number) => '# Live Example\n\n' + Array.from(const published: Record<string, string> = {};-async function publish(tag: string, bytes: number): Promise<void> {- const file = join(dir, tag + '.md');- published[tag] = '---\ntype: concept\ntitle: Live Example\n---\n\n' + truth(tag, bytes);- writeFileSync(file, published[tag]);+async function publish(tag: string, bytes: number, name = tag, title = 'Live Example', body = truth(tag, bytes)): Promise<void> {+ const file = join(dir, name + '.md');+ published[name] = '---\ntype: concept\ntitle: ' + title + '\n---\n\n' + body;+ writeFileSync(file, published[name]);expect(await importFromFile(engine, file, SLUG + '.md', { noEmbed: true, bodyPolicy: await readPageBodyPolicy(engine) })).toMatchObject({ status: 'imported' });}@@ -47,7 +51,7 @@ async function pageRow(): Promise<{ id: number; generation: number; bytes: numbe}/** The engine with `hook` run once, at the first call of `method` whose arguments `when` accepts, before or after the real call. */-function interleaved(method: 'readManifest' | 'executeRaw', when: (args: unknown[]) => boolean, at: 'before' | 'after', hook: () => Promise<void>): BrainEngine {+function interleaved(method: 'readManifest' | 'executeRaw' | 'readPageSnapshot', when: (args: unknown[]) => boolean, at: 'before' | 'after', hook: () => Promise<void>): BrainEngine {let armed = true;return new Proxy(engine, {get(target, key) {@@ -111,4 +115,38 @@ describe('GBRA-287: segmented reads across a concurrent publish', () => {expect(body.generation).toBe(after.generation);expect(body.rows.reduce((sum, row) => sum + row.byteLen, 0)).toBe(after.bytes);}, 120_000);++ test('a live read whose generation a publish retired, leaving only a shared prefix of its rows, reads the new generation whole', async () => {+ await publish('p', 2 * 1024 * 1024);+ const before = await pageRow();+ const half = truth('p', 1024 * 1024);+ await publish('p', 3 * 1024 * 1024, 'p-new-tail', 'Live Example', half + Array.from({ length: Math.ceil(2 * 1024 * 1024 / line('q', 0).length) }, (_, i) => line('q', i)).join(''));+ const live = await pageRow();+ await engine.executeRaw('DELETE FROM page_versions WHERE page_id=$1 AND body_generation=$2', [live.id, before.generation]);+ await engine.executeRaw('DELETE FROM page_body_manifest WHERE page_id=$1 AND staging_id IS NULL AND gen_to IS NOT NULL AND gen_to<=$2', [live.id, live.generation]);+ const prefix = await engine.readManifest(live.id, { generation: before.generation });+ expect(prefix.length).toBeGreaterThan(0);+ expect(prefix.reduce((sum, row) => sum + row.byteLen, 0)).toBeLessThan(before.bytes);+ let stale = true;+ const reader = new Proxy(engine, {+ get(target, key) {+ const value = Reflect.get(target, key, target);+ if (key !== 'executeRaw') return typeof value === 'function' ? value.bind(target) : value;+ return async (sql: string, params?: unknown[]) => {+ if (stale && /^SELECT body_generation(, body_bytes)? FROM pages/.test(sql)) { stale = false; return [{ body_generation: before.generation, body_bytes: before.bytes }]; }+ return target.executeRaw(sql, params as never);+ };+ },+ }) as unknown as BrainEngine;+ const read = await readTiledManifest(reader, before.id);+ expect(read.generation).toBe(live.generation);+ expect(read.rows.reduce((sum, row) => sum + row.byteLen, 0)).toBe(live.bytes);+ }, 120_000);++ test('the streamed file of a snapshot is never one revision\'s frontmatter over the next revision\'s body', async () => {+ const snapshot = await engine.readPageSnapshot(SLUG, { sourceId: 'default' });+ await publish('b', 2 * 1024 * 1024, 'b', 'Live Example Renamed');+ const { unreadPageFile } = await import('../src/core/persistence/page-prepare.ts');+ await expect(unreadPageFile(engine, snapshot!)).rejects.toThrow('changed after this read was authorized');+ }, 120_000);});