fix(cli): mds build/check exit 1 on a directory whose only .mds files are _-prefixed partials (#387) - #392
Merged
Conversation
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.
Summary
BREAKING (CLI):
mds build <dir>andmds check <dir>now exit 1 when every.mdsfile in the tree is a_-prefixed partial. The walker collects partials (they are inputs forwatch,fmtandlint) butbuild/checknever compile them, so a partials-only tree used to end0 built, 0 failedwith exit 0 — the same silent green pass #204 closed for the empty tree. It now prints<n> .mds file(s) found in <dir> but all are _-prefixed partials; nothing was built(… nothing was checked) on stderr, even under--quiet, and exits 1.One predicate, two callers:
output::partials_only(&[PathBuf]) -> Option<usize>(Nonefor an empty list — the empty-tree arm owns that — or when any non-partial exists;Some(n)otherwise), consumed by a third nothing-to-do arm inrun_build_directoryandrun_check_directory, placed after the empty-tree arm and before the loop, in the same shape as the all-excluded arm.fmt / lint / watch unchanged.
mds fmt <dir>andmds lint <dir>format and lint partials, so a partials-only library is real work for them (pinned by two new tests).mds watch <dir>has no nothing-to-do arm and still starts. A partials library that is only ever imported from elsewhere should not be passed tobuild/checkon its own.Commits
test(cli): RED— predicate scaffold (unconditionalNone, with a temporary#[allow(dead_code)]becausemds-cliis a bin-only crate and the scaffold has no non-test caller yet) + unit testpartials_only_answers+ five integration tests intests/dir_build.rs: build partials-only → exit 1; build--quietstill emits the diagnostic; check partials-only → exit 1; fmt and lint pinned unchanged. RED evidence:6 tests run: 2 passed, 4 failed(the four behaviour tests failing onSome(0)vs expectedSome(1)/NonevsSome(1)).fix(cli)— predicate body, the two arms, thebuild.rsdoc block enumerating the three diagnostics; the#[allow]comes off. The interpolated count is namedpartials_only_countand registered intests/print_discipline.rsALLOWED_UNSANITIZEDfor both call sites (integer counter, same convention as the sibling arms); the path goes throughsafe_path.docs— CHANGELOG BREAKING bullet as the sibling of build: empty directory build exits 0 — silent success hazard in CI #204, spec §7.2 (new bullet) / §7.3 (three nothing-to-process exits) / §7.9 (exit-1 row), README.Gates (local, on
344f037)cargo fmt --all -- --checkclean;cargo clippy --workspace --all-targets -- -D warningsclean;cargo clippy -p mds-cli --all-targets --features startup-race-probe -- -D warningscleancargo nextest run -p mds-core -p mds-cli: 2361 passed (mds-core 1465, mds-cli 896; +6 vs main)cargo test --doc -p mds-core: 53 passed;cargo +1.88 check -p mds-core -p mds-clicleannpm run test:gates: 212 pass / 0 fail;node scripts/verify-no-control-bytes.mjs✓ (563 files)build src/→ exit 1 with the diagnostic;build --quiet src/→ exit 1, same stderr;check src/→ exit 1,nothing was checked;fmt src/→ exit 0,0 formatted, 1 unchanged, 0 failed; withreal.mdsadded,build src/ --out-dir out/→ exit 0,out/real.mdpresent,out/_only.mdabsentSnyk code scan unavailable (MCP ENOENT); the
security/snykCI check is SCA-only.Not a release-surface PR. The mds-cli feature knowledge base refresh is deferred to the D2 docs bundle.
Related Issues
Closes #387