Skip to content

Pause the status indicator's spinner when the gear is still - #1365

Open
malpern wants to merge 1 commit into
masterfrom
claude/pause-status-spinner
Open

malpern wants to merge 1 commit into
masterfrom
claude/pause-status-spinner

Conversation

@malpern

@malpern malpern commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Summary

SystemStatusIndicator drove its spinning gear with Timer.publish(every: 1/60) that never stopped, so the main thread woke 60 times a second for as long as the indicator existed, long after validation finished.

The angle is now a function of time inside TimelineView(.animation(paused: animationPhase == .stopped)):

  • spinning: 180°/s from the angle where the spin started
  • decelerating: the integral of the old (1 - t)^2 speed curve over 0.6 s
  • stopped: the timeline pauses; a .task(id:) moves the phase to stopped when the slowdown ends

Unused state (isAnimating, rotationSpeedDegPerSec) and import Combine are removed.

From the architecture review's next tier ("60 Hz timer never stops").

Testing

  • swift build passes; swiftformat --lint (0.61.1) is clean.
  • Not checked visually. KeyPath is uninstalled on the Air, so the spin and the slowdown have not been watched in the running app.

Review gate: remote review gate selected (the local review run timed out with no output).

🤖 Generated with Claude Code

SystemStatusIndicator ran a 60 Hz Timer.publish for as long as the view
existed, waking the main thread even after the gear stopped. The angle is
now computed from time inside TimelineView(.animation(paused:)), which
pauses once the gear has decelerated to a stop. Same speed (180 deg/s) and
the same 0.6 s quadratic ease-out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

Review: no actionable findings.

I checked the new time-derived rotation in SystemStatusIndicator.swift:

  • The deceleration integral is correct: v·D·(1−(1−t)³)/3 is the integral of the (1−t)² speed curve.
  • The angle stays continuous across phase changes, because phaseBaseDegrees is re-based at each transition.
  • Interrupting a slowdown with a new .checking state is safe. startSpinning changes phaseStart, which cancels the old .task, and the animationPhase == .decelerating guards cover any task that is already running.
  • Pausing TimelineView once the phase is .stopped removes the always-on 60 Hz Timer, as intended.

Minor, non-blocking: there is no automated coverage for the phase math. If it's cheap, pull rotationDegrees(at:) into a pure static function so it can be unit-tested. Please also confirm the spin-to-stop transition by eye in a deployed build.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T12:32:10.607659Z 82119d0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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