Repository navigation
xtask: stop committing modules.json and modules.mmd while keeping live boundary checks - #1946
Conversation
zerob13
left a comment
There was a problem hiding this comment.
Verified on the exact PR merge tree on Linux. xtask check still enforces the Cargo and source-derived module boundaries, and all four module tests passed. xtask module-graph DIR reproduced both previous snapshots byte for byte, and xtask graph kept them out of the generated directory while preserving the remaining outputs. I found no downstream consumer tied to the removed paths. The CI path selection includes xtask check, and the macOS verify job is still queued.
zerob13
left a comment
There was a problem hiding this comment.
I traced xtask check through modules::check to check_boundaries(). Both live boundary checks still run, and the existing CI path rules still select xtask check.
The remaining issue is the closing reference. The current acceptance criteria for #1945 also cover unused intermediate JSON snapshots. This PR still generates crates.json and instances.json, and it still checks crates.json for freshness. Please use Refs #1945 or narrow the issue's acceptance criteria to the two module snapshots before merging.
| ) | ||
| .unwrap(); | ||
| let checked = check(&workspace); | ||
| let result = generate(&workspace); |
There was a problem hiding this comment.
Both calls reach the same analyze() path and rerun cargo metadata for each of the seven fixtures. Please use check() for these boundary assertions. The existing graph tests already cover generate() output. This is a non-blocking cleanup.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Approved. I verified the full main...head diff at 2ebe95ef.
Snapshot removal
git ls-tree at HEAD shows no modules.json or modules.mmd under docs/architecture/rust-agent/generated/. A repo-wide search finds only the intended new references in AGENTS.md:96, docs/architecture/README.md:110, and xtask/src/modules.rs:72,128. crates.*, instances.*, services.*, catalog.md, and the app-server/local service snapshots remain committed.
Boundary enforcement
modules::check() (xtask/src/modules.rs:60) and modules::generate() (xtask/src/modules.rs:73) both call analyze(), which still runs resolve_symbols(), resolve_edges(), and check_boundaries() (xtask/src/modules.rs:244-246). The move is verbatim and no rule changed. boundaries() calls modules::check() (xtask/src/main.rs:409) for both xtask check (xtask/src/main.rs:69) and xtask graph (xtask/src/main.rs:363), and the Cargo restrictions remain at xtask/src/main.rs:383-398. Only crates.json/crates.mmd are written and freshness-checked now (xtask/src/main.rs:405-410), which matches the updated docs.
On-demand output
module-graph DIR writes only inside DIR (xtask/src/main.rs:86-100). I ran it to a directory under my review data dir; both files were byte-identical to the removed base snapshots (1,629,664-byte modules.json, 102,245-byte modules.mmd), and the worktree generated directory stayed free of both files.
Verification on this head
git diff --check, git merge-tree, cargo fmt --all -- --check, node scripts/adr-check.mjs --base origin/main, cargo test --locked -p xtask -- modules:: (4 passed), cargo run --locked -p xtask -- check (743 modules, 4555 edges, all other checks passed), and module-graph all passed. CI at this head: changes and dependencies pass, verify is still pending.
Optional notes
- The PR body says "Fixes #1945", but #1945's acceptance criteria also mention unused intermediate
.jsonsnapshots, and this PR still commits and checkscrates.json(xtask/src/main.rs:406,409) and keepsinstances.json. Agree with zerob13: useRefs #1945or narrow the issue scope before merging. This does not affect the code. docs/architecture/README.md:110saysgraphis "the only command that writes committed files", butxtask typesalso writes the committednpm/branch-services.d.ts. Consider "the only command that writes the generated architecture files".- The inline cleanup at
xtask/src/modules.rs:880is not blocking. The fixture test runs in 0.22s, and asserting bothcheck()andgenerate()keeps coverage that both entry points reject boundary violations.
I did not run xtask graph end to end because it assembles an agent. Its module check path is xtask/src/main.rs:363 -> 409, and xtask check exercised the same modules::check() successfully.
Stop writing and freshness-checking the 58k-line modules.json and
5.3k-line modules.mmd snapshots under docs/architecture/rust-agent/generated/.
Both files had zero documentation readers while causing frequent merge
conflicts across parallel pull requests, and `xtask check` already
computes and enforces every crate and syn-AST module boundary rule live
from source.
- Split `modules::check` (live AST boundary enforcement without
serializing JSON/Mermaid) from `modules::generate`.
- Run `modules::check` inside `boundaries` for both `xtask check` and
`xtask graph`, keeping `crates.json` and `crates.mmd` committed and
freshness-checked.
- Add `xtask module-graph DIR` to emit `modules.json` and `modules.mmd`
on demand into an arbitrary directory without committing them.
- Remove `docs/architecture/rust-agent/generated/modules.{json,mmd}` and
update `AGENTS.md` and `docs/architecture/README.md`.
Refs #1945
# Conflicts:
# docs/architecture/rust-agent/generated/modules.json
# docs/architecture/rust-agent/generated/modules.mmd
2ebe95e to
b6f6cff
Compare
|
Thanks @zerob13 and @yyhhyyyyyy for the reviews!
|
Main stops committing the generated module graph (#1946); accept that deletion here and keep the rest of the resolve as the merge produced it.
The parent's head carries the attach reply's default cursor (arcships#1917) and moves the generated module files out of the tree (arcships#1946), so the resolution drops both files, as a sync with main does.
Summary
Stops committing
docs/architecture/rust-agent/generated/modules.json(58,183 lines, 1.6 MiB) anddocs/architecture/rust-agent/generated/modules.mmd(5,301 lines, 100 KiB) and stops diff-checking them for staleness inxtask check, while keeping 100% of live crate and syn-AST module boundary enforcement. Refs #1945 (keeping #1945 open for any follow-up decision oncrates.json/instances.json).Why
main,modules.jsonchanged 42 times andmodules.mmd19 times (even adding a single internal/test module mutates the 1.6 MiB file), creating constant merge conflicts across parallel PRs, extra rebases, and repeated CI runs.xtask/src/modules.rsalready computes the AST graph and asserts all boundary rules (check_boundaries()) live in memory from source on every run — the committed snapshots added zero enforcement.Changes
xtask/src/modules.rs: splitanalyze()intomodules::check()(live crate + syn-AST boundary verification without serializing 1.7 MiB of JSON/Mermaid) andmodules::generate()(on-demand emission), and assert both paths inbusiness_boundaries_follow_source_aliases_and_preserve_builtin_contracts.xtask/src/main.rs:modules::check(&root())?inboundaries()for bothxtask checkandxtask graph, keepingcrates.jsonandcrates.mmdcommitted and freshness-checked.cargo run --locked -p xtask -- module-graph DIRto writemodules.jsonandmodules.mmdon demand to any directory outside Git.docs/architecture/rust-agent/generated/modules.jsonanddocs/architecture/rust-agent/generated/modules.mmd(keepingcatalog.md,crates.*,services.*,instances.*, andnpm/branch-services.d.tsintact).AGENTS.mdanddocs/architecture/README.mdto documentmodule-graph DIRand live module-boundary checking.Design rule checklist
All plugin/runtime design rules are n/a: this change only affects
xtaskgraph output/check behavior and its documentation, with no runtime, Timeline, or plugin behavior changes.xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.beforecallbacks: n/a —xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.xtaskdevelopment tooling only.Documentation
Verification
cargo fmt --all -- --check --config error_on_line_overflow=true— passed.cargo clippy --locked -p xtask --all-targets -- -D warnings— passed.cargo test --locked -p xtask -- modules::— 4 passed (covering bothcheck()andgenerate()boundary assertions).cargo run --locked -p xtask -- check— passed (live module source boundaries, crate boundaries, plugin docs, service catalog, service declarations, plugin locks, comment links, literal main).cargo run --locked -p xtask -- module-graph /tmp/dim-test-module-graph— emittedmodules.jsonandmodules.mmdon demand.node scripts/adr-check.mjs --base origin/main&node --test scripts/ci-changes.test.mjs— passed.