fix: X-RateLimit-Reset header carries float epoch (6 test failures) - #293
Open
Mukller wants to merge 3 commits into
Open
fix: X-RateLimit-Reset header carries float epoch (6 test failures)#293Mukller wants to merge 3 commits into
Mukller wants to merge 3 commits into
Conversation
…riant asyncio.iscoroutinefunction is deprecated since Python 3.14 and emits a DeprecationWarning at import/call time (laurentS#263). inspect.iscoroutinefunction is the drop-in replacement and is already used elsewhere in the codebase (middleware.py).
The handler is sometimes registered for broader exception types (e.g. ConnectionError when a Redis storage backend is unreachable, laurentS#253). Those exceptions have no .detail attribute, so formatting the response raised a secondary AttributeError that masked the original error. Fall back to str(exc) instead.
get_window_stats() returns a float epoch despite the Tuple[int, int]
annotation, so the RESET header carried microsecond precision
('1787439694.295415' instead of '1787439694'). This also made six
header-related tests fail on current master.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
get_window_stats()returns a float epoch despite the localTuple[int, int]annotation, so theX-RateLimit-Resetheader carried microsecond precision:1787439694.295415instead of1787439694. Truncated both assignment sites toint.Impact
This was also the actual cause of 6 failing tests on current master (
test_headers_breachand related header tests asserted integer reset values). With this patch:(previously 6 failed / 97 passed)
Note: my earlier triage comment on #271 attributed those failures to the starlette
app.routeremoval — that was wrong, apologies for the noise; #271 remains a separate, still-unaddressed issue.Closes none directly, but fully greens the test suite.