From 07937fa59c5f94179b0f5e823fed7b7c084af38e Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 24 Sep 2026 13:57:36 +0900 Subject: [PATCH] fix(release): drop the never-called clear from the chunk reload marker (Q-6.9-9) Follow-up to 215cc54. The chunk store passed to the shared reload-once guard had a clear() that no path calls (chunk recovery has no coherent boot to clear on; its marker only expires), which dropped decide-chunk-recovery.ts to 75% function coverage against its 95% risk threshold. RecoveryMarkerStore.clear is now optional and the chunk store omits it; boot recovery still provides and uses it. Verified: test:coverage risk gate PASS (363/363 modules, 72 thresholds; it failed on this module before); all gates PASS. Co-Authored-By: Claude Opus 5.5 --- src/application/use-cases/decide-chunk-recovery.ts | 6 ++---- src/platform/release/release-mismatch-recovery.ts | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/application/use-cases/decide-chunk-recovery.ts b/src/application/use-cases/decide-chunk-recovery.ts index 6ca4326a..9e68ae35 100644 --- a/src/application/use-cases/decide-chunk-recovery.ts +++ b/src/application/use-cases/decide-chunk-recovery.ts @@ -38,7 +38,8 @@ export function decideChunkRecovery( `->${input.activeBuildId}/${input.activeReleaseId}`; // Q-6.9-9. The boot reload guard's rule: at most one automatic reload per // marker TTL, whatever the pair. A pair-keyed marker let replicas that - // alternate A/B reload on every chunk failure. + // alternate A/B reload on every chunk failure. The marker is never cleared; + // it only expires. const decision = createReloadOnceGuard({ read() { const guard = input.storage.read("CHUNK_RELOAD_GUARD"); @@ -50,9 +51,6 @@ export function decideChunkRecovery( throw new Error("chunk reload guard was not persisted"); } }, - clear() { - input.storage.remove("CHUNK_RELOAD_GUARD"); - }, }).decide(releasePair); return decision === "reload-once" ? { action: "reload-once", releasePair } diff --git a/src/platform/release/release-mismatch-recovery.ts b/src/platform/release/release-mismatch-recovery.ts index 69f466f0..1b5efcf5 100644 --- a/src/platform/release/release-mismatch-recovery.ts +++ b/src/platform/release/release-mismatch-recovery.ts @@ -19,7 +19,8 @@ export type RecoveryMarkerStore = Readonly<{ read(): string | null; write(value: string): void; - clear(): void; + /** Absent for a marker that only expires (chunk recovery never clears). */ + clear?(): void; }>; export type ReleaseMismatchDecision = "reload-once" | "show-failure"; @@ -97,7 +98,7 @@ export function createReloadOnceGuard( }, clear(): void { try { - store?.clear(); + store?.clear?.(); } catch { // A stale marker only means the next mismatch shows the failure. }