Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Keep segmented-apply.ts off verb-errors.ts's import graph

garrytan8aeabe10ce57
diff --git a/src/core/page-state/types.ts b/src/core/page-state/types.ts
index c626097f54..a085bebbae 100644
--- a/src/core/page-state/types.ts
+++ b/src/core/page-state/types.ts
@@ -80,6 +80,11 @@ export interface PageSnapshot {
/** A stale expected revision; stored on receipts (#7602 matches it for fact entity requests refused before the fix). */
export const PAGE_CHANGED_AFTER_READ_MESSAGE = 'The page changed after it was read. Read its current revision before retrying.';
+/** The coordinator's refusal when the page moved between preparation and publication (coordinator.ts, group-publish.ts,
+ * segmented-apply.ts), also thrown when a staged large file no longer matches its stage (large-file.ts); fact requests never
+ * stage large files. It lives here, beside PAGE_CHANGED_AFTER_READ_MESSAGE, so segmented-apply.ts reads it without importing
+ * verb-errors.ts and everything that module reaches. */
+export const PAGE_CHANGED_DURING_PREPARATION_MESSAGE = 'The page changed during preparation.';
/**
* The three revision refusals. `expectedRevision` is the caller's precondition: a revision (stale → `revision_conflict`),
diff --git a/src/core/persistence/segmented-apply.ts b/src/core/persistence/segmented-apply.ts
index 1cec0e76de..5a1b04ca34 100644
--- a/src/core/persistence/segmented-apply.ts
+++ b/src/core/persistence/segmented-apply.ts
@@ -41,7 +41,7 @@ import { stableJson } from './digest.ts';
import { pageBodyOverCeilingError } from '../page-body/page-shape.ts';
import { assertOriginUnclaimed } from './origin-guard.ts';
import { OperationError } from '../ops/contract.ts';
-import { PAGE_CHANGED_DURING_PREPARATION_MESSAGE } from './verb-errors.ts';
+import { PAGE_CHANGED_DURING_PREPARATION_MESSAGE } from '../page-state/types.ts';
const BODY_KEYS = new Set(['compiled_truth', 'timeline', 'content']);
diff --git a/src/core/persistence/verb-errors.ts b/src/core/persistence/verb-errors.ts
index c68ca47f28..89c612f4bf 100644
--- a/src/core/persistence/verb-errors.ts
+++ b/src/core/persistence/verb-errors.ts
@@ -7,7 +7,7 @@ import { isFrontmatterHoldMessage } from '../markdown.ts';
import { fenceLocationFromMessage, fenceWhere } from '../fence-repair/refusal.ts';
import { FACT_WITHDRAWN_SUGGESTION } from '../facts/withdrawal.ts';
import { CHECKPOINT_MOVED_MESSAGE } from './sync-slug-mode.ts';
-import { PAGE_CHANGED_AFTER_READ_MESSAGE } from '../page-state/types.ts';
+import { PAGE_CHANGED_AFTER_READ_MESSAGE, PAGE_CHANGED_DURING_PREPARATION_MESSAGE } from '../page-state/types.ts';
import { readFix } from '../ops/op-fix.ts';
import { codeEntry, ERROR_CATALOGUE } from '../error-catalogue.ts';
import { SOURCE_CHECKOUT_MISSING, type CheckoutRefusalOrigin } from './publication-failure.ts';
@@ -54,9 +54,7 @@ export const FACTS_BATCH_INCOMPLETE_MESSAGE = 'Some extracted facts have not com
export const FACTS_ENTITY_CHANGED_MESSAGE = 'The fact entity changed after extraction admission.';
export const FACTS_ENTITY_CHANGED_IN_PREPARATION_MESSAGE = 'The fact entity changed during preparation.';
export const FACTS_DEDUP_CHANGED_MESSAGE = 'The fact deduplication state changed before publication.';
-/** The coordinator's refusal when the page moved between preparation and publication (coordinator.ts, group-publish.ts), also
- * thrown when a staged large file no longer matches its stage (large-file.ts); fact requests never stage large files. */
-export const PAGE_CHANGED_DURING_PREPARATION_MESSAGE = 'The page changed during preparation.';
+export { PAGE_CHANGED_DURING_PREPARATION_MESSAGE };
/**
* #7602: entity request refusals a follow-up batch re-admits at the entity's current revision (facts-maintenance.ts), and
* that `gbrain repair failed-writes` lists. Stored receipts are matched by this exact text, so never reword these messages.