Skip to content

fix(ci): Keep decision model lint comments within size limits - #131780

Merged
TkDodo merged 4 commits into
masterfrom
ci/decision-model-lint-large-prs
Nov 19, 2026
Merged

TkDodo merged 4 commits into
masterfrom
ci/decision-model-lint-large-prs

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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.

via @TkDodo.

--

View Session [Sentry]

The decision-model lint step failed on a 3k-file PR with "gh: Argument
list too long" because the whole report went to gh as one argument.

Skip the linter when a PR changes more than 1000 files, like other PR
jobs do; a skip only replaces an earlier lint comment. Pass the comment
body to gh from a file, and cut reports longer than a GitHub comment
allows, keeping the full report in the job summary. The step's shell
moves to a POSIX script checked by shellcheck.

Co-Authored-By: Dominik Dorfmeister <1021430+TkDodo@users.noreply.github.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 19, 2026
sentry-junior Bot and others added 2 commits November 19, 2026 12:40
Upload reports over 1 MiB as workflow artifacts and link to them from
the PR comment. Keep the shell code in the workflow so the diff shows
the behavior changes.
@github-actions github-actions Bot removed the Scope: Backend Automatically applied to PRs that change backend components label Nov 19, 2026
@TkDodo TkDodo changed the title ci(decision-model-lint): Skip PRs over 1000 files and post large reports ci(decision-model-lint): Skip large PRs and cap comment size Nov 19, 2026
@TkDodo TkDodo changed the title ci(decision-model-lint): Skip large PRs and cap comment size fix(ci): Keep decision model lint comments within size limits Nov 19, 2026
@TkDodo
TkDodo marked this pull request as ready for review November 19, 2026 14:21
@TkDodo
TkDodo requested a review from a team as a code owner November 19, 2026 14:21
@sentry-junior
sentry-junior Bot requested a review from TkDodo November 19, 2026 14:22
@TkDodo
TkDodo requested a review from azulus November 19, 2026 14:41
@TkDodo
TkDodo merged commit 1e7fa62 into master Nov 19, 2026
69 checks passed
@TkDodo
TkDodo deleted the ci/decision-model-lint-large-prs branch November 19, 2026 17:47
joshuarli added a commit that referenced this pull request Nov 19, 2026
Workflow logic in YAML strings is never linted and can't be tested. This
moves the significant inline `run:` blocks in `.github/workflows/*.yml`
into `.github/workflows/scripts/`, and each step now calls its script.
Values reach the scripts through env vars or arguments, never `${{ }}`
templating. Exit codes, `GITHUB_OUTPUT`/`GITHUB_ENV` writes, and stdout
stay the same.

Known stderr differences, accepted on purpose:
- Three steps ran with `set -x` (bump-version, bump-sentry-in-getsentry,
the prek run in pre-commit.yml). Under dash or Python their trace lines
look a little different than they did under bash.
- On paths that can't happen in CI, such as a missing command, the error
text dash prints differs from bash's.

**POSIX `sh`** (mostly CLI commands in order). The `shellcheck (POSIX
sh)` hook in `.pre-commit-config.yaml` no longer keeps a list of files.
It now checks every script in `.github/workflows/scripts/` whose shebang
is `sh` (`types: [sh]`). That also brings two existing scripts under
shellcheck: `api-package-release-preflight.sh` and
`install-chrome-for-testing.sh`.
- backend.yml / acceptance.yml: `inspect-failure.sh` (one script for all
7 "Inspect failure" steps), `download-coverage-db.sh`,
`reconnect-postgres-socket.sh`, `install-odiff.sh`,
`run-backend-tests.sh`, `run-acceptance-tests.sh`, `warm-up-chrome.sh`
- frontend.yml: `check-generated-file.sh FILE DESCRIPTION COMMAND`,
shared by the form field registry and embed widget checks
- frontend-snapshots.yml: `install-playwright.sh deps|browser`,
`get-snapshot-merge-base.sh`
- type-coverage-diff.yml: `get-base-commit.sh`
- pre-commit.yml: `run-prek.sh`
- bump-sentry-in-getsentry.yml: `bump-sentry-in-getsentry.sh`, run from
the `sentry/` checkout
- update-baseline.yml: `publish-baseline-browser-mapping-pr.sh`
- update-public-suffix-list.yml: `publish-public-suffix-list-pr.sh`,
`send-public-suffix-list-checkin.sh`
- prune-oxlint-suppressions.yml: `publish-oxlint-suppressions-pr.sh`
- react-to-product-owners-yml-changes.yml: `install-pyyaml.sh`, now its
own step before `./bin/react-to-product-owners-yml-changes.sh`
- decision-model-lint.yml: `run-decision-model-lint.sh`, the lint step
as merged in #131780. Two small changes satisfy
shellcheck without changing output: the notes that contain backticks are
double-quoted, and the oversized-report branch writes to the comment
body with one grouped redirect. knip can't see the `pnpm exec
decision-model-linter` call inside a shell script, so `knip.config.ts`
now lists `@sentry/decision-model-linter` under `ignoreDependencies`.

`run-prek.sh` and `install-pyyaml.sh` replace `shell: bash` steps that
used `pipefail` pipelines. They save each stage's exit status and exit
with the status of the last stage that failed, the same way `pipefail`
did. Every stage still runs, and the step fails with the same code.

**Python 3, standard library only**, on the runner's system `python3`.
Nothing in it is newer than 3.12, the oldest Python on these images:
- bump-version.yml: `bump-version.py`. `PR_OPTIONS` splitting matches
the old `read -r -a`: first line only, split on spaces and tabs, no
quote or glob processing. The `latest` lookup still runs `curl -sL | jq
-r .info.version`, and on failure it exits with the same status the old
`pipefail` pipeline did.
- frontend-snapshots.yml: `write-vcs-metadata.py`. It writes the same
bytes as the old `jq -n` call.

**Node**: prune-oxlint-suppressions.yml's heredoc is now
`bundle-oxlint-suppressions.js`, unchanged.

**Left inline on purpose**
- frontend-snapshots-upload.yml (`workflow_run`, privileged),
self-hosted.yml manifests, dispatch-api-consumers.yml: these jobs have
no checkout.
- package-pack.yml: its sparse checkout of `static/packages` would leave
the script out.
- fast-revert.yml "comment on failure": `pull_request_target`, and the
revert action rewrites the worktree before this step runs, so a script
there could be the reverted version.
- Kafka healthcheck swap in backend.yml and acceptance.yml: it relies on
bash's `time` keyword, and POSIX sh would change that output.
- "Get changed files" in backend.yml, acceptance.yml,
getsentry-dispatch.yml: one pipe into `parse-pr-files.py`. A `gh`
failure there gives empty lists, which runs the full suite. Splitting
the pipe for POSIX sh would risk changing that.
- One- and two-command steps (matchers, cache paths, the lint ratchet
if/else, migrations output, requirements check).

**Open questions for owners** (existing bugs, not touched here)
- backend.yml typing, mypy message greps: under `set -e`, a `! grep`
line never aborts, so only the last pattern is enforced.
- development-environment.yml direnv activation: `| tee direnv.log`
hides the exit status of the `direnv exec ... test` check.

<!-- junior-request-attribution:start -->
via @joshuarli, @TkDodo.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A7217252d5acb73d5414c0eb9b5f3876f -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A7217252d5acb73d5414c0eb9b5f3876f)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A7217252d5acb73d5414c0eb9b5f3876f/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-authored-by: joshuarli <joshuarli98@gmail.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.

3 participants