Skip to content

feat(v0.5): overlay override-rules — per-context rule exemption/replacement - #52

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/project-scope-discussion-1dvjn8
Jul 17, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
claude/project-scope-discussion-1dvjn8

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What & why

First v0.5 "engine depth" increment. Overlays could already add rules; now they can override base rules — the piece real multi-context policies need. Deliberately touches none of the v0.4 wire contracts (facts/diff/findings/SARIF unchanged).

Semantics

  • override-rules { ids } — removes those base rules from the effective set. Use it to exempt a context (a vendored or generated zone) from a base rule.
  • Override + add-rules (same id) — replaces a rule: e.g. keep the check but drop its severity from error to warning for one context.
  • modify-rules stays reserved — its diff semantics are genuinely underspecified, and load-time rejection keeps evaluate total.
[[overlays.effects]]
type = "override-rules"
ids = ["readme-present"]     # this context doesn't require a README

Implementation (three places, kept consistent)

  • schema.rs — accepts override-rules; each overridden id must name a real base rule (OverrideUnknownRule otherwise). The duplicate-id check now operates over effective base ids (base minus overridden) plus overlay-added ids, so a same-id replacement is legal rather than a false collision. Overridden base rules are still fully validated at load — evaluation skips them, but a later un-override must not resurrect a malformed rule.
  • eval.rs — effective_rules drops overridden base rules; promoted to pub(crate).
  • action.rs — the planner's rule_index now reuses effective_rules, so evaluator and planner share exactly one set and a finding can never resolve to an overridden-away rule.

Verification

  • cargo test --workspace — 93 tests (5 new: override-disables and override-with-replacement at the eval level; unknown-id, same-id-replacement, and modify-rules-still-reserved at the schema level)
  • cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check clean
  • Live demo: a README-less repo fails the base readme-present rule, then passes clean (exit 0) once an overlay overrides that rule away
  • plasma check . self-check: 0 violations, 110 rules satisfied

Next in v0.5 (not in this PR)

Content facts + file-matches-pattern is the other big depth item — but it adds a file_contents layer to the FactSet, which ripples into the frozen plasma facts/plasma diff wire contracts (snapshot size vs. completeness is a real tradeoff). I've left it for a deliberate decision rather than bundling it here. More fix action types (CreateFile) also remain.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq


Generated by Claude Code

…cement

Overlays can now remove base rules from the effective set by id, and pair
an override with an add-rules reusing the same id to replace a rule (relax
a severity, exempt a vendored/generated zone, etc.). modify-rules stays
reserved (its diff semantics are underspecified).

- schema.rs: override-rules is accepted; each overridden id must name a
  real base rule (OverrideUnknownRule otherwise). The duplicate-id check
  now works over effective base ids (base minus overridden) plus added
  ids, so a same-id replacement is legal, not a collision. Overridden base
  rules are still fully validated at load.
- eval.rs: effective_rules drops overridden base rules; exposed pub(crate)
- action.rs: rule_index reuses effective_rules, so the planner and the
  evaluator share one set and a finding never resolves to an overridden
  rule
- docs/engine-v0-design.adoc: new overlay-algebra section
- 93 tests (5 new: override disables / replaces at eval level, unknown-id
  and same-id-replacement and modify-rules-reserved at schema level)
- versions unified at 0.5.0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
@hyperpolymath
hyperpolymath marked this pull request as ready for review July 17, 2026 05:39
@hyperpolymath
hyperpolymath merged commit bbdb2e7 into main Jul 17, 2026
22 checks passed
@hyperpolymath
hyperpolymath deleted the claude/project-scope-discussion-1dvjn8 branch July 17, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants