Skip to content

fix(github): keep a multi-table apply Running while tables are still queued - #1136

Merged
aparajon merged 2 commits into
mainfrom
armand/phase-state-queued-work
Aug 25, 2026
Merged

fix(github): keep a multi-table apply Running while tables are still queued#1136
aparajon merged 2 commits into
mainfrom
armand/phase-state-queued-work

Conversation

@aparajon

@aparajon aparajon commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Why

DeriveApplyState named a post-copy phase (catching up, checksumming, post-checksum) whenever one task reached it and no sibling was copying — including when the remaining siblings had not started at all. A sequential multi-table apply whose first table entered its checksum reported the whole apply as Checksumming on the CLI status list and the PR comment status line, overstating progress while most of its tables were still queued with their entire copy ahead of them.

What

Phase names now surface only once every table has started. One new rung in the projection ladder, between Running and the phase names:

  ... ──▶ running? ──no──▶ any post-copy phase task AND any pending task? ──yes──▶ Running
                                        │ no (every table started)
                                        ▼
                          catching_up? / checksumming? / post_checksum?   (unchanged)
task states before after
{checksumming, pending ×10} Checksumming Running
{completed, catching_up, pending} CatchingUp Running
{checksumming} Checksumming Checksumming
{completed, checksumming} Checksumming Checksumming
{running, checksumming, pending} Running Running
{pending, pending} Pending Pending

The rung is the named predicate postCopyPhaseWithQueuedWork. The data plane's overall-state projection (deriveOverallState), which remote-mode applies report over gRPC and the control plane persists, applies the same rung so both drive modes agree. Only the projected label changes: phase tasks already counted as running-family for activity and stuck detection, so no gate or safety semantics move.


This PR was generated by Claude Code (claude-fable-5).

…queued

DeriveApplyState named a post-copy phase (catching up, checksumming,
post-checksum) whenever one task reached it and no sibling was copying —
including when the remaining siblings had not started at all. A sequential
multi-table apply whose first table entered its checksum then reported the
whole apply as Checksumming, overstating progress on the CLI status list
and the PR comment while most of its tables were still queued.

Phase names now surface only once every table has started: while any task
is still pending alongside an active phase task, the apply stays Running.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 25, 2026 02:30

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 keeps multi-table apply status as Running while post-copy work coexists with queued tables.

Changes:

  • Adds the queued-work projection rung to DeriveApplyState.
  • Adds regression coverage for mixed table states.
  • The equivalent remote/gRPC projection still requires the same update.

Reviewed changes

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

File Summary
pkg/state/apply.go Adds the local queued-work projection, but the remote progress path can still report overstated post-copy phases.
pkg/state/apply_test.go Covers queued and mixed post-copy state combinations.
Suppressed comments (1)

pkg/state/apply.go:109

  • The projection contract is also described in docs/spirit_progress.md:181-190, which still says the phase is surfaced once every active table is draining/verifying and does not mention queued tables. After this change that documentation gives the wrong rationale for the {checksumming, pending} case; please update the canonical progress documentation alongside the code comment.
// The post-copy phases (13–15) surface the least-advanced active phase, and
// only once every table has started: while any table is still copying rows —
// or still queued with its whole copy ahead of it — the apply is Running.
// Once every table has at least begun and the active ones are draining or
// verifying, the apply names that phase.

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

Comment thread pkg/state/apply.go
…tion

The data plane's overall-state projection mirrors the apply-state ladder:
a post-copy phase surfaces only once every table has started, so a
remote apply with queued tables reports Running instead of naming one
task's phase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@aparajon
aparajon marked this pull request as ready for review August 25, 2026 16:01
@aparajon
aparajon merged commit 249727f into main Aug 25, 2026
34 checks passed
@aparajon
aparajon deleted the armand/phase-state-queued-work branch August 25, 2026 16:12
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