Skip to content

fix(cli): show checksum progress in the live watch view - #1151

Open
aparajon wants to merge 2 commits into
mainfrom
armand/watch-checksum-progress
Open

fix(cli): show checksum progress in the live watch view#1151
aparajon wants to merge 2 commits into
mainfrom
armand/watch-checksum-progress

Conversation

@aparajon

Copy link
Copy Markdown
Collaborator

Summary

Watching an apply during its checksum phase rendered a full progress bar and a numberless "Checksumming to verify data..." label, while schemabot status on the same apply showed the verify percent and a "Rows verified" line. The watch TUI parsed the progress response through its own private table struct, which dropped the checksum counters (plus the throttle fields and per-shard percent/cutover attempts) before they ever reached the shared renderer.

  • The watch TUI now consumes templates.ParseProgressResponse output directly; the duplicate parse structs are deleted, so every progress view (status, progress, and the watch TUI) renders from the same parsed data.
  • The logic that previously lived only in the watch TUI's private conversion moves into the shared parser, so the non-watch views gain it too: Spirit internal-table filtering, preferring Spirit's live progress string over the stored copy fields, deriving shard percent from rows, promoting the slowest shard's ETA to the table, and normalizing raw engine statuses.
  • The watch view additionally regains the fields its old conversion dropped: checksum progress, the throttled indicator, shard percents, and cutover attempts.
before:  API response ──► watch-only structs (fields dropped) ──► shared renderer
after:   API response ──► templates.ParseProgressResponse ──► shared renderer
                          (single parse path for status / progress / watch)
Watch view during checksum (rendered)
⣾ Checksumming to verify data...

     ~ sessions: 🟦⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 🔍 Checksumming to verify data (8%)
       ALTER TABLE `sessions` ADD INDEX `idx_app`(`app_id`, `app_identifier`);
       • Rows verified: 73,075,845 / 832,771,089

ESC detach • s stop • v volume

Previously this rendered a full bar with "Checksumming to verify data..." and no rows line.

🤖 Generated with Claude Code

The watch TUI parsed progress responses through its own private table
struct, which dropped the checksum counters (and throttle fields), so a
checksumming apply rendered a full bar with no verify percent or rows
line while the status view showed both.

Route the watch TUI through the shared ParseProgressResponse and delete
the duplicate structs, so every progress view renders from the same
parsed data. The watch-only value-adds move into the shared parser:
internal-table filtering, preferring Spirit's progress string over the
stored copy fields, deriving shard percent from rows, promoting the
slowest shard's ETA to the table, and normalizing raw engine statuses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 26, 2026 04:21
@aparajon
aparajon marked this pull request as ready for review August 26, 2026 04:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 unifies CLI/TUI progress rendering by routing the watch TUI through the shared templates.ParseProgressResponse parser, ensuring checksum/verify progress (and other previously-dropped fields) are consistently available across status, progress, and the live watch view.

Changes:

  • Watch TUI now consumes templates.ParseProgressResponse output directly, removing duplicate progress structs/conversion logic.
  • Shared progress parser now centralizes additional normalization/derivation (internal-table filtering, Spirit progress-string precedence, shard percent derivation, and slowest-shard ETA promotion).
  • Adds/updates tests to cover checksum progress visibility in watch, shard percent derivation, ETA promotion, internal-table filtering, and status normalization.

Reviewed changes

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

Show a summary per file
File Description
pkg/cmd/internal/templates/progress_parse.go Moves watch-only progress normalization into the shared parser and filters internal tables consistently.
pkg/cmd/internal/templates/progress_parse_test.go Adds coverage for ETA promotion, shard percent derivation, internal-table filtering, and Spirit progress-string precedence.
pkg/cmd/commands/watch_tui.go Replaces watch-private progress table types with shared template progress types.
pkg/cmd/commands/watch_tui_commands.go Simplifies watch progress parsing by delegating to templates.ParseProgressResponse.
pkg/cmd/commands/watch_tui_view.go Updates rendering helpers to operate on shared template progress types and removes conversion helpers.
pkg/cmd/commands/watch_tui_view_multi.go Updates multi-deployment view helpers to use shared template progress types.
pkg/cmd/commands/watch_tui_test.go Updates tests for shared types and adds coverage for checksum/verify progress in the watch view.
pkg/cmd/commands/watch_tui_vitess_test.go Adjusts tests to validate watch parsing from API response shapes (typed apitypes structs).
pkg/cmd/commands/common.go Updates change-count summarization helper to accept shared template progress types.
pkg/cmd/commands/common_test.go Updates tests to use shared template progress types.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/cmd/internal/templates/progress_parse.go
Row totals are estimates, so a nearly finished copy can report more rows
copied than the total; the percent derived from them must not exceed 100.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants