Skip to content

fix(frontend): green the unit+integration suite — 89 failures, 3 uncaught errors, 7 lint errors (#9693) - #10078

Merged
mrveiss merged 9 commits into
Dev_new_guifrom
issue-9693
Jun 13, 2026
Merged

mrveiss merged 9 commits into
Dev_new_guifrom
issue-9693

Conversation

@mrveiss

@mrveiss mrveiss commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Thinking Path

The Unit & Integration Tests job has been red since the #9512 uv-deps era: 89 failing tests across 11 files, 3 uncaught exceptions bleeding across test files, a dead integration config, and 7 real eslint errors. Each failure was classified test-stale vs real-bug; 8 real runtime bugs surfaced and were fixed at root cause.

What Changed

Real bugs fixed:

  • LiveEventService/GlobalWebSocketService: module-level auto-connect timers called useUserStore() with no active Pinia (slow mount / teardown) → new shared src/utils/whenPiniaReady.ts guard (root cause of the 3 uncaught "no active Pinia" errors)
  • useConnectionTester: DOMException-based AbortErrors misclassified as unknown errors
  • vitest-setup.ts: matchMedia stub was a vi.fn() wiped by mockReset:true after the first test (root cause of SettingsPanel/ChatInterface cascades)
  • vitest.integration.config.ts: dead since Vite 7 (mergeConfig vs function-style config) — the integration job never even loaded; migrated removed Vitest 4 options
  • double MSW interception in api.integration.test.ts corrupting stateful retry handlers
  • two ReferenceErrors from underscore-renamed declarations; useTimeout this-aliasing
  • generated src/types/_generated/ + untracked storybook-static/ now lint-ignored (lint --fix kept stripping the codegen banner, which would break the feat(tooling): codegen pipeline for backend dataclasses → frontend TypeScript types (#6951 follow-up) #7122 drift check)

Stale tests repaired (component changed legitimately): ChatInterface (#6415 deep-link), CodeCell, DeclarationsSection (SVG Icon migration), RedisServiceControl, useToolApproval (apiClient migration), useRealtimeVoice (#7421), useFetchEndpoint. i18n: 474 missing keys backfilled across 10 locales (English passthrough per #7874).

Flake bound: BulkEditModal SFC-import test given a 30s timeout (compiles a real SFC; starved as file 105/105 under load — passes 4s isolated).

Lint: 7 errors fixed without suppressions (useApi→useApiClient in telemetry files — local-only framing kept, console→logger, unused vars).

Verification

npm run test:unit → 105 files, 1781 passed / 1 skipped / 0 failed / 0 unhandled errors (re-verified after rebase onto current Dev_new_gui). npm run test:integration → 28/28. npm run lint → exit 0.

Model Used

Claude Fable 5 (frontend-engineer agent) + Opus 4.8 (main session: rebase, flake bound, re-verification)

Closes #9693. Part of umbrella #9924.

@github-actions

github-actions Bot commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

mrveiss and others added 8 commits June 13, 2026 21:08
…9693)

LiveEventService and GlobalWebSocketService fired a module-level
setTimeout that unconditionally called useUserStore(). If the timer
fired before app.use(pinia) (slow mount) or after the Pinia instance
was gone (test teardown, HMR dispose), it threw an uncaught
'no active Pinia' error. New whenPiniaReady() helper polls
getActivePinia() and only runs the auto-connect + auth watch once a
Pinia instance is actually active.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ester (#9693)

fetch abort raises a DOMException, which does not inherit Error on
every platform (jsdom, older browsers). The 'error instanceof Error'
check silently missed those aborts, reporting 'Unknown connection
error' with status 'error' instead of the timeout message with status
'disconnected'. Check DOMException explicitly, matching the existing
pattern in useToolApproval.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…9693)

- vitest-setup: window.matchMedia stub must be a plain function —
  mockReset:true wiped the vi.fn() implementation after the first test,
  so every later mount got matchMedia() === undefined
- ChatInterface.test: mount with router — component reads route.meta
  for chat tab deep-linking (#6415)
- SettingsPanel.test / useNetworkStatus.test: remove broken
  underscore-renamed variables whose assignments wrote to undeclared
  identifiers (ReferenceError in every test)
- CodeCell.spec: loading state is now a skeleton with aria-label, not
  visible text
- DeclarationsSection.test: Icon.vue renders SVG (.icon-spin), not
  FontAwesome .fa-spinner
- RedisServiceControl.spec: stop-button variant renamed danger->error
- useToolApproval.spec: composable submits via apiClient.post (parsed
  JSON contract), not raw fetchWithAuth
- useRealtimeVoice.test: mocked Response needs headers.get — connect()
  reads X-Realtime-Session-Id (#7421)
- useFetchEndpoint.test: onSuccess now receives a third context arg

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
locale-parity.test.ts requires every non-English locale to carry the
exact en.json leaf-key set. 474 keys added to en.json since the last
backfill (webResearch, visionAutomation, llc.wizard, chat.share/presets,
failureAnalysis, plugins.capabilities, ...) were missing from all 10
locales. Backfilled using English passthrough copy — the established
convention from the ui.offlineBanner backfill (#7874) — preserving each
locale's existing key order and all existing translations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
)

eslint errors (7):
- TelemetryConsentModal / TelemetrySettingsPanel: migrate deprecated
  useApi (#6487) to useApiClient() — same parsed-JSON contract, no
  behavior change (telemetry stays local-only)
- ChromaDBExplorer: drop unused v-for index
- LLMProvidersView: console.error -> scoped createLogger
- thinking-mode e2e: console.log -> test.info() annotation + assertion

oxlint errors (3 no-this-alias):
- useTimeout debounce: bundle trailing-edge args + caller context into
  one pending record instead of aliasing this
- useTimeout.test: capture context via vi.fn().mock.contexts
- BaseXTerminal.spec: constructor mock returns a plain object

lint --fix churn:
- eslint+oxlint now ignore src/types/_generated/** — both kept
  stripping the generator's /* eslint-disable */ banner, which breaks
  the frontend-codegen-drift sync check (#7122)
- eslint ignores **/storybook-static/** (untracked build artifact) so
  local runs match CI
- drop vestigial eslint-disable in monitoring-integration-test.js
  (eslint never lints plain .js; oxlint stripped it on every run)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ception (#9693)

- vitest.integration.config.ts could not load at all: vite.config
  exports a function (Vite 7) and mergeConfig cannot merge a callback —
  resolve it first, same pattern vitest.config.ts already uses. Also
  migrate removed Vitest 4 options (poolOptions.forks.singleFork ->
  maxWorkers: 1, reporter -> reporters).
- api.integration.test.ts created a second setupServer() on top of the
  global one in integration-setup.ts; the stacked interceptors handled
  every request twice, doubling the stateful retry counter and making
  'handles partial API failures gracefully' resolve instead of reject.
  Export the shared server and register per-test handlers on it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… load (#9693)

The KnowledgeScopeSelector import-existence test dynamically compiles the
real BulkEditModal.vue SFC; as the last of 100+ files under CPU/memory
contention the on-demand Vue compile can exceed the 10s default and the
whole suite goes red. Passes in 4s isolated. Give the import resolution a
realistic 30s bound — the assertion itself is instant.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…migration (#9693)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mrveiss

mrveiss commented Jun 13, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto current Dev_new_gui (now includes #9724). #9724's icon-helper migration (FA-class strings → IconName) broke 19 tests across 4 knowledge-icon helper test files (the helpers were migrated but their tests weren't — invisible because frontend-test isn't gated on PRs, the #10019 hole). Aligned those test expectations to the migrated return values (commit 22eb0ea0c).

Local full-suite verification: unit 1781 passed / 1 skipped, integration 28/28, lint exit 0. Two intermittent failures (useModal 'performance' timing test, KnowledgeUpload .zip test) are load-contention flakes on a heavily-loaded dev box — both pass in isolation (83/83), neither file touched by this PR — leaving CI's cleaner runner as the arbiter.

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.

1 participant