Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript
25.0 KB
Raw Blame
/**
 * #6340: a page that moved under a managed catch-up holds the page, not the run.
 *
 * On a live checkout (agents commit to the brain repo every few minutes while a
 * multi-hour catch-up drains a frozen manifest) four codes used to end the whole
 * run, each recoverable with a plain retry: `revision_conflict` and
 * `page_identity_changed` at freeze time (the database page changed after the
 * manifest was enumerated), and `source_changed [pinned_git_worktree_conflict]`
 * at publication (the working tree holds other bytes than the pinned commit).
 * Each relaunch then re-froze the manifest. This module is the one place that
 * decides what such an entry becomes instead:
 *
 * - bytes committed at HEAD past the pinned target are imported as HEAD has them
 *   (`headCommittedBytes`): a commit is not an uncoordinated local edit, and the
 *   later pin..HEAD diff re-imports the same bytes as a no-op (idea and first
 *   test from PR #6323 by @garrytan-agents);
 * - a database page that changed after enumeration but still holds what the
 *   entry would import is re-bound to its current revision (the caller's waiver
 *   screen then passes it as unchanged);
 * - anything else is a hold: `concurrent_write` when the database side moved
 *   (#6194's code and reconcile route, with the competing request when the
 *   proof finds one, else the observed revision alone), `worktree_dirty` when
 *   the file side moved (uncommitted bytes that match neither the pin nor the
 *   page). The cursor advances past the hold and the receipt lists it.
 *
 * Holds carry `meta.attempts`, incremented each time the same path is held
 * again (`writeGitHold` on update), so an operator contract can say
 * `needs_human` for a page that keeps moving. Only a systemic failure (the
 * preparation breaker, authority or binding loss) still ends a run.
 */
import type { BrainEngine } from '../engine.ts';
import { RECOVERY_VERSION } from '../markdown.ts';
import { gitBlobOid, sha256 } from './digest.ts';
import type { WriteRequest } from './model.ts';
import { readSyncFile, syncGitPath, type SyncDiscovery, type SyncEntry, type SyncRename } from './sync-discovery.ts';
import { readTreeBlobs } from './sync-blobs.ts';
import type { SyncIntent } from './sync-prepare.ts';
import type { HeldEntry } from './sync-screen.ts';
import { FILE_DRIFT_VERSION, type GitHoldMeta, type GitHoldRecord, type PageWriteFailureMeta } from './sync-holds.ts';
import { classifyTerminal } from './terminal-classify.ts';
import { VERSION } from '../../version.ts';
import { concurrentWriteHold, concurrentWriteProof } from './sync-concurrent-write.ts';
import { KEEP_DISK_ABANDONED_PREFIX } from './verb-errors.ts';

export { HOLD_ATTEMPTS_NEEDS_HUMAN } from './sync-fault-class.ts';

type HoldEntry = Pick<SyncEntry, 'path' | 'sourcePath' | 'working' | 'renameFrom' | 'renameHeld' | 'action'>;

/**
 * The working-tree bytes of `path` when they are exactly what HEAD commits for it (their blob id equals
 * `HEAD:<path>`), with that blob id; null when the file is absent, differs from HEAD, or Git cannot answer.
 * A read failure is the caller's ordinary refusal path, never a substitution.
 */
export function headCommittedBytes(context: Pick<SyncDiscovery, 'root' | 'gitRoot'>, path: string): { content: string; oid: string; rawHash: string } | null {
  let bytes: Buffer | null;
  try { bytes = readSyncFile(context.root, path); } catch { return null; }
  if (!bytes) return null;
  const gitPath = syncGitPath(context, path);
  let head: { oid: string } | undefined;
  try { head = readTreeBlobs(context.gitRoot, 'HEAD', [gitPath]).get(gitPath); } catch { return null; }
  if (!head) return null;
  const oid = gitBlobOid(bytes, head.oid.length === 64 ? 'sha256' : 'sha1');
  return oid === head.oid ? { content: bytes.toString('utf8'), oid, rawHash: sha256(bytes) } : null;
}

export interface PageChangeProof { request_id: string; operation: string; revision: string }

/**
 * #6194's proof, usable at freeze time as well as from a receipt: the page's live revision differs from the one the entry
 * was frozen against, and `pages.revision_write_request_id` names a committed non-sync request of the same source
 * incarnation and page id. Null when the race is not proven (the page may still have changed).
 */
