Skip to content

feat(metrics): add architecture import boundaries and pre-edit guard - #200

Open
avidianity wants to merge 5 commits into
mainfrom
feat/169-import-boundaries
Open

avidianity wants to merge 5 commits into
mainfrom
feat/169-import-boundaries

Conversation

@avidianity

Copy link
Copy Markdown
Owner

Summary

Adds configurable architecture import boundaries (zones, patterns, public_files, allow/deny rules, strict_zones, and layered/hexagonal presets) evaluated over resolved runtime imports across all supported languages, integrates boundary Budgets and Regression gating into codeint check and codeint diff, and adds the pre-edit codeint guard command in both the CLI and codeint mcp.

Closes #169
Closes #176
Closes #177
Closes #178

Tier

Tier 2 from the tier check: default tier for application code across crates/config, crates/metrics, crates/report, crates/cli, schema/codeint.schema.json, and docs/reference.md.

Task

Spec #169 and sub-issues #176, #177, #178:

Fail-first test

  • Test: crates/cli/tests/boundaries.rs (check_reports_directional_deny_allow_and_public_files_findings_across_formats, check_supports_layered_and_hexagonal_presets_with_user_overrides, diff_classifies_boundary_findings_and_gates_new_regressions_without_failing_on_preexisting) and crates/cli/tests/guard.rs (guard_reports_zone_rules_public_files_and_importers_for_existing_and_planned_files)
  • Before the change: failed with exit code 2 (codeint.json has an unknown key boundaries, codeint.json has an unknown key boundaries.preset, error: unrecognized subcommand 'guard')
  • After the change: passed (all workspace unit, integration, reference, and doc tests green)

Checks

Check Result
cargo test --workspace --locked passed
cargo clippy --workspace --all-targets -- -D warnings passed
cargo fmt --check passed
codeint diff b416af7 passed (0 regressions)
lefthook pre-commit and commit-msg passed
Merged-result check (cargo run --package xtask -- merged-result) passed

Safety proof

  • Safety fact: Repositories without a boundaries section in codeint.json experience zero behavior change in check, diff, and mcp.
  • Proof: crates/cli/tests/check.rs (143/143), crates/cli/tests/mcp.rs, and crates/cli/tests/boundaries.rs confirm boundaries is omitted from JSON/TOON/Markdown/SARIF outputs and over_budget/regression checks when unconfigured; cached CommitMeasurement deserialization preserves backward compatibility via serde defaults.
  • interrogate: none run below Tier 3.

Runtime evidence

End-to-end CLI and MCP integration tests executed the compiled codeint binary on revision 5525aa3 across TypeScript, JavaScript, and Python fixture repositories and temporary Git repositories (boundaries, guard, mcp, reference test suites all passed, and codeint diff b416af7 exited 0 with zero regressions).

Gaps

  • Deferred coverage: none
  • Pre-existing failures: none
  • Environmental failures: none

Add boundaries configuration (zones, patterns, public_files, allow/deny rules with optional reasons, strict_zones, source_sets) with strict load-time validation, evaluate boundary rules over resolved runtime imports in codeint-metrics, and emit boundary Findings in TOON, JSON, SARIF, and Markdown reports from codeint check.

Closes #176
Add built-in layered and hexagonal presets under boundaries.preset with zone and rule override semantics, expose per-Source-set boundary regression limits (defaulting to any_new_finding), and wire boundary Findings into CommitMeasurement and DiffReport across JSON, TOON, SARIF, and Markdown outputs.

Closes #177
Add codeint guard <path> (text, toon, json) and the matching read-only guard tool in codeint mcp so developers and coding agents can inspect architectural zone membership, allowed and denied target zones, public_files constraints, allowed importers, and rule reasons for existing or planned files.

Closes #178
@github-actions github-actions Bot added the tier-3 Tier 3 from the tier check label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tier-3 Tier 3 from the tier check

Projects

None yet

1 participant