Skip to content

web-js: retire auth sessions when their owning call is let go - #2501

Merged
ccheever merged 1 commit into
mainfrom
q100/005-web-js-auth-hold-cancel
Dec 1, 2026
Merged

ccheever merged 1 commit into
mainfrom
q100/005-web-js-auth-hold-cancel

Conversation

@ccheever

@ccheever ccheever commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Closes the QUEUE.md item for web JS auth hold let-go / supersession (host/web-js/auth.js).

Summary

  • Tie openAuthSession entries in host/web-js/auth.js to their owning mutation or resource call (call.owner and runtime ticket) and register auth.prune() on a new LetGo hook in host/web-js/rt.js (fired after standing commit effects, rollback, and unrun deferred tails).
  • Immediately retire live auth holds and close open popups via authHost.cancel(ticket) in host/web/auth-glue.js whenever the owning call is superseded, reset, refused, or unmounted — even when the replacement completes synchronously or never calls openAuthSession.
  • Close abandoned ticket inflight accounting (retireCall) without settling the abandoned promise (LLP 1069.006 D3/D4), guard already-let-go continuations, and supersede by owner identity when available so distinct instanced mutations still receive 409.
  • Add unit, runtime (host/web-js/auth-let-go.test.mjs), and Chromium (host/web/auth-fixture.test.mjs) regression tests, and remove the resolved QUEUE.md line.

Verification

  • bun test --isolate across 17 auth/web-js test suites (including auth-let-go.test.mjs and Chromium auth-fixture.test.mjs): 136 pass, 0 fail (1 skip: missing WebKit).
  • bun test host/web/tests/js-runtime.test.mjs --timeout 20000: 68 pass, 0 fail.
  • cargo test -p exact-runner auth::: 15 pass, 0 fail.
  • bun scripts/gate.mjs: PASS.

Match the runner's let-go rules (LLP 1069.006 D3/D4/D7) in host/web-js/auth.js:
an openAuthSession hold or popup is owned by the mutation or resource call that
started it and is retired whenever that call is superseded, reset, refused, or
unmounted, even when the replacement completes synchronously or never opens
another auth session.

- Export a LetGo hook from rt.js (invoked after standing commit effects,
  rollback, and unrun deferred tails) and register auth.prune().
- Track the owning call and owner identity from ts-data.js / rust-data.js
  across await and plain .then continuations, superseding by owner identity
  when present so distinct instanced mutations still get 409.
- On drop or let-go, remove the entry from Live, close the live popup and
  timers immediately via authHost.cancel(ticket), close any unadopted prepared
  window, release the ordinary-request wait, and close the abandoned ticket's
  inflight accounting without settling the old promise.
- Guard already-let-go calls before holding, opening, or superseding a live
  session.
- Add unit, runtime, and Chromium regression tests covering popup cancel, agent
  hold retirement, inflight accounting, refusal rollback, resource let-go, and
  late callback rejection.
@ccheever
ccheever merged commit ef1ba2b into main Dec 1, 2026
@ccheever
ccheever deleted the q100/005-web-js-auth-hold-cancel branch December 1, 2026 12:05
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