export async function pageChangeProof(engine: Pick<BrainEngine, 'executeRaw'>, input: { sourceId: string; incarnation: string; pageId: number | null; expectedRevision: string | null }): Promise<PageChangeProof | null> {
  if (input.pageId === null) return null;
  const [page] = await engine.executeRaw<{ revision: string | null; writer: string | null }>(
    'SELECT knowledge_revision::text AS revision, revision_write_request_id::text AS writer FROM pages WHERE id=$1 AND source_id=$2', [input.pageId, input.sourceId]);
  if (!page?.revision || !page.writer || page.revision === String(input.expectedRevision ?? '')) return null;
  const [writer] = await engine.executeRaw<{ request_id: string; operation: string; kind: string | null; state: string; incarnation: string; page_id: number | null }>(
    `SELECT request_id::text, operation, intent->>'kind' AS kind, state, source_incarnation::text AS incarnation, page_id FROM persistence_requests WHERE id=$1::uuid`, [page.writer]);
  if (!writer || writer.state !== 'committed' || String(writer.kind ?? '').startsWith('managed_sync_')
    || writer.incarnation !== input.incarnation || Number(writer.page_id) !== input.pageId) return null;
  return { request_id: writer.request_id, operation: writer.operation, revision: page.revision };
}

/**
 * #6600: proof that a deletion entry the origin check refuses was already carried out: its exact page (the id and the
 * revision this sync enumerated) is soft-deleted, the revision was written by a committed, authorized delete of that
 * page in the same source incarnation, and no live page records the entry's origin. Such an entry settles as an
 * idempotent deletion and clears its hold; a live replacement at the origin, a revision that moved since enumeration or
 * any other writer keeps the hold.
 */
export async function idempotentDeletionProof(engine: Pick<BrainEngine, 'executeRaw'>, input: { sourceId: string; incarnation: string; pageId: number | null;
  revision: string | null; sourcePath: string }): Promise<{ request_id: string } | null> {
  if (input.pageId === null || input.revision === null) return null;
  const [page] = await engine.executeRaw<{ revision: string; writer: string | null; deleted: boolean }>(
    'SELECT knowledge_revision::text AS revision, revision_write_request_id::text AS writer, deleted_at IS NOT NULL AS deleted FROM pages WHERE id=$1 AND source_id=$2', [input.pageId, input.sourceId]);
  if (!page?.deleted || !page.writer || page.revision !== input.revision) return null;
  const [writer] = await engine.executeRaw<{ request_id: string; operation: string; kind: string | null; state: string; incarnation: string; page_id: number | null }>(
    `SELECT request_id::text, operation, intent->>'kind' AS kind, state, source_incarnation::text AS incarnation, page_id FROM persistence_requests WHERE id=$1::uuid`, [page.writer]);
  if (!writer || writer.state !== 'committed' || writer.incarnation !== input.incarnation || Number(writer.page_id) !== input.pageId
    || !(writer.operation === 'delete_page' || writer.kind === 'managed_sync_delete')) return null;
  const live = await engine.executeRaw('SELECT 1 FROM pages WHERE source_id=$1 AND deleted_at IS NULL AND id<>$2 AND source_path=$3 LIMIT 1', [input.sourceId, input.pageId, input.sourcePath]);
  return live.length ? null : { request_id: writer.request_id };
}

/**
 * #6712 dependency edge: the hold of an entry whose slug or page id an earlier entry of the same sync shares, when that
 * entry was held in the sync: it takes the predecessor's code and waits on it (`meta.blocked_on`) instead of publishing
 * against a page whose earlier change never landed.
 */
export function dependentHold(entry: HoldEntry, slug: string, pageId: number | null, intent: Pick<SyncIntent, 'content' | 'blobOid'>,
  predecessor: { path: string; code: GitHoldRecord['code'] }): HeldEntry {
  const rename: SyncRename | undefined = entry.renameFrom ?? entry.renameHeld;
  return { path: entry.path, source_path: entry.sourcePath, slug, page_id: pageId, code: predecessor.code,
    message: `${entry.path} changes page ${slug}, which ${predecessor.path} changes earlier in the same sync, and ${predecessor.path} is held (${predecessor.code}); this file waits on it and the next sync after that hold clears imports it.`,
    upstream_version: typeof intent.content === 'string' ? sha256(intent.content) : null,
    meta: { recovery_version: RECOVERY_VERSION, ...(typeof intent.blobOid === 'string' ? { blob_oid: intent.blobOid } : {}), ...(entry.working ? { working: true } : {}),
      ...(rename ? { rename_from: rename } : {}), ...(entry.action === 'delete' ? { deleted: true as const } : {}), blocked_on: predecessor.path } };
}

