Warn instead of drawing a silent blank diagram (empty-graph cases) - #20
Merged
Conversation
Two cases produced a blank or lone-box image with exit 0 and no explanation — the last gap in codeshot's warn-on-stderr pattern: - --architecture on a repo with no resolved cross-file calls (a small/single- file repo, or an unbuilt index) emitted a graph with zero nodes: a blank image. - A symbol with no callers AND no callees rendered as a lone box, indistinguish- able from a tool glitch. Both now warn on stderr with the likely cause, still writing the image and exiting 0 like every other codeshot warning. Verified live: --architecture on shot-mcp (a known edge-less index) now prints the warning; codeshot's own connected graph does not (no false positive). - render/callgraph.js: emptyArchitectureWarning, emptyGraphWarning (pure), wired into runArchitectureMode and main - test/run.js: unit tests for both, incl. undefined-array tolerance - USAGE.md: troubleshooting entries for the two new stderr messages
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.
What
Closes the last gap in codeshot's "warn on stderr, don't hand back a silent misleading picture" pattern. Two cases drew a blank or lone-box image with exit 0 and no explanation:
--architecturewith no cross-file edges — a small/single-file repo, or an unbuilt index, yields a graph with zero nodes → a completely blank image.Both now warn on stderr with the likely cause, while still writing the image and exiting 0 (consistent with every other codeshot warning —
indexHealthWarning,truncationWarning,duplicateNameWarning,symbolBudgetWarning).Verified live
--architectureonshot-mcp(a known edge-less index) now prints:codeshot: --architecture found no cross-file call edges — the diagram is blank. …--checkdrift guards still pass (the warnings are stderr-only and don't alter the DOT).Changes
render/callgraph.js—emptyArchitectureWarning/emptyGraphWarning(pure), wired intorunArchitectureModeandmain.test/run.js— unit tests for both, including undefined-array tolerance. 85 pass (was 83).USAGE.md— troubleshooting entries for the two new stderr messages.