Repository navigation
🐛 fix: correct auth.test.tsx logout/setToken tests failing nightly unit shard 19 - #24656
Conversation
…en clearing The nightly unit-test suite (shard 19) failed deterministically in src/lib/auth.test.tsx after #24637 made clearStoredAuthToken() also drop the legacy 'kc_token' test key: - logout() POST test mocked /api/me with { ok: true } and no json(), so the mount-time refreshUser() failed, dropped to login and cleared the token; logout() then had no bearer token and never called /auth/logout. - setToken() test expected setToken() to fetch /api/me, but setToken() never calls refreshUser(); AuthCallback.tsx calls it explicitly. Refs #24572 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hey @hivecommons-hive[bot] — thanks for opening this PR!
This is an automated message. |
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88 |
♿ Accessibility Audit (WCAG 2.1 AA)✅ No WCAG 2.1 AA violations detected in audited routes. Powered by axe-core. Target: WCAG 2.1 AA compliance. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
⏹️ Post-Merge Verification: cancelledCommit: |
Refs #24572.
Root cause (nightly run 40458881935)
Go toolchain is fine now (GO_VERSION 1.26.10).
unit-testfailed for two reasons:Shard 19/48 — 2 deterministic failures in
web/src/lib/auth.test.tsx(fail with retry x2), introduced by 🐛 fix: stop auth.test.tsx OOM recursion and unhandled rejections in nightly unit shards #24637, which madeclearStoredAuthToken()also remove the legacykc_tokentest key:logout() sends POST to /auth/logout with bearer token: the test mocked/api/mewith{ ok: true }(nojson()), so mount-timerefreshUser()threwmeResponse.json is not a function, dropped to login and cleared the token.logout()then had no token, so only 1 fetch (/api/me) occurred. Fix: mock a valid/api/meuser, then the logout response.setToken() triggers refreshUser():setToken()never callsrefreshUser()(AuthCallback.tsx calls it explicitly), so/api/mecount stayed 0. Fix: test the real contract —setToken()+refreshUser(newToken)sends/api/mewith the new bearer token and populates the user.Shards 26/48 and 34/48 timed out after 900s (
Shard N TIMED OUT ... (hung test?)). Vitest output does not name the hung file; last completed files wereanalytics-dispatch-coverage.test.ts(shard 26) anduseUpgradeStateMachine.test.tsx(shard 34). Not fixed here — remains open under Nightly regression: unit-test #24572; next step is identifying the hanging file (e.g.--reporter=hanging-processor per-file timing in those shards).Test-only change; no production code touched.
— hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88