Repository navigation
feat(sentry): cite v11's data-collection defaults and never keep a partial edit (UPT-123) - #261
Conversation
…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]>
|
Review complete. 🟡 1 medium 💬 Inline comments (1)
The change introduces a new
Reviewed commit: 531207f |
There was a problem hiding this comment.
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
- 🟡 Hidden Any spread after
dataCollectionis ignored by the hidden gate — data-collection.ts:147
| const name = propertyName(p); | ||
| if (name) own.set(name, p); | ||
| } | ||
| return hidden && !own.has('dataCollection') ? undefined : own; |
There was a problem hiding this comment.
🟡 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.
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>
UPT-123. In the UpgradeBench v1 pre-run (#256, lion-reader, run 3caac4a1), the agent "kept v10 behavior" on
@sentry/nextjs11 withcookies: { deny: ["-ip", "forwarded"] }. As a deny list, that sends every other cookie, session cookies included. It also lefturlQueryParams,queuesandgraphQLat 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, …), inpacks/sentry/records.json.sources/MIGRATION-11.7.0.md.txtlike zod's snapshots, so the contract test checks quotes and sha256 offline.keepOld: the guide's "preserves the v10 default" block,exact.Sites (
check, andfixbefore the session):Sentry.initoptions, plus options objects typed as Sentry's, with nodataCollectionandsendDefaultPiiunset orfalse. They are resolved with the checker:...configwhose type has nodataCollectionhides nothing);import('@sentry/react').then(({ init }) => …), which needs Promise, so the program usesfix/verify'sbundledHostlibs, now exported.sendDefaultPii: true, an existingdataCollection,enabled: false, test files, nested packages, and spreads the checker can't see.sendDefaultPii.Kept (
fix, after the session): only when every category is at least as restrictive as the baseline:userInfo,cookies,databaseQueryData,queuesset tofalse;httpBodies: [];genAIandgraphQLboth off;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 fordataCollection.Repro on the bench fork
dataCollectionSiteson uptide-bench/brendanlong--lion-reader:57c03c32src/lib/sentry/client-sdk.ts:13,src/server/sentry.ts:96cb4729a7(constant indata-collection.ts, server options moved into a function)b3276715(cookie deny list)data-collection.test.tscovers 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.requiredmeans the human set a restrictivedataCollectionat that init (moved files and imported constants included).product-choicemeans the human upgraded the init and accepted v11's defaults.@sentry/nextjs@sentry/browser@sentry/reactdataCollection(product-choice).@sentry/nodeat 10, the same release-group move behind its breaking FP.dataCollection. That scan found the lazy-import, conditional-spread and typed-spread misses, which are fixed here.FP_CANDIDATESpath.verification.jsonwas re-recorded for all three; react's also gains the coverage fields it predated, sodocs/compatibility.mdshows them.Decisions for you
product-choice, so the record is a false positive there (what I did, perdocs/packs.md)? Orrequired(the human shipped the same widening)?product-choiceis 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, sokeepOldstaysexactas the guide calls it.bench/v1/pre5/selection.json, which is not on main, so it isn't in this PR. From the human's diff (57c03c32→cb4729a7):The
keepregex has to accept the human's shape, a constant imported from another file.score.mjsreads only the site's file.Checks
pnpm lint,pnpm typecheck,pnpm test,pnpm docs:packs --check, anduptide pack testfor 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