# High startup optimization test brief 2026-09-23. Brief only; wait for approval before implementing automated tests. Use `just test` when package tests resume. - Compare app-cold first High selection, first selection after foreground prewarm, warm different-song selection, and replay separately. Record stream context, proof, each player call, script discovery/download, decipher, media probe, native readiness, and actual advancing render clock. - Pair every cached script with its exact player URL/version and timestamp. Rotate versions and sessions independently; reject stale completion writes. - Coalesce prewarm/foreground consumers. Cancelling one waiter must not cancel another; stop/sign-out must cancel obsolete session work. No proof-provider busy error should be introduced by speculative work. - Return 403 from a cached path: invalidate relevant state and prove fresh discovery/proof/player resolution succeeds within a bounded attempt budget. Never retry an expired/rejected URL indefinitely or loop on every callback. - Simulate unchanged, rotated, unavailable, and malformed script discovery; failed prewarm must leave ordinary playback able to resolve fresh. - Confirm cold parallelism preserves request/session/proof context and that cancellation joins sibling work. Keep initial-player removal a separate experiment from cache introduction so regressions have an identifiable cause. - If media-head reuse is implemented, validate URL/header/profile identity, strict 206 and Content-Range, cancellation, caps, redirects, exact first bytes, and single consumption before seeding the native range cache. - Physical acceptance: consecutive manual High selections, known continuous album transitions, 65%/90% seeks, native Lock Screen metadata/commands, long background playback, session expiry, and slow/offline recovery. Record any retry and startup distribution; a fast successful sample alone is inadequate. - Diagnostics must contain only allowed phase/count/timing fields and random attempt IDs. No cookies, token values, response bodies, or raw URLs. ## Persistent public-JavaScript cache follow-up - Fresh max-age reuse across process launch; stale ETag/Last-Modified validation; no-cache/no-store, Expires/Date/Age, duplicate/malformed cache directives, cached failure statuses and a server returning a different script version. - Set-Cookie responses and off-allowlist redirects cannot enter the cache. Credential storage/cookie handling are disabled for script requests. - Fresh discovery after restart, matching timestamp/source/profile, capped in-memory TTL, session-generation cancellation and forced network reload after stale-decipher/media rejection. Authenticated API/media/proof sessions never inherit the public cache. - The September 24 restart canary observed a disk hit and passed High playback, but HTTP freshness edge cases still need deterministic transport fixtures.