Skip to content

fix(vitest): read configs and jest-dom setup files that never import vitest (UPT-85) - #195

Merged
lucasbraum merged 1 commit into
mainfrom
lucasbraum/upt-85-vitest-pack-raise-breaking-recall-from-50-using-ground-truth
Oct 17, 2026
Merged

lucasbraum merged 1 commit into
mainfrom
lucasbraum/upt-85-vitest-pack-raise-breaking-recall-from-50-using-ground-truth

Conversation

@lucasbraum

Copy link
Copy Markdown
Collaborator

Fixes UPT-85.

Why the pack missed half the sites

Grouped the 16 breaking false negatives from pnpm uptide pack test vitest on main:

cause misses
scanner not reaching the file: vitest.config.ts that imports defineConfig from ../../../vitest.config.shared.mjs, never vitest 13 (coverage-patterns)
scanner not reaching the file: setup file whose only vitest import is import '@testing-library/jest-dom/vitest' 2 (jest-dom-matchers)
no signal: the describe wrapper in render_ballot.bench.ts:16 1 (bench-api)

The detectors already matched these sites (their fixtures pass). detect only reads files that import the package, plus the pack's inventory, and vitest had none.

Change

  • inventory: ['{vite,vitest}.config.{ts,mts,cts,js,mjs,cjs}']: config files are outside the tsconfig include, so they're read as inventory (as the typescript, next and express packs do).
  • runtimeFindings adds project files that name @testing-library/jest-dom, the same pattern as the ai pack's vi.mock('ai') files (UPT-33).
  • New test: a workspace where neither the config nor the setup file imports vitest. It fails on main and passes here.

Before → after (same pinned ground truth, --offline)

rule before after
coverage-patterns 0 / 13 13 / 13
jest-dom-matchers 11 / 13 13 / 13
matcher-types 3 / 3 3 / 3
bench-api 2 / 3 2 / 3
breaking recall 50% (16/32) 97% (31/32)
breaking FP 0 0
behavior-note recall 0% (0/13) 100% (13/13)
unverified / generic FP 15,336 15,336 (unchanged)
status verified verified

