Repository navigation
fix(frontend): green the unit+integration suite — 89 failures, 3 uncaught errors, 7 lint errors (#9693) - #10078
Conversation
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
…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>
|
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 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. |
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 calleduseUserStore()with no active Pinia (slow mount / teardown) → new sharedsrc/utils/whenPiniaReady.tsguard (root cause of the 3 uncaught "no active Pinia" errors)useConnectionTester: DOMException-based AbortErrors misclassified as unknown errorsvitest-setup.ts: matchMedia stub was avi.fn()wiped bymockReset:trueafter the first test (root cause of SettingsPanel/ChatInterface cascades)vitest.integration.config.ts: dead since Vite 7 (mergeConfigvs function-style config) — the integration job never even loaded; migrated removed Vitest 4 optionsapi.integration.test.tscorrupting stateful retry handlersuseTimeoutthis-aliasingsrc/types/_generated/+ untrackedstorybook-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.