Repository navigation
Conversation
validate() converts an int given for a float field to float, so a JSON request with "temperature": 1 passes a float schema. No test pinned that conversion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
If
rp_validator.validatestopped accepting anintfor afloatfield, a worker with a schema like{"temperature": {"type": float, ...}}would reject every request that sends"temperature": 1, and no test would notice. JSON clients send whole-number floats that way all the time (JavaScript'sJSON.stringify(1.0)is1), so callers would get "temperature should be <class 'float'> type, not <class 'int'>" for valid input.Tests only: one test (+12 lines) in
tests/test_serverless/test_utils/test_validate.py. No change to library code.The test validates
{"a": 1}against{"a": {"type": float, "required": True}}and checks there are no errors and the validated value is the float1.0. That is the conversion_validate_input_against_schemaalready does ("Enforce floats to be floats").How it was checked
On main
ddd8972:uv run pytest tests/test_serverless/test_utils/test_validate.py: 10 passed.ruff checkis clean on the file, and Black leaves the new lines unchanged.intdropped from the accepted types in that float check (type(...) in [float]), this new test is the only one that fails. The rest of the suite (everything excepttests/test_apps, which does not use the validator) still passes: 2043 passed.This test was written with Claude Code during a planted-bug run by SK @ Trenyx.