Repository navigation
feat(check): rule and check engine with a static forbid kind - #54
Merged
Merged
Conversation
Introduce the declarative rule/check engine (CLOUD-12): a [[rule]] table in batten.toml, a `batten check` command, and an engine that selects files by glob and reports pointer-only path:line findings, byte-stable and mapped onto the exit-code contract (0 clean, 1 on any finding, 2 for a malformed rule). Ships one static kind, forbid (a banned-shape literal check), and is shaped so further kinds slot in as new RuleKind variants — notably the dynamic command kind (CLOUD-89). File selection is a working-tree walk skipping .git; scoping it to the git change-set is deferred to CLOUD-36 and CLOUD-37. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U4v4gg2DRyfPAR2fXCQ3ZZ
CLOUD-12 Rule and check engine
Port the acceptance runner and replace ad-hoc rule logic with a declarative rule/check engine. |
CARGO_TARGET_TMPDIR is defined only for integration-test crates, so the library unit tests could not reference it under clippy --all-targets. Use std::env::temp_dir() instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U4v4gg2DRyfPAR2fXCQ3ZZ
wenzowski
marked this pull request as ready for review
August 6, 2026 21:50
wenzowski
marked this pull request as draft
August 6, 2026 23:47
wenzowski
marked this pull request as ready for review
August 6, 2026 23:47
Contributor
Author
|
/fast-forward |
This was referenced Aug 7, 2026
This was referenced Aug 9, 2026
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.
What
Stands up the declarative rule and check engine (CLOUD-12) — the substrate
the Phase 2 checks work builds on.
[[rule]]table inbatten.toml: each rule hasid,kind,glob,pattern.batten checkcommand (effect:read, so it joins the derived read-only allowlist).rules.rs) that selects files by glob and applies akind-specific predicate, mapping the outcome onto the exit-code contract:0clean,1on any finding,2for a malformed rule.forbid(a banned-shape literal check), emitting pointer-onlypath:linefindings — never the matched bytes (non-negotiable rule 4) — and byte-stable across runs (§6).Why this and not CLOUD-89 directly
CLOUD-89 ("add a
commandrule kind") presupposes a rule engine with a kinddispatch to extend, but none existed — its parent CLOUD-12 was still Backlog.
Rather than smuggle a whole engine in under CLOUD-89, this PR lands the engine
first (as CLOUD-12) so
commandbecomes a clean one-variant addition. TheRuleKindenum is#[non_exhaustive]and dispatch is a singlematch, soCLOUD-89 adds a variant plus one arm.
Scope / deferrals
.git. Scoping it to thegit change-set / protected / unlanded sets is deliberately deferred to
CLOUD-36 and CLOUD-37; it layers on top of this walk without changing the
rule model.
forbidpredicate is a literal substring match (no regex dependencyadded). Richer shapes can follow as their own kinds.
commandkind and output-string promotion remain with CLOUD-89 / CLOUD-117.Tests
*,**,?), pointer-only findings,clean-tree, byte-stability,
.gitskip, non-UTF-8 files, and empty-glob usage error.with pointer-only stdout, byte-stable output, and an unknown rule key → exit 2.
mise run cigreen locally.Refs CLOUD-12. Unblocks CLOUD-89.