Skip to content

feat(sentry): cite v11's data-collection defaults and never keep a partial edit (UPT-123) - #261

Merged
lucasbraum merged 1 commit into
mainfrom
lucasbraum/upt-123-sentry-datacollection
Oct 19, 2026
Merged

lucasbraum merged 1 commit into
mainfrom
lucasbraum/upt-123-sentry-datacollection

Conversation

@lucasbraum

@lucasbraum lucasbraum commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

UPT-123. In the UpgradeBench v1 pre-run (#256, lion-reader, run 3caac4a1), the agent "kept v10 behavior" on @sentry/nextjs 11 with cookies: { deny: ["-ip", "forwarded"] }. As a deny list, that sends every other cookie, session cookies included. It also left urlQueryParams, queues and graphQL at v11's defaults. No check caught it.

What changes

  • Behavior record data-collection-defaults (ADR 0017), filed under each Sentry lead (@sentry/nextjs/data-collection-defaults, …), in packs/sentry/records.json.

    • Sources: quoted from the migration guide at tag 11.7.0. The guide is MIT, vendored as sources/MIGRATION-11.7.0.md.txt like zod's snapshots, so the contract test checks quotes and sha256 offline.
    • keepOld: the guide's "preserves the v10 default" block, exact.
  • Sites (check, and fix before the session): Sentry.init options, plus options objects typed as Sentry's, with no dataCollection and sendDefaultPii unset or false. They are resolved with the checker:

    • through consts, imports, the function that returns the options, conditional spreads, and typed spreads (a ...config whose type has no dataCollection hides nothing);
    • including import('@sentry/react').then(({ init }) => …), which needs Promise, so the program uses fix/verify's bundledHost libs, now exported.
    • Not sites: sendDefaultPii: true, an existing dataCollection, enabled: false, test files, nested packages, and spreads the checker can't see.
    • Decision: a computed sendDefaultPii.
  • Kept (fix, after the session): only when every category is at least as restrictive as the baseline:

    • userInfo, cookies, databaseQueryData, queues set to false;
    • httpBodies: [];
    • genAI and graphQL both off;
    • headers and query parameters false, or a deny list holding every baseline key.

    A cookie deny list, a category left at v11's default, or a value the checker can't see leaves the site open. The PR body then says "Not applied at …" with the exact edit, instead of reporting it kept.

  • Agent. A new prompt rule: to keep an old privacy or data-collection setting where no cited edit gives the exact value, choose the most restrictive option (false) and say so in decisions, or leave it as a decision. Never a partial deny list. The Sentry pack instructions say the same for dataCollection.

Repro on the bench fork

dataCollectionSites on uptide-bench/brendanlong--lion-reader:

state phase open sites
parent 57c03c32 before src/lib/sentry/client-sdk.ts:13, src/server/sentry.ts:96
human cb4729a7 (constant in data-collection.ts, server options moved into a function) after none (kept)
Uptide run 3caac4a1, head b3276715 (cookie deny list) after both still open

data-collection.test.ts covers the same cases as fixtures: the partial edit stays open, and the human's imported constant plus options function counts as kept. It also covers the no-site cases, the decision cases, the lazy import and typed spreads, and the prompt and PR-body text.

Measurement (silent ground truth, from each upgrade's diff)

lion-reader stays out of ground-truth.json. Ground truth comes from the packs' existing public upgrades, labelled from each human's diff after the record was written. required means the human set a restrictive dataCollection at that init (moved files and imported constants included). product-choice means the human upgraded the init and accepted v11's defaults.

pack silent TP FP FN status
@sentry/nextjs 9 0 0 verified
@sentry/browser 4 0 0 verified
@sentry/react 11 4 0 candidate (already, with 3 breaking FPs)
  • The react FPs:
    • cleanslate, ricochet-app and cucumber-reports upgraded with no dataCollection (product-choice).
    • Hyrox-Companion's server init: that upgrade kept @sentry/node at 10, the same release-group move behind its breaking FP.
  • How I checked recall: I scanned every upgrade's diff for added dataCollection. That scan found the lazy-import, conditional-spread and typed-spread misses, which are fixed here.
  • CI: react's job stays a warning through the existing FP_CANDIDATES path. verification.json was re-recorded for all three; react's also gains the coverage fields it predated, so docs/compatibility.md shows them.

Decisions for you

  • Labelling humans who accepted v11's defaults. Should a human who upgraded and accepted the permissive defaults be product-choice, so the record is a false positive there (what I did, per docs/packs.md)? Or required (the human shipped the same widening)? product-choice is the conservative reading, and it keeps react's record at candidate.
  • frameContextLines. The guide's baseline leaves it at 5 (v10: 7). It is fewer source lines, not more data, so keepOld stays exact as the guide calls it.
  • lion-reader's bench entry. It belongs in bench: UpgradeBench v1 pre-run (5 repos) #256's bench/v1/pre5/selection.json, which is not on main, so it isn't in this PR. From the human's diff (57c03c32 → cb4729a7):
"silent": [
  { "file": "src/lib/sentry/client-sdk.ts", "line": 13, "record": "@sentry/nextjs/data-collection-defaults", "keep": "cookies:\\s*false|SENTRY_DATA_COLLECTION" },
  { "file": "src/server/sentry.ts", "line": 96, "record": "@sentry/nextjs/data-collection-defaults", "keep": "cookies:\\s*false|SENTRY_DATA_COLLECTION" }
]

The keep regex has to accept the human's shape, a constant imported from another file. score.mjs reads only the site's file.

Checks

pnpm lint, pnpm typecheck, pnpm test, pnpm docs:packs --check, and uptide pack test for sentry-nextjs, sentry-browser and sentry-react, all run locally. The local pnpm 12 shim and git-lfs pass-through are machine-only; no repo change.

🤖 Generated with Claude Code

…rtial edit (UPT-123)

On @sentry/nextjs 11 the agent "kept v10 behavior" with a cookie deny list,
which sends every other cookie, and left queues, graphQL and query params at
v11's defaults (UpgradeBench v1 pre-run, lion-reader, run 3caac4a1).

- Behavior record data-collection-defaults for every Sentry lead, quoting
  the 11.7.0 migration guide (MIT, vendored snapshot) with its v10 baseline
  as the exact keepOld edit.
- Sites: Sentry.init options without dataCollection and sendDefaultPii not
  true, resolved with the checker through consts, imports, options
  functions, conditional and typed spreads and lazily imported SDKs.
  A computed sendDefaultPii is a decision.
- After fix, a site is kept only when every category is at least as
  restrictive as the baseline; a partial deny list stays open in the PR.
- Agent rule: keep privacy settings at their most restrictive value or
  leave them as a decision, never a partial deny list.
- Silent ground truth for sentry-nextjs (9/0), sentry-browser (4/0) and
  sentry-react (11 TP, 4 FP, still candidate), labelled from each upgrade's
  diff; lion-reader stays out of ground truth.

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)


The change introduces a new dataCollection behavior record for the Sentry pack with a TypeScript AST-based checker that detects sendDefaultPii/data-collection settings during Sentry.init upgrades, plus agent prompt guidance in sdk-agent.ts and pack/record wiring updates.

Files Change
packages/core/src/packs/sentry/data-collection.ts, data-collection.test.ts New static-analysis checker and tests for detecting data-collection configuration sites in Sentry init calls
packages/core/src/packs/sentry/pack.ts, meta.ts, records.json, ../records.ts Wire the new record into pack composition, move inventory constants to meta.ts, gate the record to Sentry v11 upgrades
packages/core/src/fix/sdk-agent.ts, packages/core/src/fix/verify.ts Add agent prompt guidance about data-collection defaults and export a bundledHost helper
packages/core/src/packs/sentry-{browser,nextjs,react}/* Refresh ground-truth and verification data with new fields (breakingFoundAny, etc.) and add the new record's findings
docs/compatibility.md, docs/packs.md, .changeset/*, packs/sentry/RESEARCH.md, sources/* Document new record behavior, updated precision scores, and Sentry 11.x research notes

Reviewed commit: 531207f

@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 adds a data-collection detection record for the Sentry pack covering v11 upgrades, wires it into pack composition, and refreshes ground-truth/verification data and docs.

Key findings

const name = propertyName(p);
if (name) own.set(name, p);
}
return hidden && !own.has('dataCollection') ? undefined : own;

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

Hidden Any spread after dataCollection is ignored by the hidden gate

In properties, when a spread's type is any/unknown the hidden flag is set but own keeps any dataCollection value assigned by an earlier property or resolved spread; the return guard hidden && !own.has('dataCollection') then treats the object as fully known (packages/core/src/packs/sentry/data-collection.ts:147). TypeScript spread semantics make a later spread win, so { dataCollection: BASELINE, ...unknownConfig } can widen collection at runtime. The after-phase reports the site as kept because baseline passes on the stale literal, and the before-phase skips it, so a v11 data-collection widening is silently reported as applied.

📋 Prompt for AI Agents

In packages/core/src/packs/sentry/data-collection.ts, in the properties function (lines 124-148), record the index at which the dataCollection key is assigned into own (both the resolved-spread branch at line 140 and the explicit property at line 145), and change the return at line 147 so hidden makes the result undefined whenever a hidden any/unknown spread occurs at or after that index (i.e. the unknown spread can override dataCollection at runtime). Keep returning own when the hidden spread comes before the last dataCollection assignment.

@lucasbraum
lucasbraum merged commit 93f029e into main Oct 19, 2026
29 checks passed
@lucasbraum
lucasbraum deleted the lucasbraum/upt-123-sentry-datacollection branch October 19, 2026 16:46
@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