Conversation
Test Failure AnalysisSummary: A pre-existing flaky test unrelated to this PR's changes (docs-only) failed on Python 3.10/ubuntu-latest due to non-deterministic timing and protocol overhead assumptions in the rate limiting integration test. Root Cause:
On this particular run, Python 3.10/ubuntu-latest took long enough between requests that the token bucket partially refilled, and/or only 2 overhead requests were counted, leaving the 4th Suggested Solution: Two changes to
Example hardened version of the test: async def test_rate_limiting_blocks_rapid_requests(self, rate_limit_server):
"""Test that rate limiting blocks rapid successive requests."""
# Use a near-zero refill rate so timing doesn't affect token count
rate_limit_server.add_middleware(
RateLimitingMiddleware(max_requests_per_second=0.001, burst_capacity=5)
)
async with Client(rate_limit_server) as client:
# After init overhead (2-3 requests), at most 2-3 call_tools can succeed
await client.call_tool("quick_action", {"message": "1"})
await client.call_tool("quick_action", {"message": "2"})
# Next should be rate limited (5 tokens exhausted by overhead + 2 calls)
with pytest.raises(ToolError, match="Rate limit exceeded"):
await client.call_tool("quick_action", {"message": "3"})This is a pre-existing test flakiness issue — the PR's changes (animated banner assets and MDX) have no bearing on the failure. Detailed AnalysisFailure log excerpt: Token bucket mechanics (
Request count scenario that causes the failure:
Why it passes on other platforms: Python 3.13 runs tests faster (fewer ms between requests = less refill) and/or the overhead request count happened to be 3 there. Job that failed: Tests: Python 3.10 on ubuntu-latest (ID: 64169092817). Passed on Python 3.13/ubuntu-latest, Python 3.10/windows-latest, and lowest-direct-dependencies. Related Files
|
No description provided.