Skip to content

docs(rate_limiter): fix check() docstring to match recording behavior - #4233

Open
PratikDhanave (PratikDhanave) wants to merge 1 commit into
microsoft:mainfrom
PratikDhanave:docs/rate-limiter-check-docstring
Open

PratikDhanave (PratikDhanave) wants to merge 1 commit into
microsoft:mainfrom
PratikDhanave:docs/rate-limiter-check-docstring

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

RateLimiter.check()'s docstring says it "Records the current call timestamp regardless of the outcome." But when len(dq) >= limit the method return False before dq.append(now) — rejected calls are not recorded.

The code's behavior is the correct sliding-window semantics (recording rejects would let a caller that keeps retrying while over the limit extend its own lockout past the window), and the existing tests encode the no-record behavior. So the defect is purely the docstring.

Doc-only; pytest rate-limiter suite (16 tests) passes.

🤖 Generated with Claude Code

check() said it "records the current call timestamp regardless of the outcome",
but a rejected call returns False before dq.append(now), so rejected calls are
not recorded. The code is the correct sliding-window behavior (recording
rejects would let a retrying-over-limit caller extend its own lockout); only the
docstring was wrong. Doc-only, no behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pratik Dhanave <i.pratikdhanave@gmail.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ⚠️ Missing No current-run comment
🛡️ Security Scan ⚠️ Missing No current-run comment
🔄 Breaking Changes ⚠️ Missing No current-run comment
📝 Docs Sync ⚠️ Missing No current-run comment
🧪 Test Coverage ⚠️ Missing No current-run comment

Verdict: ⚠️ AI review incomplete; ready for human review

AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims.

@github-actions github-actions Bot added the size/XS Extra small PR (< 10 lines) label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AGT Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Oct 6, 2026
@MohammadHaroonAbuomar

Copy link
Copy Markdown
Collaborator

The docstring change matches the code: check() returns False before appending, so rejected calls are not recorded, and a probe with limit 2 shows the deque staying at two entries through rejected retries. Tests pass (142). Before I approve, please replace the description with the repository PR template and complete it, in particular Type of Change, Packages Affected, Checklist and the AI Assistance attestations, since the commit records Claude Code as co-author. Same ask as on #4226.

This branch has not been deployed

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

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk size/XS Extra small PR (< 10 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants