Faithful HIR matcher model (Stage 1: ir + eval) - #362
Merged
Conversation
Lowering is now purely structural: string matches carry a wildcard-aware, original-case IrPattern and encoding modifiers stay explicit as IrEncoding steps. Nothing is lowercased, regex-compiled, or encoding-expanded during lowering. Eval's compile step reconstructs the modifier context and reuses the proven leaf compilers, so matching stays byte-identical (differential green). This removes SurfaceSpec and the regex/cidr/base64 deps from rsigma-ir, and sets up convert to render backend queries straight from the HIR without the parser AST.
Drop the module-doc references to the removed IrValue/SurfaceSpec, and resync ci/wasm-smoke and fuzz lockfiles after rsigma-ir dropped its base64/ipnet/regex dependencies, so the --locked wasm build resolves.
mostafa
marked this pull request as ready for review
July 20, 2026 19:49
This was referenced Jul 20, 2026
Merged
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.
Foundation for wiring convert through the HIR (follow-up to #360). Reworks the
rsigma-irmatcher model so it is faithful and lossless, and moves the physical work (lowercasing, regex/aho-corasick, encoding expansion) into eval's compile step.What changed
IrMatcher::Strcarries a wildcard-aware, original-caseIrPattern; encoding modifiers stay explicit asIrMatcher::Encoded { encodings: Vec<IrEncoding>, … }. Lowering no longer lowercases, compiles regexes, or expands encodings.compile_to_compiled(eval) reconstructs the modifier context and reuses the existing leaf compilers, so matching is byte-identical (thecompile_rulevscompile_rule_legacydifferential stays green).SurfaceSpecand theregex/ipnet/base64deps fromrsigma-ir; keywords are lossless without a sidecar.This is Stage 1 of the convert migration: it touches only
rsigma-ir+rsigma-eval. Convert still routes conditions throughlower_conditionsand is untouched. Stage 2 will have convert render backend queries directly from the faithful matcher.Checks
cargo test -p rsigma-ir -p rsigma-eval(832 pass, differential included)cargo test -p rsigma-convert(343) and CLI convert/eval/explain (72) unaffectedcargo clippy -p rsigma-ir -p rsigma-eval --all-targets --all-features -- -D warningscargo fmt --all;npm run docs:validatexref #346