Skip to content

ci(boards): test the validate_boards gate and make its skips honest - #1925

Merged
zackees merged 1 commit into
mainfrom
agent/test-validate-boards
Nov 6, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/test-validate-boards

Conversation

@zackees

@zackees zackees commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Why

ci/validate_boards.py is the gate validate-boards.yml runs after installing seven pinned PlatformIO platforms, and it had no test (it is entry 4 of the untested-gate backlog in ci/gate_script_tests.toml). Reading it against the pinned platform set showed three paths that could not fail — and one of them was already failing silently on 61 boards.

Defects found (all reproduced)

  1. 61 boards on installed platforms are never validated. validate_board() returned None both for "platform not installed on this host" and for "platform is installed but ships no <id>.json". The summary lumped both into skipped, and the job still printed "All checked boards match PlatformIO definitions." Measured against the exact pins in validate-boards.yml: 55 espressif32 (every esp32-c5* / esp32-c6* / esp32-p4* asset, briki_*, arduino_nesso_n1, …), 5 raspberrypi (arduino-pico ids), 1 ststm32 (arduino_uno_q).
  2. A run that compares nothing exits 0. No platform installed, or installed platforms that carry none of our boards → checked == 0 and the same "all match" line, rc 0.
  3. An empty upstream section short-circuits the diff. if expected_build and expected_build != actual_build: means that when PlatformIO declares no comparable build fields, our asset can carry anything under build (same for upload).
  4. A board asset with no platform field was skipped silently; it is now a failure that names the asset.

Fix

  • validate_board() → Validation(status, diffs) with MATCH / DRIFT / UNMATCHED / NO_PLATFORM, so "nothing to compare" cannot be confused with "compared and clean". compare_board() extracted; it diffs a section whenever either side is non-empty.
  • New ci/validate_boards_baseline.json (schema 1, verifiedAgainst = the pins, verifiedOn) holds the 61 known-unmatched ids per platform with the reason documented in the file. Unmatched-but-not-baselined is a failure pointing at the file, so a new board that cannot be validated cannot join the skip bucket. Entries are checked by the test suite: each must still exist as an asset on the declared platform, must not duplicate FBUILD_NATIVE_BOARDS, and the baseline's platforms must be a subset of the workflow's pins (so a rotted entry cannot widen the hole).
  • main() fails with "Nothing was verified" when zero boards were compared, and reports compared / passed / drifted / failed / platform-not-installed / fbuild-native / known-unmatched / NEW-unmatched.

CI-safety rehearsal (real pins, no guessing)

The stricter diff could have turned pre-existing conditions red, so the whole asset set was replayed against the exact platform versions validate-boards.yml pins (docker-free: git clone --depth 1 --branch v<ver> for atmelavr 5.1.0, espressif32 6.13.0, espressif8266 4.2.1, teensy 5.1.0, ststm32 19.5.0, raspberrypi 1.19.0, atmelmegaavr 1.9.0):

old  Results: 1648 total, 891 checked, 891 passed, 0 failed, 746 skipped, 11 fbuild-native   rc 0
new  Results: 1648 total, 891 compared, 891 passed, 0 drifted, 0 failed, 685 platform-not-installed,
              11 fbuild-native, 61 known-unmatched, 0 NEW-unmatched                            rc 0

Same 891 verdicts, same rc; the old 746 skipped was 685 + 61 never examined.

Tests

  • ci/test_validate_boards.py — 35 tests, 393 lines: field extraction (BUILD_FIELDS/UPLOAD_FIELDS/arduino subfields, list→string extra_flags, megatinycore/dxcore define injection without duplication), diff_dicts in all three directions, base + versioned platform lookup, per-board MATCH/DRIFT/UNMATCHED/NO_PLATFORM, the fbuild extension stripper, and end-to-end main() runs against a synthetic assets/ + .platformio/platforms tree (exit codes, counts, baseline covering/non-covering/malformed, --platforms filter, missing dirs, unknown arg).
  • RED proven by three in-place mutations, all restored: restore the if expected_build and … guard → 2 fail; fold UNMATCHED back into the skip bucket → 3 fail; disable the zero-compared check → 2 fail.
  • Real output: 35/35 OK; hosted self-test set 260 → 295 OK; ci/gate_script_coverage.py --budget 2 clean; check_python_complexity clean; ruff check clean; render_workflows.py --check clean.
  • Ratchet: [scripts.validate_boards] registered with its test, removed from untested (3 → 2), MAX_UNTESTED 3 → 2, registered in both entry points (ci/local_suites.py + ci-workflow-drift.yml), ci/README.md bullet.

Not done here

build_backend and build_qemu_linux_runtime remain in untested (the latter needs a container build; the former is the next entry).

validate_boards.py ran in validate-boards.yml with no test at all, and three
of its paths could not fail:

* 61 boards on *installed* platforms ship no upstream <id>.json (every
  esp32-c5/c6/p4 asset, the arduino-pico rp2040 set, arduino_uno_q). They were
  counted in the same "skipped" bucket as platforms that are simply not
  installed here, and the job printed "All checked boards match PlatformIO
  definitions". They are now an explicit known-unmatched bucket pinned in
  ci/validate_boards_baseline.json; a NEW unmatched id fails the gate.
* a run that compared zero boards (no platform installed, or none of the
  installed platforms carrying our assets) exited 0 with that same line.
* `if expected_build and expected_build != actual_build` short-circuited the
  comparison whenever PlatformIO declared nothing comparable, so an asset
  carrying build/upload fields upstream never declares was reported as a match.
* a board asset with no `platform` field was silently skipped; it is now a
  failure naming the asset.

validate_board() returns an explicit Validation(status, diffs) instead of
`list[str] | None`, so "no upstream to compare" and "compared and clean" can
no longer be confused. verifiedAgainst: the 61 entries were derived from the
platform versions pinned in validate-boards.yml and the whole set was
replayed against those exact pins (891 boards compared, 891 passed, 0 drifted,
61 known-unmatched, 0 NEW) so the stricter comparison introduces no drift.
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@zackees
zackees added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit d0ecc5d Nov 6, 2026
31 checks passed
@zackees
zackees deleted the agent/test-validate-boards branch November 6, 2026 00:06
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant