Repository navigation
fix(test): the ui package's 692 tests never ran, and a pointer bump could not be committed - #702
Merged
Merged
Conversation
…ould not be committed Two mechanisms that hid work rather than doing it. **#469 — the tests.** `packages/ui/vitest.config.ts` set its include to `packages/scaffald-ui/src/**`, a path that has not existed since the package was renamed to `packages/ui`. `root` is the workspace root, so the glob matched zero files and vitest exited 0; with `passWithNoTests: true`, nx reported success while running nothing. 41 files, 692 tests. Fixed in Scaffald/ui#28, along with the six failures that turning them on exposed — one of which was a real crash: useSidebarState guarded reaching `window.localStorage` but not reading through it, so Safari private mode or a blocked-cookie iframe threw out of a `useState` initializer and took down every page with a sidebar. `@scaffald/ui` is dropped from the `test:unit` and `affected:test` exclusions and from prepush's TEST_EXCLUDES, so those 692 tests now gate merges. Verified: `pnpm test:unit` passes across 8 projects with the package included. **#470 — the hook.** A submodule pointer bump stages one path, `packages/ui`. The pre-commit hook matches lint output against staged paths by substring, and that path is a prefix of every file in the submodule — so a bump claimed 19 of the submodule's 20 pre-existing violations as "errors in staged files" and blocked the commit. The count is identical either side of the bump, which is the proof it introduces none of them. Every pointer bump therefore had to use --no-verify, which also skipped the checks that would have been useful. Rather than exempt gitlinks outright, the hook now resolves a staged gitlink to the files that actually changed inside the submodule between the old and new pointer, so a bump still fails on violations it genuinely introduces. Measured on a real bump: 19 claimed before, 0 after, while a bump touching Slider.tsx still reports its 3. If the pointers cannot be diffed — submodule not fetched, or newly added — the gitlink is dropped rather than guessed at; pre-push and CI still lint it. This commit is itself the test case: it carries a pointer bump and was committed with the hook running, not with --no-verify. Closes #469 Closes #470 Co-Authored-By: Claude Opus 5 <[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.
Two mechanisms that hid work rather than doing it. Both are the same shape as the CI problems fixed in #692/#697: the check reported success because it never executed.
#469 — 692 tests that never ran
packages/ui/vitest.config.tsset its include to:The package has been at
packages/uisince it was renamed.rootis the workspace root, so that glob resolved against a path that has not existed for months — it matched zero files and vitest exited 0. WithpassWithNoTests: true,nx run @scaffald/ui:testreported success while running nothing.41 test files. 692 tests.
Fixed in Scaffald/ui#28 (merged). Turning them on exposed six failures, none of them new:
useSidebarState— a real crash.safeLocalStorage()guarded reachingwindow.localStoragebut not reading or writing through it, and those are the calls that actually throw. Safari private mode, an iframe with third-party cookies blocked, and an exhausted quota all hand back a realStorageobject whosegetItem/setItemraise. The read sits in auseStateinitializer, so the throw propagated out of render and took down every page that mounts a sidebar.useResponsive— stale tests. Written against an older per-instance implementation; the hook was since rewritten to a module-level singleton store. Rewritten to drive the real viewport. Several assertions that had decayed toexpect(typeof value).toBe('number')now check the value.Modal— a test that could only pass vacuously. It pinnedDate.nowto a fixed value to clear the 200ms open guard, which guarantees the guard fires instead. Its sibling was passing for the same wrong reason.This PR bumps the pointer and drops
@scaffald/uifrom thetest:unit/affected:testexclusions and from prepush'sTEST_EXCLUDES, so those 692 now gate merges.Verified:
pnpm test:unitpasses across 8 projects with the package included;pnpm prepushgreen in 207s.#470 — the hook that blocked every pointer bump
A submodule pointer bump stages exactly one path:
packages/ui. The pre-commit hook matches lint output against staged paths by substring — and that path is a prefix of every file in the submodule.Measured: 19 of the submodule's 20 pre-existing violations were claimed as "errors in staged files". The count is identical either side of the bump, which is the proof it introduces none of them. So every pointer bump had to use
--no-verify, which also skipped the checks that would have been useful.Rather than exempt gitlinks outright — which would drop the signal — the hook now resolves a staged gitlink to the files that actually changed inside the submodule between the old and new pointer:
Slider.tsxIf the pointers cannot be diffed (submodule not fetched, or newly added) the gitlink is dropped rather than guessed at; pre-push and CI still lint it.
This PR is its own test case: it carries a pointer bump and was committed with the hook running, not with
--no-verify.Closes #469
Closes #470