azurenoops / azurenoops/spin_agent

Dashboard: 53 pre-existing test failures surfaced by #707 CI gate (MSAL, localStorage, idle timer, BroadcastChannel)

Open
#810 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3
Forks
1
Avg merge
18h 9m
Merged PRs (30d)
43

Description

## Summary

When the `dashboard-unit-tests` CI job was added in PR #707 (branch `fix/707-rmf-routing-ci-gate`), running `vitest run` (the full Dashboard test suite) revealed **53 pre-existing test failures** that had been silently accumulating because CI never ran the Dashboard suite before.

These failures are **not caused by** PR #707. They predate it and were already present on `main`.

The #707 CI gate is intentionally scoped to `SystemAliasRoutes.test.tsx` (the 13 routing regression tests) to go live green today without dragging in this unrelated debt. This issue is the dedicated cleanup ticket.

---

## Failure categories (observed on branch `fix/707-rmf-routing-ci-gate`)

| Category | Approximate count | Root cause |
|---|---|---|
| **MSAL mock failures** | ~20 | `@azure/msal-browser` not mocked; auth state setup broken in test env |
| **localStorage hook failures** | ~15 | `localStorage` not available / not reset between tests in jsdom |
| **Idle timer failures** | ~10 | `setTimeout`/`clearTimeout` interactions with fake timers not set up |
| **BroadcastChannel failures** | ~8 | `BroadcastChannel` API not available in jsdom test environment |

Total: ~53 failures across multiple test files (exact breakdown to be confirmed when running the full suite).

---

## Why these were hidden

CI never ran the Dashboard's Vitest suite. The `vscode-extension-compile` and `.NET` jobs ran, but no job executed `vitest run` in `src/Ato.Copilot.Dashboard/`. The test files existed and accumulated failures silently.

PR #707 was the first time CI executed them, which surfaced this backlog.

---

## Out of scope for PR #707

PR #707 (`fix/707-rmf-routing-ci-gate`) intentionally does **not** fix these. It scopes the CI gate to the routing tests only and references this issue.

---

## Acceptance criteria for this issue

- [ ] All MSAL mock failures resolved (vitest setup file mocks `@azure/msal-browser` correctly)
- [ ] localStorage reset between tests (added to `beforeEach` or vitest setup)
- [ ] Idle timer tests use fake timers (`vi.useFakeTimers()`) consistently
- [ ] BroadcastChannel polyfilled or mocked in jsdom environment
- [ ] `npx vitest run` in `src/Ato.Copilot.Dashboard/` exits 0 (all tests pass)
- [ ] `dashboard-unit-tests` CI job updated to run the full suite (remove file scope restriction added in #707)

---

## References

- PR #707 (routing regression shield): https://github.com/azurenoops/spin_agent/pull/707
- Branch where failures were first observed: `fix/707-rmf-routing-ci-gate`
- Related issues: #498, #505, #516, #634 (routing regressions that motivated #707)

Contributor guide

Open the contributing guide

Research direction

Start in src/Ato.Copilot.Dashboard/ by running npx vitest run to confirm the current failures and identify the affected test files. Read the Vitest setup file and the MSAL, localStorage, idle timer, and BroadcastChannel test setup described in the issue. Done means the full suite passes and the dashboard-unit-tests CI job no longer restricts execution to one test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, typescript
Domain
ci-cd, frontend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.