Skip to content

fix(tui): graph metrics panel always showing zero (#1938)#1943

Merged
bug-ops merged 1 commit intomainfrom
1938-tui-graph-metrics-zero
Mar 17, 2026
Merged

fix(tui): graph metrics panel always showing zero (#1938)#1943
bug-ops merged 1 commit intomainfrom
1938-tui-graph-metrics-zero

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 17, 2026

Summary

  • App::with_metrics_rx() now eagerly reads the initial MetricsSnapshot via rx.borrow().clone() — fixes the startup case where has_changed() returns false for the initial watch channel value, causing poll_metrics() to skip it
  • spawn_graph_extraction() returns JoinHandle<()>; a follow-up fire-and-forget spawn awaits the handle, then re-reads counts from the DB and pushes them via metrics_tx — fixes stale-zero reads that occurred before the fire-and-forget extraction task finished
  • Adds regression test with_metrics_rx_reads_initial_value

Closes #1938

Test plan

  • cargo +nightly fmt --check — passes
  • cargo clippy --features full --workspace -- -D warnings — passes
  • cargo nextest run --workspace --features full --lib --bins — 6118 passed (+1 new regression test)
  • Manual: launch TUI with existing DB containing graph data and verify entity/edge/community counts are non-zero on the metrics panel

@github-actions github-actions bot added documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes core zeph-core crate bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 17, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 17, 2026 13:19
Two root causes fixed:

1. App::with_metrics_rx() now eagerly reads the initial MetricsSnapshot
   via rx.borrow().clone(). Previously has_changed() returned false for
   the initial watch channel value, causing poll_metrics() to skip it
   on the first poll.

2. spawn_graph_extraction() now returns JoinHandle<()>. A follow-up
   fire-and-forget spawn in persistence.rs awaits the handle, then
   re-reads entity/edge/community counts from the DB and pushes them
   via metrics_tx — replacing the stale-zero sync that ran before the
   extraction task completed.

Adds regression test: with_metrics_rx_reads_initial_value.
@bug-ops bug-ops force-pushed the 1938-tui-graph-metrics-zero branch from 73a93a9 to 48f00e7 Compare March 17, 2026 13:20
@bug-ops bug-ops merged commit 420cd30 into main Mar 17, 2026
20 checks passed
@bug-ops bug-ops deleted the 1938-tui-graph-metrics-zero branch March 17, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tui): graph metrics always show zero in TUI dashboard

1 participant