Skip to content

UX pass: timing, honest summaries, dashboard-style inspect, richer banner - #8

Merged
DENNIS-CODES merged 1 commit into
mainfrom
claude/mpesa-cli-milestones-8enz0d
Jul 28, 2026
Merged

UX pass: timing, honest summaries, dashboard-style inspect, richer banner#8
DENNIS-CODES merged 1 commit into
mainfrom
claude/mpesa-cli-milestones-8enz0d

Conversation

@DENNIS-CODES

Copy link
Copy Markdown
Owner

Summary

Scoped implementation of the terminal-polish feedback from the "before we release" review. This covers the achievable-now bucket of that feedback within the existing scrolling-output model. It deliberately does not build a live-redrawing TUI (ratatui), a web dashboard + auto-open browser, doctor --fix, an interactive arrow-key replay picker, or config profiles (profile create/use) — those are separate features and architectural decisions, not polish, and are worth their own scoping conversation rather than a rushed bolt-on here.

Also deliberately did not fabricate a "Health Score: 98/100" or per-callback "Latency" — there's no real formula behind a health score, and no legitimate timestamp to compute latency from (we never see when the STK push was initiated, only when the callback arrives).

doctor

  • Every check now times itself and prints its duration, e.g. ✓ OAuth round trip (612ms)
  • A conversational line ("Authenticating with Daraja...") precedes each check as it runs, instead of a batch of results dumped at the end
  • Sandbox/callback reachability wording no longer reads as ambiguous when the response is a non-2xx status (e.g. 404) — the detail text now says explicitly that any response confirms the network path, not that the route serves anything
  • Summary block shows real numbers (pass count, environment, total time) instead of a bare "N/M checks passed"

inspect

  • Startup is now a small dashboard block (heavy rule, URL, waiting state) instead of a couple of loose lines
  • Each callback prints as a labeled "Incoming STK Callback" card (status, amount, receipt, masked phone 254712••••78) ahead of the raw JSON, which is now dimmed underneath for anyone who wants the full payload
  • A running tally (Totals so far: N payments · N callbacks · N errors) prints after every event via shared Arc<Mutex<Stats>> state, so the terminal has a sense of history instead of being a flat scrolling log

Banner

  • The "M" mark stays; the dotted frame now also shows which environment you're pointed at (Environment: sandbox), highlighted in yellow when it's production since that's real money

Test plan

  • cargo build --all-targets, cargo clippy --all-targets -- -D warnings, cargo fmt --all -- --check, cargo test all pass
  • Verified locally: full doctor run against real (and deliberately broken) sandbox credentials — timing, progress lines, and summary all render correctly, including correct singular/plural grammar in the failure count
  • Verified inspect against success/failure/malformed payloads: card layout, phone masking, and counters all increment correctly (including singular "1 payment" vs plural "2 payments")
  • Confirmed replay --corrupt's diff highlighting still works on top of the new card layout
  • Confirmed banner renders correctly for both sandbox and production environments

https://claude.ai/code/session_01BE4uE4wMaDgqN43zXvbqHH


Generated by Claude Code

…nner

Scoped implementation of the terminal-polish feedback: real, achievable
improvements to the existing scrolling-output model. Explicitly did not
build a live-redrawing TUI, a web dashboard, doctor --fix, an interactive
replay picker, or config profiles — those are separate features/decisions,
not polish, and are called out as deferred rather than attempted here.

doctor:
- Every check now times itself and prints its duration
- A conversational line ("Authenticating with Daraja...") precedes each
  check as it runs, instead of a batch of results dumped at the end
- Sandbox/callback reachability wording no longer reads as ambiguous when
  the response is a non-2xx status (e.g. 404) — the detail text now says
  explicitly that any response confirms the network path, not that the
  route serves anything
- Summary block shows real numbers (pass count, environment, total time)
  instead of a bare "N/M checks passed" — deliberately not a fabricated
  "health score", since there's no real formula behind one

inspect:
- Startup is now a small dashboard block (heavy rule, URL, waiting state)
- Each callback prints as a labeled "Incoming STK Callback" card (status,
  amount, receipt, masked phone) ahead of the raw JSON, which is now
  dimmed underneath for anyone who wants the full payload
- A running tally (payments/callbacks/errors) prints after every event via
  shared Arc<Mutex<Stats>> state, so the terminal has a sense of history
  instead of being a flat scrolling log
- No fabricated "latency" on the card — there's no legitimate timestamp
  to measure it from (we don't see when the STK push was initiated)

banner:
- The "M" mark stays; the dotted frame now also shows which environment
  you're pointed at, highlighted in yellow when it's "production" since
  that's real money

Verified locally: full doctor run against real (and deliberately broken)
sandbox credentials, inspect receiving success/failure/malformed payloads
with counters incrementing correctly and singular/plural grammar fixed,
and replay --corrupt's diff view still working on top of the new card
layout. build/clippy -D warnings/fmt --check/test all pass.
Copilot AI review requested due to automatic review settings July 28, 2026 17:56
@DENNIS-CODES
DENNIS-CODES merged commit dee7bcf into main Jul 28, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements terminal UX polish across doctor, inspect, and the startup banner: timing/progress output for checks, a more “dashboard-like” callback inspector with per-event cards and running totals, and an environment indicator in the banner (with a production highlight). It also updates RUNNING.md to reflect the new output and behaviors.

Changes:

  • Add per-check timings, live “doing this now” progress lines, clearer reachability wording, and a real summary block to doctor.
  • Rework inspect startup + callback rendering into a dashboard/card layout, and introduce running stats printed after each event.
  • Extend the startup banner to display the active environment (highlighting production), and update documentation examples accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main.rs Passes the configured environment into the banner printer.
src/commands/inspect.rs Adds inspector dashboard output, callback cards, and shared running totals state.
src/commands/doctor.rs Adds timing/progress output for checks and a richer end-of-run summary.
src/banner.rs Prints an environment line and highlights production.
RUNNING.md Updates docs and examples to match the new terminal output.
Comments suppressed due to low confidence (1)

src/commands/inspect.rs:133

  • With callbacks counted per request, the stats update inside the recognized STK branch should not re-increment callbacks, and failures should contribute to errors (the PR description/test plan says counters increment for success/failure/malformed payloads). As written, Outcome::Failure callbacks don't increment errors.
            {
                let mut s = stats.lock().unwrap();
                s.callbacks += 1;
                if outcome == Outcome::Success {
                    s.payments += 1;
                }
            }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands/inspect.rs
Comment on lines 109 to 110
println!("{}", rule.dimmed());
println!("{} [{now}] callback from {addr}", icon::arrow());

DENNIS-CODES added a commit that referenced this pull request Aug 11, 2026
…enz0d

UX pass: timing, honest summaries, dashboard-style inspect, richer banner
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.

3 participants