Skip to content

fix(verify): resolve each workspace's types from the workspace, and refuse a blind baseline - #16

Merged
lucasbraum merged 5 commits into
mainfrom
fix/type-baseline-resolution
Oct 5, 2026
Merged

lucasbraum merged 5 commits into
mainfrom
fix/type-baseline-resolution

Conversation

@lucasbraum

@lucasbraum lucasbraum commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

In a pnpm workspace with the isolated node-linker, uptide fix reported 75 "pre-existing" type errors. The repo's own pnpm -r exec tsc --noEmit reports 0. Almost all of them were TS2688 Cannot find type definition file for 'node', TS2591 Buffer/process, and TS2307 node:*. Because every node-typed error was hidden on both sides of the comparison, the "0 new errors" verdict could not see anything.

Root cause: diagnostics() called parseJsonConfigFileContent without the config file name, and the compiler host kept the process's working directory. TypeScript therefore computed the default type roots (and resolved types: ["node"]) from wherever Uptide was running, not from the workspace. Under the isolated linker nothing is hoisted, so @types/node was invisible.

Changes

  • Resolution: the parsed config carries its file name, and the host answers the workspace as its current directory, the same way the workspace's own tsc does (fix/verify.ts).
  • Guard: typeResolutionFailure(root, baseline) flags baseline "cannot find type definition / module / name" errors (2307, 2580–2582, 2591–2593, 2688, 2792) for a package that is both declared and installed on the file's path. When any are found:
    • Types shows ⚠️ not verified (type resolution failed).
    • verification.passed is false in fix, pin and reverify. reverify re-judges from the stored baseline.
    • The reason is a publication blocker and appears in the PR body's verification line.
    • A package that really is missing is still treated as the repo's own error.
  • Fixture (fix/verify.test.ts): a pnpm workspace with node-linker=isolated, a store-only @types/node symlinked into each package (declared as a devDependency there), and code using Buffer and node:crypto. One package names types: ["node"], the other inherits it from a root tsconfig.base.json. The baseline must be 0. The test fails with the fix reverted.
  • End-to-end (fix.test.ts): a run whose baseline cannot see an installed package does not pass, and shows the Types cell and blocker above.

PR body and output when nothing needed editing

  • No code changes: the verdict says "No code changes were needed; only versions and the lockfile changed." The Changes cell reads "none: versions and lockfile only", and there is no "What changed" heading.
  • Generic tier note: "every edit here was written by the agent" (PR banner, run notes and terminal Tier line) only appears when the agent actually edited something.
  • Risk: Low when nothing was edited and the repository's tests pass.
  • Lists: workspace and schema lists read "web, worker and api".
  • Pre-existing errors: one line of counts by kind, e.g. 75 pre-existing errors (74 × TS2688/TS2591 missing Node types, 1 × TS2322), then the first 10 in a collapsed block.
  • LLM spend: "LLM spend: no LLM calls." when there were none; otherwise two decimals ("$0.60").

check compile path

It already resolved type roots per workspace: ts-morph loads each workspace's tsconfig.json by path, which sets configFilePath. The isolated-pnpm fixture now also runs through check (check.test.ts). The baseline is 0 per workspace and the upgrade's break is found in each package. With type roots deliberately broken, the test fails (baseline 6).

Real run: fix vitest on a pnpm monorepo like the fixture

The monorepo has web, worker and api, node-linker=isolated (nothing hoisted), and @types/node, typescript and vitest 3.2.4 per package. Its code uses Buffer, process and node:crypto, and its own pnpm -r exec tsc --noEmit reports 0 errors. The run was started from a directory with no node_modules. No LLM key was set, so a stub fixer that throws if called stood in for the agent; it was never called.

main this branch
Types ❌ 12 errors after the bump → 12 (3 pre-existing) ✅ 0 errors after the bump → 0
Risk High: unverified sites Low: no code changes; types and tests verified
Verification failed (9 "new" TS2307/TS2591 errors for node:crypto, Buffer, process) passed

PR body summary on this branch:

## Upgrade vitest 3.2.4 → 5.0.3

**Ready for review.** No code changes were needed; only versions and the lockfile changed. Types compile and the tests pass.

| **Risk**     | Low: no code changes; types and tests verified |
| **Changes**  | none: versions and lockfile only |
| **Types**    | ✅ 0 errors after the bump → 0 |
| **Behavior** | ⚠️ not checked |
| **Tests**    | ✅ 6 tests in 3 files passed |

