Skip to content

fix: preserve extension event ordering during polling - #124

Open
t91a60 wants to merge 1 commit into
BossSloth:mainfrom
t91a60:fix/extension-event-polling
Open

t91a60 wants to merge 1 commit into
BossSloth:mainfrom
t91a60:fix/extension-event-polling

Conversation

@t91a60

@t91a60 t91a60 commented Oct 17, 2026

Copy link
Copy Markdown

Extension state events were grouped by type, so a LOADED, UNLOADED, LOADED sequence replayed as LOADED, LOADED, UNLOADED. Reading and clearing the queue in separate CDP calls could also discard events arriving between those calls.

Use a FIFO queue and drain it in one evaluation. Await listeners before dispatching the next event so an asynchronous install cannot finish after a later removal. Catch rejected listeners without stopping the remaining callbacks or events.

Verification:

  • Six Bun regression tests pass. Before the fix, tests reproduced reordered events, a lost event, and removal overtaking an asynchronous installation.
  • bun run build, bun run lint, bun run check, test TypeScript checking, formatting checks, and git diff --check pass in an LF checkout. The build retains the existing circular-dependency warning.

Tests execute the injected functions in a VM and simulate the JSON/CDP boundary. Native Chrome event delivery and Steam/Millennium integration have not been tested. This does not address initial inventory hydration or general plugin teardown.

@t91a60
t91a60 marked this pull request as ready for review October 17, 2026 21:03
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