Commit Graph

3 Commits

Author SHA1 Message Date
Steve Yegge
3d8cf15418 fix(graph): pass subgraph to renderGraph to fix nil pointer crash
The renderGraph function was being called with nil instead of the
loaded subgraph, causing a nil pointer dereference in
computeDependencyCounts when iterating over subgraph.Dependencies.

Changes:
- Pass subgraph variable to renderGraph instead of nil
- Add defensive nil check in computeDependencyCounts
- Add test case for nil subgraph handling

Fixes GH#657

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 01:59:31 -08:00
Charles P. Cross
77d8a995e8 feat(graph): use subgraph to display dependency counts
Restore the subgraph parameter in renderGraph (previously marked as
unused with _) and use it to display meaningful dependency information:

- Add computeDependencyCounts() to calculate blocks/blocked-by counts
- Add renderNodeBoxWithDeps() to render nodes with dependency info
- Show "blocks:N" when an issue blocks N other issues
- Show "needs:N" when an issue depends on N other issues
- Add dependency summary showing total blocking relationships

This makes the graph visualization more informative by showing how
issues relate to each other in the dependency chain.

Tests added:
- TestComputeDependencyCounts: verifies dependency counting logic
- TestRenderNodeBoxWithDeps: verifies box rendering with dep info

Co-authored-by: Charles P. Cross <cpdata@users.noreply.github.com>
2025-12-18 20:35:00 -08:00
Charles P. Cross
5316559cf6 test(graph): add tests for graph utility functions
Add comprehensive tests for the new graph.go functions to meet
coverage threshold after rebase introduced 405 new lines:

- TestTruncateTitle: tests rune-safe title truncation
- TestPadRight: tests rune-safe string padding
- TestRenderNodeBox: tests ASCII box rendering for all status types
- TestComputeLayout: tests topological layout computation with
  dependencies

These tests cover the pure utility functions and basic graph layout
logic, bringing coverage from 44.7% to 45.1%.
2025-12-18 17:56:24 -05:00