Ground truth (same on this branch and on main)

pnpm eval:check fixtures/repos/storefront --truth=fixtures/truth/storefront.json:

real predicted hits precision recall
zod / packages/shared 9 9 9 100% 100%
zod / packages/api 19 19 19 100% 100%
stripe / packages/api 4 4 4 100% 100%

The fix baseline on storefront is still the single known error at packages/shared/src/errors.ts:19. The storefront and stripe report snapshots are unchanged.

Tests: core 790 passed, cli 313 passed; tsc and biome are clean.

🤖 Generated with Claude Code

lucasbraum and others added 5 commits October 5, 2026 15:56
…efuse a blind baseline

The baseline compiled each workspace with TypeScript's default type roots
taken from the process's working directory: parseJsonConfigFileContent was
given no config file name and the host kept the process cwd. Under pnpm's
isolated node-linker nothing is hoisted, so @types/node was invisible and a
repository whose own tsc reports 0 errors showed dozens of TS2688/TS2591/
TS2307 "pre-existing" errors, hiding every node-typed error on both sides.

The config now carries its file name and the host answers the workspace as
its current directory, as the workspace's own tsc does.

A baseline that still says a declared and installed package cannot be found
is a resolution failure, not the repository's errors: Types reads 'not
verified (type resolution failed)', verification does not pass, and the
reason is a publication blocker and part of the PR body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
…ind, round spend

- No sites: the verdict says only versions and the lockfile changed; no
  'What changed' heading, and the generic tier's agent note (PR body and
  terminal) only appears when the agent actually edited something.
