Repository navigation
style(oxfmt): Collapse object literals that fit on one line - #131758
Conversation
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
📊 Type Coverage Diff✅ no issues found |
decision-model-linteraudit
frontend
voice
decision-model-linter: 25723 calls on 4360 files, 57,548,867 input tokens, $2.4, model typesafe/jev-1.13-20260917 |
…131821) Decision model lint makes several model calls per changed file (one per suite), so mass rewrites cost a lot. #131758 (oxfmt sweep, 4,795 files) is the likely reason the OpenRouter key hit its spend limit today; @lcian spotted it. The `lint` job now runs only when the PR changes at most 200 files and adds at most 10,000 lines. The check comes from the `pull_request` event payload, so a skipped PR never checks out the repo or installs packages. Only additions count, because the linter lints added, changed, and renamed files (`--diff-filter=ACMR`) and never lints deleted ones. Thresholds come from the 6,388 PRs merged into this repo from 2026-08-20 to 2026-11-19: | | p99 | p99.9 | max | |---|---|---|---| | changed files | 51 | 240 | 3,256 | | added lines | 1,662 | 4,664 | 40,991 | Together the two limits skip 8 of those PRs (0.13%): 7 over 200 files (codemods and repo-wide sweeps) and 1 with 3 files and about 16.7k added lines. A skipped job counts as passing for required checks, so these PRs are not blocked. An earlier lint comment on the PR stays unchanged if the PR later grows past a limit. Open decision: the limits are hardcoded in this workflow. getsentry/sentry-php and getsentry/seer run the same linter, so a long-term home could be a file or call limit in getsentry/decision-model-linter itself. <!-- junior-request-attribution:start --> via @azulus. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0BPBEYUC59%3A1795098182.885889 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0BPBEYUC59%3A1795098182.885889) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0BPBEYUC59%3A1795098182.885889/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Jeremy Stanley <[email protected]>
Decision model lint checks every changed file. It passes the PR comment body to `gh` through a temporary file. This avoids the operating system argument limit that caused the failure on #131758. For reports over 60,000 bytes, the PR comment shows an excerpt and links to the workflow run. The job summary shows the full report up to GitHub's 1 MiB limit. Above that limit, the excerpt remains available in the PR comment, and GitHub adds an annotation without changing the job result. <!-- junior-request-attribution:start --> via @TkDodo. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3ACTJL7358X%3A1791466713.888049 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3ACTJL7358X%3A1791466713.888049) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3ACTJL7358X%3A1791466713.888049/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Dominik Dorfmeister <[email protected]> Co-authored-by: TkDodo <[email protected]>
|
This PR is too large for Bugbot to review. It changes 35,097 lines and 3,399,911 characters. Split the change into smaller pull requests to get a review. |
On every frontend pull request, the `pre-commit lint` workflow runs `pnpm run lint:suppressions --prune` and the bot commits the result as "apply pre-commit fixes". Since #131758 set oxfmt's `objectWrap` to `collapse`, that commit expands every `{"count": N}` in the three `oxlint-suppressions.json` files onto three lines, with identical JSON content. The next run's `format` hook collapses them again and fails, and restoring the files only triggers the bot again (seen on #131502). The prune serialized budgets with `JSON.stringify(_, null, 2)`. We now pipe each written asset through the oxfmt CLI with `--stdin-filepath`, so it picks up the same `.oxfmtrc.json` and ignore patterns as the `format` hook. Pruning master now leaves the files byte-identical. Excluding the files from oxfmt would also stop the loop, but the next prune would re-expand them and they would become the only unformatted JSON in the repo. Budget comparisons and the temporary root asset still use the plain `JSON.stringify` output, because only committed files need the hook's format.
…132232) Reformats `static/app/utils/timeSeries/timeSeriesItemConfidence.spec.tsx` to match the oxfmt rule from #131758, which collapses object literals that fit on one line. #131987 was branched before that rule landed and merged with the old formatting, so master's format hook flags this file. Formatting only, no behavior change. <!-- junior-request-attribution:start --> via **George Gritsouk**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC1B4LB39D%3A1795463754.949099 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC1B4LB39D%3A1795463754.949099) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC1B4LB39D%3A1795463754.949099/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: George Gritsouk <[email protected]>
Pages enforcing Trusted Types (`require-trusted-types-for 'script'`) block the Loader from setting the `src` of the SDK script. The Loader now creates a `sentry-loader` policy that only ever returns the bundle URL rendered by the backend. It's separate from the SDK's `sentry-sdk` policy (getsentry/sentry-javascript#26764) because it has to exist before the SDK loads, and sharing a name would require `'allow-duplicates'`. Pages with a `trusted-types` directive need to add `sentry-loader`. If it isn't allowed, the Loader falls back to the plain URL, as before. The object literal changes in `js-sdk-loader.js.tmpl` come from regenerating the template after #131758. Refs getsentry/sentry-javascript#24744 --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Set oxfmt's
objectWraptocollapseto get uniform formatting