Skip to content

chore: block new problems from being added to the suppressions files - #10314

Open
cryptodev-2s wants to merge 28 commits into
mainfrom
tsc-suppressions-ratchet
Open

cryptodev-2s wants to merge 28 commits into
mainfrom
tsc-suppressions-ratchet

Conversation

@cryptodev-2s

@cryptodev-2s cryptodev-2s commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

lint:oxlint and lint:tsc:check stop new problems from landing, but both have an escape hatch: regenerating their suppressions file. That parks a problem instead of fixing it.

lint:suppressions closes it. Measured against the base branch, oxlint-suppressions.json and tsc-suppressions.json may only shrink:

  • removing a suppression, or lowering its count, passes
  • adding one, or raising a count, fails

The comparison is per file and per rule, so deletions never offset an addition.

CI checks a pull request out as the merge into its base, so the baseline is the first parent and there is nothing extra to fetch. Outside CI there is no merge commit, so pass a ref: yarn lint:suppressions origin/main.

Bypass

The allow-new-suppressions label skips the job, for when suppressions genuinely have to be added (a new package, mostly). It needs creating, and longer term this should be a Core Platform approval rather than a label anyone can apply.

The Oxlint config change

Tests under scripts/ have to import { jest } from '@jest/globals', as Jest does not inject it in ESM, and no-shadow flagged every one. Left alone, every new script test would arrive with a fresh suppression and fail this check. Allowing that one name removes 41 lines from oxlint-suppressions.json.

Worth knowing

The check is strict, per file and per rule. A type error that moves between files, or a rename that rewrites paths, reads as an addition in one file and a removal in the other, so it wants fixing rather than re-suppressing.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Changes are limited to CI and repo lint tooling; no runtime product behavior, though PRs that legitimately need new suppressions must use the bypass label until approval flows exist.

Overview
Adds a lint:suppressions check (and yarn lint:suppressions) that fails when oxlint-suppressions.json or tsc-suppressions.json grow relative to the base branch—new file/rule entries or higher per-rule counts are rejected; shrinking or removing suppressions still passes. Baselines come from HEAD^1 in GitHub Actions and from git merge-base locally (default origin/main).

A new Lint Suppressions workflow runs that check on pull requests (re-running on label changes) and can be skipped with the allow-new-suppressions label; it also asserts a clean working tree after the job.

Oxlint now allows jest in no-shadow for scripts/**/*.test.ts, which removes a batch of script-test suppressions that would otherwise trip the new gate. lint-tsc scripts drop --experimental-strip-types, and SUPPRESSIONS_FILE_NAME is shared from tsc-suppressions.ts for the new checker and tests.

Reviewed by Cursor Bugbot for commit 89fa89f. Bugbot is set up for automated code reviews on this repo. Configure here.

@cryptodev-2s
cryptodev-2s added this pull request to stack #10315 September 21, 2026 12:47
@cryptodev-2s cryptodev-2s changed the title feat: block new type errors from being added to the suppressions file Block new type errors from being added to the suppressions file Sep 21, 2026
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch from fbcb221 to 959ec13 Compare September 22, 2026 17:01
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch from 959ec13 to 3224682 Compare September 23, 2026 13:26
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch 4 times, most recently from bbe7798 to af34ba8 Compare September 28, 2026 17:42
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch from af34ba8 to fb002d8 Compare September 29, 2026 09:41
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch 2 times, most recently from d69c0e5 to 864c3b4 Compare September 29, 2026 12:51
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch from 864c3b4 to c36d921 Compare September 29, 2026 13:00
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch 3 times, most recently from 19a71b8 to 6b78531 Compare September 29, 2026 14:00
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch from 6b78531 to cac109f Compare September 29, 2026 18:30
@cryptodev-2s
cryptodev-2s removed this pull request from stack #10315 September 29, 2026 18:52
@cryptodev-2s
cryptodev-2s force-pushed the tsc-suppressions-ratchet branch from cac109f to f30ac88 Compare September 29, 2026 19:14
@cryptodev-2s
cryptodev-2s added this pull request to stack #10581 September 29, 2026 19:14

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We occasionally do need to add new lint suppressions, e.g., when updating the Oxlint configs, in which case we need to be able to bypass this check.

Mark suggested allowing it if the pull request is approved by the Core Platform team, which sounds like a good idea to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I forgot we had a discussion about this during last retro

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mrtenz as this PR scope already grow do you think I can do a follow up on this ? otherwise is a label enough ?

Comment thread .github/workflows/lint-build-test.yml Outdated
Comment thread oxlint.config.ts
Comment thread package.json Outdated
Comment thread scripts/lib/lint-suppressions.ts Outdated
Node 24 strips types by default, which is what CI runs and what .nvmrc pins.
It read the baseline from the first parent, which is the base only when CI checks the pull request out as a merge commit. Anywhere else that is just the previous commit, so a suppression added earlier on the branch went unnoticed. It now falls back to the merge base with the target branch.
@cryptodev-2s
cryptodev-2s requested a review from Mrtenz September 30, 2026 20:36

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Comment thread scripts/lib/lint-suppressions.ts
cryptodev-2s and others added 4 commits September 30, 2026 22:46
CI checks a pull request out as the merge of the branch into its base, so the first parent is the base. A merge commit made by hand is the other way round, its first parent being the branch, so merging main into a branch locally had the check measure against the branch's own tip and miss what it had added.
Adding a suppression is sometimes the right call, updating the Oxlint configs being the example, so the check can be waived with the allow-new-suppressions label. It still reports what was added either way, leaving the addition in the diff and the waiver in the pull request's history.

It now runs on pull requests only, as the merge queue has neither the merge commit nor the label in reach.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 39074d1. Configure here.

Comment thread .github/workflows/lint-build-test.yml Outdated
cryptodev-2s and others added 10 commits October 1, 2026 11:09
A label applied after the check fails was invisible to it: the
pull_request trigger does not fire on labeled, and a re-run replays the
original event payload. Reading the labels back over the API means
applying the label and re-running the job now works.
Reading the waiver label off the event payload means a label applied
after the run started is invisible, and a re-run replays the original
payload. The other label driven checks here solve that by firing a fresh
run on labeled and unlabeled, which needs a trigger of its own. The job
used nothing from lint-build-test.yml anyway, so it moves out and picks
up the same trigger.
A label anyone can apply is not much of a gate. CODEOWNERS is, so the two
suppressions files now need a core platform review to change at all. The
label stays as the way to turn CI green, but on its own it no longer gets
anything merged.
Reverts the CODEOWNERS change, which would have made removals need a
core platform review too, and those are the ones we want to be easy. The
failure now just points at core platform instead of telling whoever hits
it which label turns the check green.
Running it first only told us what was waived, which the failing run
before the label went on already did. Checking the label first reads
simpler, and this is all going to be replaced by core approval anyway.
No point checking out and installing just to decide we are not going to
run the check.

This branch was successfully deployed

1 active (outdated) deployment
default-branch — d2b5e8df Deployed Sep 30, 2026 by cryptodev-2s via Determine whether this PR is a release PR #5004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants