feat(rules): rule files extend others by path, URL or git source; exact load-time checks #28
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 636 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.386
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #28"
general
weight: 0.35
hakuturu583
Summary
This is a follow-up to #27, which was merged before its review fixes were pushed. It does two things:
1. Fixes the two load-time check bugs that Codex found in #27. They are in v0.15.0.
2. Lets a rule file
extendsother files, so a per-vehicle file only has to write what differs from a shared weather model.🐛 Fixes from the #27 review
[0, 0, 33.3]and[33.3, 100, 100]leave 33.3 uncovered, yet the file loaded and then failed at run time. Terms are piecewise linear between their corners, so a gap (in coverage or in firing) starts and ends at a corner. The checks now also read every term corner and the midpoint between neighbouring points, which finds every such gap.CHECK_LIMIT(one million) points is now refused immediately, with a message to split it.Both cases have regression tests.
✨
extends| Reference | How it is read |
|---|---|
|
../base.yaml| relative to the file naming it (a local file, a URL, or a file in a git checkout), or an absolute path ||
https://...| fetched by the host: Python'sopenodd.rules.fetch_url(urllib, 30 s timeout, 4 MB max) or the browser'sfetch.http://is refused ||
{url, sha256}| same, refused unless the content has that digest ||
{git, rev, path}| the existing git sources (cached per commit,$OPENODD_CACHE) |rulesare replaced whole.nullremoves an entry.<<: *anchoris now expanded, for sharing part of a mapping within one file.Rules.fileslists every file read with its SHA-256, so a run can record exactly which rules it used.API
RuleSet::load/parse_with/load_over/parse_over/references. Resolution goes through aFetchtrait.Filesreads local files and git sources and calls a host closure for URLs;Giventakes files fetched in advance. The core gains no HTTP dependency, so it still builds for wasm.-
Rules.read(path or URL, fetch=)andRules.from_text(text, source, base=, fetch=)-
Rules.read_over()/text_over(): read a file that names only its changes over rules already in hand-
Rules.files-
Rules.merged()now merges deeply and can raiseRulesError-
Backend.use_rules()accepts a URL and reads the file over the backend's rules, so a run's file can be partial-
new RulesView(text, source, files),RulesView.references(),files()-
merge()reads a partial file-
loadRules(RulesView, url, {text})inviewer.jsfetches the wholeextendschain. Therules.htmleditor uses it. Git sources can't be read in the browser and give an explicit error.⚠️ Behaviour change
Rules.merged()used to replace whole quantities; it now merges down to the rule base. A file that restates a whole quantity gets the same result as before. The only visible difference is that a rule base present only in the earlier file is now kept, where before it was dropped. Callers that relied on that should set it tonull.✅ Tests
cargo fmt --check,cargo clippy --workspace --all-features --all-targets -D warningscargo test --workspace: 95 core tests pass, including 11 new rule tests (relative paths, chained files, lists, cycles, URLs through the host, sha256 pins, a git source at a tag in a local repository, deep merge withnull, merge keys, partial files over rules in hand, plus the two check regressions)pytest: 180 passed, 4 skipped (5 newextendstests)wasm-bindgen-test-runner);cargo build -p openodd --no-default-features --target wasm32-unknown-unknownsucceedsloadRulesfollowsvehicles/mini.yaml→sample_rules.yaml, giving grip 0.30–0.50 and inheriting visibility, with both files recorded. A missing file reports its URL and the 404. No page errors.📝 Docs
docs/rules.mdhas a new "Extending a rule file" section and an updated "Checks" section.docs/wasm.mdcoversloadRules,references,filesand the new constructor argument.Release: minor (new API).
---
_Generated by Claude Code_