R1: mechanical cleanup — dead surface out, one copy of each policy#45
Merged
Conversation
From the post-review refactor plan (plan.md, R1). Zero behavior change, proven by the untouched e2e suite (37/37). - Drop the vestigial isRetry/_isRetry plumbing (no caller ever passed it; resetAttemptCounters is now unconditional) and the unused _getRetryCount. - Collapse resumeRadio/resumePlayer into one function and drop the defensive non-promise/sync-throw branches that contradicted the RadioDeps.playerPlay(): Promise<void> contract (with their two tests — they pinned behavior no browser produces). - Export isAbortError() from the machine and reuse it in the guard, handleResumeError, and both soundEffects catch sites (4 copies -> 1). - Extract the duplicated transition ladders in the machine: streamFailure() (the canRetry->retrying / else->error policy, was spelled 5 times) and tryRecover (error's after/RETRY_FROM_ERROR arrays were char-identical). - mediaSession: one feature-detected clearPositionState() replaces the 5 inline setPositionState try/catch blocks (3 of which bypassed the existing feature detection). - stationSelector: shared scrollOptionIntoView() for the two hand-copied scrollIntoView option objects. - plan.md: add the post-review refactor plan (R1-R6). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
CI Summary
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First phase of the post-review refactor plan (see the new section in
plan.md). Zero behavior change, proven by the untouched e2e suite: 37/37 green, plus clean typecheck, 61/61 unit, identical build structure (bundle slightly smaller: 58.9 KB vs ~60 KB).What's removed (all verified dead)
isRetry/_isRetryplumbing — no caller ever passed it;resetAttemptCountersis now unconditional. The vestigial param invited a future caller to silently skip counter resets, resurrecting the pre-XState retry design._getRetryCount— zero usages.resumeRadio/resumePlayeralias pair → one function.RadioDeps.playerPlay(): Promise<void>contract and existed only for two tests pinning behavior no browser produces (tests deleted with them).What's deduplicated
isAbortError()exported from the machine, reused in the guard,handleResumeError, and bothsoundEffectscatch sites (4 hand-typed copies → 1).streamFailure(...extra)— the canRetry→retrying / else→error ladder was spelled 5 times in the machine (loading onError, loading timeout, playing STALLED, playing PLAYER_ERROR, paused PLAYER_ERROR).tryRecover— error'safter.RECOVERY_DELAYandon.RETRY_FROM_ERRORarrays were character-identical.clearPositionState()in mediaSession — one feature-detected helper replaces 5 inlinesetPositionStatetry/catch blocks (3 of which bypassed the existing feature detection).scrollOptionIntoView()in the station selector — the two hand-copied scrollIntoView option objects.Also includes the full post-review refactor plan (R1–R6) appended to
plan.md.Net code diff (excluding plan.md): ~63 added / ~125 removed.
🤖 Generated with Claude Code