Conversation
…t time The three rate-limit env vars were parsed with int(), which accepts arbitrary precision. limit.py:take() converts to float at request time, so a 400-digit value caused OverflowError on every route. Fix: attempt float(v) conversion at boot and catch OverflowError — rejects only values that would actually overflow at runtime, without imposing an arbitrary ceiling. A float-safe value like 10,000,001 is accepted; a 400-digit value is rejected. Based on yukkie3276's review: reject the actual representation boundary rather than a hard 10M cap.
…ection Adds boot-level tests for all three rate-limit environment variables: - Overflowing values (400-digit) assert boot refusal - Large float-representable values (10,000,001) assert successful boot Addresses flop-labs#744 review feedback: the fix existed but lacked executable regression coverage.
Moves the max(1, v) floor before the float(v) OverflowError guard so that oversized negative values (e.g. a 400-digit negative) are floored to 1 and then pass representability without issue — matching the pre-PR contract where zero/negative values were silently floored. Addresses review feedback on PR flop-labs#820.
Asserts that a 400-digit negative value floors to 1 and boots cleanly, since max(1, v) is now applied before the float(v) representability check. Addresses review feedback on PR flop-labs#820.
|
Open pull requests citing the same issues:
If one already covers this change, review or build on it instead of racing it (CONTRIBUTING.md "Overlapping work"). |
Contributor
|
This is #863's four commits, patch-identical ( So my comparison on #863 still applies: #863 (comment). In particular, |
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.
Replaces #863 with a clean rebase on v0.14.0.
Fixes: #744
Rejects oversized CHAT_RATE_* env values at config import time (via float() conversion check), instead of crashing at request time with OverflowError.