Repository navigation
fix(s16): reject non-integral floats for JSON Schema "integer" - #677
Open
shuhuNB515 wants to merge 1 commit into
Open
shuhuNB515 wants to merge 1 commit into
shuhuNB515 wants to merge 1 commit into
Conversation
SimpleJsonSchema folded integer into number, so a workflow that asked for
{"type": "integer"} accepted 3.7 and handed the float to the caller. Every
other primitive is checked strictly (3, True and "3" are all rejected for
"number"), so this was an oversight rather than a deliberate shortcut.
Accept a non-bool int or a float whose is_integer() is true (JSON Schema
treats 3.0 as an integer) and report "expected integer" otherwise. Sync the
embedded s16 snapshot in versions.json.
Disclosed AI assistance: found during an AI-assisted review.
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.
Fixes #676
Problem
SimpleJsonSchema.validatetreatedintegeras an alias ofnumber:So
agent(prompt, schema={"type": "integer"})accepted3.7and passed the float to the caller as a validated result — including on the resume/cache path, which validates the cached value with the same class.Change
_fill_schemais untouched (it already yieldsintfor both types). The embeddeds16snapshot inweb/src/data/generated/versions.jsonis regenerated, sotests/test_web_scenarios.pystays byte-identical.Verification
Loaded the real module and exercised the validator directly, 16/16 checks:
type: integertype: number33.03.7expected integerTrueexpected integerexpected number"3"expected integerexpected numberAlso covered: the error is prefixed by the property name inside
object(count: expected integer) and by the index insidearray([1]: expected integer);enumstill wins when both are present; an empty schema still accepts anything;_fill_schemastill produces a realint; and the threeSimpleJsonSchema(schema).validate(...)call sites (fresh run, cached resume, retry) are unchanged.Nothing in
tests/mentions"integer", so no existing assertion changed meaning.Whole suite on this branch with
tests/test_agent_teams_runtime.pyexcluded (that file now stops responding in this sandbox even when run alone, on unmodifiedmaintoo):433 passed, 43 subtests passed, 3 failed. The three failures are environment-only and reproduce identically on unmodifiedmain— a sandboxmkdirEEXISTintest_s_full_background.py(×2) and one GBK subprocess case. The snapshot equality check thattest_web_scenarios.pyperforms was also verified byte-for-byte directly.Disclosed AI assistance: found during an AI-assisted review; patch and verification done with AI assistance.