Skip to content

interval: make refresh override reversible - #10

Merged
barlevalon merged 1 commit into
mainfrom
review-interval-lifecycle
Aug 22, 2026
Merged

interval: make refresh override reversible#10
barlevalon merged 1 commit into
mainfrom
review-interval-lifecycle

Conversation

@barlevalon

@barlevalon barlevalon commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Behavior

  • Temporarily lowers status-interval only while scrolling is enabled, automatic interval control is enabled, and rendered metadata exceeds the scrolling threshold.
  • Restores the captured interval and clears ownership state for short or empty output and when either controlling option is disabled.
  • Captures a fresh user-selected interval on each later acquisition instead of restoring stale state.
  • When status-interval changes externally during an active override, records that value as the new restoration target before reapplying the temporary interval.
  • Serializes concurrent status refresh transitions and ignores unpaired legacy ownership markers, preventing inconsistent or stale restoration.

Structural simplification

  • Consolidates interval acquisition and release in update_nowplaying_status_interval.
  • Removes the separate original-interval getter and empty-output restoration wrapper.
  • Initializes empty track state and invokes lifecycle handling exactly once per render.
  • Uses paired original/applied markers to distinguish current ownership from stale state.

Tests

  • Replaces the stateless tmux stub with a persistent file-backed mock supporting global reads, writes, unsets, and wait-for locking.
  • Covers acquisition, repeated acquisition, short and empty output, disabled controls, cleanup, inactive no-ops, later user interval recapture, changes made during active ownership, stale legacy state, and deterministic active/inactive interleaving.
  • Passes shell syntax checks, the full shell test suite, ShellCheck, and isolated real-tmux lifecycle checks.

Residual risks

  • A process killed without running its EXIT trap after acquiring the wait-for lock could leave that lock held.
  • External tmux commands do not participate in the plugin lock, though observed interval changes are preserved on the next lifecycle transition.

Integration

  • consolidated the shared stateful tmux mock while preserving absent-vs-empty option fallback and status interpolation coverage
  • added isolated real-tmux coverage for 15 -> 1 -> external 5 -> active refresh -> release 5, including marker cleanup

@barlevalon
barlevalon force-pushed the review-interval-lifecycle branch from 3310f2d to 1ce91a8 Compare August 22, 2026 15:00
@barlevalon
barlevalon force-pushed the review-interval-lifecycle branch from 1ce91a8 to a422c06 Compare August 22, 2026 15:56
@barlevalon
barlevalon merged commit 14f1bb8 into main Aug 22, 2026
2 checks passed
@barlevalon
barlevalon deleted the review-interval-lifecycle branch August 22, 2026 15:57
@barlevalon
barlevalon restored the review-interval-lifecycle branch August 22, 2026 15:59
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