/**
 * The page's current revision, soft-deleted pages included (a deletion advances the revision, and a new-file entry whose slug
 * a page now occupies has moved too); null when no row exists. For a hold that records what it observed.
 */
export async function liveRevision(engine: Pick<BrainEngine, 'executeRaw'>, sourceId: string, page: { pageId: number | null; slug: string }): Promise<string | null> {
  const [row] = page.pageId === null
    ? await engine.executeRaw<{ revision: string | null }>('SELECT knowledge_revision::text AS revision FROM pages WHERE source_id=$1 AND slug=$2', [sourceId, page.slug])
    : await engine.executeRaw<{ revision: string | null }>('SELECT knowledge_revision::text AS revision FROM pages WHERE id=$1 AND source_id=$2', [page.pageId, sourceId]);
  return row?.revision ?? null;
}

function base(entry: HoldEntry, slug: string, pageId: number | null, code: 'concurrent_write' | 'worktree_dirty' | 'file_drift' | 'page_write_failed',
  message: string, content: string | null, blobOid: string | null | undefined, meta: Partial<GitHoldMeta>): HeldEntry {
  const rename: SyncRename | undefined = entry.renameFrom ?? entry.renameHeld;
  return { path: entry.path, source_path: entry.sourcePath, slug, page_id: pageId, code, message, upstream_version: content === null ? null : sha256(content),
    meta: { recovery_version: RECOVERY_VERSION, ...(blobOid ? { blob_oid: blobOid } : {}), ...(entry.working ? { working: true } : {}),
      ...(rename ? { rename_from: rename } : {}), ...(entry.action === 'delete' ? { deleted: true as const } : {}), ...meta } };
}

/**
 * #6712 PR 1: the `file_drift` hold for an import whose page moved since its file was last imported (`sides`, from the
 * discovery baseline, sync-prescreen.ts) and whose import is not a no-op: importing would overwrite a database version
 * sync never saw. `proof` names the database-only request that wrote the current revision when one did. Identifiers
 * and revisions only, never content. `repair file-drift` is the exit; the hold is re-screened when the file or the
 * page revision changes.
 */
export function fileDriftHold(entry: HoldEntry, slug: string, pageId: number | null, intent: Pick<SyncIntent, 'content' | 'blobOid'>,
  observed: { sides: 'database' | 'both' | 'unknown'; revision: string | null; proof: PageChangeProof | null; sharedOrigin: boolean; baseline?: string | null }): HeldEntry {
  const by = observed.proof ? `${observed.proof.operation} request ${observed.proof.request_id} wrote page ${slug} straight to the database` : `page ${slug} changed in the database`;
  const file = observed.sides === 'database' ? 'its file did not change in Git' : 'its file changed too';
  // GBRA-133: with no import record and no database write on record, nothing shows the database side changed.
  // #7199: the hold also names what the page was compared with: the file at the last synced commit, or that commit had no file.
  const held = observed.sides === 'unknown' && !observed.proof
    ? `page ${slug} differs from its file and has no import record to tell whether the file or the database changed; the page also ${observed.baseline ? 'differs from the file at the last synced commit' : 'has no file at the last synced commit to compare with'}`
    : `${by} since the file was last imported and ${observed.sides === 'unknown' ? 'there is no import record to tell whether the file changed too' : file}`;
  return base(entry, slug, pageId, 'file_drift',
    `${entry.path}: ${held}, so sync held the import instead of overwriting the database version; the rest of the source synced.`,
    intent.content ?? null, intent.blobOid, { sides: observed.sides, drift_version: FILE_DRIFT_VERSION, ...(observed.sides !== 'database' ? { side: observed.sides } : {}), ...(observed.revision ? { page_revision: observed.revision } : {}),
      ...(observed.proof ? { competing_request_id: observed.proof.request_id, competing_operation: observed.proof.operation } : {}),
      ...(observed.sharedOrigin ? { shared_origin: true as const } : {}) });
}

