fix(spf): preserve moq retry backoff until fresh media
Fixes #49
Summary
A relay can accept a replacement subscription to an ended track and replay cached media, repeatedly resetting the retry delay and preventing a finite retry budget from being exhausted. Preserve retry accounting until the replacement receives a valid media frame beyond its SUBSCRIBE_OK LARGEST_OBJECT boundary.
Changes
- Keep accepted-but-silent and cached-only replacements in the same recovery episode, retaining capped exponential delays and finite-budget exhaustion.
- Evaluate freshness within each subscription so publisher timestamp and object-number resets can recover; retain the result across buffer drains and reactive batching.
- Add 21 regression cases covering video, audio, handoff retries, watchdog expiry, cached replay, publisher resets, pre-OK delivery, and auth refresh.
Testing
- 1,336 non-browser SPF tests pass after rebasing onto the current
mmcc/moqbase. - SPF build and package typecheck pass; workspace consistency passes all 10 checks.
- Changed-file lint and formatting checks pass.
- Claude CLI review found no actionable findings and independently confirmed the 73 focused actor/behavior tests pass before the rebase.
Browser tests could not launch because Chromium system libraries are missing. Root typecheck reports errors outside SPF in the element/store/HTML dependency chain. Freshness relies on the relay reporting LARGEST_OBJECT correctly; live cached-replay validation remains outstanding.
Summary by cubic
Preserves the capped retry backoff for MOQ track recovery so a relay that accepts a replacement subscription and replays cached media can no longer reset a finite retry budget. Recovery now completes only when the replacement delivers a valid media frame beyond its SUBSCRIBE_OK LARGEST_OBJECT boundary; previously, acceptance or cached replay repeatedly reset the backoff and prevented exhaustion.
Behavior changes
- Each subscription attempt is isolated: retired callbacks cannot affect the next attempt's buffer, freshness boundary, measurements, or watchdog.
hasFreshFrameis latched per subscription, survives buffer drains, and clears when auth refresh retires the subscription.- Retry attempts reset only when the recovery target reports a fresh frame, not on the steady-state active status.
- Freshness depends on the relay reporting
LARGEST_OBJECTcorrectly; live cached-replay validation remains outstanding.