test: property-check write-queue serialization and clamp invariants#575
Conversation
fast-check properties over withQueuedRetry, complementing the example-based suite: - for ANY schedule of ok/flaky/fatal tasks across three keys, every key's invocations form contiguous groups in submission order (retries never interleave with another task), fatal tasks reject without blocking successors, and every task runs on its own key - any positive 429 retry-after hint is clamped into the 10ms..30s range and used verbatim within it https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Warning Review limit reached
More reviews will be available in 6 minutes and 40 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
…ustion From review: flaky and the new exhausted behavior throw any of the five retryable Windows codes (EPERM/EACCES dominate in practice, not just EBUSY), and the exhausted variant pins that a task burning the whole four-attempt budget rejects with the retryable error while its key's successors still run. https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
Summary
Second property suite of this wave (sibling: #574; complements the example-based #567). The settings write queue is the per-path serialization primitive behind every settings write — its Windows-safety claim is precisely a concurrency invariant, which is the kind of thing the repo's
test/property/tradition exists to pin across the whole input space rather than at hand-picked points. This addstest/property/settings-write-queue.property.test.ts(2 fast-check properties).Invariants pinned
Each property iteration uses a unique key namespace so the module-level queue map never couples runs.
retryAfterMshint (up to 2×10⁹) produces exactly one sleep ofmax(10, min(30000, round(hint)))— used verbatim inside the range, clamped at the 10ms floor and the 30s ceiling outside it.Validation
vitest run test/property/settings-write-queue.property.test.ts— 2/2 passing (default fast-check run counts)npm run typecheck— cleannpx eslint test/property/settings-write-queue.property.test.ts --max-warnings=0— cleanhttps://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
Generated by Claude Code
note: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
adds
test/property/settings-write-queue.property.test.tswith two fast-check properties pinning the write-queue's concurrency and rate-limit invariants. both previously-flagged gaps — windows-relevant errno codes and retry-budget exhaustion — are addressed.ok,flaky,fatal,exhausted) and all five windows-relevant errno codes (EBUSY,EPERM,EACCES,EAGAIN,ENOTEMPTY); checks contiguous per-key grouping, correct outcomes, exhausted-task retry count, and "every task ran at least once on its own key."retryAfterMshint (1..2×10⁹) produces exactly one sleep ofmax(10, min(30000, round(hint))); uses a unique key per iteration to avoid coupling runs through the module-level queue map.Confidence Score: 5/5
test-only addition with no changes to production code; safe to merge
the new test file exercises all retryable windows errno codes, all four task behaviors including retry-budget exhaustion, per-key serialization contiguity, and the 429 clamp formula — the two previously flagged gaps are both addressed and the implementation logic is sound
no files require special attention
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[fc.asyncProperty: arbSchedule] --> B[schedule.map: submit tasks] B --> C{spec.behavior} C -->|ok| D[return result-taskIndex] C -->|flaky| E{flakyFailed?} E -->|no| F[throw retryableCode\nadd to flakyFailed] E -->|yes| D C -->|fatal| G[throw ENOSPC\nnon-retryable] C -->|exhausted| H[throw retryableCode\nevery attempt] F -->|retry| E H -->|retry x4| I[budget exhausted\nthrow lastError] G --> J[reject immediately\ndon't block successors] D --> K[outcome: ok] I --> L[outcome: error] J --> L K --> M[Assert: contiguous groups\nper key in submission order] L --> M M --> N[Assert: exhausted tasks\ninvoked exactly SETTINGS_WRITE_MAX_ATTEMPTS times] N --> O[Assert: every task ran\nat least once on its own key]Prompt To Fix All With AI
Reviews (2): Last reviewed commit: "test: draw transient codes from the full..." | Re-trigger Greptile