/**
 * #6517: whether `sourcePath`'s page survived a shared-origin delete (another page recording the same file was soft-deleted
 * with `write_through.skipped: shared_origin`, keeping the file). Its `file_drift` hold leads with importing the file, as
 * the delete's receipt does.
 */
export async function sharedOriginSurvivor(engine: Pick<BrainEngine, 'executeRaw'>, sourceId: string, sourcePath: string): Promise<boolean> {
  const rows = await engine.executeRaw(`SELECT 1 FROM pages d JOIN persistence_requests r ON r.source_id=d.source_id AND r.slug=d.slug
    WHERE d.source_id=$1 AND d.deleted_at IS NOT NULL AND d.source_path=$2 AND r.operation='delete_page' AND r.state='committed'
      AND r.outcome->'write_through'->>'skipped'='shared_origin' LIMIT 1`, [sourceId, sourcePath]);
  return rows.length > 0;
}

/**
 * The `concurrent_write` hold for a page that changed in the database after this entry was enumerated (or after its
 * import was admitted). `why` names the change as the caller saw it; identifiers and revisions only, never content.
 */
export function pageChangedHold(entry: HoldEntry, slug: string, pageId: number | null, intent: Pick<SyncIntent, 'content' | 'blobOid' | 'expected_revision'>,
  observed: { proof: PageChangeProof | null; revision: string | null; why: string }): HeldEntry {
  const what = entry.action === 'delete' ? 'deletion' : 'import';
  const by = observed.proof ? `${observed.proof.operation} request ${observed.proof.request_id} wrote page ${slug} straight to the database` : observed.why;
  return base(entry, slug, pageId, 'concurrent_write',
    `${entry.path}: ${by} after this sync enumerated it, so its ${what} is held and the rest of the source synced; neither version was overwritten.`,
    typeof intent.content === 'string' ? intent.content : null, typeof intent.blobOid === 'string' ? intent.blobOid : null,
    { ...(observed.proof ? { competing_request_id: observed.proof.request_id, competing_operation: observed.proof.operation } : {}),
      ...(observed.revision ?? observed.proof?.revision ? { page_revision: observed.revision ?? observed.proof!.revision } : {}),
      ...(intent.expected_revision ? { expected_revision: String(intent.expected_revision) } : {}) });
}

/**
 * The `worktree_dirty` hold for a file whose working-tree bytes match neither the pinned commit nor the current page
 * and are not committed at HEAD: an uncoordinated local edit sync must not overwrite. `blobOid` is the pinned blob,
 * so discovery re-screens the hold when a later commit changes the file, and `sources retry-held` re-screens it once
 * the edit is committed.
 */
export function worktreeDirtyHold(entry: HoldEntry, slug: string, pageId: number | null, intent: Pick<SyncIntent, 'content' | 'blobOid' | 'rawHash'>,
  conflict: 'page' | 'writeback' = 'page'): HeldEntry {
  const what = conflict === 'writeback' ? `has uncommitted working-tree bytes newer than the pinned commit, which the import's canonical correction would overwrite`
    : 'has uncommitted working-tree bytes that match neither the pinned commit nor the current page';
  return base(entry, slug, pageId, 'worktree_dirty',
    `${entry.path} ${what}, so its import is held and the rest of the source synced; the local edit was not overwritten. Commit the file (or restore it) and the next sync imports it.`,
    typeof intent.content === 'string' ? intent.content : null, typeof intent.blobOid === 'string' ? intent.blobOid : null,
    { ...(intent.rawHash ? { working_hash: intent.rawHash } : {}) });
}

/** The sync-prepare.ts refusal of a canonical correction (writeback) whose target file holds newer uncommitted bytes (#6513). */
export const CANONICAL_WRITEBACK_CONFLICT = 'Canonical sanitization cannot overwrite newer working-tree bytes.';

/**
 * The receipt of a `managed_sync_import` that publication refused as `pinned_git_worktree_conflict`: sync-prepare.ts
 * `newerWorkingTree`, or (#6513) its canonical-writeback refusal, which until then blocked the cursor with no exit
 * because `--retry-failed` replays the same pin against the same newer bytes.
 */
