Skip to content

fix(id-core): correct frames byte-refusal test to the crate oversize semantics (#8354) - #9889

Merged
dezren39 merged 1 commit into
mainfrom
fix/8354-frames-test-precedence
Nov 14, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/8354-frames-test-precedence

Conversation

@dezren39

@dezren39 dezren39 commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

The test was wrong; the code follows the crate's documented design. Evidence:

  • The abuse module's design contract (pkgs/id/crates/id-core/src/abuse.rs, module docs): "A request whose cost exceeds its bucket's burst capacity is a permanent block of its own kind (RefusalReason::RequestTooLarge): refill caps the bucket at capacity, so the cost is unreachable at any future time and no retry is offered — wiring surfaces map it to a permanent client error (e.g. HTTP 413), never to 429/Retry-After."
  • The id(abuse): check_bytes/check_frame promise a retry for requests larger than bucket capacity — oversize can never be admitted, but refusal is temporary with retry_after_ms #3927 oracle test in the same file (oversize_byte_request_is_refused_permanently) pins exactly this for check_bytes: cost = burst + 1 → RequestTooLarge, retry_after_ms None, at t=0 and at a far-future time; the exact-burst control is admitted.
  • check_frame_and_bytes (what charge_frame calls) implements the same rule: oversize on either bucket is checked first and returns RequestTooLarge.

The failing frames test charged 5 bytes against byte_burst 4 — an over-capacity cost — but expected BudgetExhausted, which the design reserves for a within-capacity cost the bucket momentarily cannot cover (retryable). No code change was needed; production semantics are unchanged.

Fix (test-only): the oversize charge now expects RequestTooLarge with no retry offered, keeping the test's no-spend assertions (no counters recorded; the frame allowance intact, proven by the following 4-byte charge landing exactly {frames: 1, bytes: 4}). A second scenario was added so the test also pins the BudgetExhausted atomicity it was named for: drain the byte bucket with an admitted 4-byte charge, then a within-capacity 1-byte charge is refused BudgetExhausted (retry present) and likewise spends neither the frame token nor the counters.

Verification: cargo test -p id-core --lib in a worktree at origin/main: 427 passed, 0 failed (previously 427 run with this one failure).

Closes #8354


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 14, 2026 10:26
@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-14T10:26:37.715735Z
We couldn’t complete this review. Comment @codex review to try again.
0af739f 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.

@coderabbitai

coderabbitai Bot commented Nov 14, 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 29 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: 146eaf9c-d873-4d18-89b6-1bb1478b327a
Commits

Reviewing files that changed from the base of the PR and between 034df98 and 0af739f.

Files selected for processing: 1

  • pkgs/id/crates/id-core/src/frames.rs
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id: frames byte-refusal test fails on main (RequestTooLarge vs BudgetExhausted) — blocks id build + nixos-integration check

1 participant