Skip to content

fix(claude): statusline distinguishes an empty graph from a missing one (#185) - #194

Merged
shhdwi merged 1 commit into
trailhq:mainfrom
Frankie-Xu:fix/185-empty-graph-statusline
Aug 27, 2026
Merged

fix(claude): statusline distinguishes an empty graph from a missing one (#185)#194
shhdwi merged 1 commit into
trailhq:mainfrom
Frankie-Xu:fix/185-empty-graph-statusline

Conversation

@Frankie-Xu

Copy link
Copy Markdown
Contributor

Summary

  • Statusline "not built" is now "no graph artifact", not "zero nodes".
  • A successful graft build that produces an empty wiring.json (docs-only repos, skipped languages) renders as ◤ graft · 0 nodes / 0 edges · ✓ synced.
  • Repos with no wiring.json still render ◤ graft · not built · run graft build.
  • Non-empty graphs are unchanged.

Cause

As analyzed in #185: renderStatusline() treated nodeCount === 0 as never-built, and resolveStats() could not tell a legitimate empty graph from a missing one — both look like zero. graft build already succeeds (✓ wiring: 0 nodes ...); only the bar was lying.

Built is now artifact presence (wiring.json via readWiring()). renderStatusline only shows "not built" when stats are null. A 0-node cache without wiring is still missing, not empty-and-built.

Test plan

  • node --import tsx --test test/claude-format.test.ts test/claude-statusline.test.ts test/claude-stats.test.ts (31/31)
  • npm run build && npm test (882/882)
  • Manual docs-only repo (README.md only, git init + commit, graft build):
# graft build
✓ wiring: 0 nodes (), 0 edges, 0 cards []

# statusline after that successful empty build
◤ graft · 0 nodes / 0 edges · ✓ synced

# control: same layout, never built (no wiring.json)
◤ graft · not built · run graft build

# control: this repo (non-empty graph, same bar style as before)
◤ graft · 1524 nodes / 4547 edges · ✓ synced

Closes #185

Made with Cursor

…ne (trailhq#185)

Co-authored-by: Cursor <cursoragent@cursor.com>
github-actions Bot added a commit that referenced this pull request Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🌱 graft blast radius

Nothing outside this diff depends on it. 1 area changed; no indexed dependents at depth 2.
Tests: 1 area updated its tests.

Test signal per changed area — 1 ✓

Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.

  • Status Display — 2 of 2 reached · 2 test files changed here: test/claude-format.test.ts, test/claude-statusline.test.ts

graft blast · origin/main...HEAD · depth 2 · 4 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Aug 25, 2026
@shhdwi

shhdwi commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Verified locally on top of current main (clean merge; build clean).

Before/after (statusline line, ANSI-stripped):

Fix is format.ts (nodeCount === 0 no longer forced into "not built") + resolveStats() returning null only when the artifact is genuinely absent. 3 new tests for the empty-graph case; claude-* 105/105. Fixes #185. Merging.

@shhdwi
shhdwi merged commit d29b5e5 into trailhq:main Aug 27, 2026
5 of 7 checks passed
github-actions Bot added a commit that referenced this pull request Aug 27, 2026
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.

Statusline reports "not built" for a successfully-built but empty graph

2 participants