Repository navigation
UN-4612 [DEV] Gate v1 unit tests on the frontend-v1-unit group and its coverage threshold - #2440
Closed
johnyrahul wants to merge 10 commits into
Closed
johnyrahul wants to merge 10 commits into
johnyrahul wants to merge 10 commits into
Conversation
…rig group - vitest.v1.config.mts runs src/v1 (minus plugins/) with its own setup, coverage report (coverage/v1) and 80% threshold; vitest.v1-plugins.config.mts runs cloud v1 plugins. vitest.config.mjs now excludes src/v1. - src/v1/test: renderV1/renderHookV1 over one pluggable provider chain (QueryClient, MemoryRouter, v1 theme root + #v1-portal), typed session and distribution, MSW at the HTTP boundary with a catch-all that fails the test naming every unmocked request, axe-core assertions, observer/matchMedia fakes. - Rig: optional vitest_config on a group (vitest runner only, must exist inside workdir), passed as --config; existing groups' commands are unchanged. - test-fixtures/v1-harness proves an unmocked request fails a real vitest run. - Deps (exact): msw 2.15.0, axe-core 4.14.0, @vitest/coverage-v8 3.2.6, @tanstack/react-query 5.104.5.
… the harness
v0's optionalPluginImports() stubbed a missing import under any /plugins/
path, so a missing v1 module imported as {} instead of failing (UN-4286's
missing-import test caught it). The v1 config now declares its own plugins
(react, svgr) and only the @v1 alias.
…-review - WebSocket: a catch-all ws.link closes unmocked sockets (1011) and records the URL; before, MSW opened a mocked socket and the test passed. - Requests started in cleanup() (unmount effects) now fail the test that unmounted: afterEach awaits pending interceptors before checking. - Requests after a file's last test fail the file from afterAll. - server.resetHandlers(...args) keeps the catch-alls last. - Overlapping axe runs are queued instead of throwing 'Axe is already running'. - A test leaving fake timers on gets real timers back before teardown. Each gap has a known-bad case in test-fixtures/v1-harness.
…, export ws - The WebSocket catch-all steps aside when a test's own ws.link() matches the URL: MSW runs every matching ws handler, so it closed mocked sockets too. - Observer fakes re-register on observe() after disconnect(). - @v1/test re-exports ws. - The harness fixtures run the lockfile's vitest via process.execPath instead of resolving npx from PATH.
# Conflicts: # frontend/bun.lock # frontend/package.json # frontend/src/v1/README.md
…2399 landed The theme slot in src/v1/test/providers.tsx swaps its stand-in for app/theme/ThemeProvider, the one-file change the harness was built for. prepareProviders stores the requested theme for it to hydrate and creates #v1-portal with lib/portal's getPortalContainer; resetProviders clears the portal, the theme storage key and the store after each test. PORTAL_CONTAINER_ID, V1_ROOT_CLASS and ThemeMode now come from lib/.
- setup.ts: settle() awaits two macrotask turns without an await-in-loop. - test_groups.py: build the manifest outside pytest.raises so only load_groups() can raise.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGS1GBTPe9YzARhNtPE
…ts coverage threshold The `v1 · Unit tests` check runs vitest.v1.config.mts, the rig's frontend-v1-unit config, so a run below v1's coverage threshold fails, and uploads the coverage report. test-fixtures/v1-unit-gate proves the threshold fails passing tests below it and that the CI job and tests/groups.yaml name the same config. The Guard fixtures check now also runs the harness fixtures. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGS1GBTPe9YzARhNtPE
|
johnyrahul
pushed a commit
that referenced
this pull request
Nov 5, 2026
…its coverage Brings over UN-4612 from #2440. The v1 · Unit tests check runs vitest.v1.config.mts, the config tests/groups.yaml gives the rig's frontend-v1-unit group, so a run below v1's coverage threshold fails, and it uploads the coverage report. test-fixtures/v1-unit-gate proves the threshold fails passing tests below it, and that the CI job and the rig group name the same config. test:v1 and the Guard fixtures check run those fixtures too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv
Contributor
Author
|
Folded into #2434 (1422fa7), which now carries the v1 unit gate, its coverage upload and the Generated by Claude Code |
johnyrahul
added a commit
that referenced
this pull request
Nov 10, 2026
…seam, purity, bundle, separation and accessibility (#2434) * UN-4363 [FEAT] Enforce the frontend v1 rules as separate PR checks (P0-T10) - ci-frontend-v1.yaml: v1 checks as their own jobs (Biome, Typecheck, Purity, Unit tests, Build/bundle/separation, Guard fixtures), moved out of the v0 typecheck job so v1 reports apart from v0. - ci-frontend-v1-seam.yaml + scripts/check-v1-seam.mjs: v1 work may change v0 (src/ outside v1, public/) only at scripts/v1-seam-allowlist.json. Change sets that touch no v1 file pass; the v0-change label turns it into a report. - scripts/check-v1-separation.mjs: no tracked plugin folder under src/v1/plugins (enterprise code stays in unstract-cloud). - scripts/check-v1-bundle.mjs: production build, then no v1 chunk or chunk it loads holds a v0 module or antd. - biome.json: a11y rules are errors under src/v1; lint:v1 fails on warnings. - 17 fixture cases proving each new guard fails and passes as specified, including two real Vite builds for the bundle guard. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv * UN-4363 [FIX] Make the v1 guard scripts executable and clear SonarCloud findings - chmod +x on the three new shebang scripts (pre-commit check-shebang-scripts-are-executable). - Explicit compare functions for every sort. - Split the bundle guard's check() into reachable() and describe() to bring its cognitive complexity under the limit; output is unchanged. - git from PATH marked NOSONAR with the reason, as in the fixture runner. - String.raw in the glob escaper; no nested template literal. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv * UN-4363 Gate v1 unit tests on the frontend-v1-unit config and upload its coverage Brings over UN-4612 from #2440. The v1 · Unit tests check runs vitest.v1.config.mts, the config tests/groups.yaml gives the rig's frontend-v1-unit group, so a run below v1's coverage threshold fails, and it uploads the coverage report. test-fixtures/v1-unit-gate proves the threshold fails passing tests below it, and that the CI job and the rig group name the same config. test:v1 and the Guard fixtures check run those fixtures too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv * UN-4363 [FIX] Read changed paths unquoted in the seam guard and run v1 checks on their config files git diff -z keeps a non-ASCII path such as src/pages/Überblick.jsx as written, so it is matched against the seam instead of slipping past both rules quoted. The v1 workflow now also runs when only ci-frontend-v1.yaml or tests/groups.yaml changes, since the unit-gate fixtures read both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv * UN-4363 [FIX] Judge the bundle by imports and test every guard the way CI runs it Addresses the review on #2434. - Bundle guard: walk the module graph from every src/v1 module (static and dynamic imports) instead of judging chunk placement, so a package shared with v0 no longer fails clean v1 code and a statically mounted v1 entry that imports v0 no longer passes. - Seam guard: read the allowlist from the base branch with --base, guard index.html, count top-level v1 files (vitest.v1.config.mts) as v1 work, and drop src/setupTests.js from the allowlist. - Separation guard: ls-files -z, so a non-ASCII name is read as written. - Fixtures: git-case.sh runs the seam and separation guards in a real repository rooted above frontend/ (renames, deletes, non-ASCII paths, a bad ref, an ignored overlay, a committed plugin, a widened allowlist); real-build bundle cases for a shared package, a static mount and a dynamic v0 import; seam glob near-misses; the 11 a11y rules pinned as errors; each v1 CI job's exact commands pinned; coverage cases just above and below 80%. makeTree leaves out a local cloud overlay. - Docs: the production build covers v1 only once v0 imports it (P0-T03); cloud plugins are for the cloud mirror (UN-4614). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv * UN-4363 [FIX] Widen the allowlist with node in the seam fixture, so it runs on macOS BSD sed has no GNU-style `sed -i`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv * UN-4363 [FEAT] Suppress a false-positive hook-dependency warning in the CodeEditor test mock The v1 lint now fails on warnings. Biome flags loads as unnecessary, but it is read per render from a mutable mock that the tests flip between renders. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv * UN-4363 [FEAT] Follow CommonJS wrapper modules in the v1 bundle guard Rollup reaches a CommonJS module through a virtual "\0<file>?commonjs-..." module. The guard dropped every virtual id, cutting the chain, so v1 could reach v0 or antd through a CommonJS package unnoticed. Virtual modules now stay in the graph, named after the file they wrap (edges merged); ones with no file behind them are "virtual:<id>" and never count as v1, v0 or antd. New fixture bundle-v1-cjs-v0 (v1 -> CommonJS lib -> v0) fails as it should. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HzRGGUgsEDiwJ56zKJ4ASv --------- Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Requested by Johny · project thread
What
v1 · Unit testscheck now runsvitest.v1.config.mts, the rig'sfrontend-v1-unitgroup config from UN-4329 [FEAT] Add the v1 unit-test harness and the frontend-v1-unit rig group #2429, so a run below v1's 80% coverage threshold fails. It also uploads the coverage report.test-fixtures/v1-unit-gate/fixtures show that passing tests fail the gate below the threshold and pass at it. They also check that the CI job andtests/groups.yamlname the same config, so the two can't drift apart.v1 · Guard fixturescheck, andtest:v1, now also run UN-4329 [FEAT] Add the v1 unit-test harness and the frontend-v1-unit rig group #2429's harness fixtures and these new ones.Why
How
test:v1script and itssrc/v1/README.mdrow, and UN-4329 [FEAT] Add the v1 unit-test harness and the frontend-v1-unit rig group #2429's version of both was kept. That merge is its own commit (b685793), and the change itself is0209198.vitest.v1-plugins.config.mts) are not gated here because OSS has none. They belong to the cloud mirror (UN-4614).Can this PR break any existing features? If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
test:v1script. No app code changes.Relevant Docs
Related Issues or PRs
Dependencies Versions / Env Variables
Notes on Testing
Run locally:
bun run test:v1: 26 test files and 247 tests pass, v1 coverage is 97% lines, and 117 fixtures pass.lint:v1,typecheck:v1,biome ci --error-on-warnings src/v1/and the seam guard all pass.Screenshots
...
Checklist
I have read and understood the Contribution Guidelines.
Generated by Claude Code