Skip to content

fix(fix): accept compiler-required fixture properties; name tests that pin a changed default (UPT-121) - #259

Merged
lucasbraum merged 2 commits into
mainfrom
lucasbraum/upt-121-test-edit-gate
Oct 19, 2026
Merged

lucasbraum merged 2 commits into
mainfrom
lucasbraum/upt-121-test-edit-gate

Conversation

@lucasbraum

@lucasbraum lucasbraum commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

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.status required. The agent added status: "ok" to a span fixture in tests/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 default dataCollection failed too.

Changes

  • Gate (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 the return there. Those are the places the compiler anchors these errors; plain containment would pick the outer literal for span: {…}. The same property added to any other object in the file is rejected, as is every other input change. Both callers go through the shared testEditObjection: the SDK editRules and the assisted path. The agent prompt says the addition is allowed.
  • Reported (review): every property added this way is listed under "Tests changed: review" in the PR body (Added \status: 'ok'` at file:line …). In report.json it is under llm.tasks[].fixtureProperties(SDK) orsites[].attempts[].fixtureProperties` (patch), with file, line, property and the literal the agent chose. Only accepted tasks and attempts are shown.
  • Pinned defaults (packs/decisions.ts): BehaviorNote gets an optional option, 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.ts asserts 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 tags dataCollection and attachStacktrace. The contract is documented in docs/packs.md.
  • Failing type-check (third expectation): no change; this was already enforced. A new type error on a healthy baseline sets verification.passed: false, marks ❌ type-check and "Verification: FAIL" in the body, makes publish refuse, and exits 1. The non-draft PR in this run came from the bench harness, not from uptide publish.

Verification

  • Repro on the fork's real file (bench/3caac4a1) with the run's TS2741 message: the old gate rejects the status: "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.
  • New tests: test-edits.test.ts (allowed addition and its record; anchoring through a name, a property name and a return; 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 (editRules with and without the starting diagnostics), and sentry.test.ts (the pinned-default decision names only the asserting test).
  • vitest run in packages/core: 2372 passed, 32 skipped. tsc --noEmit and biome are clean (the one remaining warning is already on main).

Not done here: a bench rerun of lion-reader.

🤖 Generated with Claude Code

…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]>
@luxor-code-review

luxor-code-review Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 1 medium

💬 Inline comments (1)

  • 🟡 TS2740 branch parses a message shape TS2740 never emits — test-edits.ts:21

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 option whose mention and assertion must appear in inventory tests.

Files Change
packages/core/src/fix/test-edits.ts Adds missingProperties parsing and a required transformer that drops compiler-approved properties from object literals.
packages/core/src/fix/assisted.ts, packages/core/src/fix/sdk-agent.ts Wires the new gate into the edit rules and agent scaffolding.
packages/core/src/packs/contract.ts, packages/core/src/packs/decisions.ts Adds optional BehaviorNote.option and rule-based decision packing that requires mentions in inventory tests.
packages/core/src/packs/sentry/behavior.ts, docs/packs.md, .changeset/fixture-required-props.md Documents and exercises the new option field.
packages/core/src/fix/*.test.ts, packages/core/src/packs/sentry/sentry.test.ts Test coverage for the new transformer and decision behavior.

Reviewed commit: ed20501

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • 🟡 TS2740 branch parses a message shape TS2740 never emits — test-edits.ts:21

Comment thread packages/core/src/fix/test-edits.ts Outdated
Comment on lines +21 to +24
: d.code === 2739 || d.code === 2740
? d.message.match(
/missing the following properties from type '.*': (.*?)(?:, and \d+ more)?\.?$/,
)?.[1]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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]>
@lucasbraum
lucasbraum merged commit 0db73c8 into main Oct 19, 2026
28 checks passed
@lucasbraum
lucasbraum deleted the lucasbraum/upt-121-test-edit-gate branch October 19, 2026 16:45
@uptide-release uptide-release Bot mentioned this pull request Oct 19, 2026
lucasbraum pushed a commit that referenced this pull request Oct 19, 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]

### 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>
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