Skip to content

[Help wanted] Validate Worker quota under 100 concurrent calls β€” Cloudflare Workers KV atomicity testΒ #10

@hoainho

Description

@hoainho

🌟 Before claiming this issue

Two quick steps before you open a PR:

  1. ⭐ Star the repository β€” low-friction signal that you'll follow through
  2. πŸ’¬ Comment I'll take this (or similar) below β€” prevents two contributors racing on the same issue

Full policy: CONTRIBUTING.md β†’ How to claim. If a claim is older than 7 days with no PR, you can reclaim it politely.


Context

The Worker quota requirement worker-quota/spec.md "Concurrent writes do not lose increments" claims that 20 concurrent requests against a free-tier key result in counter equal to 20 exactly (no lost updates). This needs an independent reproducibility test with higher concurrency.

Where to look

  • File: worker/src/quota.ts (created by task 3.6)
  • The spec says 20 concurrent requests; we want 100 to truly stress the atomicity guarantee
  • KV getWithMetadata + put is NOT atomic by default; needs explicit single-flight pattern (D1 atomic counter or Durable Object)

Expected outcome

  • New test file worker/test/quota-concurrency.test.ts
  • Test fires 100 concurrent incrementAndCheck calls against a fresh key in a real Cloudflare Workers preview environment
  • Asserts: final counter equals exactly 100 (zero lost updates)
  • Documents the implementation choice (D1 vs Durable Object vs other) and the latency cost

Estimated effort

M (3 to 6h)

How to claim

Comment "@hoainho I will take this" to claim. PR within 10 days or unclaimed.

Acceptance criteria

  • Test passes on wrangler dev --remote mode (real KV/D1)
  • Test is wired into CI via wrangler-action or manually-triggered workflow
  • If atomicity guarantee cannot be met with current implementation, open a follow-up issue with the failure mode documented

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions