Skip to content

test(pkarr-worker): exercise RETENTION_SECONDS guard through the real DO alarm path (#10818) - #10824

Merged
dezren39 merged 2 commits into
mainfrom
queue/17521-10818-real-do-alarm
Nov 16, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/17521-10818-real-do-alarm

Conversation

@dezren39

@dezren39 dezren39 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Follow-up to triage task 17517.

The retention regression tests from PR #4352 only drive worker.fetch with a mock PKARR_STORE whose putPacket re-implements the production alarm expression (now + retentionMilliseconds(...)), so a wiring regression in the real PkarrStore (wrong env var, dropped setAlarm) would pass the suite. Verified on main a20e2239: mock at test/worker.test.ts:33-48, all RETENTION_SECONDS cases at :136-180 via the mock, sole real-DO getAlarm readback at :196 under default env.

This PR adds test/worker.retention.test.ts, executed once per vitest project with RETENTION_SECONDS set to 0, 7d, out-of-range (8640000000000), and valid non-default 3600 (see vitest.config.ts projects; a DO always sees the worker's configured vars, so per-value projects are the only way to vary it). Each case PUTs through SELF to the real Durable Object and asserts the scheduled alarm from real DO storage via runInDurableObject + state.storage.getAlarm() against a literal constant — never retentionMilliseconds itself. The existing default-env matrix in worker.test.ts is untouched.

Test-only change; no production wiring touched.

Closes #10818.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 16, 2026 16:14
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 67765f0e-2275-4c44-a14a-3a2f319b8587
Commits

Reviewing files that changed from the base of the PR and between 86ebce1 and e47a0d0.

Files selected for processing: 2

  • pkgs/pkarr-worker/test/worker.retention.test.ts
  • pkgs/pkarr-worker/vitest.config.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T16:14:41.000550Z
We couldn’t complete this review. Comment @codex review to try again.
b282d38 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

repo-worker-tmp-code-b added 2 commits November 16, 2026 10:42
… DO alarm path (#10818)

The retention regression tests only drove worker.fetch with a mock
PKARR_STORE whose putPacket re-implements the production alarm
expression, so a wiring regression in the real PkarrStore would pass
the suite. Add test/worker.retention.test.ts, run once per vitest
project with RETENTION_SECONDS set to 0, 7d, out-of-range, and 3600:
each PUT goes through SELF to the real Durable Object and asserts the
scheduled alarm from real DO storage against a literal constant.
The default-env matrix in worker.test.ts is untouched.
…TENTION_SECONDS via miniflare bindings

Top-level projects:[] is ignored by vitest 4 (must be test.projects);
without it the cloudflareTest plugin never applied. miniflare.vars is
silently dropped by the plugin's V4 schema parse — the V4 shape carries
plain-text vars as bindings, which merge over wrangler-derived values
per key. Also keep deploy-*.test.ts in the default project so the suite
still runs every file main runs.
@dezren39
dezren39 force-pushed the queue/17521-10818-real-do-alarm branch from b282d38 to e47a0d0 Compare November 16, 2026 16:49
@dezren39
dezren39 merged commit 96efa28 into main Nov 16, 2026
1 check passed
@dezren39
dezren39 deleted the queue/17521-10818-real-do-alarm branch November 16, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant