Skip to content

fix: stop the XHR seed path from pre-empting the seeded collection - #684

Merged
KrX3D merged 1 commit into
mainfrom
fix/seed-path-preempts-scheduler
Aug 29, 2026
Merged

fix: stop the XHR seed path from pre-empting the seeded collection#684
KrX3D merged 1 commit into
mainfrom
fix/seed-path-preempts-scheduler

Conversation

@KrX3D

@KrX3D KrX3D commented Aug 29, 2026

Copy link
Copy Markdown
Owner

The seeding from #683 never actually ran. On-device: xhr_seed_triggered present, native_settled entirely absent.

20:49:47.914  keep-one.register            (initial)
20:49:48.3-.7 three native continuations
20:49:48.883  batch_fetched                (unseeded, from the seed path)
   ...no reload...
20:49:54.979  continuation.detected -> from_native -> reload

Two faults, both mine:

  1. The seed path wins the race. It fires on the first continuation request (~400ms), well before the 1200ms settle timer, and sets __ttPrefetchStarted — so when the timer fired, autoStartCollect bailed at its own guard and the seeded run never happened. Collection restarted from batch 2 exactly as before. It now stands down while the settle timer is armed.

  2. That path never reloaded. Its completion only called _triggerReveal, never the cache/reload — so it could finish a full collection and still leave the page alone. That's the "batches loaded but no reload, had to scroll" behaviour; the page only corrected itself 6s later when a manual scroll produced the final native batch. It now runs the same storeFullPlaylist + maybeReloadForFullPlaylist as the scheduled path.

Also clears __ttNativeSettleTimer as the timer fires — the seed path reads a set handle as "scheduler owns this", and setTimeout handles don't self-clear, so it would have deferred forever and lost its fallback role.

The seeding added in this PR never ran. On-device the log shows
xhr_seed_triggered present and native_settled entirely absent:

  20:49:47.914  keep-one.register            (initial)
  20:49:48.3-.7 three native continuations
  20:49:48.883  batch_fetched                (unseeded, from the seed path)
  ...no reload...
  20:49:54.979  continuation.detected -> from_native -> reload

Two faults, both mine:

1. The XHR seed path fires on the FIRST continuation request, roughly
   400ms in and well before the 1200ms settle timer. It sets
   __ttPrefetchStarted, so when the timer did fire autoStartCollect bailed
   at its own guard and the seeded run never happened — collection
   restarted from batch 2 exactly as before the change. It now stands down
   while the settle timer is armed, since a run started there has strictly
   worse information.

2. That path's completion only ever called _triggerReveal, never the
   cache/reload. So it could finish a complete collection and still leave
   the page alone — which is what was seen: batches loaded, no reload, and
   the page only corrected itself six seconds later when a manual scroll
   produced the final native batch. It now does the same storeFullPlaylist
   + maybeReloadForFullPlaylist as the scheduled path, so whichever path
   runs, the reload happens.

Also clears __ttNativeSettleTimer as the timer fires. The seed path reads a
set handle as "the scheduler owns this", and setTimeout handles do not
self-clear, so it would have deferred forever and lost its fallback role.
@KrX3D
KrX3D merged commit 7026eef into main Aug 29, 2026
2 checks passed
@KrX3D
KrX3D deleted the fix/seed-path-preempts-scheduler branch August 29, 2026 20:54
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