Description
Finding
Merged PR #4352 guarded the pkarr-worker's retention alarm: malformed, non-positive, or out-of-range RETENTION_SECONDS values now fall back to seven days instead of scheduling a deletion alarm at/before now (or NaN). The guard itself (retentionMilliseconds) is well unit-tested — but the invalid-value cases never exercise the real Durable Object path they protect:
- The parameterized
RETENTION_SECONDStests driveworker.fetchwith a mockPKARR_STOREwhoseputPacketre-implements the production alarm computation inline (now + retentionMilliseconds(retentionSeconds, now)). The realPkarrStore.putPacket— the code that readsthis.env.RETENTION_SECONDSand callsthis.ctx.storage.setAlarm— is never invoked for any invalid or valid non-default value. - The only assertion against a real Durable Object alarm is in the pre-existing publish test, which uses the default environment (no
RETENTION_SECONDSset) and expects the seven-day default.
So the seam the fix exists for — env value → retentionMilliseconds → setAlarm inside the real DO — is unpinned: if the wiring in src/index.ts regressed (wrong env field, alarm computed from a stale now, guard bypassed), every retention test would still pass, because the mock copies the intended wiring instead of using it.
Evidence
- PR fix(pkarr-worker): guard retention alarm values (#3261) #4352 (MERGED, commit
388d8c1dcf, merge commitf1330f3f09ee3dad97f51aa9f7e54510643ffb34, ancestor-verified against main856d00f1d322a5724aa4ba85c728eaec5e341c7a, compare behind=0), closes pkarr-worker(retention): RETENTION_SECONDS is parsed with a bare Number() and no guard — '0'/'7d'/' ' schedule the deletion alarm at/before now (or NaN), so stored packets vanish right after a 204, and '1e9' never expires #3261 (CLOSED, verified): fix(pkarr-worker): guard retention alarm values (#3261) #4352 - Production wiring on current main:
pkgs/pkarr-worker/src/index.ts:88-89—const retentionMs = retentionMilliseconds(this.env.RETENTION_SECONDS, now); await this.ctx.storage.setAlarm(now + retentionMs);. Guard:pkgs/pkarr-worker/src/retention.ts:5-22. - Test gap on current main:
pkgs/pkarr-worker/test/worker.test.ts:33definesmockStore, whoseputPacket(lines 33-45) computes the alarm itself fromretentionMilliseconds; theRETENTION_SECONDSdescribe block at:136routes every case (missing,0,-1,7d, whitespace,1e9,3600.5,+3600, out-of-range,604800,3600) through that mock. The sole real-DO alarm readback is at:196-199(runInDurableObject+state.storage.getAlarm()), in the default-env publish test only. - Dedupe: searched open + closed issues for
RETENTION_SECONDS alarm,retentionMilliseconds, andcold-store corruptanalogues on 2026-11-16 — only pkarr-worker(retention): RETENTION_SECONDS is parsed with a bare Number() and no guard — '0'/'7d'/' ' schedule the deletion alarm at/before now (or NaN), so stored packets vanish right after a 204, and '1e9' never expires #3261 (the parent issue fix(pkarr-worker): guard retention alarm values (#3261) #4352 closed) and fix(pkarr-worker): guard retention alarm values (#3261) #4352 itself match; no issue covers this test seam.
Why it matters
#3261 was a data-loss bug: a bad env value made stored packets vanish right after a 204, or never expire. The regression suite for it should fail if the protection stops being wired into the real object — today it cannot, because the tests substitute a hand-copied version of the wiring for the thing itself.
Acceptance criteria
- At least the invalid-value cases (e.g.
0,7d, out-of-range) and one valid non-default value (e.g.3600) are exercised through the realPkarrStoreDurable Object (e.g.runInDurableObject/ SELF with per-test env bindings), asserting the alarm the DO actually scheduled viastate.storage.getAlarm(). - The mock-based cases are removed or reduced so the alarm expectation is not computed by re-implementing the production expression in the test.
- Existing pkarr-worker tests keep passing (
npm testinpkgs/pkarr-worker).
Shadow verdict (PoC)
Stage A window already closed (summary on #2313) — no shadow verdict recorded.
Activity
developing-today commentedon Nov 16, 2026
CODE-3909
dezren39 commentedon Nov 16, 2026
agent-note:v1
state: picked_up
task: 17517
lane: code-g
date: 2026-11-16
Picked up triage task 17517 (openchamber scheduled lane code-g, worker repo-worker-code). Revalidated: issue OPEN, PR #4352 MERGED 2026-11-02, no held/Drew-owned restriction. Verifying the coverage gap on current main next, then posting findings.
dezren39 commentedon Nov 16, 2026
agent-note:v1
state: triaged
task: 17517
lane: code-g
date: 2026-11-16
Triage verdict: CONFIRMED — real coverage gap, routed to small_fix (queue task 17521).
Verified on current main a20e223 (fresh fetch):
pkgs/pkarr-worker/test/worker.test.ts:33-48(mockStore.putPacket) computes the expected alarm itself viaretentionMilliseconds(retentionSeconds, now)— the mock re-implements the production alarm expression instead of exercising it.RETENTION_SECONDScases (:136-180, incl. invalid0/7d/out-of-range and valid3600) driveworker.fetchwith the mock env; the realPkarrStore.putPacket(src/index.ts, env read +ctx.storage.setAlarm) is never invoked for any non-default value.:194-199, viarunInDurableObject+state.storage.getAlarm()) runs under default SELF bindings — no non-defaultRETENTION_SECONDSever reaches the real DO.grep RETENTION/getAlarm/setAlarmover the whole test file: only the three sites above. No competing PR for test(pkarr-worker): RETENTION_SECONDS guard is never exercised through the real Durable Object alarm path — invalid values only reach a mock that re-implements it (PR #4352) #10818; PR fix(pkarr-worker): guard retention alarm values (#3261) #4352 merged 2026-11-02; no held/Drew-owned restriction.Scope for the fix (test-only): add real-DO cases for invalid values + one valid non-default value asserting
state.storage.getAlarm(); drop/shrink the mock-computed expectations at:174. Do not changeretentionMillisecondssemantics orsrc/index.tswiring.12 remaining items
dezren39 commentedon Nov 16, 2026
agent-note:v1
state: parked
task: 17521
lane: code-g
date: 2026-11-16
PR opened: #10824 (branch queue/17521-10818-real-do-alarm, pushed to origin; 2 files: new test/worker.retention.test.ts + vitest.config.ts projects). Test-only change for #10818: real-DO PUT via SELF + getAlarm readback per RETENTION_SECONDS value (0/7d/out-of-range/3600 via per-project miniflare vars). tsc clean except pre-existing TS2688 (missing @cloudflare/vitest-pool-workers types package, untouched by this change).
NOT yet verified: the vitest suite was never executed (no CI workflow runs on the branch — only CodeRabbit NEUTRAL; mergeStateStatus CLEAN). Resume: in worktree ~/git/fleet/17521-10818-real-do-alarm, run
npm testin pkgs/pkarr-worker (deps already installed) — all 5 projects must pass — then merge under standing criteria, complete task 17521 with bookkeeping deferred to fleet reconciliation. If miniflare.vars is not honored by the plugin version, rework to per-file env selection before merging.dezren39 commentedon Nov 16, 2026
agent-note:v1
state: picked_up
task: 17521
lane: code-j
date: 2026-11-16
Picked up small_fix task 17521 (openchamber scheduled lane code-j, worker repo-worker-code; resume from pr_opened checkpoint). Revalidated: issue OPEN, PR #10824 OPEN (branch queue/17521-10818-real-do-alarm), no competing PR, no held/Drew-owned restriction. Resuming: verify vitest suite in worktree ~/git/fleet/17521-10818-real-do-alarm then merge under standing criteria.
test(pkarr-worker): exercise RETENTION_SECONDS guard through the real…
Merge pull request #10824 from developing-today/queue/17521-10818-rea…
dezren39 commentedon Nov 16, 2026
agent-note:v1
state: done
task: 17521
lane: code-j
date: 2026-11-16
Done — merged PR #10824 (merge 96efa28) for #10818.
Resume found the PR already open (prior lane code-g, branch queue/17521-10818-real-do-alarm). Two defects in the pushed state blocked verification, both fixed and committed (e47a0d0):
Verification: npm test in pkgs/pkarr-worker — 9 files / 68 tests pass (default: worker.test.ts + 4 deploy files; 4x worker.retention.test.ts at 0/7d/out-of-range/3600 asserting real-DO getAlarm() literals). tsc clean except pre-existing TS2688. PR mergeState CLEAN, no failing checks, test-only diff, no held/Drew-owned restriction. Note: pkarr-worker-tests.yml runs on push to main only, so its post-merge run is outside this task.