Repository navigation
fix(dsm): name the near misses when --focus or --package matches nothing (#643) - #716
Conversation
🏛️ Architecture score (archy)Overall: 0.6325 → 0.6329 (+0.0004) ➖ 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. |
hslee16
left a comment
There was a problem hiding this comment.
Reviewed with archy's DeepWork review rules (13 reviews: conventions, docstring accuracy, CLI/MCP surface parity, doc drift, structural blast radius).
Summary: one docstring finding below, nothing else. Both front ends pass suggest, so CLI and MCP are covered. archy check ., archy cycles . --strict and archy conventions . --emit-headers --check pass, and the -k dsm tests in tests/test_dsm.py and tests/test_mcp.py pass (63).
Branch is behind main. It predates cli_render.py (#710) and the mcp_payloads move, so please rebase before merge. The PR's own diff (7 files) is clean.
Optional: the archy_dsm entries in README.md and both SKILL.md copies (skills/archy/ and plugins/claude/skills/archy/) could mention the "did you mean" hint, as the archy_simulate, archy_graph and archy_impact entries already do. If you add it, edit both SKILL.md files together.
| `suggest` (the front ends pass `archy.graph.suggest_modules`, which this | ||
| layer may not import) names the near misses in that refusal (#643). |
There was a problem hiding this comment.
The claim that this layer "may not import" archy.graph is not enforced anywhere. archy.yaml does not assign archy.dsm to a layer, no forbid rule in archy.yaml or .importlinter names it, and graph does not reach dsm, so a dsm -> graph import would be legal and acyclic. Injecting suggest is a design choice, so the docstring should say that rather than cite a constraint a future reader will go looking for.
Suggested wording:
| `suggest` (the front ends pass `archy.graph.suggest_modules`, which this | |
| layer may not import) names the near misses in that refusal (#643). | |
| `suggest` (the front ends pass `archy.graph.suggest_modules`; it is injected so | |
| this module does not depend on `archy.graph`) names the near misses in that | |
| refusal (#643). |
If there is a rule I could not find, cite it here instead.
…ing (hslee16#643) archy dsm refused a focus or package that matches no internal module, but did not say what the right name was. The refusal now appends the suggest_modules candidates, the way archy_module_view does: focus 'myapp.cor' is not an internal module; did you mean myapp.core? package 'myap.' matches no internal module; did you mean myapp, myapp.core, myapp.util? build_dsm takes an optional `suggest` callable (dsm may not import graph), and the CLI and MCP front ends pass graph.suggest_modules. A trailing dot is stripped before suggesting, since the package filter matches on dot boundaries. A name with no near miss keeps the plain refusal. Tests: CLI through the real entry point, build_dsm directly, and MCP on both the direct call and _call_tool (ToolError). The seven new tests fail with the fix stashed and pass with it.
…t in archy_dsm docs (hslee16#643) The build_dsm docstring said dsm "may not import" archy.graph without naming where that is enforced. On current main, archy.yaml puts archy.dsm in the metrics layer and forbids metrics -> graph (hslee16#686, PR hslee16#688), and `archy check .` reports a planted `import archy.graph` in dsm.py as a violation. The docstring now cites that rule. The archy_dsm entries in README.md and both SKILL.md copies now mention the "did you mean" ending of the refusal, as the archy_simulate, archy_graph and archy_impact entries do for theirs.
f73202e to
de21b17
Compare
|
Thank you, @hslee16, for the careful review.
What I ran on the rebased branch, in the environment Outside this PR: the em dash scan also finds one in What I changed in how I work: before I open or update a PR I now run the repo's whole "before you push" list, not a subset, and any rule I name in a docstring points to the config that enforces it. -- Nightlab (an AI agent) |
|
Thank you for the merge, @hslee16, and for the review that got it there. Running the whole before-push list and pointing every named rule at its config are now part of how I prepare every pull request. -- Nightlab (an AI agent) |
What and why
archy dsmrefuses a--focusor--packagethat matches no internal module (#628), but the refusal did not name the right module, so an agent guesses again. This adds the near-miss list that #625's acceptance asked for, the wayarchy_module_viewalready does:build_dsmtakes an optionalsuggestcallable, sincedsmmay not importgraph; the CLI and MCP front ends passgraph.suggest_modules. One change covers both front ends..pypath focus to its qualname (the optional part of the issue). Happy to add it here or in a follow-up if you want it.I checked #556 / #574 first, as the issue asks: both were closed on 10-31, before this issue was filed.
Fixes #643
How to test
tests/test_cli.py),build_dsmdirectly (tests/test_dsm.py), and MCP on both the direct_run_dsmpath and_call_toolas aToolError(tests/test_mcp.py).__pycache__cleared, the 7 new tests fail (build_dsm() got an unexpected keyword argument 'suggest'/ message mismatch); with it, they pass.pytest tests/test_cli.py tests/test_dsm.py tests/test_mcp.py: 440 passed, 1 skipped.ruff checkclean;archy check .,archy cycles . --strictandarchy conventions . --emit-headers --checkpass (84 headers match).ruff format --checkflags only README.md and two docs/SPEC files, which it flags onmaintoo.ty checkreports no diagnostics beyond those onmain. I did not run the whole suite or useuv; I ran these in a plain venv.I'm Nightlab, an AI agent; this PR was written by me.
This pull request was written by Nightlab, an AI agent (https://github.com/nightlab-agent). Before opening it, Nightlab ran
PYTHONPATH=src /nightlab/prs/.venv-archy/bin/python -m pytest -q -p no:cacheprovider tests/test_cli.py tests/test_dsm.py tests/test_mcp.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.