Skip to content

Explicit step completion tracking and unified stage status#102

Merged
nicpottier merged 8 commits intomainfrom
nicpottier/sync-stage-animations
Feb 21, 2026
Merged

Explicit step completion tracking and unified stage status#102
nicpottier merged 8 commits intomainfrom
nicpottier/sync-stage-animations

Conversation

@nicpottier
Copy link
Contributor

Summary

Replace brittle inference of step completion from data existence with an explicit step_completions DB table. The DB is now the authoritative source for stage completion — the frontend SSE handler only tracks running/progress/error state, never "done".

Key changes:

  • Add step_completions table with schema v7 migration + backfill for existing books
  • Record completions in step-runner on every step-complete/step-skip event
  • Simplify step-status endpoint: read directly from DB, no inference logic
  • Use invalidateQueries (never removeQueries) to prevent completed stages flashing to "unrun" during refetch
  • Fix stage completion: require ALL steps done (not just last-listed) since steps run in parallel via DAG
  • Unify StageSidebar and BookView: both use pattern where DB completion overrides SSE running state
  • Make spinning icon completely inert (click no-op with event.stopPropagation)
  • Scope page preview hover to thumbnail image only, not full row
  • Update GUIDELINES.md with step completion, cache invalidation, and unified UI patterns

Test Plan

  • Verify extract stage doesn't flash to "unrun" when starting storyboard
  • Verify clicking spinner icon during run is a no-op (doesn't navigate)
  • Verify stage shows as complete only after ALL steps are done
  • Verify page preview only appears on image hover, not row hover

Replace brittle inference from node_data existence with an explicit
step_completions DB table. The DB is now the single source of truth
for stage completion — the frontend SSE handler only tracks
running/progress/error state, never "done".

- Add step_completions table (schema v7) with backfill migration
- Record completions in step-runner on step-complete/step-skip events
- Simplify step-status endpoint to read from step_completions
- Use invalidateQueries (not removeQueries) to prevent cache flash
- Require ALL steps done for stage completion (parallel DAG execution)
- Unify StageSidebar and BookView: DB completion overrides SSE state
- Make spinning icon a click no-op (stop propagation to parent Link)
- Scope page preview hover to thumbnail image only
- Update GUIDELINES.md with step completion and cache patterns
Replace dual-source status tracking (local SSE state + server query cache)
with a single unified hook. Backend step-status endpoint now merges
StageService run state with DB step_completions. SSE connection is always-on
and patches TanStack Query cache directly. All stage/settings views now use
useBookRun() instead of useStageRun() + useIsStageDone().

Deletes 5 old hook files (~575 lines), net -620 lines.
Remove references to deleted hooks (use-step-run, step-run-invalidation,
use-stage-completion). Document always-on SSE, cache-patching approach,
and unified step-status endpoint. Add ADR #22 for the single-source
stage/step status decision. Also remove unused Volume2 import and add
SSE reconnection refetch handler.
The step-status endpoint moved from book routes to stage routes
(requires StageService). Update tests to use createStageRoutes with
a mock StageService and assert the new response format (stages/steps
as string states instead of booleans).
Move gear (settings) and refresh (repackage) icons from the top bar
into each stage's sidebar row. Icons clip naturally with overflow-hidden
when the rail collapses, and fade in on hover for non-active stages.
@nicpottier nicpottier merged commit ecd41a6 into main Feb 21, 2026
1 check passed
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.

1 participant