export function pinnedWorktreeConflict(done: Pick<WriteRequest, 'state' | 'error_code' | 'error_message'>): boolean {
  return done.state !== 'committed' && done.error_code === 'source_changed'
    && ['Newer working-tree bytes and the current page disagree with this pinned Git import.', 'Newer code file bytes disagree with the pinned import.', CANONICAL_WRITEBACK_CONFLICT].includes(done.error_message ?? '');
}

/**
 * The receipt of an import whose file bytes changed between admission and publication (`raw_file_changed` in verb-errors.ts),
 * or (#6858) whose stuck publication `gbrain repair stuck-recovery --keep disk` abandoned, keeping the file as edited on disk.
 */
export function fileChangedAfterAdmission(done: Pick<WriteRequest, 'state' | 'error_code' | 'error_message'>): boolean {
  return done.state !== 'committed' && done.error_code === 'source_changed'
    && (['The imported file changed after sync admission.', 'The canonical file changed after preparation.', 'The canonical file changed during preparation.'].includes(done.error_message ?? '')
      || (done.error_message ?? '').startsWith(KEEP_DISK_ABANDONED_PREFIX));
}

/** A `revision_conflict` receipt whose page really moved (its live revision differs from the frozen one); run-level conflicts stay blocking. */
export async function pageMovedSinceAdmission(engine: Pick<BrainEngine, 'executeRaw'>, sourceId: string, pending: { slug: string; pageId: number | null; intent: Pick<SyncIntent, 'expected_revision'> },
  done: Pick<WriteRequest, 'state' | 'error_code'>): Promise<{ revision: string | null } | null> {
  if (done.state === 'committed' || done.error_code !== 'revision_conflict') return null;
  const revision = await liveRevision(engine, sourceId, pending);
  return revision === (pending.intent.expected_revision === null || pending.intent.expected_revision === undefined ? null : String(pending.intent.expected_revision)) ? null : { revision };
}

/**
 * The hold a terminal receipt of a page request earns when its page moved under the sync, or null when the receipt is
 * not such a fault: #6194's proven race (`concurrent_write` with the competing request), a `revision_conflict` whose page
 * really moved (`concurrent_write` by revision), or a `pinned_git_worktree_conflict` (`worktree_dirty`). Shared by the
 * run's receipt branch and the start-of-run conversion of an older release's blocked cursor.
 */
export async function receiptPageFaultHold(engine: Pick<BrainEngine, 'executeRaw'>, input: { sourceId: string; incarnation: string; entry: HoldEntry;
  pending: { slug: string; pageId: number | null; intent: SyncIntent }; done: Pick<WriteRequest, 'request_id' | 'state' | 'error_code' | 'error_message' | 'error_detail'> }): Promise<HeldEntry | null> {
  const { entry, pending, done } = input;
  const repeated = await repeatedWriteFailure(engine, input.sourceId, input.incarnation, pending.slug, done);
  if (repeated) return base(entry, pending.slug, pending.pageId, 'page_write_failed',
    `${entry.path}: its ${entry.action === 'delete' ? 'deletion' : 'import'} failed the same way ${repeated.attempts} times (${repeated.origin ?? repeated.code}${repeated.errno ? `, SQLSTATE ${repeated.errno}` : ''}${repeated.error_class ? `, ${repeated.error_class}` : ''}; request ${done.request_id}), so it is held and the rest of the source synced. `
      + 'Read the receipt with gbrain write-request, report it or fix the file, then gbrain sources retry-held; an upgrade re-tests it on its own.',
    typeof pending.intent.content === 'string' ? pending.intent.content : null, typeof pending.intent.blobOid === 'string' ? pending.intent.blobOid : null,
    { write_failure: { ...repeated, request_id: done.request_id, gbrain_version: VERSION } });
  const page = pending.intent.kind === 'managed_sync_import' && typeof pending.intent.content === 'string';
  const proof = page ? await concurrentWriteProof(engine, { sourceId: input.sourceId, incarnation: input.incarnation, pending, done }) : null;
  if (proof) return concurrentWriteHold(entry, pending.slug, pending.pageId!, pending.intent, proof);
  const moved = await pageMovedSinceAdmission(engine, input.sourceId, pending, done);
  if (moved) return pageChangedHold(entry, pending.slug, pending.pageId, pending.intent, { proof: null, revision: moved.revision, why: `page ${pending.slug} changed in the database` });
  return page && pinnedWorktreeConflict(done) ? worktreeDirtyHold(entry, pending.slug, pending.pageId, pending.intent, done.error_message === CANONICAL_WRITEBACK_CONFLICT ? 'writeback' : 'page') : null;
}