- Risk is Low when nothing was edited and the repository's tests pass.
- Workspace and schema lists read 'web, worker and api'.
- Pre-existing errors are one line of counts by kind ('75 pre-existing
  errors (74 × TS2688/TS2591 missing Node types, 1 × TS2322)'), with the
  first 10 in a collapsed block.
- 'LLM spend: no LLM calls.' when there were none; otherwise two decimals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
…es/node

The fixture from the fix baseline (nothing hoisted, @types/node only in each
package's node_modules, Buffer and node:crypto in use) now also runs through
check: a baseline of 0 per workspace and the upgrade's break in each. check
already resolved type roots from each workspace's tsconfig; this keeps it so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
…with no code changes

A real 'fix vitest' on a pnpm monorepo that needed no edits still carried the
generic pack's 'every edit here was written by the agent' run note, a Changes
cell of '0 sites in 0 files · 0 by rule · 0 by agent', and 'runtime behavior
needs review' after every test passed. The note is left out when the agent
made no edit (stored runs included), Changes reads 'none: versions and
lockfile only', and a Low-risk run with no edits says the tests pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
@lucasbraum
lucasbraum merged commit d7f13d8 into main Oct 5, 2026
5 checks passed
@lucasbraum
lucasbraum deleted the fix/type-baseline-resolution branch October 5, 2026 23:44
lucasbraum added a commit that referenced this pull request Oct 7, 2026
## What and why

`packs/queue.json` ranked by npm downloads × breaking majors. That put
libraries everything pulls in transitively on top (undici,
google-auth-library), and listed packages that upgrade together as
separate entries (react, react-dom). `pnpm packs:queue` now ranks by
what app developers declare and how much a major breaks:

**score = direct-use repositories × log2(1 + breaking changes)**, × 0.9
with a partial official codemod. Weekly downloads only break ties.

1. **Direct use.** The number of sample repositories that declare one of
the entry's packages in a `package.json` (`dependencies`,
`devDependencies`, `optionalDependencies`). The sample is the 2
repositories in `fixtures/corpus.json` plus 50 public TypeScript
applications pinned to commits in `scripts/packs-queue-sample.ts`
(cal.com, twenty, dub, plane, outline, immich, n8n, posthog, grafana,
sentry, …). Only manifests are read: each repository is fetched shallow
and blobless at its commit, and only
`package.json`/`pnpm-workspace.yaml` are checked out. Nothing is
installed or run. Results are cached in `~/.cache/uptide/queue-sample`.
`npm:` aliases count as the aliased package, `catalog:` entries are
resolved from pnpm catalogs, and example/template/fixture/test manifests
are skipped.
2. **One entry per upgrade, named after its hub.** Two packages join one
entry when:
- `list`'s group logic (`dependencyGroups`) finds an exact pin they move
together;
   - one is the `@types` package of the other;
- one is a facade that re-exports the other at the same version and
shares its release history (react-router-dom → react-router, motion →
framer-motion);
- they are released in lockstep (react + react-dom, next +
eslint-config-next + `@next/*`).

Two of `list`'s rules are narrower here: a scope family links only
members released in lockstep, and a peer link attaches only a plugin to
its host. react-router keeps its own entry and says it needs react
moved.
3. **Breaking changes.**
- `from` is the major most of the repositories still behind declare;
`to` is the latest. ≥3 sample repositories must be behind.
- Changes come from the type-surface diff `check` runs (`diffPackage`).
**Distinct changes count:** a change repeated across many exports counts
once (same kind and before/after text, with the symbol's own name taken
out), and each removed or renamed export counts once. lucide-react 1 is
102 distinct changes, not 7,587. Entries carry `breaking: { total,
distinct, guide }`.
- **Where types understate the break:** `GUIDES` records the official
migration guide for 22 top-40 entries: its link, which sections were
counted, and every item. An item is every heading in those sections with
no heading under it, with instruction subheadings like "How to update"
left out. When the guide lists more items than distinct type changes
(CSS, configuration, runtime behavior), the entry is scored on the
guide's count and says "type diff understates". tailwindcss 4 has 31
items against 8 type changes; express 5 has 32 against 1.
- At least 10 counted changes are needed to enter. The score counts up
to 16,383 (log2 = 14), which also lets the ranking stop diffing once
nothing left can place.
- A package without types is read through its `@types` member when the
group has one. A package no diff measures (no types at `from`, or a diff
failure) enters only when its guide or changelog lists API changes. It
is marked "not measured" and scored on max(10, items listed). eslint 10
lists 21, prettier 3 lists 18 and @babel/core 8 lists 15. nodemailer 10,
jsdom 30, cross-env 10 and turbo 2 list none.
- date-fns counts only its main entry's exports (`MAIN_ENTRY_ONLY`),
because the diff does not match v4's subpath modules yet. Its entry says
so.
4. **Codemods.** An official codemod that covers the upgrade end to end
drops the entry; none qualified. A partial one is linked in `codemod`
and counts 0.9: it leaves the manual work a pack does, and a pack can
run it as one of its rules. The five partial ones (next, react,
tailwindcss, eslint, express) come from each project's own upgrade
guide.
5. **Out:** zod, stripe and ai (and anything grouped with them),
packages declared in fewer than 3 sample repositories, and `typescript`
and `@types/node` (`NOT_A_PACK`: a compiler and the runtime).

Entries gain `members`, `repos`, `reposBehind`, `breaking` and
`codemod`. `weeklyDownloads` stays, and `breakingMajors2y` is gone.
`docs/packs.md` describes the ranking.

Network: `api.npmjs.org` is not reachable from the environment this ran
in, so downloads come from `registry.npmjs.org`'s search results, which
carry the same weekly count. The script needs only github.com and
registry.npmjs.org.

## The new top 15

With a "why it's worth a pack" for each entry: [this
comment](#43 (comment)).

| # | Entry | Repos using it directly | Behind | from → to | Breaking:
total / distinct / guide | Score |
| --- | --- | --- | --- | --- | --- | --- |
| 1 | react (+ react-dom, @types/react, …) | 48 | 17 | 18 → 19 | 1,645 /
739 / 18 | 411.8 (codemod ×0.9) |
| 2 | vitest (+ @vitest/*) | 39 | 31 | 4 → 5 | 332 / 276 / 34 | 316.4 |
| 3 | date-fns | 39 | 17 | 3 → 4 | 143 / 123 / – (main entry only) |
271.2 |
| 4 | vite (+ plugins) | 35 | 18 | 7 → 8 | 49 / 40 / 14 | 187.5 |
| 5 | recharts | 20 | 14 | 2 → 3 | 688 / 659 / 4 | 187.3 |
| 6 | ioredis | 24 | 22 | 5 → 6 | 976 / 191 / – | 182.0 |
| 7 | lucide-react | 27 | 21 | 0.x → 1 | 7,587 / 102 / – | 180.5 |
| 8 | @sentry/core (+ @sentry/*) | 22 | 21 | 10 → 11 | 295 / 289 / 98 |
180.0 |
| 9 | @prisma/client (+ adapters) | 14 | 8 | 6 → 7 | 5,261 / 4,403 / 16
| 169.5 |
| 10 | @typescript-eslint/utils (+ parser, plugin) | 20 | 8 | 6 → 8 |
468 / 237 / 7 | 157.9 |
| 11 | tailwindcss | 35 | 18 | 3 → 4 | 8 / 8 / **31**, type diff
understates | 157.5 (codemod ×0.9) |
| 12 | react-day-picker | 22 | 21 | 9 → 10 | 134 / 133 / 9 | 155.5 |
| 13 | openai | 16 | 16 | 4 → 7 | 1,299 / 825 / 18 | 155.0 |
| 14 | next (+ eslint-config-next, @next/*) | 27 | 10 | 15 → 16 | 75 /
74 / 15 | 151.4 (codemod ×0.9) |
| 15 | react-router (+ react-router-dom) | 23 | 21 | 6 → 8 | 103 / 83 /
9 | 147.0 |

prettier is #16 (not measured, 18 guide items) and eslint #18 (not
measured, 21 guide items, codemod ×0.9). express is #27 (32 guide items
against 1 type change, type diff understates), just outside the 25
entries `queue.json` keeps.

## How it was verified

- `pnpm packs:queue` runs end to end against the pinned sample: 52
repositories and 1,340 packages declared in ≥3 of them. The diffs are
cached in `~/.cache/uptide/queue-diff`, and a rerun from cache takes
under 30 s.
- Guide counts come from the guides' own sources: the docs repositories
on GitHub, fetched raw. They were counted with the rule above, and the
item lists are in `GUIDES`.
- `pnpm lint` is clean, and `queue.json` is written through the
repository's Biome. The two scripts typecheck under `--strict` with the
source condition. Repository typecheck and tests don't cover `scripts/`,
and no package code changed.
- Each grouping rule was checked against the cases that broke earlier
drafts:
  - coincidental `x.0.0` versions linked rehype-slug with ioredis;
  - optional peers linked openai with ws;
  - plugin peers fused eslint with tailwindcss;
- eslint-config-next 16.4.0 pins `globals` 16.4.0, which looked like a
facade.
- Found along the way: Uptide's diff crashed on i18next 23 → 26 and
type-fest 4 → 5. That is fixed separately in #44. Until
it merges, the script reports both as diff failures and leaves them out.

## Checklist

- [x] Tests for the change: no test covers `scripts/`, so the generated
file and the run output above are the check
- [x] `pnpm lint` passes (typecheck and tests are unaffected: only
`scripts/`, `packs/` and `docs/` change)
- [x] README and docs updated if behavior changed (`docs/packs.md`)
- [x] No changeset: scripts and data only (`no-changeset` label)
- [x] No new dependency
- [x] No private code, names or paths in fixtures, tests or docs: the
sample is public repositories at public commits
- [x] The rules in CONTRIBUTING.md ("Rules that do not bend") still
hold: nothing from a sample repository is installed or executed

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

https://claude.ai/code/session_01B2T8GmEVnZwfNrugajEMqi

---------

Signed-off-by: Claude <[email protected]>
Co-authored-by: Claude <[email protected]>
lucasbraum added a commit that referenced this pull request Oct 19, 2026
…253)

Stripe's clover request API changes omitted billing mode to flexible
without a compiler error. This adds cited behavior records, API-specific
preserving edits, and decisions in the existing report sections.

Coverage and behavior:

- Cover all six APIs in the pinned changelog: subscriptions, invoice
previews, subscription schedules, quotes, subscription-mode Checkout,
and Payment Links. Exact paths are root `billing_mode` for
subscriptions/schedules, `subscription_data.billing_mode` for
Checkout/quotes, and `subscription_details.billing_mode` or
`schedule_details.billing_mode` for invoice previews.
Existing-subscription schedules/previews are excluded. Unknown quote
recurrence and Payment Links' undocumented preserving parameter become
cited decisions.
- Match the effective request API version. Retained pre-clover pins
produce no finding. Selected pin migrations add creation sites to the
agent plan; post-edit verification checks the actual pin and classic
value. Raw compiler findings are classified with the existing rule
classifier. Payload `api_version` values never move clients. SDK 12/13
upgrades are supported; the record's SDK range is a candidate filter,
not the behavior boundary.
- Remove full Stripe pages and `.gitattributes`. Records keep quoted
lines, URLs, read dates, and full-page SHA256 hashes.
`build:stripe-changelog` fetches, verifies hashes and quotes, fails on
drift requiring author review, and writes snapshots only to a gitignored
cache. The zod snapshot contract is retained.

Independent dms-saas audit of parent
`6390f434622db5d6e546854b435fb1017c3cc665`, checked against human PR
#70:

- Existing expected sites remain
`packages/dms-saas/src/workspaces/provisioning.ts:355` and
`packages/dms-saas/src/stripe/workspace-checkout.ts:211` (the parameter
builder shared by the initial/retry wrapper).
- Additional calls: `src/stripe/plan-schedule.ts:52` uses
`from_subscription`; `src/stripe/upcoming-invoice.ts:107` previews an
existing `subscription`. Neither creates a subscription with the new
default. No quotes or Payment Links calls exist. No ground-truth entries
were added or changed based on Uptide output. Full rationale and source
references are in `packages/core/src/packs/stripe/RESEARCH.md`.

Validation:

- Rebased onto **#251 / UPT-94** (`773dbbe`). A regression test passes
real quoted Stripe findings through the pack transform and
`sdkCostEstimate`: they remain manual sites under
`stripe/billing-mode-default-flexible`, add their own rule cost, and
repeated occurrences count as separate sites while sharing that rule
cost. No production cost-estimator changes were needed.
- Post-rebase validation: **790 core tests passed / 14 skipped**,
including all fix tests, behavior records, Stripe triggers and cost
estimates; TypeScript and formatting checks pass. The first broader
invocation omitted the package config and was superseded by this
successful configured run.
- After the rebase, the dms-saas parent scan still matches exactly the
same two sites and preserving edits. Per the conditional rerun request,
no additional benchmark run or spend was incurred; the successful fork
run below remains the benchmark evidence.

- **13/13 verified-pack gates passed; no FP regressions against
origin/main.** All breaking and silent FP counts remain zero. Existing
behavior-note FPs (Redis 2, TypeScript 8) and auxiliary mechanical
tallies (Next 1, React Router 336) match origin/main. No expectations or
gate were relaxed. The broader offline command exits 1 only because
candidate packs ioredis, joi, openai and @sentry/react lack cached
repositories; every verified pack passes.
- Stripe standalone pack test passed and recorded verified: breaking
**23 TP / 0 FP / 2 FN**; the frozen silent-oracle discrepancy is
explained below.
- Source fetch/hash/quote build, TypeScript check, build, formatting and
diff checks pass. **22 trigger/plan tests**, **150
fix/SDK/record/pack-contract tests**, and **5 benchmark scorer tests**
pass. Two initial five-second timeouts under concurrent pack load passed
on rerun with a 30-second test timeout.
- Uptide-only #169 rerun `4776187e`, commit `f82fca0`: [dms-saas fork PR
#16](https://github.com/uptide-bench/AntelopeJS--dms-saas/pull/16),
**MERGEABLE**, **2/2 silent sites caught and edited**, **0 silent FP**,
**$0.2669476**, **255 seconds**, exit **0**. Both original sites resolve
to explicit classic afterward. Independent harness install, typecheck,
lint and tests all exit **0**. The isolated clone's pre-existing missing
frontend dependencies are resolved by the independent full install.
- An earlier validation rerun exposed the raw-finding
rule-classification bug and caught 0/2; it was fixed and
regression-tested before the successful run. That attempt cost
**$0.2888555 / 331 seconds**. Total for the two review reruns:
**$0.5558031 / 586 seconds** (setup excluded). Neither attempt changed
ground truth.

The frozen unkey pack expectations still include two creation sites
whose clients retain `2023-10-16`. Correct pin handling suppresses those
findings in `check`, so the unchanged silent oracle scores **0 TP / 0 FP
/ 2 FN**. This discrepancy is disclosed and recorded in
verification.json; the ground truth was not adjusted after scoring.
During `fix`, selecting the pin migration activates the creation-site
findings, as the dms-saas rerun verifies.

Changeset: **minor**, for the new runtime-behavior detection capability.
Signed-off commits, rebased on origin/main; shared run/report edits
remain localized. No upstream third-party writes or CI watching.

UPT-113

---------

Signed-off-by: Lucas Braum <[email protected]>
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