Left unfixed

  • libs/hmpb/src/render_ballot.bench.ts:16 bench-api: the describe wrapper that becomes a test receiving { bench }. No compiler error lands on that line (the error is on the bench import at line 2, and that site is found). The ground truth already records it as a site no check signal covers yet. Catching it would need a source detector for describe blocks that contain bench( calls. That's a separate rule with its own fixtures, so I left it out of this PR.

Ground truth, its declaration method and thresholds are unchanged. verification.json comes from pack test vitest --write, and the README/compatibility tables come from pnpm docs:packs.

Checks

  • pnpm uptide pack test vitest --offline --write: PASS, verified, 1 false negative (above)
  • @uptide/core tests: 2012 passed. tsc --noEmit is clean. pnpm lint is clean apart from 1 warning that is already on main.

🤖 Generated with Claude Code

…vitest (UPT-85)

Breaking recall 50% -> 97% (16 -> 31 of 32 sites), 0 breaking FP.
15 of the 16 misses were files `detect` never read: vitest.config.ts
files that take defineConfig from a shared file, and setup files whose
only vitest import is '@testing-library/jest-dom/vitest'.

- inventory: {vite,vitest}.config.{ts,mts,cts,js,mjs,cjs}
- runtimeFindings adds project files that name @testing-library/jest-dom
  (same pattern as the ai pack's vi.mock files, UPT-33)

Ground truth and thresholds unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
@lucasbraum
lucasbraum force-pushed the lucasbraum/upt-85-vitest-pack-raise-breaking-recall-from-50-using-ground-truth branch from 1202e70 to e9f0168 Compare October 17, 2026 06:26
@lucasbraum
lucasbraum merged commit 15b3b3e into main Oct 17, 2026
28 checks passed
@lucasbraum
lucasbraum deleted the lucasbraum/upt-85-vitest-pack-raise-breaking-recall-from-50-using-ground-truth branch October 17, 2026 16:48
@uptide-release uptide-release Bot mentioned this pull request Oct 17, 2026
lucasbraum added a commit that referenced this pull request Oct 17, 2026
…PT-89) (#202)

Scanner reach audit for every pack except zod and react (UPT-86 /
UPT-87). Fixes UPT-89.

Method: classified every breaking false negative from the latest
successful Packs run on main (3f81193) by path, then shallow-cloned (no
install, deleted after) only the repos where the path did not settle it,
and checked whether each miss file imports the package and is inside a
tsconfig include. Only `@sentry/browser` and
`@sentry/nextjs`/`@sentry/react` were re-scored locally, since only the
Sentry packs changed.

## Reach table (breaking false negatives, before)

| Pack | FN | In unreached files | Shape |
|---|---|---|---|
| ai | 2 | 0 | reached, compile-diff sites |
| express | 13 | 0 | reached; 3 are route paths in a mock-API helper
that never imports express (ground-truth quirk, not reach) |
| ioredis | 2 | 0 | reached test file |
| joi, lucide-react, sentry-nextjs | 0 | 0 | |
| next | 4 | 0 | reached (config + app files) |
| openai | 17 | 0 | reached, compile-diff sites |
| react-router | 2 | 0 | reached test files |
| redis | 3 | 0 | reached (wrapper fix already landed, UPT-66) |
| **@sentry/browser** | 11 | **10** | JS file outside the tsconfig
include that requires `@sentry/core`, not `@sentry/browser` — **fixed
here** |
| @sentry/react | 8 | 0 for this pack | the checked server files import
`@sentry/node`, a different pack's package; the JS miss is already in
the inventory glob (a rule miss). 6 repos need git-lfs to score locally,
so not changed |
| stripe | 2 | 0 | reached |
| typescript | 20 | 0 | tsconfig files and project files |
| vitest | 1 | 0 | reached (reach fixed in #195) |

Every other miss is a rule miss on a reached file, not a reach gap. No
cross-pack reach shape repeats beyond the ones already fixed (vitest
#195, ai, redis), so I added no shared inventory helper for them.
`packs/reach.ts` (`scriptsMentioning`) is additive; vitest/ai/redis are
untouched.

## Fix

The Sentry packs add `.js/.jsx/.mjs/.cjs` files that mention `@sentry/`
(skipping `dist`, `build`, `out`, `coverage`, `vendor`, files over 200
KB) to the files their base `runtimeFindings` reads.

| | breaking TP | FN | FP | recall | status |
|---|---|---|---|---|---|
| @sentry/browser before | 11 | 11 | 0 | 50% | verified |
| @sentry/browser after | 18 | 4 | 0 | 82% | verified |
| @sentry/nextjs | 8 | 0 | 0 | 100% | verified, unchanged |
| @sentry/react | unchanged on the 8 repos that score locally; the other
6 could not be scored without git-lfs | | | | candidate |

Overall false positives for `@sentry/browser` stay 0. `renamed-exports`
is now exercised (7 TPs). Ground truth and thresholds unchanged.
`verification.json` and the docs table are regenerated for
`@sentry/browser` only.

## Shared-hook audit (from the UPT-86 lead)

A pack that overrides `runtimeFindings` without running the base hook
drops every rule that fires through `detect`.

- zod: overrides without the base (UPT-86 owns it; excluded from the
guard).
- stripe: overrides without the base, but has 0 detecting rules or
behaviors, so nothing is dropped today.
- ai, vitest, redis: wrap the base; fine.
- New `runtime-findings.test.ts`: for every registered pack,
`runtimeFindings` must report each site `detect` finds in the pack's
fixtures (86 cases). zod is listed in one constant to remove once UPT-86
lands.

## Tests

- Sentry reach test: fails on main, passes here (JS file requiring
`@sentry/core` found; `dist/` copy and unrelated file ignored).
- `vitest run src/packs`: 436 passed. Typecheck and biome clean.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Lucas Braum <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
lucasbraum pushed a commit that referenced this pull request Oct 17, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## [email protected]

### Patch Changes

- [#191](#191)
[`db1d384`](db1d384)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The ai pack now
reports AI SDK 7 renames in tests that `vi.mock('ai')` or
`jest.mock('ai')` without importing it: the mock factory's `stepCountIs`
key, and `onFinish` and the other renamed options read by fakes of `ai`
calls such as `toUIMessageStreamResponse`.

- [#196](#196)
[`fa6f788`](fa6f788)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` no longer
runs out of memory type-checking monorepos whose root tsconfig includes
every package: each workspace's program holds only the files that
workspace owns, and the baseline check releases one workspace's program
before building the next. When the analysis thread does run out of
memory, `fix` says the repository is too large for analysis instead of
crashing, and its temporary clone is removed on every exit path, a
crashed or out-of-memory analysis thread included.

- [#190](#190)
[`cdf7f69`](cdf7f69)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `check <pkg>` no
longer returns nothing for an outdated dependency used only through
config files (typescript through tsconfig): it is always reported, with
the reason, including when its workspace's analysis fails or the time
budget runs out. Analysis no longer fails with ENAMETOOLONG on a package
that links itself (Yarn `link:.`).

- [#186](#186)
[`5e01ef3`](5e01ef3)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Keep the
migration's starting branch and commit in reports and diff hints,
including after re-verification. Default hints to `npx uptide`, use
`uptide` only when the command on PATH resolves to the running binary,
keep shared reports portable, and preserve explicit flags accepted by
suggested commands, including peer retry budgets and workspace-root
retries.

- [#197](#197)
[`b51ca9b`](b51ca9b)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Suggested
commands no longer print `uptide` when the launcher found is a
project-local `node_modules/.bin` entry (as under `pnpm run`/`pnpm exec`
or npm scripts); only a real global install does, otherwise `npx
uptide`.

- [#187](#187)
[`6fe81b4`](6fe81b4)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Prevent `fix`
from failing with `spawnSync git ENOBUFS` when Git output exceeds 1 MiB
in large repositories. Raise the buffered output limit to 256 MiB for
shared Git operations and source-version status checks.

- [#185](#185)
[`98a3119`](98a3119)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Detect removed
Zod error members on local results of schemas imported through
repository modules, including awaited safeParseAsync calls, so their
`.errors` reads can migrate to `.issues`.

- [#193](#193)
[`a68fea3`](a68fea3)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` no longer
refuses on lockfile changes the upgrade didn't cause. When the install
guard finds resolutions outside the upgrade's subtree, it runs the same
install at the parent commit and judges the upgrade against that
lockfile. Churn the parent install already produces is listed as
"Lockfile churn the parent commit already has" and never blocks; changes
only the upgrade makes are still refused, or listed for review in
agent-led runs.

- [#180](#180)
[`549edc3`](549edc3)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Update
conflicting root pins automatically when preparing draft PRs, including
App/Action runs, and list the changes at the top of the PR under "Root
pins changed: review". Add `updatePins: false` in `uptide.yml` to opt
out. Local runs still require explicit `--update-pins` consent.

- [#188](#188)
[`69b1c88`](69b1c88)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Continue `fix` as
an agent-led draft instead of exiting 2 when a preflight refusal has an
assisting agent: peer blockers that need a major run as the plan's
suggested command, root pins without consent are updated (an explicit
`updatePins: false` still refuses), companions that cannot move together
leave the lead alone, and the install check reports out-of-scope
resolutions for review. The reason heads the PR body and the terminal
summary, next to feedback rounds and spend. Without an agent, with
`--no-llm`, or on a downgrade, `fix` still refuses.

- [#188](#188)
[`69b1c88`](69b1c88)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` makes the
no-pack stop (no agent, or a major for a PR) before cloning or
installing. When the check returns nothing to analyze for an outdated
package, `fix` now says so instead of "has no upgrade", and an agent
continues as a draft. Lockfile resolutions an agent-led install changed
outside the upgrade are listed for review in the PR body and the
terminal summary. Downgrades, key-like settings in `uptide.config.json`,
credentials in `OPENAI_BASE_URL` and unsafe run reports throw
`SafetyRefusal`, which no fallback continues past.

- [#194](#194)
[`7dd3259`](7dd3259)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Stop `fix` in
preflight on npm when a package that moves, or a peer npm installs for
it, rejects a package that stays installed: vitest 5 peers on vite, and
vite 8 rejects the repository's esbuild 0.25. Before, npm refused the
install after the clone. The row names the chain, and `--allow-peer`
writes the override.

-
[`4c3dc23`](4c3dc23)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `uptide pack
test` now prints the precision of every rule with a rewrite, breaking or
not, and warns when one is below 80%. It is a warning only: no pack's
status and no rule's run mode changes. The compatibility matrix lists
each rewrite's precision.

- [#179](#179)
[`9112f2b`](9112f2b)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Add `fix
--update-pins` to explicitly approve updates to conflicting root Yarn
resolutions and npm/pnpm overrides for the target and its companions.
Preserve unrelated pins, update root declarations and pnpm catalogs
together, report pin changes, and reject ambiguous selectors before
installation.

- [#192](#192)
[`3f81193`](3f81193)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The
`@sentry/browser` 10 to 11 pack is verified again: 5 public upgrades, 22
real breaking sites, breaking precision 100% and recall 50%.
`@sentry/react` stays a candidate: its ground truth grew to 14 public
upgrades and 29 breaking sites, with 3 false positives among its
breaking findings.

- [#202](#202)
[`51a6f70`](51a6f70)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The Sentry packs
now read JavaScript files that only require another Sentry package
(`@sentry/core`, a sibling SDK of the same release), which the
TypeScript compile scope skipped. `@sentry/browser` breaking recall on
public ground truth goes from 50% to 82% with no false positives.

- [#199](#199)
[`08da2a7`](08da2a7)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The Sentry 10 to
11 pack no longer reports `beforeSendTransaction` or
`ignoreTransactions` in a `Sentry.init` that sets `traceLifecycle`: the
option keeps transactions, so they still work.

- [#189](#189)
[`5d1d350`](5d1d350)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Avoid shared
registry-cache write races during parallel checks, publish complete
package extractions atomically, and print package failure reasons on
stderr when check exits 2.

- [#195](#195)
[`15b3b3e`](15b3b3e)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The vitest pack
now reads `vite.config.*` and `vitest.config.*` files and jest-dom setup
files that never import `vitest` (a config that takes `defineConfig`
from a shared file, a setup file that only does `import
'@testing-library/jest-dom/vitest'`), so it reports their bare-directory
coverage patterns and jest-dom registrations.

Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.com>
@uptide-release uptide-release Bot mentioned this pull request Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant