Skip to content

fix(id/serve-proxy): bound credit grants to a finite window ceiling (#8970) - #10977

Merged
dezren39 merged 1 commit into
mainfrom
queue/18789-8970-credit-ceiling
Nov 17, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/18789-8970-credit-ceiling

Conversation

@dezren39

@dezren39 dezren39 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Bounds CreditWindow credit grants to a finite ceiling (#8970, task 18789).

What changed (pkgs/id/src/serve_proxy.rs only):

  • CreditWindow now carries an explicit ceiling set at construction from the effective configuration (CreditWindow::new(initial, ceiling); a ceiling below the initial grant is raised to it). No universal deployment limit is invented — the design delegates the limit to configuration, so the ceiling is a construction parameter. The built-in per_stream() / per_connection() windows are fixed-size (ceiling = the configured initial credit): a WINDOW_UPDATE can only return credit the sender has actually consumed, which is the design's "credit returns only as bounded buffer space is released" rule.
  • grant() returns Result<()>: a grant that would exceed the ceiling or overflow is an explicit protocol/resource error and leaves the window unchanged — no more silent saturating_add toward u64::MAX. The mux slice maps this error to ErrorReason::CreditOverrun, as the module doc already specifies.
  • The credit_is_never_exceeded proptest oracle is extended (refused grants change neither accounting nor state; available <= ceiling always), plus unit tests: normal credit return, exact-ceiling grant, over-ceiling refusal with unchanged state, repeated u32::MAX WINDOW_UPDATE grants, overflow grant, and a configured ceiling above the initial grant.

Acceptance mapping: criteria 1 (explicit finite ceiling tied to the effective limits), 2 (over-ceiling/overflow = explicit error, no silent saturation or mutation), and 4 (the named tests) are implemented. Criterion 3 (mux-level accounting) has no mux to enforce against yet — the prior triage (2026-11-12) confirmed no mux/channel/DATA path consumes this primitive in the current source; the primitive now exposes exactly the bounded, error-returning surface the mux slice needs.

Blocker history: the 2026-11-12 triage left this blocked on (a) PR #8971 editing the same file — MERGED 2026-11-14, blocker gone — and (b) the ceiling source, settled here by parameterizing the ceiling instead of hardcoding a deployment limit.

Tests: cargo test --lib serve_proxy:: — 13 passed (incl. the 3 credit tests); cargo fmt --check clean. Clippy could not run in this environment (nightly toolchain's librustc_driver is missing — pre-existing, unrelated to this change); the crate compiles and tests under cargo test.

Refs #8970 (issue stays open for the mux-slice criterion 3).


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 17, 2026 04:48
@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-17T04:48:35.232013Z
We couldn’t complete this review. Comment @codex review to try again.
e557259 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 17, 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 57 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: 66abaa15-6c45-4c85-84ae-58af217adedd
Commits

Reviewing files that changed from the base of the PR and between 22e7682 and e557259.

Files selected for processing: 1

  • pkgs/id/src/serve_proxy.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

@dezren39
dezren39 merged commit 9701c17 into main Nov 17, 2026
1 check passed
@dezren39
dezren39 deleted the queue/18789-8970-credit-ceiling branch November 17, 2026 04:49
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.

1 participant