You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deferred from PR #2007 (issue #2006). Raised there across three review rounds and declined on scope, not on merit — the reasoning is on-thread; this issue exists so it is tracked rather than lost in a closed PR's review history.
packages/cli/src/catchup-runner.ts now holds four unrelated concerns:
The readiness proof/evidence model — CatchupPlaneCompletionEvidence, CatchupPlaneRoundDiagnostics, catchupPeerPlaneEvidence, addCatchupPlaneEvidence, catchupPlaneProvenByData, catchupPlaneProvenByUnanimousEmpty, catchupPlaneReady
A reader tracing readiness from context-graph-readiness.ts lands in a module whose name promises a runner, and adding a new evidence signal reads as a runner change when it is domain policy.
Proposed change
Extract (4) into packages/cli/src/catchup-proof.ts and have the worker impl and the readiness classifier import from there. The unit tests for those predicates already live together in catchup-runner.test.ts and would move as a block.
Two adjacent cleanups worth doing in the same change, since both are about how this file decomposes:
Collapse the parallel per-plane accumulators in catchup-runner-worker-impl.ts. Note they are not identical: durable carries metaOnlyResponses, verifiedPrivateOnlyResponses, dataRejectedMissingMeta, rejectedKcs and a complete flag that gates its evidence; shared memory carries droppedDataTriples and has nocomplete concept (SharedMemorySyncResult has no such field). A naive collapse trades duplication for per-plane branching.
Type the worker RPC protocol. The bridge currently uses raw method-name strings and positional unknown[], so an argument reordering compiles on both sides and surfaces as mislabelled scheduler diagnostics rather than a type error. Payloads are typed (invoke<DurableSyncResult>, CatchupPlaneContext, SyncPeerResolution); the method/arity contract is not.
The proof model is cohesive and has no dependency on the runner class or the route helpers.
CatchupJobResult['cleanPlaneCompletions'] is now the shared CatchupPlaneCompletionEvidence rather than a structurally duplicated inline literal, so there is no second definition to move with it.
catchup-runner.ts is imported by the readiness classifier, the worker impl, the subscribe route and seven test files. Land this on its own so the import churn is legible as import churn, not mixed into a behavioural change.
Context
Deferred from PR #2007 (issue #2006). Raised there across three review rounds and declined on scope, not on merit — the reasoning is on-thread; this issue exists so it is tracked rather than lost in a closed PR's review history.
packages/cli/src/catchup-runner.tsnow holds four unrelated concerns:classifyDurableCatchupRequest,runDurableCatchupLeg)WorkerCatchupRunnerclass and its parent-side RPC bridgecatchupPeerResponded,catchupPeerSucceeded)CatchupPlaneCompletionEvidence,CatchupPlaneRoundDiagnostics,catchupPeerPlaneEvidence,addCatchupPlaneEvidence,catchupPlaneProvenByData,catchupPlaneProvenByUnanimousEmpty,catchupPlaneReadyA reader tracing readiness from
context-graph-readiness.tslands in a module whose name promises a runner, and adding a new evidence signal reads as a runner change when it is domain policy.Proposed change
Extract (4) into
packages/cli/src/catchup-proof.tsand have the worker impl and the readiness classifier import from there. The unit tests for those predicates already live together incatchup-runner.test.tsand would move as a block.Two adjacent cleanups worth doing in the same change, since both are about how this file decomposes:
catchup-runner-worker-impl.ts. Note they are not identical: durable carriesmetaOnlyResponses,verifiedPrivateOnlyResponses,dataRejectedMissingMeta,rejectedKcsand acompleteflag that gates its evidence; shared memory carriesdroppedDataTriplesand has nocompleteconcept (SharedMemorySyncResulthas no such field). A naive collapse trades duplication for per-plane branching.unknown[], so an argument reordering compiles on both sides and surfaces as mislabelled scheduler diagnostics rather than a type error. Payloads are typed (invoke<DurableSyncResult>,CatchupPlaneContext,SyncPeerResolution); the method/arity contract is not.Why it is cheap now
PR #2007 deliberately left it in a good position:
CatchupJobResult['cleanPlaneCompletions']is now the sharedCatchupPlaneCompletionEvidencerather than a structurally duplicated inline literal, so there is no second definition to move with it.cleanCompletionHasResponseincontext-graph-readiness.tstakes that same type, so a new evidence carrier cannot be added to the model and omitted from the pre-readiness gate without a type error — the bug class that produced one of fix(sync): walk catch-up peers progressively and fail closed on empty rounds (#2006) #2007's blockers.Constraint to respect
catchup-runner.tsis imported by the readiness classifier, the worker impl, the subscribe route and seven test files. Land this on its own so the import churn is legible as import churn, not mixed into a behavioural change.Related