Add bulk rule loading from CSV and JSON files#120
Open
ColtonPayne wants to merge 35 commits intomainfrom
Open
Conversation
Implements add_rule_from_csv() and add_rule_from_json() for bulk rule loading, following the same pattern as bulk fact loading from PR #100. Updates add_rules_from_file() with raise_errors parameter for backwards-compatible error handling. Adds comprehensive test coverage. Resolves #117 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Adds bulk rule loading from CSV and JSON files, following the same pattern established in PR #100 for bulk fact loading. Also updates the existing text file loader with a
raise_errorsparameter for consistency (set to False by default for the old text loader only to avoid breaking changes)Resolves #117
Three-tier rule loading
Each file format supports a different level of expressiveness:
.txt).csv).json)rule_textnameinfer_edgesset_staticFalse(default)custom_thresholdsweightsraise_errorsdefaultFalseTrueTrueadd_rules_from_file): Simplest format. One rule per line.infer_edgesis applied uniformly to all rules.raise_errorsdefaults toFalsefor backwards compatibility.add_rule_from_csv): Per-rule control overinfer_edgesandset_static. Supports flexible boolean formats (True/true/1/yes). Auto-detects headers.add_rule_from_json): Full expressiveness. Supports all Rule parameters includingcustom_thresholds(as serializedThresholdobjects) andweightsper rule.Other changes
_parse_bool_param()and_parse_and_validate_rule_params()helpersTest plan
TestAddRulesFromFile+ 9TestAddRuleFromCSV+ 11TestAddRuleFromJSON)🤖 Generated with Claude Code