chore(policy-engine): add crate scaffold, policy model, and RE2/glob helpers #4928
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.42) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 353 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.351
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #4928"
general
weight: 0.35
dashpole
Change summary
Adds the
otel-arrow-dfe-policy-enginecrate scaffold,opentelemetry.proto.policies.v1developmentRust data model (aligned with OTEP 4738 and open-telemetry/opentelemetry-proto#865), and core RE2/glob/numeric helper functions.This is PR 1 of the 6-PR incremental split from closed reference PR #4795:
1. This PR: Crate scaffold, policy model (
model.rs), RE2 AST validation/compilation, glob matching, andi64/f64comparison helpers.2. Dense bitset pool and required n-gram string index (
bitset.rs,string_index.rs).3. OTAP Arrow accessors, SIMD predicate kernels, and RFC 8949 CBOR reader (
otap_ops.rs,columnar.rs).4. Filter engine (
compile.rs,field_eval.rs,engine.rs).5. 4-stage log transforms (
transform.rs).6. Criterion benchmarks (
benches/engine.rs).Key design choices in PR 1:
unsafe_code = "deny"lint and depends only on four crates already present inrust/otap-dataflow/Cargo.lock(memchr,regex-automata,regex-syntax,thiserror).regex_syntax::ast::Astlevel before translating directly to HIR (multi_line(false)), rejecting non-RE2 syntax (lookarounds, backreferences,(?x)/(?u)/(?R)flags, set operators, nested classes,\u/\U, non-RE2 Unicode binary properties or long names), rewriting\d/\w/\s/\b/\Bto RE2 ASCII semantics and\p{^Name}/\P{^Name}to negated classes, and enforcing source length (4 KiB), nesting depth (64), Thompson NFA (256 KiB), and hybrid DFA cache (64 KiB) bounds.i64againstf64without losing precision above2^53and matches/?globs without exponential backtracking.#![allow(dead_code)]inmodel.rs: Kept strictly tosrc/model.rsfor crate-internal engine helpers (parse_re2_hir,compile_,matches_glob,cmp_,apply_regex_redaction) until downstream modules wire them up in PRs 2-5.Related issue
Validation
Unit tests in
crates/policy-engine/src/tests/model.rscoveri64/f64precision boundaries, predicate ordering, capture-template redaction (including reusableCapturesbuffers), glob matching, constructors, RE2 syntax rejections,\p{^Name}/\P{^Name}negation,(?i)\wcase-folding parity, NFA/length/depth bounds, and HIR translation across all 206 entries inRE2_UNICODE_GROUPS.User-facing changes
None (internal library crate not yet wired into a dataflow processor node;
chorePR title).