Repository navigation
fix(fix): accept compiler-required fixture properties; name tests that pin a changed default (UPT-121) - #259
Conversation
…t pin a changed default (UPT-121) The test-edit gate rejected an agent adding `status` to a SpanJSON fixture after @sentry/nextjs 11 made it required (TS2741), leaving the branch failing tsc. A test may now gain a property the starting diagnostics report missing (TS2739/TS2740/TS2741), with a literal value; properties already there must survive unchanged, and every other input change is still rejected. Behavior notes can name the option whose default changed. A test the note's line names that mentions the option and asserts pins the old default: the decision says so, for the owner to choose, and the agent is told to leave it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
|
Review complete. 🟡 1 medium 💬 Inline comments (1)
The change extends the fix pipeline so an agent may add required fixture properties named in compiler diagnostics, and extends pack decisions so behavior notes can declare an
Reviewed commit: ed20501 |
There was a problem hiding this comment.
This PR teaches the test-edit gate to recognize required-property additions reported by TS2740/TS2739 diagnostics and lets pack decision notes reference behavior options, with changesets and docs.
Key findings
- 🟡
TS2740branch parses a message shape TS2740 never emits — test-edits.ts:21
| : d.code === 2739 || d.code === 2740 | ||
| ? d.message.match( | ||
| /missing the following properties from type '.*': (.*?)(?:, and \d+ more)?\.?$/, | ||
| )?.[1] |
There was a problem hiding this comment.
🟡 bug · medium
TS2740 branch parses a message shape TS2740 never emits
missingProperties treats code 2740 with the "missing the following properties from type" regex, but TS2740 emits the same "Property 'x' is missing in type ... but required in type ..." wording as TS2741 (packages/core/src/fix/test-edits.ts:21-24). A fixture assigned from a non-fresh object reports TS2740, so its property name is never extracted and the legitimate addition is rejected even though the changeset and editRules advertise TS2740 support. The new tests cover only 2741 and 2739, so the gap is untested end to end.
📋 Prompt for AI Agents
In packages/core/src/fix/test-edits.ts around lines 18-24, change the d.code === 2740 branch of missingProperties to use the same single-property regex as the d.code === 2741 branch (TS2740's message is "Property 'x' is missing in type '...' but required in type '...'", not the multi-property 2739 wording). Then in packages/core/src/fix/test-edits.test.ts add a case with code: 2740 and that message asserting the property name is extracted.
…tic points at; report them (UPT-121) Review of #259. The allowance was per file: any object in the test could gain a property named by a missing-property diagnostic. It is now per object. Each TS2739/TS2740/TS2741 diagnostic names the object literal it is anchored to: the literal at its position (an array element), or the literal initializing the variable or property named there, or returned by the `return` there. That is where the compiler puts these errors, and plain containment would pick the outer literal for `span: {…}`. The same property added to any other object is rejected. Every property added this way is recorded with file, line, property and the literal chosen: on the accepted SDK task (llm.tasks[].fixtureProperties) or patch attempt (sites[].attempts[].fixtureProperties) in report.json, and under "Tests changed: review" in the PR body. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
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] ### Minor Changes - [#261](#261) [`93f029e`](93f029e) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Sentry 10 → 11: report every `Sentry.init` whose data collection widens because `dataCollection` is unset, citing the migration guide, and give the agent the guide's exact v10 baseline. After a fix, a site counts as kept only when every category is at least that restrictive, so a partial edit such as a cookie deny list stays open in the PR instead of being reported as kept. The agent now keeps privacy settings at their most restrictive value, or leaves them as a decision, when no cited edit exists. - [#253](#253) [`e48373d`](e48373d) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Find Stripe's clover billing-mode default change at subscription creation sites, across the six affected APIs. Respect request API-version pins, preserve classic billing at documented parameter paths, and report unresolved parameters or semantics as decisions. Verify quoted sources against full-page hashes at pack-build time without vendoring Stripe pages. Score the dms-saas silent billing change in UpgradeBench. ### Patch Changes - [#260](#260) [`8ea1a87`](8ea1a87) Thanks [@lucasbraum](https://github.com/lucasbraum)! - A build that fails the same way before and after the upgrade (same command, status and output; only durations and clock times may differ) no longer fails verification. Builds are now compared to the baseline the same way tests are. The PR says `⚠️ build: failing at baseline, not checked`, and the verdict reads `no new errors`, not `verification passed`. A build that passed at baseline and fails after the upgrade still fails, and so does one that fails differently. Without a pack, a run like this still does not publish, because its build cannot verify the bump. - [#259](#259) [`0db73c8`](0db73c8) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Let the agent add a property the upgraded types made required to a test fixture: only to the object the compiler's TS2739, TS2740 or TS2741 error points at, and only with a literal value. Every other test input change is still rejected. Each such property is listed under "Tests changed: review" in the PR body and in report.json (file, line, property and the value the agent chose). Name a test that asserts a dependency default the upgrade changed (Sentry's `dataCollection` and `attachStacktrace`) under "Decisions for you", instead of leaving it to fail unexplained. - [#251](#251) [`773dbbe`](773dbbe) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Calibrate the SDK pre-run cost estimate from recorded migrations, accounting for shared rule knowledge instead of charging a full session allowance per site. Keep the configured spending limit and per-call budget enforcement unchanged. - [#258](#258) [`3a4898f`](3a4898f) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Discover independent nested projects when fixing a dependency absent from the root project. Run installation, migration and verification in the selected project's directory, preserving its lockfile and package manager. When several projects declare the dependency, name their manifests and require an explicit directory. - [#257](#257) [`7b9ed7f`](7b9ed7f) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Run pinned npm through Corepack when local npm differs. When the pin is unavailable, allow local npm with a compatible v3 lockfile, record the fallback in the report, and reject frozen installs that rewrite the lockfile. Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.com>
Fixes UPT-121, from the UpgradeBench v1 pre-run (run 3caac4a1,
uptide-bench/brendanlong--lion-reader#2, @sentry/nextjs 10.75.0 → 11.6.0).What went wrong
v11 made
SpanJSON.statusrequired. The agent addedstatus: "ok"to a span fixture intests/unit/sentry-span-ip.test.ts, which was the compiler's own fix for TS2741. The test-edit gate rejected it all 3 times, because it allowed only expected-value changes. The branch was left failing tsc. In CI, the repo's own test asserting v10's defaultdataCollectionfailed too.Changes
fix/test-edits.ts): a test edit may add a property that one of the task's starting TS2739/TS2740/TS2741 diagnostics reports missing, with a literal value, only to the object literal that diagnostic points at. That is the literal at its position (an array element), or the literal initializing the variable or property named there, or the one returned by thereturnthere. Those are the places the compiler anchors these errors; plain containment would pick the outer literal forspan: {…}. The same property added to any other object in the file is rejected, as is every other input change. Both callers go through the sharedtestEditObjection: the SDKeditRulesand the assisted path. The agent prompt says the addition is allowed.Added \status: 'ok'` at file:line …). In report.json it is underllm.tasks[].fixtureProperties(SDK) orsites[].attempts[].fixtureProperties` (patch), with file, line, property and the literal the agent chose. Only accepted tasks and attempts are shown.packs/decisions.ts):BehaviorNotegets an optionaloption, the setting whose default changed. A test file that the note's line names (so it leaves the option unset), that mentions the option and that asserts gets its own decision. Example: "tests/unit/sentry-span-ip.test.tsasserts dataCollection without setting it: it pins @sentry/nextjs 10.75.0's default, which 11.6.0 changes…". The test stays as it is, and the owner chooses. Sentry tagsdataCollectionandattachStacktrace. The contract is documented indocs/packs.md.verification.passed: false, marks ❌ type-check and "Verification: FAIL" in the body, makespublishrefuse, and exits 1. The non-draft PR in this run came from the bench harness, not fromuptide publish.Verification
bench/3caac4a1) with the run's TS2741 message: the old gate rejects thestatus: "ok"edit. The new gate accepts it and records it at line 47 with"ok", and still rejects the same property added to the file's trace-context object.test-edits.test.ts(allowed addition and its record; anchoring through a name, a property name and areturn; rejected when added to another object in the file, when the compiler didn't name it, with a computed value, alongside another input change, or when it changes one that was already there),pr-body.test.ts(listed with its value; a rejected task's not listed),sdk-agent.test.ts(editRuleswith and without the starting diagnostics), andsentry.test.ts(the pinned-default decision names only the asserting test).vitest runin packages/core: 2372 passed, 32 skipped.tsc --noEmitand biome are clean (the one remaining warning is already on main).Not done here: a bench rerun of lion-reader.
🤖 Generated with Claude Code