docs: web comments say what the app does, not how it came to be (#6277)

Rewrites the web app's comments to rule 32. Task, milestone, rule and
spec ids are gone; regression stories are restated as the trap they
guard (public auth routes, the menu's stopPropagation, universal loads
under adapter-static, metric deltas with their margin). Flutter and
Tauri mentions now name the Android app or a native shell, operator
quotes and dates are dropped, and one library's counts no longer
appear outside test fixtures. Verified with a TypeScript-scanner token
comparison (template literals and regex literals re-scanned): only
comment text changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 12:42:12 -04:00
co-authored by Claude Opus 5.5
parent 6028d78844
commit 10d50dccbd
164 changed files with 602 additions and 624 deletions
+22 -23
View File
@@ -70,26 +70,26 @@ let _queueDrawerOpen = $state(false);
// saved position after metadata loads.
let _pendingRestorePosition: number | null = null;
// M4c: track when the queue was seeded by a radio call so we can
// Track when the queue was seeded by a radio call so we can
// auto-refresh at 80% consumption. Cleared when the user enqueues
// from a non-radio source.
let _radioSeedId = $state<string | null>(null);
let _radioRefreshInFlight = false;
// #415: which system playlist (if any) this queue was seeded from.
// Which system playlist (if any) this queue was seeded from.
// 'for_you' | 'discover' | null. Read by the events dispatcher so
// play_started carries `source` and the play counts against that
// playlist's rotation. Re-set on every playQueue (a fresh non-system
// queue clears it).
let _queueSource = $state<string | null>(null);
// Track B (#968): consecutive load failures since the last successful
// Consecutive load failures since the last successful
// 'playing'. A bad track auto-advances instead of dead-ending; the streak
// (capped against queue length) stops a fully-unplayable queue from
// looping forever. Reset on a successful play and on a fresh playQueue.
let _failureStreak = 0;
// Track B (#968): when a queue is seeded from a refreshable source (a system
// When a queue is seeded from a refreshable source (a system
// playlist or radio), the seeder hands us a closure that re-pulls the fresh
// snapshot. On total failure (whole queue unplayable — likely a stale tab
// left open across the daily rebuild) we call it once to self-heal before
@@ -123,7 +123,7 @@ export function registerAudioEl(el: HTMLAudioElement | null): void {
_audioEl = el;
}
// #5418: a missing file can't stream, so it never enters the queue. Returns
// A missing file can't stream, so it never enters the queue. Returns
// the same array when nothing is missing.
function playable(tracks: TrackRef[]): TrackRef[] {
return tracks.some((t) => t.unavailable) ? tracks.filter((t) => !t.unavailable) : tracks;
@@ -138,12 +138,12 @@ export function playQueue(
refetch?: () => Promise<TrackRef[]>;
} = {},
): void {
_radioSeedId = null; // M4c: non-radio enqueue clears the radio refresh state
// #415: a fresh queue resets the system-playlist source. Set only
_radioSeedId = null; // Non-radio enqueue clears the radio refresh state
// A fresh queue resets the system-playlist source. Set only
// when seeded from a system playlist (server already returned the
// rotation-aware order, so no client shuffle in that path).
_queueSource = opts.source ?? null;
// #968: a fresh play replaces the self-heal closure + resets its budget.
// A fresh play replaces the self-heal closure + resets its budget.
_queueRefetch = opts.refetch ?? null;
_selfHealAttempts = 0;
// Start on the chosen track's place in the playable list; if the chosen
@@ -184,8 +184,8 @@ export function playQueue(
export function togglePlay(): void {
if (_queue.length === 0) return;
// "Intent to play" (loading + playing) → paused. Anything else → loading (user
// wants to play; audio will catch up).
// "Intent to play" (loading + playing) → paused. Anything else → loading
// (user wants to play; audio will catch up).
if (_state === 'playing' || _state === 'loading') {
_state = 'paused';
} else {
@@ -340,7 +340,7 @@ export function reportStateFromAudio(
}
}
// Track B (#968): a single failed track must not strand the player on the
// A single failed track must not strand the player on the
// "Try again" dead-end. Advance past it; only surface the error once the
// whole queue has proven unplayable — every track failed, or we reached the
// end with nothing playable. The streak cap (vs queue length) stops a
@@ -362,7 +362,7 @@ function handleLoadFailure(detail?: string): void {
_error = detail ?? 'Playback failed.';
}
// #968: re-pull a stale refreshable queue. Returns true if a self-heal was
// Re-pull a stale refreshable queue. Returns true if a self-heal was
// started (caller must not dead-end). Bounded to one attempt per exhaustion
// (reset on the next successful play) so a still-broken refresh can't loop.
function trySelfHeal(): boolean {
@@ -411,12 +411,12 @@ export function enqueueTrack(t: TrackRef): void {
}
/**
* M7 #372: insert a track immediately after the currently-playing one
* Insert a track immediately after the currently-playing one
* so it plays next. If the queue is empty, behaves like enqueueTrack
* and starts the queue with this track at index 0.
*/
export function playNext(t: TrackRef): void {
_radioSeedId = null; // M4c: any user-driven enqueue clears the radio refresh state
_radioSeedId = null; // Any user-driven enqueue clears the radio refresh state
if (t.unavailable) return;
if (_queue.length === 0) {
_queue = [t];
@@ -461,10 +461,10 @@ async function fetchRadioTracks(seedTrackId: string): Promise<TrackRef[]> {
export async function playRadio(seedTrackId: string): Promise<void> {
const tracks = await fetchRadioTracks(seedTrackId);
if (tracks.length === 0) return;
// #968: hand the player a self-heal closure so a fully-stale radio queue
// Hand the player a self-heal closure so a fully-stale radio queue
// re-seeds from the same track instead of dead-ending.
playQueue(tracks, 0, { refetch: () => fetchRadioTracks(seedTrackId) });
_radioSeedId = seedTrackId; // M4c: set AFTER playQueue (which clears it)
_radioSeedId = seedTrackId; // Set AFTER playQueue (which clears it)
}
export function moveQueueItem(from: number, to: number): void {
@@ -577,7 +577,7 @@ export function consumePendingRestorePosition(): number | null {
return p;
}
// M4c: auto-refresh radio queue when 80% consumed.
// Auto-refresh radio queue when 80% consumed.
// Fires whenever the consumption ratio crosses 80% AND the queue was
// seeded by playRadio() AND no refresh is currently in-flight.
$effect.root(() => {
@@ -590,7 +590,7 @@ $effect.root(() => {
_radioRefreshInFlight = true;
const seed = _radioSeedId;
// Drift #554: cap the exclude list so a multi-hour radio session
// Cap the exclude list so a multi-hour radio session
// doesn't grow the query string past common 8KB limits and start
// 414-ing /api/radio. The .catch() below would silently swallow
// that failure and the player would stop topping up — a dead
@@ -625,7 +625,7 @@ $effect.root(() => {
});
});
// Session-end teardown (#375): auth signals via sessionEnd; player
// Session-end teardown: auth signals via sessionEnd; player
// owns the player-specific cleanup (clear persisted queue for the
// outgoing user, reset in-memory queue, close drawer) without auth
// having to import any player APIs.
@@ -641,10 +641,9 @@ $effect.root(() => {
});
});
// Persistence (M7 #364): split-effect shape. Queue/index changes write
// immediately (rare, user-driven); position changes throttle to once
// per 5s during steady playback. See spec section "Persistence write
// effect" for the alternative debounce shape.
// Persistence: split-effect shape. Queue/index changes write immediately
// (rare, user-driven); position changes throttle to once per 5s during
// steady playback.
$effect.root(() => {
let lastPositionWriteAt = 0;