Skip to content

🤖 tests: isolate CoderOauthService catalog concurrency test from cross-file fetch-mock pollution - #4006

Merged
ibetitsmike merged 1 commit into
mainfrom
mike/fix-coder-oauth-test-order
Aug 29, 2026
Merged

🤖 tests: isolate CoderOauthService catalog concurrency test from cross-file fetch-mock pollution#4006
ibetitsmike merged 1 commit into
mainfrom
mike/fix-coder-oauth-test-order

Conversation

@ibetitsmike

Copy link
Copy Markdown
Contributor

Summary

Fixes the last remaining order-dependent unit test breaking merge-queue runs: CoderOauthService > startDesktopFlow > fetches origin catalogs concurrently so a stalled origin cannot starve a healthy one failed pr-4003's merge-group composition twice in a row while passing standalone. Same class as #4005's unit leg (shared bun process + unsorted find file order), different mechanism.

Background

waitForDesktopFlow() resolves when commitDesktopLogin() calls desktopFlows.finish(), before the background task awaits refreshBridgeModels(); dispose() only shuts down registered flows, so an already-finished flow's catalog retries survive the test. A 250ms retry then calls a LATER test's globalThis.fetch mock: the victim observed 4 catalog calls instead of 2, with stale Authorization tokens from three earlier tests in the same file (confirmed via temporary diagnostics; deterministic with a 300ms window).

Implementation

  • Victim isolation: the concurrency test's fetch mock now returns 404 for /aibridge/ requests whose Authorization is not its own Bearer at_concurrent, so stale services from earlier tests cannot release its gate or inflate its signal count.
  • Defense in depth: quarantine coderOauthService.test.ts in pr.yml's isolated_unit_tests (same precedent as WorkspaceFooterBar.test.tsx from 🤖 tests: fix test-order pollution and review e2e race that block the merge queue #4005).

Validation

  • Red: each confirmed polluter + delayed victim failed (received 4 vs expected 2). Green: same pairs pass 0-fail with the isolation; victim file standalone 88/88; diagnostics removed.
  • make static-check green locally.

Risks

Test-only + CI quarantine entry; no production code changed.


Generated with xum • Model: anthropic:claude-fable-5 • Thinking: xhigh • Cost: $107.70

Ignore catalog calls from stale test services so their post-login refreshes
cannot participate in the current flow's concurrency gate. Run the file in an
isolated CI process as defense in depth.

---

_Generated with  • Model:  • Thinking: _

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=high -->
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@chatgpt-codex-connector

This comment has been minimized.

@chatgpt-codex-connector

This comment has been minimized.

@ibetitsmike
ibetitsmike added this pull request to the merge queue Aug 29, 2026
Merged via the queue into main with commit b077ded Aug 29, 2026
36 of 38 checks passed
@ibetitsmike
ibetitsmike deleted the mike/fix-coder-oauth-test-order branch August 29, 2026 05:34
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