fix(tools/skill-evals): require exact boolean for negate in assertions - #966
Open
surajthedev wants to merge 1 commit into
Open
fix(tools/skill-evals): require exact boolean for negate in assertions#966surajthedev wants to merge 1 commit into
surajthedev wants to merge 1 commit into
Conversation
Why: spec.get("negate") used Python truthiness, so a string like
"false" (non-empty, therefore truthy) would silently invert a
security assertion that the author intended to leave un-negated.
This is a silent correctness bug with no error surfaced.
The fix reads the negate field into a local variable and raises
TypeError immediately if the value is not an exact bool. Existing
callers that already pass true/false are unaffected.
Three new tests cover the three required cases:
- negate: true -> result is inverted
- negate: false -> result is unchanged
- non-boolean -> TypeError is raised with a clear message
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.
Closes #942
tools/skill-evals/src/skill_evals/runner.py read the
negateassertion key using Python truthiness, so a value like "false" (a non-empty string, therefore truthy) would silently invert a security assertion the author intended to leave un-negated.This PR requires
negateto be an exact boolean. Any non-boolean value now raises a clear TypeError instead of silently producing the wrong result.Added three tests covering negate: true, negate: false, and non-boolean values (string, int, float, list, dict).