You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ship the first concrete rules pack: a per-rule directory layout, build-time bundling into a static RULES array exposed by rustmanifest-rules-core, and the first 5 tier-1 rules drawn directly from the EN methodology (code-review-methodology/en/quick-reference.md).
Phase 0 only locked the type surface. Phase 1A makes the type surface real with concrete data and validates that the build pipeline works end-to-end.
Locked design
Rule definition layout
Each rule lives in its own directory under crates/rustmanifest-rules-core/rules/:
rules/
RM-SEC-001/
rule.toml
pass.rs # MUST NOT trigger this rule
fail.rs # MUST trigger this rule
RM-SEC-002/
...
The old tier: Tier field on Rule is removed (the tier is implicit in the enum variant). Golden schemas regenerated and committed. Schema-drift CI gate stays green.
First 5 rules
Sourced verbatim from code-review-methodology/en/quick-reference.md:
ID
Title
Source line (quick-reference.md)
Severity
RM-SEC-001
Hardcoded credentials
L12
error
RM-SEC-002
SQL injection via format!
L15
error
RM-SEC-003
Command injection via format!
L18
error
RM-RUST-001
Panic in production code
L33
error
RM-PERF-001
Vec::new() without with_capacity
L60
warning
Each ships with a minimal pass.rs and fail.rs. Fixtures are intentionally narrow to lock the regex semantics; broader fixtures come with the actual engine in Phase 1B.
Deliverables
rustmanifest-schema: Rule reshaped, RuleDefinition enum added, golden schemas regenerated.
cargo test --workspace passes — including the new rule-validation tests.
reuse lint 100% compliant on all new files.
cargo deny check clean.
Schema-drift CI gate green.
cargo run --bin rustmanifest-schema-export and committed schemas reflect the new RuleDefinition enum.
All 13 CI jobs green on the PR.
Risks
Regex from quick-reference.md (e.g. for SQL injection) is intentionally simple and over-broad; documented as "high recall, medium precision" tier-1 behavior. False-positive narrowing happens in Phase 1B when the engine adds glob exclusions and call-site context.
Schema breakage (Rule reshape) ripples through any consumer; since this is pre-1.0 (0.0.0), the cost is contained — but the schema-drift gate must catch any forgotten regeneration.
regex crate is large; verify it does not break multiple-versions = "deny" in cargo-deny. If it does, narrow the dep tree or document specific skips with rationale (no blanket allow).
Goal
Ship the first concrete rules pack: a per-rule directory layout, build-time bundling into a static
RULESarray exposed byrustmanifest-rules-core, and the first 5 tier-1 rules drawn directly from the EN methodology (code-review-methodology/en/quick-reference.md).Phase 0 only locked the type surface. Phase 1A makes the type surface real with concrete data and validates that the build pipeline works end-to-end.
Locked design
Rule definition layout
Each rule lives in its own directory under
crates/rustmanifest-rules-core/rules/:rule.tomlschemadefinitionis a tagged enum (tieris now derived fromdefinitionvariant). Variants:[definition.pattern]— tier 1; carriesregexandexclude_globs.[definition.ast]— tier 2; carriescheckidentifier (concrete checks land in Phase 1C).[definition.semantic]— tier 3; reserved.Build pipeline
build.rsinrustmanifest-rules-corewalksrules/, parses eachrule.toml, validates ID equals directory name, emitsOUT_DIR/rules.json.lib.rsexposespub static RULES: LazyLock<Vec<Rule>>that parses the embedded JSON once on first access.Schema change
rustmanifest-schema::Rulebecomes:The old
tier: Tierfield onRuleis removed (the tier is implicit in the enum variant). Golden schemas regenerated and committed. Schema-drift CI gate stays green.First 5 rules
Sourced verbatim from
code-review-methodology/en/quick-reference.md:RM-SEC-001RM-SEC-002format!RM-SEC-003format!RM-RUST-001RM-PERF-001Vec::new()withoutwith_capacityEach ships with a minimal
pass.rsandfail.rs. Fixtures are intentionally narrow to lock the regex semantics; broader fixtures come with the actual engine in Phase 1B.Deliverables
rustmanifest-schema:Rulereshaped,RuleDefinitionenum added, golden schemas regenerated.rustmanifest-rules-core/rules/with 5 rule directories (TOML + pass.rs + fail.rs each).rustmanifest-rules-core/build.rsbundling rules intoOUT_DIR/rules.json.rustmanifest-rules-core/src/lib.rsexposingRULES: LazyLock<Vec<Rule>>.rustmanifest-rules-core:fail.rsmatches its rule's regex.pass.rsdoes not match.^RM-(SEC|PERF|RUST|QUAL|STRUCT)-\d{3}$.New dependencies
rustmanifest-rules-core):regex 1for compiling tier-1 patterns at runtime (used by tests in 1A, by the engine in 1B).rustmanifest-rules-core):toml 0.9(build-deps only).cargo-denypolicy.Out of scope
STRUCTURE.md— Phase 1C.checksubcommand wiring — Phase 1D.Acceptance criteria
cargo +nightly fmt --all -- --checkclean.cargo clippy --workspace --all-targets --all-features -- -D warningsclean.cargo test --workspacepasses — including the new rule-validation tests.reuse lint100% compliant on all new files.cargo deny checkclean.cargo run --bin rustmanifest-schema-exportand committed schemas reflect the newRuleDefinitionenum.Risks
quick-reference.md(e.g. for SQL injection) is intentionally simple and over-broad; documented as "high recall, medium precision" tier-1 behavior. False-positive narrowing happens in Phase 1B when the engine adds glob exclusions and call-site context.regexcrate is large; verify it does not breakmultiple-versions = "deny"incargo-deny. If it does, narrow the dep tree or document specific skips with rationale (no blanket allow).