Skip to content

ci(lockdown): freeze max_size in every check_*_size.yml + add lint enforcement - #3303

Merged
zackees merged 1 commit into
masterfrom
ci/size-thresholds-lockdown
Jun 20, 2026
Merged

zackees merged 1 commit into
masterfrom
ci/size-thresholds-lockdown

Conversation

@zackees

@zackees zackees commented Jun 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Three-pronged lockdown to stop CI agents from "fixing" red size-check workflows by raising the threshold ceiling instead of fixing the underlying regression. Same pattern as the root ./platformio.ini lockdown (PR #3280) but applied to .github/workflows/check_*_size.yml.

What lands

1. Lockdown banner in all 10 size-check workflows

.github/workflows/check_*_size.yml (bluepill, esp32, teensy30/31/32/35/36/41/lc, uno) all gain a comment block above the max_size lines telling the reader the value is mirror-locked by ci/lint/check_size_thresholds.py.

2. New lint check (ci/lint/check_size_thresholds.py)

  • Frozen FROZEN_THRESHOLDS dict — single source of truth for all canonical ceilings.
  • Validates every max_size{,_apa102} value in every check_*_size.yml against the dict.
  • Wired into bash lint as stage size_thresholds_locked.
  • ERROR mode by design — no warn-only escape hatch. Changing a YAML value without updating the dict in the same PR fails lint.
  • Catches: silent threshold bumps, removal of max_size lines, new check_*_size.yml workflows added without registration in the frozen dict.

3. CodeRabbit rule

New .coderabbit.yaml entries on .github/workflows/check_*_size.yml and on the lint script itself. Flags any threshold raise as HIGH severity and requires explicit issue reference + maintainer sign-off.

Threshold revert

This PR reverts the recent esp32 700KB cap back to 330KB. The 700KB bump was the band-aid from PR #3295 to make CI green while #3298 (fbuild not propagating ESP32 board-level build_flags/build_unflags to the toolchain) is unfixed. CI on check_esp32_size.yml will be RED until #3298 is fixed — that is the correct state: the red signal is what forces the underlying fbuild bug to be addressed.

teensy41 apa102 (165000) is preserved at its bumped value with an explanatory comment — the real ceiling is 88000 once #2802 fl::ifstream over-link is fixed.

Frozen values

Board max_size max_size_apa102
bluepill 55000 45000
esp32 330000 330000
teensy30 60000 50000
teensy31 80000 65000
teensy32 80000 65000
teensy35 100000 85000
teensy36 120000 100000
teensy41 120000 165000 (waiting on #2802)
teensylc 35000 30000
uno 11000 / -1 9300 / -1

Verification

$ uv run python ci/lint/check_size_thresholds.py
✅ Size-thresholds lockdown: all 10 check_*_size.yml workflow(s) match frozen values.

$ bash lint
  ✅ size_thresholds_locked completed  (0s)
🎉 All linting completed!

Failure-mode test: temporarily bumping check_esp32_size.yml from 330000 → 700000 (without updating the lint dict) fails:

[size-thresholds-locked] ERROR — 2 frozen-threshold violation(s):
  check_esp32_size.yml:43: `max_size: 700000` does not match frozen value(s) {330000}.
  check_esp32_size.yml:44: `max_size_apa102: 700000` does not match frozen value(s) {330000}.

Out of scope (deferred to follow-up issues filed alongside this PR)

Note on python_pipeline lint

bash lint shows python_pipeline FAILED — that's pre-existing on master (9 ty diagnostics about os.system soft-deprecation, unrelated to this PR). Verified by running ty check ci/ on master directly.

Test plan

  • bash lint — size_thresholds_locked stage clean
  • Manual failure-mode test (bumped value flagged correctly with exit 1)
  • Manual passing-case test (all 10 frozen values pass)

Summary by CodeRabbit

  • Chores
    • Implemented stricter enforcement of binary size limits across supported boards through a centralized verification system.
    • Updated size threshold documentation in CI workflows to clarify immutable limits and synchronization requirements.

…forcement

Three-pronged lockdown to stop agents from "fixing" red size-check
workflows by raising the threshold ceiling instead of fixing the
underlying regression:

1. **Lockdown banner** added to all 10 .github/workflows/check_*_size.yml
   files (bluepill, esp32, teensy30/31/32/35/36/41/lc, uno) right above
   the max_size lines. Tells the reader the value is mirror-locked.

2. **New lint check** ci/lint/check_size_thresholds.py with a frozen
   FROZEN_THRESHOLDS dict. Validates every max_size{,_apa102} value in
   every check_*_size.yml against the dict. Wired into `bash lint` as
   stage `size_thresholds_locked` — ERROR mode by design (no warn-only
   escape hatch). Changing a YAML value without updating the dict in the
   same PR fails lint. Adding a new check_*_size.yml without registering
   it also fails lint.

3. **CodeRabbit rule** on `.github/workflows/check_*_size.yml` (and on
   the lint script itself) flags any threshold raise as HIGH severity
   and requires an explicit issue ref + maintainer sign-off.

**Reverts the recent esp32 700KB cap back to 330KB.** The 700KB bump was
the band-aid from PR #3295 to make CI green while #3298 (fbuild not
propagating board-level build_flags/build_unflags) is unfixed. CI on
check_esp32_size.yml will be red until #3298 is fixed — that is the
correct state: the red signal is what forces the underlying fbuild bug
to be addressed.

teensy41 apa102 (165000) is preserved at its bumped value with an
explanatory comment — the real ceiling is 88000 once #2802 fl::ifstream
over-link is fixed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit ee842e5 into master Jun 20, 2026
10 of 11 checks passed
@coderabbitai

coderabbitai Bot commented Jun 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

Warning

Ignoring CodeRabbit configuration file changes. For security, only the configuration from the base branch is applied for open source repositories.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d1d2278c-6b3f-43e2-9136-1274febeaceb

📥 Commits

Reviewing files that changed from the base of the PR and between b4ac48a and c73b1e2.

📒 Files selected for processing (13)
  • .coderabbit.yaml
  • .github/workflows/check_bluepill_size.yml
  • .github/workflows/check_esp32_size.yml
  • .github/workflows/check_teensy30_size.yml
  • .github/workflows/check_teensy31_size.yml
  • .github/workflows/check_teensy32_size.yml
  • .github/workflows/check_teensy35_size.yml
  • .github/workflows/check_teensy36_size.yml
  • .github/workflows/check_teensy41_size.yml
  • .github/workflows/check_teensylc_size.yml
  • .github/workflows/check_uno_size.yml
  • ci/lint.py
  • ci/lint/check_size_thresholds.py

📝 Walkthrough

Walkthrough

Introduces ci/lint/check_size_thresholds.py, which defines a FROZEN_THRESHOLDS dict and validates all check_*_size.yml workflow files against it. The script is registered as a new size_thresholds_locked stage in ci/lint.py. All size-check workflows receive freeze-policy comments; the ESP32 workflow's thresholds are lowered from 700 KB to 330 KB. CodeRabbit review rules are added to enforce paired changes.

Changes

Frozen Binary-Size Threshold Enforcement

Layer / File(s) Summary
check_size_thresholds.py: FROZEN_THRESHOLDS, scanner, validator, reporter, CLI
ci/lint/check_size_thresholds.py
Defines FROZEN_THRESHOLDS mapping each workflow to allowed max_size/max_size_apa102 frozensets, Violation named tuple, _scan_file() regex parser, check() validator, _print_violations() reporter, run() orchestrator, and main() CLI entrypoint.
ci/lint.py: size_thresholds_locked stage
ci/lint.py
Imports run_size_thresholds_check and registers a new LintStage named size_thresholds_locked with a 10-second timeout in create_stages().
Workflow freeze comments and ESP32 threshold correction
.github/workflows/check_esp32_size.yml, .github/workflows/check_*_size.yml
Adds "frozen size threshold" banner comments to all size-check workflows documenting the mirror-lock requirement. Lowers check_esp32_size.yml max_size and max_size_apa102 from 700000 to 330000 and replaces old TODO comments with freeze-policy documentation referencing issue #3298.
CodeRabbit review rules
.coderabbit.yaml
Adds two path_instructions entries: one for check_*_size.yml enumerating threshold-lockdown violation conditions, and one for ci/lint/check_size_thresholds.py requiring FROZEN_THRESHOLDS changes to be paired with workflow edits and documented with an issue link or maintainer sign-off.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • FastLED/FastLED#2790: Previously bumped check_esp32_size.yml max_size/max_size_apa102 to 700000; this PR directly reverts those values to 330000 and freezes them.
  • FastLED/FastLED#2804: Modified check_esp32_size.yml and check_teensy41_size.yml thresholds that are now governed by the new FROZEN_THRESHOLDS enforcement in ci/lint/check_size_thresholds.py.
  • FastLED/FastLED#3268: Also touches check_esp32_size.yml max_size/max_size_apa102 values at the 330 KB level that this PR is now locking as a frozen ceiling.

Poem

🐇 Hop, hop — no more size creep tonight,
The thresholds are frozen, locked up tight!
A script now guards each byte with care,
Raise the cap? You'd better declare!
With issue links and sign-off due,
The linter rabbit's watching you. 🔒

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/size-thresholds-lockdown

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 20, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 20, 2026
zackees added a commit that referenced this pull request Jun 20, 2026
… vs. band-aids (#3305) (#3307)

Follow-up to PR #3303's defensive lockdown. Walks every check_*_size.yml
workflow's git history, classifies each currently frozen max_size /
max_size_apa102 value as either a "real ceiling" or a "band-aid for a
known regression", and ties every band-aid to a tracking issue.

Audit findings:

| Board    | Frozen value(s)            | Status                          |
|----------|----------------------------|---------------------------------|
| uno      | 11000 / 9300 (-1 sentinel) | real ceiling                    |
| bluepill | 55000 / 45000              | real ceiling                    |
| esp32dev | 330000 / 330000            | real ceiling (RED on #3298)     |
| teensy30 | 60000 / 50000              | real ceiling                    |
| teensy31 | 80000 / 65000              | real ceiling                    |
| teensy32 | 80000 / 65000              | real ceiling                    |
| teensy35 | 100000 / 85000             | real ceiling                    |
| teensy36 | 120000 / 100000            | real ceiling                    |
| teensy41 | 120000 / **165000**        | apa102 band-aid (#2802; real=88000) |
| teensylc | 35000 / 30000              | real ceiling                    |

Only one current band-aid: teensy41 max_size_apa102=165000 (PR #2804,
closes #2802). The real ceiling is 88000 once fl::ifstream /
fl::posix_filebuf / fl::strerror / fl::AsyncLog* are kept out of the
Apa102 link.

esp32dev's 330000 is a real ceiling but CI is currently RED until #3298
(fbuild dropping ESP32 board-level build_flags / build_unflags) is
fixed. The 700K bumps in PR #2790 and PR #3295 were band-aids; both
already reverted by PR #3303.

Changes:

- New `docs/SIZE_THRESHOLD_HISTORY.md` with the per-board classification
  table, the historical bump catalogue for esp32dev and teensy41 (the
  two workflows with non-trivial bump histories), and instructions for
  how to change a frozen value (issue + YAML + lint script + this doc).
- `ci/lint/check_size_thresholds.py` — extended the existing teensy41
  band-aid comment pattern to every other entry, tagging each value as
  "real ceiling" or "band-aid (#NNNN)" so the lockdown lint script
  documents the audit it enforces.
- `agents/docs/binary-size-analysis.md` — single-line cross-reference
  to the new doc so agents discover it from the bloat workflow.

No frozen values changed; the lockdown lint still passes
(size_thresholds_locked stage: green).

Out of scope (per the issue):
- Actually fixing #2802 or #3298.
- Stretch goal `bash ci/audit-size-thresholds.py` automation.

Closes #3305

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees deleted the ci/size-thresholds-lockdown branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant