Open
Conversation
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.
Summary
Closes #104
Adds comprehensive input validation to the rule parser (
rule_parser.py) so that malformed rules, invalid bounds, and bad parameters produce clear, actionable error messages instead of cryptic runtime failures.Changes
<-separator; head and body must both be non-empty after splitting[a-zA-Z_][a-zA-Z0-9_]*; digit-leading names and special characters are rejected with specific messages[0, 1]withlower <= upper; NaN, Inf, and out-of-range values are caught~pred(X):[l,u]now correctly computes[1-u, 1-l]for both head and body clauses:True/:Falseshorthand — body and head bounds accept boolean string literals as aliases for[1,1]and[0,0]~~in head or body raises immediatelyforall()syntax validation — the inner expression must contain a predicate with variablesValueErrornp.float64arraysExceptionraises replaced withTypeError/ValueError_split_body_into_clauses,_parse_head,_validate_predicate_name, and_validate_variable_namehelpersdon_disable_jit→dont_disable_jitin test suite targetTest coverage
Added 722-line test file (
tests/unit/dont_disable_jit/test_rule_parser.py) with three test classes:TestValidRuleParsing— node/edge rules, temporal deltas, annotation functions, bounds, negation,:True/:False,forall, head functions, thresholds, weights, and a complex combined-parameter caseTestInvalidRuleParsing— type errors, empty inputs, missing arrows, bad bounds, wrong-length thresholds/weights, NaN/Inf weights, malformedforallTestEdgeCasesAndBoundary— boundary bounds, large delta_t, all six comparison operators, single-char predicates, negation inversion arithmetic, NaN/Inf bounds, digit-leading names, double negation🤖 Generated with Claude Code