Skip to content

The agent that grows with you

ci: one command runs every blocking lint check, locally and in CI

teknium1ca682666b8c0
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index ce2f204db13..3679aa1f41b 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -148,7 +148,8 @@ jobs:
lint:
name: Python lints
needs: detect
- if: needs.detect.outputs.python == 'true'
+ # frontend too: the code-health ratchet in lint.yml also covers TypeScript.
+ if: needs.detect.outputs.python == 'true' || needs.detect.outputs.frontend == 'true'
uses: ./.github/workflows/lint.yml
with:
event_name: ${{ needs.detect.outputs.event_name }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 67d83c44afa..cf9228ec509 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,12 +1,14 @@
name: Lint (ruff + ty)
-# Two things here:
+# Three things here:
# 1. Advisory diff — ruff + ty diagnostics as a diff vs the target branch.
# Writes a Markdown summary to the run page. Exit zero always.
# 2. Blocking ``ruff check .`` — enforces the explicit rules in
# ``[tool.ruff.lint.select]`` (currently PLW1514). Failure blocks merge.
# Separate job so the advisory diff still runs even when enforcement
# fails.
+# 3. Blocking code-health ratchet (``scripts/code_health``) for Python and TypeScript.
+# ``python scripts/check`` runs every blocking check here locally with the same pinned tools.
#
# CI-sensitive file review is enforced by .github/CODEOWNERS, not a CI job.
@@ -45,7 +47,7 @@ jobs:
- name: Install ruff + ty
uses: ./.github/actions/retry
with:
- command: python -m scripts.ci.python_packages ruff==0.15.10 ty==0.0.82
+ command: python -m scripts.ci.python_packages "$(python -m scripts.code_health --print-pins)" ty==0.0.82
- name: Determine base ref
id: base
@@ -136,7 +138,7 @@ jobs:
- name: Install ruff
uses: ./.github/actions/retry
with:
- command: python -m scripts.ci.python_packages ruff==0.15.10
+ command: python -m scripts.ci.python_packages "$(python -m scripts.code_health --print-pins)"
- name: ruff check .
# No --exit-zero, no || true. Exit code propagates to the job,
@@ -144,6 +146,34 @@ jobs:
run: |
ruff check .
+ code-health:
+ # Per-unit ratchet: every function and file keeps its own cap (its value on main when it is
+ # already over target, else the target) and pattern rules compare fingerprints, so a PR
+ # cannot trade one violation for another. The merge commit is compared with its first
+ # parent (current main), so an improvement that lands on main is locked in at once.
+ name: code health ratchet (blocking)
+ if: inputs.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7.0.1
+ with:
+ fetch-depth: 2 # the merge commit and its first parent (the base branch tip)
+
+ - uses: ./.github/actions/setup-pm
+ with:
+ cache-python: true
+ prune-python-cache: true
+
+ - name: Install pinned ruff
+ uses: ./.github/actions/retry
+ with:
+ command: python -m scripts.ci.python_packages "$(python -m scripts.code_health --print-pins)"
+
+ - name: Ratchet the PR against the base branch tip
+ run: python scripts/check --only health --base HEAD^1
+
windows-footguns:
# Static guardrails on Windows-unsafe Python primitives — os.kill(pid, 0),
# os.killpg, os.setsid, signal.SIGKILL without getattr fallback,