Repository navigation
test(solid): migrate browser tests onto @solidjs/testing-library, lint-ban render from solid-js/web in tests (#389) - #417
Conversation
…t-ban render from solid-js/web in tests (#389) Finishes the interrupted repo-wide migration off hand-rolled `render` from 'solid-js/web' plus manual disposer arrays, onto @solidjs/testing-library, across apps/conciv and 8 Solid packages (extensions/tanstack, terminal, test-runner, try-it, ui-kit-chat, ui-kit-chat-tools, ui-kit-system, ui-kit-terminal). Critical gap found and closed: @solidjs/testing-library only self-registers its afterEach(cleanup) when `typeof afterEach === 'function'` in global scope (vitest `globals: true`), which this repo does not use. Verified against the installed package source (@solidjs/testing-library/dist/index.js) and by a failing-first regression test (packages/ui-kit-chat/test/solid-cleanup-wiring.browser.test.tsx) that fails with a strict-mode "resolved to 2 elements" violation when the wiring is absent. Wired explicitly via a shared @conciv/vitest-config/solid-cleanup entry (afterEach(cleanup)) pulled in through a new ciTestSolidBrowser() helper, consumed by every affected package's browser vitest project's setupFiles. @solidjs/testing-library is declared as an optional peerDependency of @conciv/vitest-config so the setup file's own import resolves without vitest-config forcing the dependency on non-Solid consumers; each Solid package still carries it as its own devDependency for its test files' direct imports. Adds packages/oxlint-plugin/src/solid-test-render.js: a filename-gated oxlint rule banning `render`/`hydrate` imports from solid-js/web in test files, mirroring tool-card-shell.js's structure, with a failing-first fixture suite under test/fixtures/solid-test-render and wired into .oxlintrc.json. Two legitimate shadow-DOM exemptions (ui-kit-system/test/dialog-harness.tsx, extensions/terminal/test/reload-replay.browser.test.tsx) stay on solid-js/web's render directly, since @solidjs/testing-library mounts into document.body/a supplied container rather than an arbitrary shadow root. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughBrowser tests across Conciv and UI packages now use ChangesSolid browser testing migration
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant BrowserTest
participant SolidTestingLibrary
participant VitestCleanup
BrowserTest->>SolidTestingLibrary: render component
SolidTestingLibrary-->>BrowserTest: return container or unmount
VitestCleanup->>SolidTestingLibrary: cleanup after each test
SolidTestingLibrary-->>VitestCleanup: remove rendered mounts
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/oxlint-plugin/src/solid-test-render.js`:
- Line 3: Update TEST_FILE in
packages/oxlint-plugin/src/solid-test-render.js:3-3 to match test and standalone
spec files with .ts, .tsx, .js, and .jsx extensions. Add violation fixtures
covering JavaScript or JSX tests and a standalone spec file in
packages/oxlint-plugin/test/solid-test-render.test.ts:14-39.
In `@packages/vitest-config/src/solid-cleanup-setup.ts`:
- Line 2: Declare `@solidjs/testing-library` as a dependency for
`@conciv/extension-terminal` in its package manifest, ensuring the existing
ciTestSolidBrowser() setup can load the imported cleanup symbol from
solid-cleanup-setup.ts before tests run.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 11ae6ed1-bde7-4da2-8c59-851172c10359
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (79)
.oxlintrc.jsonapps/conciv/package.jsonapps/conciv/test/attachment-dispatch.browser.test.tsxapps/conciv/test/attachment-widget.browser.test.tsxapps/conciv/test/chat-pane.browser.test.tsxapps/conciv/test/context-tracker.browser.test.tsxapps/conciv/test/engine-staleness.browser.test.tsxapps/conciv/test/grab-reference.browser.test.tsxapps/conciv/test/helpers/pane-harness.tsxapps/conciv/test/kit-controls.browser.test.tsxapps/conciv/test/launch-actions.browser.test.tsxapps/conciv/test/launch-menu.browser.test.tsxapps/conciv/test/model-selector.browser.test.tsxapps/conciv/test/notices.browser.test.tsxapps/conciv/test/panel-focus-stability.browser.test.tsxapps/conciv/test/session-selector.browser.test.tsxapps/conciv/test/tool-card-dispatch.browser.test.tsxapps/conciv/test/user-turn.browser.test.tsxapps/conciv/vitest.config.tspackages/extensions/tanstack/package.jsonpackages/extensions/tanstack/test/inspector-chip.browser.test.tsxpackages/extensions/tanstack/vitest.config.tspackages/extensions/terminal/vitest.config.tspackages/extensions/test-runner/package.jsonpackages/extensions/test-runner/test/test-card.browser.test.tsxpackages/extensions/test-runner/vitest.config.tspackages/extensions/try-it/package.jsonpackages/extensions/try-it/test/connect-pane.browser.test.tsxpackages/extensions/try-it/vitest.config.tspackages/oxlint-plugin/src/plugin.jspackages/oxlint-plugin/src/solid-test-render.jspackages/oxlint-plugin/test/fixtures/solid-test-render/clean-testing-library.tsxpackages/oxlint-plugin/test/fixtures/solid-test-render/hydrate-violation.tsxpackages/oxlint-plugin/test/fixtures/solid-test-render/render-violation.tsxpackages/oxlint-plugin/test/fixtures/solid-test-render/test/fixtures/host/main.tsxpackages/oxlint-plugin/test/fixtures/solid-test-render/unrelated-import.tsxpackages/oxlint-plugin/test/oxlintrc-solid-test-render.jsonpackages/oxlint-plugin/test/solid-test-render.test.tspackages/ui-kit-chat-tools/package.jsonpackages/ui-kit-chat-tools/test/catalog-cards.browser.test.tsxpackages/ui-kit-chat-tools/test/mount-view.tsxpackages/ui-kit-chat-tools/test/new-tool-projection.browser.test.tsxpackages/ui-kit-chat-tools/test/page-tool-cards.browser.test.tsxpackages/ui-kit-chat-tools/test/registry-card-declarations.browser.test.tsxpackages/ui-kit-chat-tools/vitest.config.tspackages/ui-kit-chat/package.jsonpackages/ui-kit-chat/test/action-bar-copy.browser.test.tsxpackages/ui-kit-chat/test/action-row.browser.test.tsxpackages/ui-kit-chat/test/card-shell-subtitle.browser.test.tsxpackages/ui-kit-chat/test/chip.browser.test.tsxpackages/ui-kit-chat/test/collapsible-card-shape.browser.test.tsxpackages/ui-kit-chat/test/collapsible-section.browser.test.tsxpackages/ui-kit-chat/test/composer-completion.browser.test.tsxpackages/ui-kit-chat/test/composer-send-morph.browser.test.tsxpackages/ui-kit-chat/test/element-preview.browser.test.tsxpackages/ui-kit-chat/test/meta-tool-card-error.browser.test.tsxpackages/ui-kit-chat/test/model-selector.browser.test.tsxpackages/ui-kit-chat/test/mount-view.tsxpackages/ui-kit-chat/test/result-image.browser.test.tsxpackages/ui-kit-chat/test/slot-instances.browser.test.tsxpackages/ui-kit-chat/test/solid-cleanup-wiring.browser.test.tsxpackages/ui-kit-chat/test/status-visual.browser.test.tsxpackages/ui-kit-chat/test/thread-auto-scroll.browser.test.tsxpackages/ui-kit-chat/test/thread-composition.browser.test.tsxpackages/ui-kit-chat/test/thread-hold.browser.test.tsxpackages/ui-kit-chat/test/tool-call-card-dispatch.browser.test.tsxpackages/ui-kit-chat/vitest.config.tspackages/ui-kit-system/package.jsonpackages/ui-kit-system/test/dialog-harness.tsxpackages/ui-kit-system/test/dialog.browser.test.tsxpackages/ui-kit-system/test/text-field.browser.test.tsxpackages/ui-kit-system/test/tooltip-icon-button.browser.test.tsxpackages/ui-kit-system/vitest.config.tspackages/ui-kit-terminal/package.jsonpackages/ui-kit-terminal/test/terminal.test.tsxpackages/ui-kit-terminal/vitest.config.tspackages/vitest-config/package.jsonpackages/vitest-config/src/reporters.tspackages/vitest-config/src/solid-cleanup-setup.ts
💤 Files with no reviewable changes (1)
- apps/conciv/test/engine-staleness.browser.test.tsx
| @@ -0,0 +1,46 @@ | |||
| import {isIdentifier} from './ast-walk.js' | |||
|
|
|||
| const TEST_FILE = /(^|[\\/])test[\\/].*\.tsx?$|\.test\.tsx?$/ | |||
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Match all supported test-file names.
Line 3 does not match .js, .jsx, or standalone .spec.* files. A test such as widget.spec.jsx can therefore import render or hydrate from solid-js/web without a diagnostic.
packages/oxlint-plugin/src/solid-test-render.js#L3-L3: include JavaScript, JSX, and.specsuffixes inTEST_FILE.packages/oxlint-plugin/test/solid-test-render.test.ts#L14-L39: add violation fixtures for a JavaScript or JSX test and a standalone spec file.
Proposed matcher update
-const TEST_FILE = /(^|[\\/])test[\\/].*\.tsx?$|\.test\.tsx?$/
+const TEST_FILE = /(^|[\\/])test[\\/].*\.[jt]sx?$|\.(?:test|spec)\.[jt]sx?$/As per coding guidelines, **/*.{test,spec}.{ts,tsx,js,jsx} is an explicitly supported test-file pattern.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const TEST_FILE = /(^|[\\/])test[\\/].*\.tsx?$|\.test\.tsx?$/ | |
| const TEST_FILE = /(^|[\\/])test[\\/].*\.[jt]sx?$|\.(?:test|spec)\.[jt]sx?$/ |
📍 Affects 2 files
packages/oxlint-plugin/src/solid-test-render.js#L3-L3(this comment)packages/oxlint-plugin/test/solid-test-render.test.ts#L14-L39
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/oxlint-plugin/src/solid-test-render.js` at line 3, Update TEST_FILE
in packages/oxlint-plugin/src/solid-test-render.js:3-3 to match test and
standalone spec files with .ts, .tsx, .js, and .jsx extensions. Add violation
fixtures covering JavaScript or JSX tests and a standalone spec file in
packages/oxlint-plugin/test/solid-test-render.test.ts:14-39.
Source: Coding guidelines
| @@ -0,0 +1,4 @@ | |||
| import {afterEach} from 'vitest' | |||
| import {cleanup} from '@solidjs/testing-library' | |||
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Expect every Solid browser test package to resolve `@solidjs/testing-library`.
rg -n -C 2 '"`@conciv/vitest-config`"|"`@solidjs/testing-library`"' --glob 'package.json' .
rg -n -C 2 '\bciTestSolidBrowser\s*\(' --glob '*.ts' .Repository: conciv-dev/conciv
Length of output: 23352
🏁 Script executed:
printf '%s\n' '--- skill files ---'
find .. -iname '*skill*' -o -iname 'AGENTS.md' -o -iname 'CONTRIBUTING.md' | head -80
printf '%s\n' '--- relevant manifests and setup ---'
sed -n '1,140p' packages/vitest-config/package.json
sed -n '1,100p' packages/vitest-config/src/solid-cleanup-setup.ts
sed -n '1,90p' packages/vitest-config/src/reporters.ts
for f in \
apps/conciv/package.json \
packages/ui-kit-terminal/package.json \
packages/ui-kit-chat/package.json \
packages/ui-kit-chat-tools/package.json \
packages/ui-kit-system/package.json \
packages/extensions/try-it/package.json \
packages/extensions/test-runner/package.json \
packages/extensions/terminal/package.json \
packages/extensions/tanstack/package.json; do
printf '\n--- %s ---\n' "$f"
cat "$f"
doneRepository: conciv-dev/conciv
Length of output: 36319
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- skill files ---'
find .. \( -iname '*skill*' -o -name 'AGENTS.md' -o -name 'CONTRIBUTING.md' \) -print | head -80
printf '%s\n' '--- relevant manifests and setup ---'
sed -n '1,140p' packages/vitest-config/package.json
sed -n '1,100p' packages/vitest-config/src/solid-cleanup-setup.ts
sed -n '1,90p' packages/vitest-config/src/reporters.ts
for f in \
apps/conciv/package.json \
packages/ui-kit-terminal/package.json \
packages/ui-kit-chat/package.json \
packages/ui-kit-chat-tools/package.json \
packages/ui-kit-system/package.json \
packages/extensions/try-it/package.json \
packages/extensions/test-runner/package.json \
packages/extensions/terminal/package.json \
packages/extensions/tanstack/package.json; do
printf '\n--- %s ---\n' "$f"
cat "$f"
doneRepository: conciv-dev/conciv
Length of output: 10317
🏁 Script executed:
python3 - <<'PY'
import json
import pathlib
import re
root = pathlib.Path('.')
config = json.loads((root / 'packages/vitest-config/package.json').read_text())
peer = '`@solidjs/testing-library`'
print('optional_peer:', config.get('peerDependenciesMeta', {}).get(peer, {}).get('optional'))
print('peer_range:', config.get('peerDependencies', {}).get(peer))
calls = []
for path in root.rglob('*.ts'):
text = path.read_text(errors='replace')
if re.search(r'\bciTestSolidBrowser\s*\(', text):
calls.append(path)
for path in sorted(calls):
manifest = path.parent
while manifest != root and not (manifest / 'package.json').exists():
manifest = manifest.parent
data = json.loads((manifest / 'package.json').read_text()) if (manifest / 'package.json').exists() else {}
deps = {}
for group in ('dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'):
if peer in data.get(group, {}):
deps[peer] = group
print(f'{path}: manifest={manifest / "package.json"} {deps or "MISSING"}')
PY
printf '%s\n' '--- setup resolution and config export ---'
rg -n -C 5 'solid-cleanup|SOLID_CLEANUP_SETUP_ENTRY|setupFiles|from .solid-cleanup' packages/vitest-config/src packages/vitest-config/package.jsonRepository: conciv-dev/conciv
Length of output: 3633
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- repository guidance ---'
cat AGENTS.md
printf '%s\n' '--- review skill ---'
cat .claude/skills/conciv-review/SKILL.md
printf '%s\n' '--- code-review skill ---'
cat .github/skills/code-review/SKILL.mdRepository: conciv-dev/conciv
Length of output: 32697
🏁 Script executed:
set -euo pipefail
pnpm dlx `@tanstack/intent`@latest listRepository: conciv-dev/conciv
Length of output: 1919
Declare @solidjs/testing-library for @conciv/extension-terminal.
packages/extensions/terminal/vitest.config.ts calls ciTestSolidBrowser(), but its manifest does not declare @solidjs/testing-library. The setup file imports this optional peer at load time, so Vitest can fail before tests run.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/vitest-config/src/solid-cleanup-setup.ts` at line 2, Declare
`@solidjs/testing-library` as a dependency for `@conciv/extension-terminal` in its
package manifest, ensuring the existing ciTestSolidBrowser() setup can load the
imported cleanup symbol from solid-cleanup-setup.ts before tests run.
There was a problem hiding this comment.
Pull request overview
Migrates Solid browser tests to Solid Testing Library, adds explicit cleanup wiring, and prevents regressions through linting.
Changes:
- Adds shared
afterEach(cleanup)browser-test configuration. - Migrates tests away from manual Solid render disposal.
- Adds and tests a lint rule banning direct Solid web rendering in tests.
Reviewed changes
Copilot reviewed 79 out of 80 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pnpm-lock.yaml |
Records testing-library dependencies. |
packages/vitest-config/src/solid-cleanup-setup.ts |
Registers Solid cleanup. |
packages/vitest-config/src/reporters.ts |
Adds browser-test configuration helper. |
packages/vitest-config/package.json |
Exports cleanup setup and peers. |
packages/ui-kit-terminal/vitest.config.ts |
Enables shared cleanup. |
packages/ui-kit-terminal/test/terminal.test.tsx |
Migrates terminal rendering. |
packages/ui-kit-terminal/package.json |
Adds testing-library dependency. |
packages/ui-kit-system/vitest.config.ts |
Enables shared cleanup. |
packages/ui-kit-system/test/tooltip-icon-button.browser.test.tsx |
Removes manual disposal. |
packages/ui-kit-system/test/text-field.browser.test.tsx |
Migrates text-field rendering. |
packages/ui-kit-system/test/dialog.browser.test.tsx |
Migrates dialog rendering. |
packages/ui-kit-system/test/dialog-harness.tsx |
Updates regular and shadow mounts. |
packages/ui-kit-system/package.json |
Adds testing-library dependency. |
packages/ui-kit-chat/vitest.config.ts |
Enables shared cleanup. |
packages/ui-kit-chat/test/tool-call-card-dispatch.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/thread-hold.browser.test.tsx |
Migrates thread harness. |
packages/ui-kit-chat/test/thread-composition.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/thread-auto-scroll.browser.test.tsx |
Migrates scroll harness. |
packages/ui-kit-chat/test/status-visual.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/solid-cleanup-wiring.browser.test.tsx |
Verifies test isolation. |
packages/ui-kit-chat/test/slot-instances.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/result-image.browser.test.tsx |
Migrates image rendering. |
packages/ui-kit-chat/test/mount-view.tsx |
Uses testing-library rendering. |
packages/ui-kit-chat/test/model-selector.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/meta-tool-card-error.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/element-preview.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/composer-send-morph.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/composer-completion.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/collapsible-section.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/collapsible-card-shape.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/chip.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/card-shell-subtitle.browser.test.tsx |
Migrates card rendering. |
packages/ui-kit-chat/test/action-row.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/test/action-bar-copy.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat/package.json |
Adds testing-library dependency. |
packages/ui-kit-chat-tools/vitest.config.ts |
Wires shared cleanup setup. |
packages/ui-kit-chat-tools/test/registry-card-declarations.browser.test.tsx |
Uses centralized cleanup. |
packages/ui-kit-chat-tools/test/page-tool-cards.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat-tools/test/new-tool-projection.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat-tools/test/mount-view.tsx |
Uses testing-library rendering. |
packages/ui-kit-chat-tools/test/catalog-cards.browser.test.tsx |
Removes local cleanup. |
packages/ui-kit-chat-tools/package.json |
Adds testing-library dependency. |
packages/oxlint-plugin/test/solid-test-render.test.ts |
Tests the new lint rule. |
packages/oxlint-plugin/test/oxlintrc-solid-test-render.json |
Configures lint fixtures. |
packages/oxlint-plugin/test/fixtures/solid-test-render/unrelated-import.tsx |
Covers allowed imports. |
packages/oxlint-plugin/test/fixtures/solid-test-render/test/fixtures/host/main.tsx |
Covers host exemption. |
packages/oxlint-plugin/test/fixtures/solid-test-render/render-violation.tsx |
Covers forbidden render. |
packages/oxlint-plugin/test/fixtures/solid-test-render/hydrate-violation.tsx |
Covers forbidden hydration. |
packages/oxlint-plugin/test/fixtures/solid-test-render/clean-testing-library.tsx |
Covers valid rendering. |
packages/oxlint-plugin/src/solid-test-render.js |
Implements the lint rule. |
packages/oxlint-plugin/src/plugin.js |
Registers the lint rule. |
packages/extensions/try-it/vitest.config.ts |
Enables shared cleanup. |
packages/extensions/try-it/test/connect-pane.browser.test.tsx |
Migrates pane rendering. |
packages/extensions/try-it/package.json |
Adds testing-library dependency. |
packages/extensions/test-runner/vitest.config.ts |
Enables shared cleanup. |
packages/extensions/test-runner/test/test-card.browser.test.tsx |
Migrates card rendering. |
packages/extensions/test-runner/package.json |
Adds testing-library dependency. |
packages/extensions/terminal/vitest.config.ts |
Enables shared cleanup. |
packages/extensions/tanstack/vitest.config.ts |
Enables shared cleanup. |
packages/extensions/tanstack/test/inspector-chip.browser.test.tsx |
Migrates chip rendering. |
packages/extensions/tanstack/package.json |
Adds testing-library dependency. |
apps/conciv/vitest.config.ts |
Enables shared cleanup. |
apps/conciv/test/user-turn.browser.test.tsx |
Migrates thread rendering. |
apps/conciv/test/tool-card-dispatch.browser.test.tsx |
Migrates card rendering. |
apps/conciv/test/session-selector.browser.test.tsx |
Removes manual disposal. |
apps/conciv/test/panel-focus-stability.browser.test.tsx |
Migrates router rendering. |
apps/conciv/test/notices.browser.test.tsx |
Migrates toaster rendering. |
apps/conciv/test/model-selector.browser.test.tsx |
Migrates selector rendering. |
apps/conciv/test/launch-menu.browser.test.tsx |
Migrates menu rendering. |
apps/conciv/test/launch-actions.browser.test.tsx |
Removes manual disposal. |
apps/conciv/test/kit-controls.browser.test.tsx |
Migrates control rendering. |
apps/conciv/test/helpers/pane-harness.tsx |
Migrates shared pane harness. |
apps/conciv/test/grab-reference.browser.test.tsx |
Migrates reference rendering. |
apps/conciv/test/engine-staleness.browser.test.tsx |
Removes manual disposal. |
apps/conciv/test/context-tracker.browser.test.tsx |
Migrates tracker rendering. |
apps/conciv/test/chat-pane.browser.test.tsx |
Removes manual disposal. |
apps/conciv/test/attachment-widget.browser.test.tsx |
Migrates widget rendering. |
apps/conciv/test/attachment-dispatch.browser.test.tsx |
Migrates attachment rendering. |
apps/conciv/package.json |
Adds testing-library dependency. |
.oxlintrc.json |
Enables the lint rule and exemptions. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| dispose() | ||
| host.remove() | ||
| }, | ||
| dispose: mounted.unmount, |
…rap onCleanup (#469) * fix(test+router): #462 router-owned extension-instance disposal via Wrap onCleanup createConcivRouter now passes a Wrap component to createRouter that registers onCleanup to dispose every extension instance, riding whatever unmounts the tree rendering RouterProvider (solid-router renders Wrap inside its reactive root). This replaces disposeConcivRouter, an export every consumer had to remember to pair with unmount by hand — packages/embed/src/mount-impl.tsx and three apps/conciv browser suites carried ad hoc disposer arrays for exactly that reason. Central DOM cleanup (afterEach(cleanup) from @conciv/vitest-config/solid-cleanup, added in #417) already unmounts every rendered tree between tests, so the apparent "leak" was never a missing unmount call — it was extension instances nothing in the render tree owned. Phase 1 evidence (see PR body) confirmed both: no DOM persists across tests on main, and a plain render+unmount with no manual disposeConcivRouter call never disposes an extension instance. router.ts becomes router.tsx (the Wrap needs a JSX fragment to satisfy the solid/reactivity lint rule against returning props.children bare), with the apps/conciv/package.json "./router" export updated to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(app): cover throw-resilient extension disposal in the Wrap onCleanup path The deleted router-restore.browser.test.ts test proved three extensions all get disposed even when the middle one's dispose() throws. That semantic still lives in disposeInstances but the new router-wrap-disposal suite only covered a single extension with no throw. Extends it with a second test: three extensions, middle disposer throws, unmount via the render result, assert it doesn't throw and every disposer ran exactly once in order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(app): explicit idempotent disposal path for a router that is never rendered Copilot review on #469 flagged that Wrap-owned disposal only fires once Solid actually mounts the tree: a router created via createConcivRouter but never rendered through RouterProvider has no disposal owner for its eagerly-created extension instances (createInstances runs at router-creation time, not inside Wrap). Confirmed real before touching anything: packages/embed/src/mount-impl.tsx reads router.options.context.instances synchronously right after createConcivRouter returns, to build the page-tool driver, before render() ever runs — so deferring instance creation into Wrap's component body (the originally proposed fix) would leave that driver built with zero tools and zero effects on every real widget boot. Grepped every other reader (extension-slots.tsx, app/context.ts, routes/__root.tsx) and confirmed they all read post-render, inside the routed component tree Wrap wraps. Fix, kept as one mechanism: createConcivRouter still creates instances eagerly, but now builds a single guarded disposer (closure flag; first call disposes every instance with the existing try/catch semantics, every later call is a no-op) and stores it on context as disposeInstances. Wrap's onCleanup calls it. disposeConcivRouter is re-exported as a one-line call to that same disposer, giving mount-impl.tsx (and any router that boot-fails before render) an explicit, idempotent owner: calling it after a normal unmount is a no-op, and calling it twice on a never-rendered router disposes exactly once. packages/embed/src/mount-impl.tsx: re-added disposeConcivRouter(router) to both bootNormal's and bootConnect's disposer lists. apps/conciv/test/router-wrap-disposal.browser.test.tsx: two new tests (idempotent after unmount; disposes + is idempotent when never rendered), with the three single-extension setups deduped through a routerWithDisposeSpy helper (fallow flagged the near-identical inline setups as introduced duplication). Verified red (missing export) against the pre-fix source, green with the fix restored via a manual git-checkout revert-check (no stash). The three already-migrated suites (route-boundary, panel-focus-stability, router-restore) are untouched — Wrap alone still covers them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Part of epic #409.
Summary
Finishes an interrupted repo-wide migration: browser tests move off hand-rolled
renderfromsolid-js/webplus manual disposer arrays, onto@solidjs/testing-library, acrossapps/concivand 8 Solid packages (extensions/tanstack,terminal,test-runner,try-it,ui-kit-chat,ui-kit-chat-tools,ui-kit-system,ui-kit-terminal).Critical finding: cleanup wasn't wired
@solidjs/testing-libraryonly self-registers itsafterEach(cleanup)whentypeof afterEach === 'function'in global scope (vitestglobals: true). This repo does not use vitest globals, so without explicit wiring the migration would have been a silent no-op (or a DOM leak across tests).Verified directly against the installed package source:
And with a failing-first regression test (
packages/ui-kit-chat/test/solid-cleanup-wiring.browser.test.tsx): with the wiring temporarily removed, the second of two tests that each mount an identically-named button fails withstrict mode violation: getByRole('button', ...) resolved to 2 elements— proof the previous test's DOM leaked. With wiring restored, both tests pass.Fix: shared, explicit setupFiles wiring
packages/vitest-config/src/solid-cleanup-setup.ts—afterEach(cleanup), exported as the@conciv/vitest-config/solid-cleanupsubpath.packages/vitest-config/src/reporters.ts— newciTestSolidBrowser()helper:{...ciTest(), setupFiles: ['@conciv/vitest-config/solid-cleanup']}.ciTestSolidBrowser()(or spreads itssetupFiles) instead of bareciTest().@solidjs/testing-libraryis an optional peerDependency of@conciv/vitest-config(verified pnpm resolves it correctly from each consumer's own devDependency — confirmed empirically per-package, and thatpackages/extensions/terminalneeded no direct devDependency on it at all, since it has no direct import, only the transitive setup file; fallow's dead-dependency check caught that one and it was removed).Lint: ban the footgun at the source
packages/oxlint-plugin/src/solid-test-render.js— a new filename-gated rule (mirrorstool-card-shell.js's structure) banningrender/hydrateimports fromsolid-js/webin test files, with a failing-first fixture suite underpackages/oxlint-plugin/test/fixtures/solid-test-render/and wired into.oxlintrc.jsonasconciv/solid-test-render: error.Two legitimate exemptions (file-level
.oxlintrc.jsonoverrides, not rule-level):packages/ui-kit-system/test/dialog-harness.tsxandpackages/extensions/terminal/test/reload-replay.browser.test.tsxboth mount into a shadow root they create themselves —@solidjs/testing-library'srender()mounts intodocument.bodyor a supplied container, not an arbitrary shadow root, so these keepsolid-js/web'srenderdirectly with their own manual disposal.Test plan
pnpm turbo run typecheckfor all 11 touched packages — 44 tasks, all greenTURBO_CONCURRENCY=1 VITEST_MAX_FORKS=1 pnpm turbo run test --concurrency=1for all 11 touched packages, 3 foreground batches — all green, zero skipspackages/oxlint-pluginown suite (including the new rule's fixtures) — greenpnpm lint&&pnpm format:check— cleanpnpm exec fallow audit --changed-since origin/main --format json --quiet— verdictpass, zero introduced findings (one introduced dead-dependency and one introduced complexity finding were found and fixed during this PR: removed terminal's unneeded direct@solidjs/testing-librarydevDependency, and split a helper out of the new lint rule to bring cyclomatic complexity under the threshold)🤖 Generated with Claude Code
Summary by CodeRabbit