diff options
| author | Adam Malczewski <[email protected]> | 2026-06-12 16:28:07 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-12 16:28:07 +0900 |
| commit | 46d6b48d5229bd8cd8eb61efd0a0275349de7caf (patch) | |
| tree | 1afce4d7e7eb14acca6fc1cea0b162d28760d086 /src/features/cache-warming/logic/view-model.test.ts | |
| parent | 9469b3d56be7d5a1b7fe781a5f6e6eb213e46439 (diff) | |
| download | dispatch-web-46d6b48d5229bd8cd8eb61efd0a0275349de7caf.tar.gz dispatch-web-46d6b48d5229bd8cd8eb61efd0a0275349de7caf.zip | |
feat(cache-warming): consume CR-4 lifecycle — tab-close cancel + scope-aware subscriptions
- closeTab now POSTs /conversations/:id/close (abort in-flight turn + stop/disable
warming server-side); disconnect still leaves both running ([email protected])
- syncSubscriptions honors catalog scope ([email protected]): global surfaces are
not re-subscribed on conversation switch
- fix(ws): the surface-message parser dropped the conversationId echo (CR-4d was
ours, not the backend's) — preserved + unit-tested
- secondsUntilNext: 3s stale guard — a past nextWarmAt renders as waiting, not 0s
- re-pinned + re-mirrored [email protected] / [email protected]
- scripts/probe-cache-warming.ts: live CR-4 probe (default-off, future nextWarmAt,
repeated warms, mid-turn close abort, idempotent re-close) — 17/17 against bin/up
Diffstat (limited to 'src/features/cache-warming/logic/view-model.test.ts')
| -rw-r--r-- | src/features/cache-warming/logic/view-model.test.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/features/cache-warming/logic/view-model.test.ts b/src/features/cache-warming/logic/view-model.test.ts index 3d6f6d0..d5ea901 100644 --- a/src/features/cache-warming/logic/view-model.test.ts +++ b/src/features/cache-warming/logic/view-model.test.ts @@ -215,6 +215,14 @@ describe("secondsUntilNext (authoritative, from nextWarmAt)", () => { expect(secondsUntilNext(10_000, 10_000)).toBe(0); expect(secondsUntilNext(250_000, 10_000)).toBe(240); expect(secondsUntilNext(70_000, 10_000)).toBe(60); - expect(secondsUntilNext(5_000, 999_999)).toBe(0); // already past + }); + + it("treats a nextWarmAt past the stale grace as not scheduled (belt-and-braces)", () => { + // Within the 3s grace an on-time warm may briefly read "0s"… + expect(secondsUntilNext(10_000, 11_000)).toBe(0); + expect(secondsUntilNext(10_000, 13_000)).toBe(0); + // …but beyond it the value is stale → null (the "waiting…" state). + expect(secondsUntilNext(10_000, 13_001)).toBeNull(); + expect(secondsUntilNext(5_000, 999_999)).toBeNull(); }); }); |
