Skip to content

fix(lint): Don't fail CI on stale suppression budgets inherited from master - #126882

Merged
natemoo-re merged 5 commits into
masterfrom
nate/oxlint-inherited-stale-budgets
Oct 8, 2026
Merged

natemoo-re merged 5 commits into
masterfrom
nate/oxlint-inherited-stale-budgets

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

PRs can merge without being up to date with master, so two merges can each prune the same file or reduce debt on their own. When that happens, master ends up with oxlint-suppressions.json budgets that are higher than the actual debt. The --ci ratchet then fails on master, and on every PR after it, with "Suppression budgets are stale", even though nothing got worse.

Stale budgets now only fail CI when the change caused them. New debt still fails everywhere.

  • master / no --base: stale budgets print a warning (a ::warning:: annotation in Actions) and the ratchet passes.
  • PRs (--base HEAD^1): a stale budget fails only if the PR edited that budget, or if live debt for that file and rule went down compared to the base's live debt. That covers reductions caused indirectly by edits to other files, such as type changes. Editing a file that already has stale budget, without reducing its debt, only warns.

Skipping the stale check must not weaken the ratchet. A passing master run is no longer enough to reuse its committed budgets as a PR baseline. --ci now writes budgets=exact|stale to the step output. A new Verify exact lint budgets step runs only when the budgets are exact, and find-verified-lint-base.js only trusts runs where that step succeeded. On a stale base, PR checks fall back to scanning the base, so the baseline is always the base's live debt. Refilling inherited slack, whether directly or indirectly, then shows up as a new violation.

Tradeoff: until master is pruned, PRs pay for an extra base scan instead of reusing the verified budgets. Automatic pruning or bot commits will be a separate follow-up.

Also moves CODEOWNERS for oxlint-suppressions.json to @getsentry/design-engineering.

via Junior system actor event.

--

View Junior Session [Sentry]

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 8, 2026
@natemoo-re

Copy link
Copy Markdown
Member

Reviewed head 5f64e965f88eaae6af1f3a54225e487d6dd94eac. The direction is right: inherited excess budget should not block unrelated PRs, but new debt must still fail. Please address these before landing:

  1. Do not treat a warning-only master scan as a verified baseline. find-verified-lint-base.js currently trusts a successful Verify lint ratchet step. With this change, master can pass with stale budgets and downstream PRs reuse those budgets instead of scanning actual base debt. This permits direct violations too, not only the indirect type-aware case described in the PR body. I reproduced this using ciFixture against this head:

    const {write, commit, lint, ci} = ciFixture(t);
    write('source.js', ''); // committed budget remains no-debugger: 1
    commit();
    assert.equal(lint('--ci').status, 0); // warning-only master
    write('source.js', 'debugger;\n');
    assert.equal(ci(1).status, 1); // FAILS: actual status is 0

    Once the new violation fills the slack exactly, staleBudgets finds nothing stale, even though the PR edited the file. Preserve a separate, explicit signal that the committed budgets exactly match live counts, and only allow verified-base reuse with that proof. Otherwise fall back to the existing base scan. Add coverage for the workflow/verifier contract as well as this direct-refill case, and update the PR body's tradeoff explanation.

  2. Attribute staleness to reductions, not merely touching a file. changes.has(file) makes a harmless edit to a file with already-stale budget fail, even if its live violation count did not decrease. The intended behavior is to tolerate inherited slack and require pruning for reductions the PR introduces (including reductions caused indirectly in other files). Compare live head/base counts to distinguish these cases; keep intentional budget edits validated. Cover an unrelated edit within a stale file and an indirectly introduced reduction.

  3. Ownership: change CODEOWNERS for oxlint-suppressions.json and the CI workflow containing the oxlint job (/.github/workflows/frontend.yml) to @getsentry/design-engineering. CODEOWNERS operates at file granularity, so this routes the whole workflow file.

No artifact caching in this change. Keep automatic cleanup/bot commits as a separate follow-up; this PR should establish the warning-versus-failure behavior without weakening the ratchet.

@natemoo-re

Copy link
Copy Markdown
Member

Retracting my suggestion to update CODEOWNERS for /.github/workflows/frontend.yml, but yes to oxlint-suppressions.json

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🚨 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 #discuss-dev-infra channel.

@natemoo-re
natemoo-re marked this pull request as ready for review October 8, 2026 15:59
@natemoo-re
natemoo-re requested review from a team as code owners October 8, 2026 15:59
@natemoo-re
natemoo-re enabled auto-merge (squash) October 8, 2026 15:59
@natemoo-re
natemoo-re merged commit dd40943 into master Oct 8, 2026
75 of 76 checks passed
@natemoo-re
natemoo-re deleted the nate/oxlint-inherited-stale-budgets branch October 8, 2026 16:13
natemoo-re added a commit that referenced this pull request Oct 13, 2026
…126895)

Because we don't require branches to be up-to-date when merging, there
are situations where `oxlint-suppressions.json` could potentially be
stale. #126882 made this condition non-failing, but it also causes PRs
to spend longer checking their baseline.

In this PR, we add a cleanup workflow that runs the existing full
type-aware `--prune` command and maintains a baseline cleanup PR
automatically.

This branch was successfully deployed

1 active deployment
Preview — 4dd8b47c Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant