Repository navigation
test: localize workbench automock state - #18546
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe test suite now configures and inspects mocked APIs, services, dialogs, and telemetry through imported module methods or composables. Existing test scenarios and expectations remain generally unchanged. ChangesTest Mock Refactor
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to This is a test-side mock-access refactor; no concrete merge-blocking risk remains in the inspected changes. 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
Full details: End-To-End Regression Coverage For FixesExplanation The commit subject
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. No new findings in the changed files. Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since 6e891abd1806da620be79102a9c08ad75af1ee5f
Full docs: ADR-DEVEX-LINT-0015 🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 2124 passed, 0 failed · 1 flaky📊 Browser Reports
📦 Bundle Size
🔬 E2E Coverage
🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight This candidate changes nothing the matrix measures, so every expensive stage was skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #18546 +/- ##
==========================================
+ Coverage 83.79% 84.65% +0.86%
==========================================
Files 3026 2302 -724
Lines 149499 132287 -17212
Branches 38645 35707 -2938
==========================================
- Hits 125276 111993 -13283
+ Misses 22918 19992 -2926
+ Partials 1305 302 -1003
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…ked-cleanup Amp-Thread-ID: https://ampcode.com/threads/T-01a0cb8f-0bf7-76fa-8e50-2a14431319be # Conflicts: # src/platform/keybindings/presetService.test.ts # src/platform/secrets/api/secretsApi.test.ts # src/platform/settings/composables/useSettingsUrlLoader.integration.test.ts # src/platform/settings/globalSettingsApi.test.ts # src/platform/updates/components/ReleaseNotificationToast.test.ts # src/workbench/extensions/agent/AgentPanelRoot.test.ts # src/workbench/extensions/agent/components/agent/Composer.test.ts # src/workbench/extensions/agent/components/agent/message/MessageFeedback.test.ts # src/workbench/extensions/agent/components/agent/message/ReplyAudioCard.test.ts # src/workbench/extensions/agent/components/agent/message/TabLinkCard.test.ts # src/workbench/extensions/agent/composables/agent/useAgentConsent.test.ts # src/workbench/extensions/agent/feedback.test.ts # src/workbench/extensions/agent/services/agent/agentRestClient.test.ts # src/workbench/extensions/agent/stores/agent/agentPanelStore.test.ts # src/workbench/extensions/agent/stores/agent/agentRunModeStore.test.ts
…ked-cleanup Amp-Thread-ID: https://ampcode.com/threads/T-01a0cb8f-0bf7-76fa-8e50-2a14431319be # Conflicts: # src/workbench/extensions/agent/AgentPanelRoot.test.ts
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 5 Pipeline jobs failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 9569fdb | Docs | View more details | Give us feedback! |
benjcooley
left a comment
There was a problem hiding this comment.
[BLOCKER] Requesting changes: the alias removal is incomplete in two touched files, so the current head does not typecheck and 13 unit tests fail.
| Severity | Count |
|---|---|
| BLOCKER | 2 |
| SHOULD FIX | 0 |
| TRIVIAL | 0 |
The lint-and-format aggregate failure is downstream of the typecheck failure; the standalone lint job passes.
| assert.exists(telemetryProvider) | ||
| const telemetry = vi.mocked(telemetryProvider) | ||
|
|
||
| function getTelemetryMock() { |
There was a problem hiding this comment.
[BLOCKER] The old telemetry binding was removed, but this file still uses it at lines 3023, 3028, 3046, 3055, 3089, 3097, 3120, and 3128. The current head therefore fails typecheck and five tests throw ReferenceError: telemetry is not defined. Replace those remaining references with lifecycle-local access too. Per the unit-test review rule, please inline that access rather than keeping this getTelemetryMock() alias-by-renaming helper.
There was a problem hiding this comment.
Fixed in 9569fdb. Removed the getTelemetryMock alias, replaced all remaining stale telemetry references with direct useTelemetry() access, and kept vi.mocked only for typed .mockClear/.mock.calls access. AgentPanelRoot plus agentPanelStore now pass 287/287, and the full typecheck passes.
| return store | ||
| } | ||
|
|
||
| function getTelemetryMock() { |
There was a problem hiding this comment.
[BLOCKER] The old telemetry binding was removed, but the pagehide tests still reference it throughout lines 195–311. The current head has eleven resulting TypeScript errors and eight tests throw ReferenceError: telemetry is not defined. Migrate those references as well, and inline the singleton lookup rather than retaining this getTelemetryMock() alias-by-renaming helper.
There was a problem hiding this comment.
Fixed in 9569fdb. Removed the getTelemetryMock alias and converted every pagehide assertion to direct useTelemetry() access; the one .mock.calls inspection uses vi.mocked for typing. AgentPanelRoot plus agentPanelStore pass 287/287, and the full typecheck passes.
`test: localize workbench automock state` (#18546) removed this file's module-level `telemetry` binding and inlined every read as `useTelemetry()!`, because the automock state is now per-test rather than hoisted. That landed on main while this branch was open. Git merged the two textually with no conflict — main's deletion of the binding won, and the paywall-telemetry block added here kept referencing it — so the merge result failed to compile with 22 `TS2304: Cannot find name 'telemetry'`. The branch and main each typecheck alone, which is why only the merge queue saw it. This block now uses main's idiom: `useTelemetry()!` for assertion targets and `vi.mocked(useTelemetry())!` where the mock object itself is needed. Verified by merging current main locally: typecheck clean and the suite green at 276.
Summary
Stacked on #18501. Remove migration-introduced module-scoped aliases so automocked services are referenced at their lifecycle owner.
Changes
expect(vi.mocked(fn)).toHaveBeenCalled*wrappers across 3 tests; retainvi.mockedonly for configuration or typed.mockaccess.Review Focus
Hoisted functions required by
vi.mockcollection timing and pre-existing lifecycle-owned SUT/store fixtures remain unchanged. The stacked diff contains 15 owned test files and no shared mock changes.Verification: