feat(ci): configure cargo deny for workspace layer boundary enforcement - #1932
Conversation
There was a problem hiding this comment.
Pull request overview
Adds automated enforcement of the workspace’s layered architecture by introducing cargo deny bans (via wrappers) and wiring the check into local and CI workflows, plus updating documentation and fixing internal dependency metadata needed to satisfy wildcard bans.
Changes:
- Added
deny.tomlwith[bans]rules to prevent forbidden cross-layer dependency edges. - Integrated
cargo deny check bansinto CI (testing.yaml) and the local pre-commit hook. - Documented the enforcement mechanism and updated internal path dependencies to include explicit versions (to satisfy wildcard bans).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
deny.toml |
New cargo-deny bans configuration to enforce layer boundaries via wrappers. |
.github/workflows/testing.yaml |
Adds layer-bans job to run cargo deny check bans in CI. |
.github/workflows/copilot-setup-steps.yml |
Installs cargo-deny in the Copilot setup workflow so agent VMs can run the new checks. |
contrib/dev-tools/git/hooks/pre-commit.sh |
Adds a pre-commit step to run cargo deny check bans. |
docs/packages.md |
Documents layer boundary enforcement, forbidden edges, and maintenance guidance. |
packages/AGENTS.md |
Adds contributor guidance referencing the deny-based enforcement. |
packages/udp-server/Cargo.toml |
Adds missing version for an internal path dependency (avoid wildcard bans failure). |
packages/persistence-benchmark/Cargo.toml |
Adds missing version for an internal path dependency (avoid wildcard bans failure). |
docs/issues/open/1925-1669-si-31-configure-cargo-deny-for-layer-boundary-enforcement.md |
Updates implementation tracking and verification status for the issue spec. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1932 +/- ##
===========================================
- Coverage 79.49% 79.46% -0.03%
===========================================
Files 324 324
Lines 23116 23116
Branches 23116 23116
===========================================
- Hits 18375 18370 -5
- Misses 4465 4476 +11
+ Partials 276 270 -6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Install and configure cargo-deny with bans + wrappers to enforce the workspace layered architecture, preventing accidental dependency edges between layers. - Create deny.toml with deny entries for server, core, and protocol crates - Add layer-bans CI job to testing.yaml workflow - Add Install cargo-deny to copilot-setup-steps workflow - Add cargo deny check bans to pre-commit hook - Document forbidden edges and wrapper rules in docs/packages.md - Fix two wildcard path dependencies (udp-server, persistence-benchmark)
- Make multiple-versions rationale self-contained in deny.toml - Tighten protocol crate comment to match actual rule - Add --locked flag to copilot setup workflow install step - Mark M4 verification as PASS in issue spec
5518180 to
e1b01da
Compare
- Pin cargo-deny to v0.19.9 in testing.yaml and copilot-setup-steps.yml - Update proposed config example in issue spec to match actual deny.toml - Clean up duplicate notes block in issue spec
|
All 7 Copilot review comments have been addressed in commits a478b63c and 97b37fb:
(These thread IDs don't expose GraphQL node IDs via the REST API, so I can't use the resolve_thread API — but the fixes are pushed to the branch.) |
|
ACK 97b37fb |
Description
Install and configure
cargo denyto programmatically enforce the workspace's layered architecture rules, preventing accidental dependency edges between layers from being introduced.Closes #1925
Changes
deny.toml(new): workspace root configuration with[bans]section using thewrappersmechanism to restrict which packages can depend on server-layer, protocol, and core crates.github/workflows/testing.yaml: added newlayer-bansCI job that runscargo deny check bans.github/workflows/copilot-setup-steps.yml: addedInstall cargo-denystep (setup workflow for Copilot agent VM infrastructure)contrib/dev-tools/git/hooks/pre-commit.sh: addedcargo deny check bansas a pre-commit step (0.57s runtime)docs/packages.md: added "Layer Boundary Enforcement" section documenting forbidden edges, wrapper mechanism, known exceptions, and maintenance instructionspackages/AGENTS.md: added step 7 in "Adding or Modifying a Package" referencing deny enforcementpackages/udp-server/Cargo.toml: fixed wildcard path dependency (added missingversion)packages/persistence-benchmark/Cargo.toml: fixed wildcard path dependency (added missingversion)docs/issues/open/1925-...md: updated implementation tracking and verification resultsVerification
cargo deny check bans— ✅ (exit 0, zero errors)core -> server) — ✅ detected aserror[banned]cargo build --workspace— ✅linter all— ✅cargo test --doc --workspace— ✅