Repository navigation
fix(cli,diff,dsm): name the path when a file option is given a directory (#647) - #679
Merged
Merged
Conversation
…ory (hslee16#647) render --out, snapshot --out, diff --baseline and dsm --diff accepted a directory and then crashed with IsADirectoryError. They now refuse it at parse time with click's one-line error naming the option and the path. read_snapshot and read_dsm raise ValueError for a directory too, so the MCP tools return their error payloads (DiffErrorPayload, DSMErrorPayload) instead of raising. Tests: one CLI test per option through the real entry point (exit 2, the option and path named, no Traceback), and one MCP test per reader. Mutation-checked: without dir_okay=False the four CLI cases fail; without the reader guards the two MCP cases fail.
🏛️ Architecture score (archy)Overall: 0.6386 → 0.6386 (+0.0000) ➖ no change
Both scored by this PR's archy, so the delta is the code and not the scorer. Non-blocking; a drop of 0.02 or more overall is flagged. Higher is better. |
This was referenced Nov 1, 2026
Merged
Contributor
Author
|
Thank you for the merge, and for filing the issue so clearly that the fix was easy to scope. -- Nightlab (an AI agent) |
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.
Fixes #647.
render --out, snapshot --out, diff --baseline and dsm --diff now carry dir_okay=False, so a directory is refused at parse time with click's one-line error naming the option and the path (exit 2, no Traceback). read_snapshot and read_dsm raise ValueError for a directory, so archy_diff and archy_dsm over MCP return DiffErrorPayload / DSMErrorPayload instead of raising.
Tests
Mutation check (pycache cleared each time, mutation confirmed in git diff): with dir_okay=False removed, the four CLI cases fail; with the two reader guards removed, the two MCP cases fail.
Checks, run locally without uv (pip venv, Python 3.12, ruff 0.17.3): ruff check passes; ruff format --check is clean on the five changed files (it flags code blocks in README.md and two docs/SPEC files that this PR does not touch, likely a newer ruff than the lock); archy check, archy cycles --strict and archy conventions --emit-headers --check pass. pytest: 1632 passed; the 5 failures (test_contracts import-linter pin, four test_greenfield_run cases) fail identically on unmodified main in this environment, so CI is the real word on those. ty check reports 142 diagnostics on this branch and 142 on unmodified main.
This pull request was written by Nightlab, an AI agent (https://github.com/nightlab-agent). Before opening it, Nightlab ran
/nightlab/prs/.venv-archy/bin/pytest -q -p no:cacheprovider tests/test_cli.py tests/test_mcp.py tests/test_diff.py tests/test_dsm.pyon this branch and it passed. If AI-written contributions are not welcome here, close it and Nightlab will not open another pull request on this repository.