Skip to content

fix(fix,zod): TS 7 libs in the fix type-check, uuid() as breaking (UPT-100) - #219

Merged
lucasbraum merged 1 commit into
mainfrom
lucasbraum/upt-100-bench-calmcp-baseline-and-zod-rules
Oct 18, 2026
Merged

lucasbraum merged 1 commit into
mainfrom
lucasbraum/upt-100-bench-calmcp-baseline-and-zod-rules

Conversation

@lucasbraum

Copy link
Copy Markdown
Collaborator

Closes UPT-100.

On calmcp (zod 3.25.76 → 4.6.5, from the #169 bench), Uptide reported 5 pre-existing type errors on a repository whose own tsc is clean at the parent commit. It also sent every site to the agent.

1. False baseline errors (TypeScript 7 libs in the fix type-check)

calmcp runs TypeScript 7.0.2, which ships no compiler API and no lib.*.d.ts, so fix type-checks it with the bundled compiler. Its tsconfig has target: "ES2022" and lib: ["ES2023"]. The fix phase's host (verify.ts bundledHost) served only the libs a probe program with that target had loaded, and lib.es2023.d.ts was not one of them. That produced TS6053 (/__uptide_lib__/lib.es2023.d.ts not found) and 4 × TS2550 (Object.hasOwn). UPT-73 fixed the same gap in the analysis (compile.ts), but not in the fix phase's own checker.

Fix: bundledHost loads any lib by name through compile.ts's bundledLib, the same source the analysis uses. Fixture: verify.test.ts, a TS 7-style install with lib: ["ES2023"] under target: "ES2022" using Object.hasOwn. It failed before the fix (TS6053, TS2304 Object) and passes now.

2. No zod rule fired (uuid() → guid())

Reach and import shape were fine: check found src/tools/create.ts:20 z.string().uuid() as ZodString#uuid, fixability mechanical. The type diff calls it deprecated, though, and fix selects only breaking sites unless --include-deprecated is set, so string-format never saw it. The agent then changed it during the verification-feedback round, after 4 tests failed.

But uuid() is a behavior change, not only a deprecation: zod 4's uuid() also checks the RFC version and variant, so ids zod 3 accepted stop validating. That is what broke calmcp's tests.

Fix: the zod pack's foldFindings marks ZodString#uuid sites breaking (evidence pack, with that reason). string-format rewrites them to z.guid() without the flag. The other formats (email, url, datetime, base64) stay deprecated and flag-gated. The rule id is unchanged, so ground truth and per-rule scores still line up. Fixture: zod.test.ts, the calmcp shape (const uuid = z.string().uuid()) is promoted and rewritten flagless, and email() is not.

.errors → .issues did not fire because calmcp has no .errors reads (nothing to match), not because of a bug.

Bench: calmcp, Uptide arm only, before / after

Same harness (bench/ copied from the #169 branch, uncommitted, unchanged), same model (claude-sonnet-5-5, medium), same caps ($1 Uptide budget), same parent commit, and bench/check.sh for the final checks. Before = this branch's base (origin/main 195ae10). After = this branch. One run each.

before after
exit 0 0
install / typecheck / lint / test (check.sh) pass / pass / pass / pass pass / pass / pass / pass
baseline type errors reported 5 (4 × TS2550, 1 × TS6053) 0
sites: mechanical / agent-led 0 / 5 1 / 5 (create.ts:20 by string-format)
uuid() → guid() made by agent, in the feedback round after 4 failing tests rule, before the agent
verification-feedback rounds 1 ($0.137, 69 s) 1 ($0.027, 16 s, no edits)
cost $0.197 $0.106
wall time (run.sh) 148 s 89 s
files changed (src + lock/manifest) 2 + 2 2 + 2

Phases (ms, cost):

phase before after
analyze 8 847 11 853
baseline 3 792 5 152
install 10 603 12 056
rules 1 649
agent 40 574, $0.060 34 041, $0.079
verify 6 802 4 206
feedback 69 262, $0.137 16 000, $0.027

The 5 agent-led sites in src/tools/zodDoc.ts are type-level code over zod internals (ZodTypeAny parameters, _def, .description). They match the zod pack's types rule, which is agent work by design, so they stay agent-led.

Not fixed here (follow-up)

The remaining feedback round in the after run is spurious. verification.build keeps the build result from right after the bump (tsc -p tsconfig.json failing on zodDoc.ts), not the build at the final head. At the final head, tsc -p tsconfig.json exits 0. The feedback agent got that stale error, found nothing to fix and made no edits. The PR body also says "Build … failed". The before run (and the #169 rerun, "❌ build") has the same defect.

Checks

  • pnpm --filter @uptide/core exec vitest run: 186 files, 2253 passed
  • pnpm typecheck, pnpm exec biome check .: clean (existing warnings only)
  • The Packs workflow re-scores zod on this PR: uuid() sites in the ground truth now count as breaking instead of deprecated, which may move zod's breaking counts in verification.json. Not run locally.

No fork PRs were made for these two runs. Nothing was pushed outside this repository.

🤖 Generated with Claude Code

Loading
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