/**
 * GBRA-130 A-6: a sync page write that failed the same unclassifiable way this many times (the receipts of this path in this
 * source incarnation, this one included) is held `page_write_failed` instead of stopping every later sync at the entry. It
 * matches `STOPS_PER_ENTRY` (sync-run.ts), the re-freezes a run gives a stopped entry.
 */
export const PAGE_WRITE_FAILURE_REPEATS = 3;
/** The terminal categories that place no fault (an owner exception, a refusal the receipt does not explain); writer, binding and schema stops are not among them. */
const UNPLACED = new Set(['owner_exception', 'diagnosis_required']);
/**
 * GBRA-130 A-6: the fault of a failed sync page receipt the terminal classifier cannot place, once the same path failed with
 * the same (code, origin, error class, SQLSTATE) `PAGE_WRITE_FAILURE_REPEATS` times; null otherwise (one occurrence still
 * stops the run, so a transient defect never holds a file).
 */
async function repeatedWriteFailure(engine: Pick<BrainEngine, 'executeRaw'>, sourceId: string, incarnation: string, slug: string,
  done: Pick<WriteRequest, 'request_id' | 'state' | 'error_code' | 'error_message' | 'error_detail'>): Promise<Omit<PageWriteFailureMeta, 'request_id' | 'gbrain_version'> | null> {
  if (done.state !== 'failed' || !done.error_code) return null;
  const detail = (done.error_detail ?? null) as Record<string, unknown> | null;
  const verdict = classifyTerminal({ source_id: sourceId, slug, operation: 'submit_job', state: 'failed', error_code: done.error_code, error_detail: detail,
    recovery: null, blocked_reason: null, compacted: false, error_message: done.error_message ?? null, intent_kind: 'managed_sync_import' });
  if (!verdict || !UNPLACED.has(verdict.category)) return null;
  const field = (key: string) => typeof detail?.[key] === 'string' ? detail[key] as string : null;
  const fault = { code: done.error_code, origin: field('origin'), error_class: field('error_class'), errno: field('errno') ?? field('sqlstate') };
  const [row] = await engine.executeRaw<{ n: number }>(`SELECT count(*)::int AS n FROM persistence_requests WHERE source_id=$1 AND source_incarnation=$2::uuid AND slug=$3
    AND state='failed' AND intent->>'kind' IN ('managed_sync_import','managed_sync_delete') AND error_code=$4 AND COALESCE(error_detail->>'origin','')=$5
    AND COALESCE(error_detail->>'error_class','')=$6 AND COALESCE(error_detail->>'errno',error_detail->>'sqlstate','')=$7`,
  [sourceId, incarnation, slug, fault.code, fault.origin ?? '', fault.error_class ?? '', fault.errno ?? '']);
  const attempts = Number(row?.n ?? 0);
  return attempts >= PAGE_WRITE_FAILURE_REPEATS ? { ...fault, attempts } : null;
}

/**
 * The `concurrent_write` hold for an entry whose recorded origin no longer identifies the page this sync enumerated
 * (`assertSyncPageOrigin` refused at freeze time: the page at that origin was deleted, re-bound or replaced in the database).
 */
export async function originFaultHold(engine: Pick<BrainEngine, 'executeRaw'>, input: { sourceId: string; incarnation: string; entry: HoldEntry & Pick<SyncEntry, 'slug' | 'pageId' | 'revision'>;
  observed: { page: { id: number }; revision: string | null } | null; message: string }): Promise<HeldEntry> {
  const { entry } = input;
  const proof = await pageChangeProof(engine, { sourceId: input.sourceId, incarnation: input.incarnation, pageId: entry.pageId ?? null, expectedRevision: entry.revision ?? null });
  return pageChangedHold(entry, entry.slug!, input.observed?.page.id ?? entry.pageId ?? null, { content: null, blobOid: undefined, expected_revision: entry.revision ?? null },
    { proof, revision: input.observed?.revision ?? null, why: `the page recorded at ${entry.sourcePath} no longer identifies the one this sync enumerated (${input.message})` });
}