Skip to content

Warn instead of drawing a silent blank diagram (empty-graph cases) - #20

Merged
inth3shadows merged 1 commit into
masterfrom
claude-empty-graph-warning
Jul 19, 2026
Merged

Warn instead of drawing a silent blank diagram (empty-graph cases)#20
inth3shadows merged 1 commit into
masterfrom
claude-empty-graph-warning

Conversation

@inth3shadows

Copy link
Copy Markdown
Owner

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:

  1. --architecture with no cross-file edges — a small/single-file repo, or an unbuilt index, yields a graph with zero nodes → a completely blank image.
  2. A symbol with no callers and no callees — renders as a lone box, indistinguishable from a tool glitch.

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

  • --architecture on shot-mcp (a known edge-less index) now prints:
    codeshot: --architecture found no cross-file call edges — the diagram is blank. …
  • codeshot's own connected graph prints no empty warning (no false positive), and both --check drift guards still pass (the warnings are stderr-only and don't alter the DOT).

Changes

  • render/callgraph.jsemptyArchitectureWarning / emptyGraphWarning (pure), wired into runArchitectureMode and main.
  • 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.

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
@inth3shadows
inth3shadows merged commit 5e1f28b into master Jul 19, 2026
5 checks passed
@inth3shadows
inth3shadows deleted the claude-empty-graph-warning branch July 19, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant