Skip to content

Studio tests: drain deferred work before the auth refresh fixture restores window - #17055

Merged
danielhanchen merged 1 commit into
mainfrom
ci/auth-refresh-test-settles
Nov 7, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/auth-refresh-test-settles

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Since #16755 merged, every Frontend CI run fails on both Frontend build + bundle sanity and Frontend unit tests (Windows), with the same file. On PRs this includes #17010 and the cosmos3, images and voice PRs, and the main push runs are red too:

# Error: Test "without Web Locks a session with no mark does not take a later sign-in for a peer's rotation"
  at tests/auth-refresh-transient.test.ts:453:1 generated asynchronous activity after the test ended.
  This activity created the error "TypeError: Cannot read properties of undefined (reading 'location')"
  and would have caused the test to fail, but instead triggered an unhandledRejection event.
not ok 140 - tests/auth-refresh-transient.test.ts

The product code is correct; the test does not wait for it. In the new test, authFetch returns the 401, and the rejected-refresh path then sends the tab to /login through window.location on a later turn. The test ends right after the returned response. The fixture's t.after then restores the real globalThis.window, which is undefined under Node, so the deferred redirect throws. The sibling tests that take a 401 already await f.settle() before they finish. This one does not.

The failure depends on the Node version. CI pins Node 22 (22.23.4), which fails the file every time. Node 24 does not, which is why the PR was green where it was written.

Change

studio/frontend/tests/auth-refresh-transient.test.ts, tests only:

  • The fixture's t.after drains five turns before it restores window, fetch, setTimeout, clearTimeout and Date.now. That is the same drain as f.settle(). Deferred work from any test in the file now runs against the fixture's window, not after it is gone.
  • The new test settles and asserts what the rejected path does, location.href == "/login". It also keeps its existing checks: the other sign-in's tokens stay and nothing is cleared.

Testing

Node 22.23.4 (CI) Node 24.22.1
main file fails (# pass 23, # fail 1, the error above) 23 pass
this branch 23 pass 23 pass
this branch, fixture drain alone (new assertion removed) 23 pass

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T23:30:31.112204Z 6284518 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 6284518fbd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 3b0a483 into main Nov 7, 2026
@danielhanchen
danielhanchen deleted the ci/auth-refresh-test-settles branch November 7, 2026 23:35
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