StaticserializeOptionalonStart: (entry: QueueEntry) => voidStaticcancelCancel the specific entry the caller owns by firing its AbortSignal
— nothing more. If the entry is still queued, its chained then
skips the task body via the abort.signal.aborted guard; if it is
running, the task observes the signal and unwinds.
Identity-scoped on purpose: it acts ONLY on the caller's own entry, so
an older store's dispose() can never cancel a newer same-datasetId
store's validation.
Deliberately does NOT touch the map. Map cleanup is left entirely to
serialize's finally head-guard (queues.get(datasetId) === entry).
Deleting here would be wrong for a WAITING head: an aborted waiting
entry still settles when its predecessor settles (keeping successors
FIFO-chained via its promise), and removing it early would let the
next serialize see previous === undefined and run concurrently with
the still-live predecessor. Safe to call more than once and on an
already-settled entry.
Run
taskafter any previously-queued validation fordatasetIdresolves.taskreceives anAbortSignalthat fires when ValidationQueue.cancel is called with THIS call's QueueEntry (typically from the owning instance'sdispose()).The entry is created synchronously and handed to the optional
onStartcallback BEFORE the firstawait, so the caller can capture its own handle and later cancel exactly that entry — even after a newer same-datasetIdvalidation has replaced it as the map head. The returned promise still resolves only when the validation completes, soawait serialize(...)keeps its "wait until done" contract.If the abort fires while waiting in line,
taskis skipped entirely (the closure may have captured a now-disposedthis).