Skip to content

test(quantum): Vitest coverage for useQuantumCircuitAscii hook glue (#13832)#13852

Merged
kubestellar-hive[bot] merged 2 commits into
kubestellar:mainfrom
ANAMASGARD:test/quantum-hook-auth-circuit
May 16, 2026
Merged

test(quantum): Vitest coverage for useQuantumCircuitAscii hook glue (#13832)#13852
kubestellar-hive[bot] merged 2 commits into
kubestellar:mainfrom
ANAMASGARD:test/quantum-hook-auth-circuit

Conversation

@ANAMASGARD
Copy link
Copy Markdown
Contributor

@ANAMASGARD ANAMASGARD commented May 15, 2026

Part of #13832

Adds Vitest tests for the useQuantumCircuitAscii glue layer:

  • Disabled path: isAuthenticated: false returns null data with flags normalized via getDisabledResult, refetch forwarded, and useCache wired with enabled: false and expected key/demo/fetcher
  • Demo mode: isDemoFallback + not loading returns DEMO_QUANTUM_CIRCUIT with isDemoData: true (exact object match)
  • Loading + demo: isDemoFallback: true while isLoading: true keeps isDemoData false
  • forceDemo: cache enabled: false when authenticated with forceDemo: true

Note: useQuantumAuthStatus tests were merged in #13911 — this PR only adds useQuantumCircuitAscii.test.ts.

Out of scope: other quantum UI tests per #13832.

  • DCO signed (git commit -s)
  • Rebased / aligned with current main
  • Build and lint validated by CI (not run locally per CLAUDE.md)

Copilot AI review requested due to automatic review settings May 15, 2026 11:32
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label May 15, 2026
@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 eeshaansa 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

@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for kubestellarconsole ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit c4274d7
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a07c66b99e8b0000867d7df
😎 Deploy Preview https://deploy-preview-13852.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
Copy link
Copy Markdown
Contributor

👋 Hey @ANAMASGARD — 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 May 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Vitest unit tests for two quantum hooks (useQuantumAuthStatus and useQuantumCircuitAscii) from the useCachedQuantum module, covering disabled-path behavior and isDemoData derivation logic.

Changes:

  • New test file for useQuantumAuthStatus covering disabled path and three isDemoData cases.
  • New test file for useQuantumCircuitAscii covering disabled path and demo-mode data return.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
web/src/hooks/tests/useQuantumAuthStatus.test.ts Adds 2 tests validating disabled return + isDemoData = isDemoFallback && !isLoading logic
web/src/hooks/tests/useQuantumCircuitAscii.test.ts Adds 2 tests validating disabled return + demo-mode DEMO_QUANTUM_CIRCUIT data

ANAMASGARD added a commit to ANAMASGARD/console that referenced this pull request May 15, 2026
…uilds

Revert duplicate declarations and invalid writeJSON err checks introduced
on main by PR kubestellar#13816 so CI can build the full repo for kubestellar#13852.

Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
@ANAMASGARD ANAMASGARD force-pushed the test/quantum-hook-auth-circuit branch from 571ff0a to d8917b9 Compare May 15, 2026 12:47
Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

Thanks for the test coverage contribution! However this PR has significant scope creep beyond the stated test additions:

Files that shouldn't be in a test PR:

  • App.tsx — removes LiveLocationProvider (functional change)
  • NamespaceOverview.tsx — removes hasShownRestoreErrorRef (functional change)
  • Layout.tsx — adds new import
  • ClusterFilterPanel.tsx — adds new import
  • useMissions.provider.tsx, useStellar.tsx, kagentBackend.ts, localAgentChat.ts, services/stellar.ts — unclear changes

What's good: The two new test files (useQuantumAuthStatus.test.ts and useQuantumCircuitAscii.test.ts) look well-structured.

Please:

  1. Remove all non-test changes from this PR (revert to only the two new test files)
  2. If the other changes fix real issues, open a separate PR for each

The non-test changes conflict with main and risk introducing regressions. Keep PRs focused on one concern.

@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

Thanks for the test coverage contribution! However this PR has significant scope creep beyond the stated test additions:

Files that shouldn't be in a test PR:

  • App.tsx — removes LiveLocationProvider (functional change)
  • NamespaceOverview.tsx — removes hasShownRestoreErrorRef (functional change)
  • Layout.tsx — adds new import
  • ClusterFilterPanel.tsx — adds new import
  • useMissions.provider.tsx, useStellar.tsx, kagentBackend.ts, localAgentChat.ts, services/stellar.ts — unclear changes

What's good: The two new test files (useQuantumAuthStatus.test.ts and useQuantumCircuitAscii.test.ts) look well-structured.

Please:

  1. Remove all non-test changes from this PR (revert to only the two new test files)
  2. If the other changes fix real issues, open a separate PR for each

The non-test changes conflict with main and risk introducing regressions. Keep PRs focused on one concern.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

Test coverage here is a bit too mock-driven to catch real regressions.

  • Both specs stub useCache completely, but never assert the contract passed into it (key, enabled, initialData, demoData, fetcher, refreshInterval, autoRefresh). That means a wiring bug inside useQuantumAuthStatus / useQuantumCircuitAscii could still pass as long as the stubbed return shape looks right.
  • useQuantumAuthStatus should explicitly assert the unauthenticated branch returns DEFAULT_AUTH_STATUS, preserves the mocked refetch, and disables the cache (enabled: false). Right now it only checks derived fields from a fabricated cache result.
  • useQuantumCircuitAscii should exact-match DEMO_QUANTUM_CIRCUIT and add a isLoading=true && isDemoFallback=true case to pin the "no demo data while loading" rule. A regex on the ASCII art is too loose to prove the hook returned the intended demo object.
  • vi.resetAllMocks() is brittle here because it wipes the module mock implementation for the polling context; that makes autoRefresh behavior depend on an implicit undefined coercion instead of the intended mocked value. Prefer vi.clearAllMocks() or re-stub the polling mock in each test so the suite stays deterministic.
  • Neither file covers forceDemo, so a regression in that guard would be missed.

Net: good start, but I would tighten these into contract/edge-case tests so they fail on real hook regressions, not just snapshot the mocked outputs.

@kubestellar-hive
Copy link
Copy Markdown
Contributor

Hi @ANAMASGARD! Thanks for contributing these tests for useQuantumAuthStatus and useQuantumCircuitAscii.

The build failures here are not caused by your test code — your branch is stale against main and is picking up unrelated TypeScript errors that were introduced and then fixed in main after your PR was created. Specifically:

  • src/App.tsx: TS2440 import conflict (LiveLocationProvider) + UNSAFE_LocationContext missing
  • src/components/layout/navbar/ClusterFilterPanel.tsx: NAVBAR_FILTER_PANEL_OFFSET_CSS_VAR / NAVBAR_FILTER_PANEL_GAP_PX not found
  • src/lib/kagentBackend.ts: ChatStreamResponse not found
  • src/hooks/useStellar.tsx: unused variable warning

Fix: rebase your branch onto the current main:

git fetch origin main
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once you rebase, CI should pick up the current main which has all these fixes and your tests will be properly evaluated. Looking forward to getting this merged! 🙌

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

Hi @ANAMASGARD — several blocking CI checks are failing on this PR:

  • build (both amd64 and arm64)
  • fullstack-smoke
  • pr-check
  • All Cards TTFI (Hard Gate)
  • App Visual Regression

Please investigate the build failure (likely a TypeScript compilation error), fix the issues, and push an updated commit. You may also need to rebase on the latest main since several PRs have merged recently. Thanks!

@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

Hi @ANAMASGARD — several blocking CI checks are failing on this PR:

  • build (both amd64 and arm64)
  • fullstack-smoke
  • pr-check
  • All Cards TTFI (Hard Gate)
  • App Visual Regression

Please investigate the build failure (likely a TypeScript compilation error), fix the issues, and push an updated commit. You may also need to rebase on the latest main since several PRs have merged recently. Thanks!

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubestellar-hive
Copy link
Copy Markdown
Contributor

Thanks for the update. Current failing checks are fullstack-smoke and pr-check.\n\nPlease run a rebase onto latest main, then push a refresh so CI reruns cleanly. If failures persist after rebase, please share the failing log snippet from fullstack-smoke in this PR so we can pinpoint the exact break.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

Hey @ANAMASGARD — this PR has merge conflicts with main and CI is failing. Could you:

  1. Rebase on the latest main: git fetch origin main && git rebase origin/main
  2. Resolve conflicts and force-push
  3. Check the CI failures after rebase

Happy to re-review once it's green. Thanks!

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

Hey @ANAMASGARD 👋 — this PR currently has a merge conflict and multiple CI failures (build, fullstack-smoke, pr-check, TTFI, visual regression all fail).

Could you please:

  1. Rebase on the latest main: git fetch origin main && git rebase origin/main
  2. Fix the build errors — likely due to upstream changes since this branch was created
  3. Force-push the updated branch

Happy to re-review once CI is green. Thanks!

@kubestellar-hive
Copy link
Copy Markdown
Contributor

👋 @ANAMASGARD — This PR has merge conflicts and a CI build failure. Could you rebase onto main and fix the build when you get a chance? Let me know if you need help.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

Security review: PASS

Test-only PR adding Vitest coverage for useQuantumAuthStatus and useQuantumCircuitAscii hooks. No production code changes.

@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

Security review: PASS

Test-only PR adding Vitest coverage for useQuantumAuthStatus and useQuantumCircuitAscii hooks. No production code changes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

Security review ✅ — Test-only, no production code changes. Proper mock patterns with vi.mock and vi.mocked. Clean assertions on isDemoData flag behavior.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

LGTM. Good test coverage for useQuantumAuthStatus and useQuantumCircuitAscii — proper mock isolation, isDemoData logic verified, edge cases covered.

@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

LGTM. Good test coverage for useQuantumAuthStatus and useQuantumCircuitAscii — proper mock isolation, isDemoData logic verified, edge cases covered.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

Hi @ANAMASGARD — this PR has a merge conflict and CI is failing (build/fullstack-smoke). Could you rebase on main and fix the build failures? Thanks for the contribution!

@kubestellar-hive
Copy link
Copy Markdown
Contributor

Following up on the earlier rebase request — the branch is still conflicting with main and CI is failing across all checks (build, coverage, etc.) due to the stale state.

Please rebase onto current main when you get a chance:

git fetch origin main
git rebase origin/main
git push --force-with-lease

The test logic itself looks reasonable once the branch is current. Happy to review again after the rebase!

@kubestellar-hive
Copy link
Copy Markdown
Contributor

Hi @ANAMASGARD — the test additions look good structurally, but CI is failing across multiple jobs.

Root cause: Branch is 63 commits behind main and has merge conflicts (mergeable_state: dirty). The build failures ("Build frontend", "Build production bundle", "Build and push by digest") are not caused by your test files — they're from stale dependencies on code that has since changed on main.

Fix: Rebase onto current main:

git fetch origin
git rebase origin/main
# Resolve any conflicts
git push --force-with-lease

The test files themselves (useQuantumAuthStatus.test.ts, useQuantumCircuitAscii.test.ts) import from useCachedQuantum and lib/cache — both exist and export the expected symbols. Once rebased, CI should pass.

Failing checks:

  • build (linux/amd64) — "Build and push by digest" step
  • build (linux/arm64) — "Build and push by digest" step
  • fullstack-smoke — "Build frontend" step
  • All Cards TTFI — "Build production bundle" step
  • pr-check — "Fail on new findings" step
  • App Visual Regression — likely cascading from build failure

All are build-stage failures, not test failures. Rebase will resolve.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

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

sec-check ✅ — Test-only PR (172 lines). Vitest coverage for useQuantumAuthStatus and useQuantumCircuitAscii. No dangerous patterns (eval/innerHTML/exec). No production code changes. LGTM.

@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

sec-check ✅ — Test-only PR (172 lines). Vitest coverage for useQuantumAuthStatus and useQuantumCircuitAscii. No dangerous patterns (eval/innerHTML/exec). No production code changes. LGTM.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

…ubestellar#13832)

Add Vitest glue tests for useQuantumCircuitAscii; rebase drops duplicate
useQuantumAuthStatus coverage already merged in kubestellar#13911.

Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
…act (kubestellar#13832)

- Add UseCacheResult fields (retryFetch, clearAndRefetch) to mocks
- Strengthen disabled-path test with noisy cache + useCache wiring asserts
- Exact-match DEMO_QUANTUM_CIRCUIT; pin isDemoData when loading+demo
- Cover forceDemo disabling cache; use clearAllMocks in beforeEach

Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
@ANAMASGARD ANAMASGARD force-pushed the test/quantum-hook-auth-circuit branch from 7d5eb26 to c4274d7 Compare May 16, 2026 01:20
@ANAMASGARD ANAMASGARD changed the title test(quantum): Vitest coverage for useQuantumAuthStatus and useQuantumCircuitAscii (#13832) test(quantum): Vitest coverage for useQuantumCircuitAscii hook glue (#13832) May 16, 2026
@ANAMASGARD
Copy link
Copy Markdown
Contributor Author

I have done all that rebase and things you asked for .

@kubestellar-hive kubestellar-hive Bot merged commit cb0b9f4 into kubestellar:main May 16, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. 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.

2 participants