Skip to content

fix(test): the ui package's 692 tests never ran, and a pointer bump could not be committed - #702

Merged
thinkclay merged 1 commit into
mainfrom
claude/test-visibility
Sep 2, 2026
Merged

thinkclay merged 1 commit into
mainfrom
claude/test-visibility

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

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.ts set its include to:

packages/scaffald-ui/src/**/*.{test,spec}.{ts,tsx}

The package has been at packages/ui since it was renamed. root is the workspace root, so that glob resolved against a path that has not existed for months — it matched zero files and vitest exited 0. With passWithNoTests: true, nx run @scaffald/ui:test reported 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 reaching window.localStorage but 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 real Storage object whose getItem/setItem raise. The read sits in a useState initializer, 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 to expect(typeof value).toBe('number') now check the value.
  • Modal — a test that could only pass vacuously. It pinned Date.now to 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/ui from the test:unit / affected:test exclusions and from prepush's TEST_EXCLUDES, so those 692 now gate merges.

Verified: pnpm test:unit passes across 8 projects with the package included; pnpm prepush green 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:

case violations claimed
bare gitlink (before) 19 → blocked
resolved files (after) 0 → allowed
bump touching Slider.tsx 3 → still blocked

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 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

…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]>
@thinkclay
thinkclay merged commit b53bd63 into main Sep 2, 2026
8 checks passed
@thinkclay
thinkclay deleted the claude/test-visibility branch September 2, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant