Skip to content

fix: let assisted migrations edit related type declarations - #70

Merged
lucasbraum merged 3 commits into
mainfrom
codex/related-declaration-edits
Oct 11, 2026
Merged

lucasbraum merged 3 commits into
mainfrom
codex/related-declaration-edits

Conversation

@lucasbraum

@lucasbraum lucasbraum commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

A nullable ref can fail at a call site while the type that must change belongs to a prop declared in another file. Preserve compiler-linked repository declarations as additional editable regions, group sites sharing a declaration, and let the agent fix that declaration once. Keep a patch only when every grouped target diagnostic disappears and no new diagnostic appears anywhere in the program.

The gate now identifies diagnostics by file, start line/column, code and related-information locations. Rewording an existing diagnostic is not a new error; a different code or position still rejects the patch. This also fixes target-removal checks when TypeScript expands the message of another existing error.

The missing finder TS2503 was absent from check's compilation, before matching or fix selection. The overlay redirected React imports to the target declarations but automatic type references and Next.js’s react/experimental / react-dom/experimental references still loaded installed React 18 declarations, keeping global JSX alive. Resolve target type references against the same overlay as imports. The resulting TS2503 reaches the existing React global-jsx-namespace guide. Include existing React import bindings in agent context.

Validate all hunks before writing, limit related-file edits to the compiler-linked declaration, exclude node_modules and paths/symlinks outside the repository, and roll back every file on rejection. Carry declaration edits into formatting, linting, tests, verification and reports; disclose additional provider context. No matcher or ground-truth changes. Patch changeset retained.

Original run: audit of the nine remaining errors

Inspected the saved uptide__react-19.3.0/report.json and the kept clone. All paths below start with components/apps/.

Diagnostic Agent called? Proposed change Why it remained
calendar/calendar-app.tsx:455 TS2322 3 attempts Make event-search.tsx:21 inputRef nullable Empty diff: receiving declaration unavailable/outside allowed file
calendar/calendar-app.tsx:469 TS2322 3 attempts Same event-search.tsx:21 declaration Same; now grouped with the preceding site
finder/finder-app.tsx:162 TS2503 No None No finding or agent attempt recorded for missing global JSX
finder/finder-app.tsx:1522 TS2322 3 attempts Make nav.tsx:26 searchInputRef nullable Empty diff: receiving declaration unavailable/outside allowed file
messages/chat-area.tsx:195 TS2322 3 attempts Make message-list.tsx:18 messageInputRef nullable Same
messages/sidebar.tsx:566 TS2322 3 attempts Make search-bar.tsx:6 inputRef nullable Same
notes/notes-app.tsx:91 TS2322 3 attempts Make presenters/notes-mobile-presenter.tsx:10 containerRef nullable Same
notes/notes-app.tsx:119 TS2322 3 attempts Make presenters/notes-desktop-presenter.tsx:14 containerRef nullable Same
notes/sidebar.tsx:707 TS2322 3 attempts Make search.tsx:6 inputRef nullable Same

Each TS2322 attempt returned diff: ""; validation appended patch must modify exactly the reported file. No patch was applied, so none of these were rejected for retaining a compiler error or introducing a new one. The agent explicitly declined call-site casts and asked to edit the receiving declaration. Original recorded spend: $0.195442001, 46,691 input / 10,206 output tokens.

Validation

  • Full suite: 1,472 passed, 15 existing skips; lint and typecheck passed.
  • Local public-tree scan: 905 tracked files, clean (CI-only denylist unavailable locally).
  • Gate tests exercise actual assisted application/rollback: message-only change accepted; different code, line, column or related location rejected. Multiset comparison retained.
  • Synthetic overlay-to-agent fixture uses the real compiler and covers automatic inclusion, explicit types, custom typeRoots and triple-slash references, including react/experimental subpaths used by Next.js. All five produce TS2503, select the existing React guide and accept the agent fix. The fixture fails against the previous overlay resolver because no diagnostic is emitted.
  • Existing two-file tests cover shared declarations within/across files, declaration-only and multi-file diffs, repaired hunk positions, unchanged targets, new program errors, full rollback and edit boundaries.

Live rerun

