Repository navigation
ci(boards): test the validate_boards gate and make its skips honest - #1925
Merged
Merged
Conversation
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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ci/validate_boards.pyis the gatevalidate-boards.ymlruns after installing seven pinned PlatformIO platforms, and it had no test (it is entry 4 of the untested-gate backlog inci/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)
validate_board()returnedNoneboth for "platform not installed on this host" and for "platform is installed but ships no<id>.json". The summary lumped both intoskipped, and the job still printed "All checked boards match PlatformIO definitions." Measured against the exact pins invalidate-boards.yml: 55espressif32(everyesp32-c5*/esp32-c6*/esp32-p4*asset,briki_*,arduino_nesso_n1, …), 5raspberrypi(arduino-pico ids), 1ststm32(arduino_uno_q).checked == 0and the same "all match" line, rc 0.if expected_build and expected_build != actual_build:means that when PlatformIO declares no comparable build fields, our asset can carry anything underbuild(same forupload).platformfield was skipped silently; it is now a failure that names the asset.Fix
validate_board()→Validation(status, diffs)withMATCH/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.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 duplicateFBUILD_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 reportscompared / 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.ymlpins (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):Same 891 verdicts, same rc; the old
746 skippedwas685 + 61 never examined.Tests
ci/test_validate_boards.py— 35 tests, 393 lines: field extraction (BUILD_FIELDS/UPLOAD_FIELDS/arduino subfields, list→stringextra_flags, megatinycore/dxcore define injection without duplication),diff_dictsin all three directions, base + versioned platform lookup, per-board MATCH/DRIFT/UNMATCHED/NO_PLATFORM, the fbuild extension stripper, and end-to-endmain()runs against a syntheticassets/+.platformio/platformstree (exit codes, counts, baseline covering/non-covering/malformed,--platformsfilter, missing dirs, unknown arg).if expected_build and …guard → 2 fail; foldUNMATCHEDback into the skip bucket → 3 fail; disable the zero-compared check → 2 fail.35/35 OK; hosted self-test set260 → 295 OK;ci/gate_script_coverage.py --budget 2clean;check_python_complexityclean;ruff checkclean;render_workflows.py --checkclean.[scripts.validate_boards]registered with its test, removed fromuntested(3 → 2),MAX_UNTESTED 3 → 2, registered in both entry points (ci/local_suites.py+ci-workflow-drift.yml),ci/README.mdbullet.Not done here
build_backendandbuild_qemu_linux_runtimeremain inuntested(the latter needs a container build; the former is the next entry).