Skip to content

Stage 6: CI bloat regression gate (ratcheting baseline) (#2886) #2899

Closed

Description

@zackees

Goal

Ship the CI regression gate that locks in the savings from Stages 1+2+3 (and any future stage) by asserting bash bloat esp32s3 flash total stays at or below a recorded baseline.

No code change to FastLED runtime. New deliverables are tooling + CI wiring only. The acceptance criterion in #2886 reads:

Add tests/test_esp32s3_bloat_regression.sh that asserts bash bloat esp32s3 flash total is ≤ 280,000 B. Wire into CI so future PRs flag regressions.

Parent: #2886 — Stage 6 of the multi-stage bloat-reduction plan.

Why this is the next stage to ship

Stages 1+2+3 introduced ~70 KB of projected savings. Stage 0 (#2898) documented every knob in docs/SLIM_ESP32S3.md but marked all numbers 📊 because no measured baseline lives in the tree yet. Stage 6 is the bridge that flips 📊 → ✅ AND prevents the savings from silently regressing as the codebase evolves.

Stages 4 (cold-helper audit) and 5 (basic_string::write simplification) are smaller and harder to PR cleanly without a regression gate already in place — a careless refactor on either path could unwittingly undo Stage 1's collapse. Shipping Stage 6 first means Stage 4/5 PRs are validated against an objective gate.

Threshold strategy — initial gate vs. end goal

The #2886 end goal is ≤ 280,000 B. That assumes ALL six stages are landed; with only 1+2+3 shipped, current flash is projected at ~318-325 KB. Setting the gate at 280,000 B immediately would fail every PR.

Initial gate: ≤ 388,380 B (the pre-Stage-1 baseline). Catches any regression beyond where we started.

Headroom policy: the gate ratchets down as later stages land. Each stage PR that lands measurable savings includes a follow-up commit that lowers the threshold in the regression-gate's pinned-baseline file. The file lives at tests/data/esp32s3_bloat_baseline.txt (single-line integer) so the ratchet is a one-line diff per stage.

End-goal gate: ≤ 280,000 B after Stages 4+5+6 all land (and the regression-gate has flipped its baseline file ≥ 3 times in lockstep).

Deliverable

1. Regression test script

Path: tests/test_esp32s3_bloat_regression.py

Python (not shell — bash bloat is a thin wrapper around ci/bloat.py, so the test should be CLI-launchable on any of CI's Linux/macOS/Windows runners without bash quirks). The script:

def main() -> int:
    """Run `bash bloat esp32s3 --build`; assert flash total <= baseline.

    Reads:
        - tests/data/esp32s3_bloat_baseline.txt — single integer, in bytes.
          Updated in the same PR as each Stage's savings to ratchet down.

    Writes:
        - .build/symbols/esp32s3/report.json (via the bloat wrapper).

    Exits 0 on pass, non-zero on regression (with a per-symbol delta
    table printed to stderr to help the PR author diagnose).
    """

2. Recorded baseline

Path: tests/data/esp32s3_bloat_baseline.txt

Single-line plain-text integer (388380) representing the pre-Stage-1 NEOPIXEL Blink flash baseline from the #2886 top-25 audit. Each subsequent Stage that lands measurable savings includes a one-line diff lowering this number.

3. CI workflow

Path: .github/workflows/bloat_regression_esp32s3.yml

Mirrors the path filters of .github/workflows/build_esp32s3.yml (any change to src/**, examples/**, ci/**, build descriptors, or pyproject.toml). Invokes:

- run: uv run python tests/test_esp32s3_bloat_regression.py

After the existing esp32s3 build step succeeds (so the ELF is already on disk and --build can be skipped in the test invocation when reusing the cached artifact).

4. Doc update — flip 📊 → ✅ where applicable

Once the gate is live and the recorded baseline reflects measured numbers, the table in docs/SLIM_ESP32S3.md flips the relevant rows from 📊 → ✅. This is a follow-up commit that lands after the first successful CI run that records the measurement.

Acceptance

  1. tests/test_esp32s3_bloat_regression.py exists and runs end-to-end via uv run python tests/test_esp32s3_bloat_regression.py.
  2. tests/data/esp32s3_bloat_baseline.txt contains the integer 388380.
  3. .github/workflows/bloat_regression_esp32s3.yml exists and is wired to PR + push events on the same path filters as build_esp32s3.yml.
  4. On a deliberately-regressed PR (e.g. a sketch that adds -DFASTLED_LOG_VERBOSITY=1 to force a regression), the workflow fails with a clear "flash total X exceeds baseline Y" message.
  5. The roadmap entry in docs/SLIM_ESP32S3.md lists Stage 6 as "in progress" → "shipped" once this lands.

Out of scope

  • Flipping 📊 → ✅ in docs/SLIM_ESP32S3.md for Stages 1+2+3 — that's a follow-up PR after the first successful CI run records the measurement.
  • Stage 4 (cold-helper audit) and Stage 5 (basic_string::write simplification) — each lands as its own PR with its own baseline ratchet.
  • Per-symbol delta enforcement (e.g. "no single symbol may grow by > 256 B") — that's a separate, finer-grained gate tracked in a future issue.

Related

🤖 Generated with Claude Code

Activity

  1. moved this from Triage to Done in FastLED Trackeron Jun 7, 2026
  2. added a commit that references this issue on Jun 7, 2026
    9d28145
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions