From e7497bc6dca7ab734d8e5784a283f1381ffbdcca Mon Sep 17 00:00:00 2001 From: ci-check Date: Sat, 24 Oct 2026 22:20:55 +0800 Subject: [PATCH] test: align epoch-confirm/escalation-latch expectations with the merged #3641 contract (#4555) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both master-red tests after the #4525 train are expectation lag, not implementation drift — no runtime change (src/ untouched): - epoch-confirm-lifecycle all-missing shipped born-red in a5d1994d (train CI legs cancelled): it asserted foldEpochConfirmPending never latches, contradicting #3641 boundary 4 and MESSAGE-IDENTITY.md's epoch-confirm gate (total collapse latches, snapshot retained, nothing deleted). Expect pass >= 3 like one-interior-survivor; the kernel deactivates the zero-coverage block, the pause contract is shape-independent. - issue2915 escalation-latch-recovery encoded the pre-#3641 reap-at-escalation clean-slate contract. a5d1994d made the doctrine real (epochProtected gates the #2695 reap), so a healthy resend now yields 'resend' with the substrate retained and post-recovery id churn re-anchors ('reanchored') instead of rebuilding from zero. Verified: 90/90 across the three reconcile suites on rebased head ba5ab0bce; old test ran 15/0 green on pre-train master (8ae56a01), pinning a5d1994d as sole cause (only train commit touching the latch path). --- tests/epoch-confirm-lifecycle.test.ts | 5 ++- .../issue2915-order-centric-reconcile.test.ts | 31 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/epoch-confirm-lifecycle.test.ts b/tests/epoch-confirm-lifecycle.test.ts index 071571beba..327d5dad7c 100644 --- a/tests/epoch-confirm-lifecycle.test.ts +++ b/tests/epoch-confirm-lifecycle.test.ts @@ -58,7 +58,10 @@ for (const shape of ["one-interior-survivor", "all-missing", "small-zombie"] as if (shape === "all-missing") { assert.equal(session.state.blocks.length, 1); assert.equal(session.state.blocks[0].active, false); - assert.equal(session.metadata.foldEpochConfirmPending === true, false); + // #3641 boundary 4 / MESSAGE-IDENTITY.md epoch-confirm gate: total collapse latches + // like partial coverage — the kernel deactivates the zero-coverage block, but the + // snapshot is retained and folding pauses until realignment or a user-confirmed epoch. + assert.equal(session.metadata.foldEpochConfirmPending === true, pass >= 3); } } assert.equal(session.blockContents.get(blockId)?.full.text, original); diff --git a/tests/issue2915-order-centric-reconcile.test.ts b/tests/issue2915-order-centric-reconcile.test.ts index ce74154a5c..fb273b9887 100644 --- a/tests/issue2915-order-centric-reconcile.test.ts +++ b/tests/issue2915-order-centric-reconcile.test.ts @@ -337,7 +337,7 @@ describe("gap resolution tiers (owner rule 2026-10-12: any channel → flanks describe("escalation latch recovery (review gap ②) — upgrade-in-place heals", () => { test("3 total-loss passes latch once; a healthy resend clears the latch; post-recovery churn still repairs", () => { - _setStoreForTest(new SessionStore({ enabled: false })); // escalation reaps via markDirty + _setStoreForTest(new SessionStore({ enabled: false })); const originals = history(); const session = fakeSession(originals.map((m) => m.id as string)); const logs: { level: string; msg: string }[] = []; @@ -360,21 +360,28 @@ describe("escalation latch recovery (review gap ②) — upgrade-in-place heals" assert.equal(logs.filter((l) => l.msg.includes("fold epoch confirmation required")).length, 1, "#2297: exactly ONE error line per episode"); - // healthy resend of the ORIGINAL bytes: missing=0 → noop, and the - // streak reset clears the latch — the upgrade-in-place recovery path. + // healthy resend of the ORIGINAL bytes: nothing missing, no claims — + // a plain resend receipt — and the streak reset clears the latch + // (#4260/#3641: alignment recovery is how the epoch pause ends). const healthy = reconcileFoldCoverage(session, originals, opts(log)); - assert.equal(healthy.kind, "noop"); + assert.equal(healthy.kind, "resend"); + assert.equal(healthy.missing, 0); + assert.equal(healthy.reaped, 0); assert.ok(session.metadata.foldDriftEscalated === undefined, "latch cleared on recovery"); assert.ok(session.metadata.foldDriftStreak === undefined, "streak cleared on recovery"); - // Escalation reaped the destroyed block (#2695 zombie-carrier reap) — - // so after the latch clears the ledger is a CLEAN SLATE, not a repair - // target: nothing is covered, nothing missing, and the next fold - // cycle starts fresh. That is the upgrade-in-place contract: a - // v0.1.192→v0.1.196 upgrade with a latched ledger heals instead of - // dead-looping the doomed preflight. - assert.equal((session.state.blocks as unknown[]).length, 0, "destroyed substrate reaped at escalation"); + // Post-#3641 contract (MESSAGE-IDENTITY.md epoch-confirm gate): + // escalation LATCHES, it does not reap — the snapshot is the + // conversation body and nothing is deleted. Recovery therefore + // restores a LIVE ledger, not a clean slate: the retained block + // re-anchors onto ordinary id churn instead of rebuilding from zero, + // and the lane never dead-loops the doomed preflight. + assert.equal((session.state.blocks as unknown[]).length, 1, "epoch-protected substrate retained at escalation"); const r = reconcileFoldCoverage(session, remint(originals, "g9"), opts(log)); - assert.equal(r.kind, "noop", "clean slate — the lane lives, folds rebuild on the next compress cycle"); + assert.equal(r.kind, "reanchored", "retained block re-anchors onto re-minted ids"); + assert.equal(r.unmatched, 0); + assert.ok(session.metadata.foldDriftEscalated === undefined, "ordinary churn after recovery never re-escalates"); + const stable = reconcileFoldCoverage(session, remint(originals, "g9"), opts(log)); + assert.equal(stable.kind, "resend", "repeat of the same history is quiet — healed, not looping"); }); });