Skip to content

Phase whygraph scan into three ordered phases with a results panel#33

Merged
cvetty merged 1 commit into
mainfrom
feature/scan-phased-output
Jul 9, 2026
Merged

Phase whygraph scan into three ordered phases with a results panel#33
cvetty merged 1 commit into
mainfrom
feature/scan-phased-output

Conversation

@cvetty

@cvetty cvetty commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What & why

whygraph scan already sequenced git/GitHub before the LLM analyzer, but every crawler's progress bar was registered at construction and all five were built before any thread started — so the run looked fully parallel even though it wasn't. This makes the real structure visible and sharpens it.

Changes

  • Three ordered phases: Phase 1 git + github (concurrent) → Phase 2 pr-origins → Phase 3 analyze (the slow, token-heavy LLM long pole, run last and alone). codegraph stays a best-effort background task started before Phase 1 and joined after Phase 3.
  • Per-phase bar reveal: each phase's crawlers are constructed when its phase starts, so bars appear per-phase instead of all at once — no change to the Crawler render path.
  • Presentation: icon'd, numbered console.rule headers (numbered against the count of phases that actually run), per-phase timing + a dim ✓ … (Ns) completion line, and a Progress column set with MofNCompleteColumn + TimeElapsedColumn so the LLM phase reports 12/45 · 0:00:31.
  • Closing results panel bookending the pre-scan preview: per-phase status glyph (///— skipped), summary, timing, and total elapsed — fed by a single additive Crawler.summary attribute set by each crawler's work().
  • --no-llm-descriptions help text updated (no hard-coded phase number).

Behavior-preserving

Sequencing analyze last does not change what gets described: its todo is bounded by repository.commits (the main walk), which never includes on_default_branch=0 origin rows — so recovered PR-origin commits stay on lazy backfill exactly as before. Pinned by a new test.

Testing

  • New tests/test_cli_scan_phases.py: phase-ordering (LLM strictly last), numbered-header counts (1/3, 1/2, 1/1), skip cases, and a defensive/total results-panel unit test.
  • Extended test_git_crawler.py / test_scan_analyze_crawler.py: Crawler.summary strings + the origin-commits-stay-lazy behavior pin.
  • 527 passed; ruff check and ruff format --check clean.
  • Manually smoke-tested the rendered output (headers, per-phase bars, results panel) in a throwaway repo.

Notes

  • Bars now share the stderr console (consistent with the pre-scan panel); non-TTY paths (hooks/CI/Docker) auto-degrade rich to plain lines, so automation is unaffected.
  • Icon set (🔎/🔗/🧠/🕸) lives in one dict for easy swapping.

`whygraph scan` already sequenced git/GitHub before the LLM analyzer, but
every crawler's progress bar was registered at construction and all five
were built before any thread started, so the run *looked* fully parallel.

Make the structure real and visible:

- Three ordered phases — Phase 1 git + GitHub (concurrent), Phase 2
  pr-origins, Phase 3 analyze (the slow LLM long pole, last and alone) —
  with CodeGraph a best-effort background task spanning the whole scan.
- Construct each phase's crawlers when its phase starts, so bars appear
  per-phase instead of all at once (no Crawler render-path change).
- Icon'd, numbered `console.rule` headers (numbered against the count of
  phases that actually run), per-phase timing + a dim completion line, and
  a Progress column set with M-of-N + elapsed for the LLM phase.
- New closing results panel bookending the pre-scan preview: per-phase
  status glyph, summary, timing, and total elapsed. Fed by a single
  additive `Crawler.summary` attribute set by each crawler's `work()`.

Sequencing analyze last is behavior-preserving: it only ever describes
main-walk commits (todo is bounded by `repository.commits`), so recovered
on_default_branch=0 origin commits stay on lazy backfill exactly as before.

Tests: new phase-ordering / header / skip cases, a defensive results-panel
unit test, per-crawler summary strings, and an origin-commits-stay-lazy
behavior pin. 527 passed; ruff check + format clean.
@cvetty cvetty merged commit 9db2751 into main Jul 9, 2026
2 checks passed
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