Skip to content

fix(069-B2): green dashboard-usage-switcher unit tests (MCP-900)#576

Merged
Dumbris merged 1 commit into
mainfrom
fix/069-b2-dashboard-usage-test
Jun 3, 2026
Merged

fix(069-B2): green dashboard-usage-switcher unit tests (MCP-900)#576
Dumbris merged 1 commit into
mainfrom
fix/069-b2-dashboard-usage-test

Conversation

@Dumbris
Copy link
Copy Markdown
Member

@Dumbris Dumbris commented Jun 2, 2026

Problem

The Frontend CI lane is red on `main`. `frontend/tests/unit/dashboard-usage-switcher.spec.ts` (added in 069-B1 #570) broke when 069-B2 (#571) swapped the inline usage panel for the real async `Usage.vue`. Every `frontend/**` PR now fails the merge gate.

Failures (reproduced on clean `origin/main`)

  • defaults to the Overview tab …[data-test="dashboard-usage-panel"] absent from the mounted DOM.
  • switches to Usage … lazily fetches the aggregate — usage fetch spy called 0 times.
  • re-fetches with the selected window …Cannot call trigger on an empty DOMWrapper for [data-test="usage-window-7d"].

Root cause (mount-side, two parts)

  1. The usage panel wrapper carried v-if="usageEverActive", so it was absent on first paint (failed exists()).
  2. shallowMount stubbed both <Suspense> and the async UsageView, so the real Usage.vue never rendered — no fetch fired and its window buttons never existed.

Fix

Dashboard.vue — move the lazy gate from the wrapper onto the inner <Suspense v-if="usageEverActive">. The panel wrapper is now always in the DOM (hidden via v-show), while the chart bundle + usage fetch inside UsageView still mount only on first switch. Preserves SC-004 (no usage fetch / chart bundle on first paint — Usage still code-splits into its own chunk) and SC-006 (Overview subtree never torn down). No user-facing behavior change.

test — un-stub <Suspense> and swap the async UsageView for an eagerly-imported Usage.vue (a dynamic import() never settles inside flushPromises + Suspense, leaving the panel stuck on its fallback spinner). The genuine switcher fetch-on-activation + window-re-fetch logic now runs; Usage's chart grandchildren stay shallow-stubbed so jsdom never touches a canvas.

Verification

  • vitest run dashboard-usage-switcher.spec.ts → 4/4 pass
  • vitest run (full frontend suite) → 91/91 pass
  • vue-tsc --noEmit → clean
  • vite build → clean (Usage still code-splits)

Unblocks MCP-867 (#575). Related #571

The 069-B1 switcher tests broke when 069-B2 (#571) swapped the inline
usage panel for the real async Usage.vue. Two mount-side problems:

- The usage panel wrapper carried v-if="usageEverActive", so it was
  absent from the DOM on first paint and the exists() assertion failed.
  Move the lazy gate onto the inner <Suspense> instead: the wrapper div
  is now always present (hidden via v-show), while the chart bundle +
  usage fetch inside UsageView still mount only on first switch (SC-004),
  and the Overview subtree is preserved across switches (SC-006).

- shallowMount stubbed both <Suspense> and the async UsageView, so the
  real Usage.vue never rendered (no fetch, no window buttons). Un-stub
  Suspense and swap the async wrapper for an eagerly-imported Usage.vue
  so the fetch-on-activation and window-re-fetch logic actually runs; a
  dynamic import() never settles inside flushPromises + Suspense. Usage's
  chart grandchildren stay shallow-stubbed (no jsdom canvas).

Related #571
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8a6a240
Status: ✅  Deploy successful!
Preview URL: https://ac222acb.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-069-b2-dashboard-usage-t.mcpproxy-docs.pages.dev

View logs

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/069-b2-dashboard-usage-test

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (24 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 26842454773 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@Dumbris Dumbris merged commit fa8efc5 into main Jun 3, 2026
29 checks passed
@Dumbris Dumbris deleted the fix/069-b2-dashboard-usage-test branch June 3, 2026 02:04
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.

2 participants