fix(index): live progress during parallel parse and resolve phases#9
Conversation
The parallel-parse refactor broke the progress bar: the parse ran inside
one `par_iter().collect()` with no per-file callback, so the bar jumped
straight from 0 to N, and each resolve phase ("resolving references",
etc.) reported once and then sat on a static label for seconds, looking
hung.
- Parse: a scoped observer thread polls an atomic counter the rayon
workers bump and drives the progress callback (which stays off the
worker threads), so the bar climbs smoothly 0 -> N during the parse —
where the per-file wall-clock now is. `ProgressFn` gains a `Sync` bound
so the observer can share it; the binary's closure already qualifies.
- Resolve/write phases: `IndexProgress` gains `phase_progress: (done,
total)`. `resolve_supertypes`/`resolve_references` report per-file
progress (coarsely, ~every 1%), and a "writing graph" phase is shown
around the batched node write. The bar's bottom line now reads e.g.
"resolving references 1203/1559…" and advances.
Cosmetic only — indexed output (counts, edges, deterministic `related`)
is unchanged.
Review Summary by QodoRestore live progress bar during parallel parse and resolve phases
WalkthroughsDescription• Restore live progress feedback during parallel parse phase - Observer thread polls atomic counter bumped by rayon workers - Progress callback driven from main thread, stays off worker threads • Add per-phase progress tracking with phase_progress: (done, total) - Resolve phases report per-file progress at ~1% cadence - Writing graph and resolve phases now show advancing counters • Make ProgressFn Sync to enable shared observer thread access • Update progress UI to display phase sub-counts (e.g., "resolving references 412/1559…") Diagramflowchart LR
A["Parse Phase<br/>Rayon Workers"] -->|"bump atomic<br/>counter"| B["Atomic Counter"]
B -->|"poll every 80ms"| C["Observer Thread"]
C -->|"drive callback"| D["Progress Bar"]
E["Resolve Phases<br/>resolve_supertypes<br/>resolve_references"] -->|"report per-file<br/>progress ~1%"| F["phase_progress<br/>done/total"]
F -->|"update UI"| D
File Changes1. src/indexer/mod.rs
|
Code Review by Qodo
1. ProgressFn called from thread
|
Summary
The parallel-parse work in the perf PR (#8) regressed the indexing progress bar:
par_iter().collect()with no per-file callback, so the bar jumped straight from 0 to N.resolving references,resolving type relationships) reported once and then sat on a static label for seconds, looking hung.This restores live feedback.
Changes
ProgressFngains aSyncbound so it can be shared; the binary's closure already qualifies). The bar now climbs smoothly 0 → N during the parse, where the per-file wall-clock now lives.IndexProgressgainsphase_progress: Option<(done, total)>.resolve_supertypes/resolve_referencesreport per-file progress (coarsely, ~every 1% of files), and awriting graphphase is shown around the batched node write. The bar's bottom line now reads e.g.resolving references 1203/1559…and advances.Notes
relatedoutput on aeontis-backend before/after.Test plan
cargo fmt --check && cargo clippy --all-targets && cargo test— all green (91 tests).synapse index --forceon a large repo (aeontis-new-reactnative) shows the parse bar climbing, thenwriting graph, thenresolving … N/M…ticking — no more 0→full jump or frozen phase labels.