Pinned alanagoyal/alanagoyal@fd60b0a1d66e112cca9c350da33d4bbb1154aad7; Node 24.21.0 / npm 11.19.0. Same equivalent command as the preceding PR run (upstream no longer declares tabs or react-resizable-panels):

npx uptide fix react @radix-ui/react-tooltip --target 19.3.0 \
  --allow-peer @emoji-mart/react --provider anthropic --model claude-sonnet-5-5 --keep

No --pr, no push and no fork of that repository.

Final rerun at commit 6efcaa4, clean build, 3m 52s, exit 0, verification passed:

  • Types: 0 baseline → 13 after upgrade → 0 remaining, no new diagnostics.
  • 13 sites: 1 auto-fixed, 12 agent-fixed, 0 manual; 15 files in the reported verification scope.
  • Repository tests: 181 passed before and after; edited-file ESLint clean.
  • LLM: $0.083120001, 21,845 input / 3,943 output tokens, Anthropic claude-sonnet-5-5, $1 cap. All nine agent calls succeeded on their first attempt. The shared calendar declaration was one call for two sites; one notes guard edit resolved three sites.
  • Calendar 455/469 and notes 91 now pass the location-based gate. Finder 162 reaches the agent with the JSX guide; the accepted patch adds type JSX to the existing React import, preserving diagnostic positions.
  • No remaining manual or unassigned diagnostic. Fixing the overlay also removes the old/target React declaration mixing that produced extra findings: the report now has 13 real sites instead of 23.

With: tooltip 1.0.7 → 1.1.0; @types/react 18.2.62 → 19.3.0; @types/react-dom 18.2.19 → 19.3.0; react-dom 18.2.0 → 19.3.0. Existing bounded peer re-resolution and scope-guard behavior are unchanged (38 dedupe moves, 3 metadata-only changes). The explicit emoji-mart override remains an unverified runtime compatibility risk; behavior was not checked.

Also ran upstream’s npm run check: full-repository lint, all 181 tests, tsc --noEmit, Next.js compilation and Next.js’s TypeScript check all passed. The production build then stopped while collecting /notes/[slug] page data because this scratch checkout has no NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY (supabaseUrl is required). No environment values were supplied or changed.

For completeness, the intermediate follow-up run (before adding type-reference subpath handling) cost $0.071590001 and ended with only finder TS2503 remaining; it was not the final result. Total LLM spend for this follow-up: $0.154710002. No external PR, push or fork was created.

@lucasbraum
lucasbraum marked this pull request as ready for review October 11, 2026 17:58
@lucasbraum
lucasbraum force-pushed the codex/related-declaration-edits branch from ea8b057 to af0c11c Compare October 11, 2026 18:20
@lucasbraum
lucasbraum merged commit d72e285 into main Oct 11, 2026
8 checks passed
@lucasbraum
lucasbraum deleted the codex/related-declaration-edits branch October 11, 2026 18:35
@uptide-release uptide-release Bot mentioned this pull request Oct 11, 2026
lucasbraum pushed a commit that referenced this pull request Oct 11, 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

- [#77](#77)
[`38ffa16`](38ffa16)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Present peer
blockers in fix as a pending upgrade plan, without a failure marker or
error prefix. Keep exit code 2, grouped blockers, and the Next command,
and omit LLM spend when no call was attempted.

- [#70](#70)
[`d72e285`](d72e285)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Let assisted
fixes edit repository-local expected-type declarations linked by
compiler diagnostics. Fix sites sharing a declaration together, while
retaining program-wide type verification and strict patch scope.
  
Identify verification diagnostics by source location, code and related
locations so changed message details do not reject valid fixes. Resolve
automatic type references against the target declarations, so React 19's
removed global JSX namespace reaches the agent with the React pack
guide.

- [#78](#78)
[`7662903`](7662903)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Verify the
exported migration branch has the exact tree that passed verification.
Refuse success and publication when export fails, preserve the complete
clone, and require the recorded verified tree before pushing a stored
run. Report changed-file counts from the committed diff.
  
Export fresh migrations to numbered branches when an existing branch has
different content. Preserve identical packages' libc restrictions when
older npm serializers omit them, without relaxing the resolution guard.

Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.com>
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