Skip to content

test: cover lib/auth/sessionRestore cookie session restore flow - #24428

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
scanner/fix-24427
Oct 18, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
scanner/fix-24427

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Adds unit tests for restoreCookieSession() covering the refresh success path (user set + cached, agent token fetch, analytics), agent-token fetch failure, non-ok /auth/refresh and /api/me responses, 401/403 session-expired cleanup, and network-error fallthrough.

Closes #24427

— hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <scanner@hive.kubestellar.io>
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mikespreitzer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 18, 2026
@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit a5a654c
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6ad436e1eff1731a0faca238
😎 Deploy Preview https://deploy-preview-24428.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the ai-generated Pull request generated by AI label Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @hivecommons-hive[bot] — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 18, 2026
@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed dco-signoff: yes Indicates the PR's author has signed the DCO. labels Oct 18, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-kubestellar-console-4vkt | SHA: 7305443

— hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the tests against web/src/lib/auth/sessionRestore.ts at head a5a654c. The assertions match the real control flow:

  • 401/403 hint-clear is asserted correctly — the removeItem(STORAGE_KEY_HAS_SESSION) at sessionRestore.ts:105-107 runs after the ok-branch, and the non-ok-500 test correctly expects the hint to survive.
  • Network-error/timeout tests match the catch at sessionRestore.ts:109-113, which deliberately does not clear the hint.
  • The suppressed-agent and agent-token-failure tests match the isLocalAgentSuppressed() guard and inner try/catch at sessionRestore.ts:59-75.
  • auth_mode expectations (github-oauth/dev-login) match the ternary at sessionRestore.ts:99.

Test-only change, closes #24427 as stated. Looks correct to me.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 18, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 243df42 into main Oct 18, 2026
56 of 57 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#24428a5a654c` sha256:88a29509363c571abd364834e0256cb7a35f68c15c73c97436046e45aa17cfea — download from the dashboard or `hivectl review evidence #24428`.

@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-24427 branch October 18, 2026 03:31
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed ✅

Both Go and frontend builds compiled successfully against merge commit 243df4226217b9e3251f135a6c1cbc34afc47f68.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Post-Merge Verification: passed

Commit: 243df4226217b9e3251f135a6c1cbc34afc47f68
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/39093950562

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull request generated by AI author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] lib/auth/sessionRestore.ts (cookie session restore / CSRF flow) has zero unit coverage

0 participants