Skip to content

fix(data): recover queries after scheduler cancellation or rejection - #397

Merged
smiggleworth merged 2 commits into
mainfrom
fix/query-work-admission
Sep 6, 2026
Merged

fix(data): recover queries after scheduler cancellation or rejection#397
smiggleworth merged 2 commits into
mainfrom
fix/query-work-admission

Conversation

@smiggleworth

@smiggleworth smiggleworth commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Clearing or rejecting a queued query previously left its refresh promise pending and prevented future refreshes from starting. Query starts now own a cancellable scheduling ticket that settles the current promise and releases queued ownership, including invalidation replacements and reconciliation retries. Existing generation tokens prevent obsolete queued work from settling a newer request.

The ticket's cancellation extension only resets internal bookkeeping and resolves a promise; scheduler clearing does not invoke subscribers. The redundant query startQueued flag is removed. Public signatures are preserved, including a Promise return when production admission silently rejects a promoted manual refresh.

Validation:

  • Fourteen public query regressions pass: eight demonstrated red on the original implementation, and six review regressions demonstrated late-result publication after cancellation. Cancelling queued work now retires the aborted fetch generation, so late resolve/reject cannot replace the preserved snapshot.
  • Formatting, lint/typecheck, build, unit (336), jsdom (1,619), Chromium (53), public types, and packed consumers (21) pass.
  • Relevant tier2 query deduplication/abort benchmark passes (795 samples, 0.756 ms mean, 0.42% RME; no baseline speedup claim).
  • All 60 repository checks, including architecture boundaries and the unchanged 256 KiB SSG hydration bundle limit, pass after rebasing onto root-lifecycle PR fix(boot): preserve reentrant root lifetimes during cleanup #398.

Cancellation limitation: clearing queued work preserves the last published query snapshot. If invalidation already aborted an in-flight request, that snapshot can still report refreshing until a later explicit refresh. This is documented and tested; cancellation does not publish a state change from inside scheduler queue clearing.

@smiggleworth
smiggleworth force-pushed the fix/query-work-admission branch from ea14760 to 4050f36 Compare September 6, 2026 20:29
@smiggleworth
smiggleworth force-pushed the fix/query-work-admission branch from 4050f36 to 8a82cd7 Compare September 6, 2026 20:40
@smiggleworth
smiggleworth marked this pull request as ready for review September 6, 2026 20:48
@smiggleworth
smiggleworth merged commit c057ede into main Sep 6, 2026
7 checks passed
@smiggleworth
smiggleworth deleted the fix/query-work-admission branch September 6, 2026 20:50
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