Skip to content

feat(ci): standardized per-platform smoke-sketch manifest (refs #2411) - #2803

Merged
zackees merged 2 commits into
masterfrom
feat/2411-standardize-smoke-sketches
Jun 5, 2026
Merged

zackees merged 2 commits into
masterfrom
feat/2411-standardize-smoke-sketches

Conversation

@zackees

@zackees zackees commented Jun 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements Part A of #2411: a canonical, platform-agnostic list of FastLED example sketches that EVERY supported board must compile in CI. This is the prerequisite the opt-in PlatformIO comparison job (Part B) will read from.

Files added:

  • tests/platforms/_standard/SMOKE_SKETCHES.txt — the manifest itself (plain text, one example name per line, # comments, blank lines ignored).
  • ci/standardized_smoke_sketches.py — a tiny reader (load_smoke_sketches(), load_smoke_sketches_detailed(), manifest_path()) plus a CLI entry point that prints the list, suitable for shell pipelines.
  • ci/tests/test_standardized_smoke_sketches.py — 8 tests covering parser edge cases plus three live-manifest sanity checks (manifest exists, contains the canonical four, every entry resolves to an existing examples/<name>/ directory).

Canonical sketches in the manifest

Sketch Why it's in the set
Blink Basic clockless one-pixel sanity. If this fails, the toolchain can't link the simplest FastLED program.
XYMatrix 2D matrix wiring + XYMap — the most common 2D abstraction.
Apa102 Clocked SPI chipset + 8-bit gamma / palette code. Picked over Apa102HD because Apa102 has the smaller exclusion set (only stm32f103cb is filtered out via @filter) and matches the "PROGMEM gradient/palette tables" intent in the issue.
AudioFftParity FFT / sin LUT path. ESP32-only by its own @filter (esp_dsp.h availability — see #2623); on non-ESP32 boards the existing sketch_filter machinery skips it cleanly. The slot is reserved here so a future cross-platform FFT-parity sketch can replace this entry without churning every CI consumer.

Per-board skipping continues to be driven by the existing @filter directives inside each .ino — the manifest itself stays platform-agnostic on purpose. Per-board overrides / additional smoke sketches remain under tests/platforms/<board>/ as today.

Sample invocation

$ uv run python ci/standardized_smoke_sketches.py
Blink
XYMatrix
Apa102
AudioFftParity

# Shell-pipeline consumer (illustrative):
$ bash compile esp32dev --examples $(uv run python ci/standardized_smoke_sketches.py | tr '\n' ' ')

Python consumers:

from ci.standardized_smoke_sketches import load_smoke_sketches
for sketch in load_smoke_sketches():
    ...  # feed to ci-compile.py / fbuild / pio_compile / arduino-cli

Not in scope (deferred)

  • Part B from ci: standardize per-platform smoke sketches + opt-in PlatformIO comparison job in build_template.yml #2411 — the opt-in also_build_with_platformio input on .github/workflows/build_template.yml and the per-backend pass/fail summary. This PR is the prerequisite; the workflow side lands in a follow-up.
  • CI matrix shape — no changes to the default per-PR build matrix. Existing per-board build runs are unchanged.
  • Part C (agent docs update) — also deferred to the Part B follow-up so the "diagnosing fbuild-only failures" docs section can reference both pieces.

Test plan

  • uv run python -m pytest ci/tests/test_standardized_smoke_sketches.py -v — 8/8 pass locally (covers parser comments / blank lines / inline comments / duplicate rejection / missing-manifest error, plus live-manifest sanity).
  • bash lint — clean (ruff + ty + cpp_linting + javascript_linting + meson_linting).
  • uv run python ci/standardized_smoke_sketches.py — prints the four canonical names, one per line.
  • CI: GitHub Actions on this PR.

Refs #2411.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Added comprehensive test coverage validating the canonical smoke-sketch manifest, that entries resolve to example sketches, and parser behaviors (skips blanks/comments, strips inline comments, records line numbers, rejects duplicates, errors on missing manifest).
  • Chores

    • Introduced a standardized smoke-sketch manifest for CI across platforms and a small CLI to list the canonical sketches.

Adds tests/platforms/_standard/SMOKE_SKETCHES.txt as the canonical list of
example sketches every supported board must compile in CI:

  - Blink            — basic clockless one-pixel sanity
  - XYMatrix         — 2D matrix wiring + XY helper
  - Apa102           — clocked SPI chipset + 8-bit gamma/palette code
  - AudioFftParity   — FFT / sin LUT path (ESP32-only via its own @filter)

Plus ci/standardized_smoke_sketches.py — a trivial reader (one example name
per line, '#' comments) that exposes load_smoke_sketches() for CI tooling
and prints the list when invoked as a script. Per-board skipping continues
to be driven by the existing @filter directives inside each .ino, so the
manifest stays platform-agnostic.

Sample invocation:

    uv run python ci/standardized_smoke_sketches.py
    # Blink
    # XYMatrix
    # Apa102
    # AudioFftParity

ci/tests/test_standardized_smoke_sketches.py covers parser edge cases
(comments, blank lines, inline comments, duplicate rejection,
missing-manifest error) plus three live-manifest sanity checks that ensure
every entry resolves to an existing examples/<name>/ directory.

Part B from #2411 (opt-in PlatformIO comparison job in build_template.yml)
is deferred to a follow-up PR. No CI workflow changes here — this PR is the
prerequisite the consumer side will build on.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9b089386-859d-4861-91c3-fdcf4545d31c

📥 Commits

Reviewing files that changed from the base of the PR and between b643ed4 and 20b027a.

📒 Files selected for processing (2)
  • ci/standardized_smoke_sketches.py
  • ci/tests/test_standardized_smoke_sketches.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • ci/tests/test_standardized_smoke_sketches.py
  • ci/standardized_smoke_sketches.py

📝 Walkthrough

Walkthrough

Adds a canonical SMOKE_SKETCHES.txt manifest, a parser module that reads/validates the manifest (including duplicate detection and line-number tracking), a small CLI, and tests that validate the live manifest and parser behaviors.

Changes

Standardized smoke-sketch manifest system

Layer / File(s) Summary
SmokeSketch data contract and path resolution
ci/standardized_smoke_sketches.py
Introduces the SmokeSketch frozen dataclass with name and manifest_line fields, the manifest location constant MANIFEST_RELATIVE_PATH, and _project_root() / manifest_path() helpers to resolve the manifest file.
Manifest parser and wrapper
ci/standardized_smoke_sketches.py
Implements load_smoke_sketches_detailed() to parse the manifest while skipping blank lines, stripping inline and full-line comments, tracking seen names, detecting duplicates (ValueError with line info and manifest path), and raising FileNotFoundError if missing; load_smoke_sketches() returns ordered names.
CLI entrypoint
ci/standardized_smoke_sketches.py
Adds _main() that prints one sketch name per line and maps errors to exit codes: 1 missing file, 2 invalid/duplicate manifest, 130 keyboard interrupt, 0 success; wired to __main__.
Canonical manifest file
tests/platforms/_standard/SMOKE_SKETCHES.txt
Adds the canonical manifest listing Blink, XYMatrix, Apa102, and AudioFftParity with usage notes and per-board filtering guidance.
Live manifest validation tests
ci/tests/test_standardized_smoke_sketches.py
Verifies the canonical manifest exists, contains the expected sketches, and that each entry resolves to an existing examples/<name>/ directory.
Parser behavior and error handling tests
ci/tests/test_standardized_smoke_sketches.py
Tests parser behavior with synthetic manifests: skipping blank/full-line comments, stripping inline comments/whitespace, recording manifest line numbers, rejecting duplicates with a ValueError, and raising FileNotFoundError when manifest is absent.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Parser
  participant FileSystem
  CLI->>Parser: call load_smoke_sketches_detailed(project_root)
  Parser->>FileSystem: open manifest_path(project_root)
  FileSystem-->>Parser: file lines or FileNotFoundError
  Parser->>Parser: strip comments, skip blanks, detect duplicates
  Parser-->>CLI: return list of SmokeSketch / raise ValueError
  CLI-->>FileSystem: print names to stdout
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Poem

🐰 I nibble lines in a manifest bright,
Four tiny sketches, parsed just right,
Comments trimmed, duplicates caught tight,
CI hops along into the night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and concisely describes the main change: introducing a standardized, platform-agnostic manifest for smoke-sketch CI testing, which is the primary objective of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/2411-standardize-smoke-sketches

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ci/standardized_smoke_sketches.py`:
- Around line 143-145: Move the local import of sys out of the if __name__ ==
"__main__": block and add it to the top-level import section with the other
standard-library imports; update the import ordering so sys appears in the
standard-library group before third-party/local imports, and remove the
in-function import (ensure any use of sys in main continues to work unchanged).
- Line 120: Replace the list comprehension in the return statement with an
explicit loop: call load_smoke_sketches_detailed(project_root), iterate over its
results, append each entry.name to a new list variable, and return that list;
update the function containing this line (the caller of
load_smoke_sketches_detailed) to use the explicit loop for clarity and
debuggability.
- Around line 131-139: The try/except around the loop over load_smoke_sketches()
must handle KeyboardInterrupt before the other exception handlers; add an except
KeyboardInterrupt clause immediately after the try to either re-raise the
KeyboardInterrupt (preferred for CLI) or perform the immediate shutdown behavior
your app expects, then keep the existing except FileNotFoundError as exc and
except ValueError as exc handlers after it so KeyboardInterrupt is not swallowed
by those handlers.
- Around line 58-71: Remove default parameter values for the public APIs: change
signatures like manifest_path(project_root: Path | None = None) and
load_smoke_sketches_detailed(project_root: Path | None = None) to require an
explicit project_root parameter (e.g., project_root: Path | None) so no
parameter has a default; update any other functions in this file with the same
pattern (lines around the second occurrence) and adjust callers/tests to pass
project_root explicitly (or add a small internal helper that calls the original
logic with _project_root()), and update docstrings to stop claiming a default
when removed.
- Around line 34-46: Import the runtime type-check decorator by adding "from
typeguard import typechecked" and apply it to the SmokeSketch dataclass by
placing `@typechecked` above `@dataclass`(frozen=True); specifically update the
declaration of the SmokeSketch class so the decorator order is `@typechecked` then
`@dataclass` while keeping the existing fields (name: str, manifest_line: int) and
docstring intact to enable runtime type validation for the SmokeSketch class.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c32f5bf-bcab-4354-8567-6687bbfb1c44

📥 Commits

Reviewing files that changed from the base of the PR and between 787de45 and b643ed4.

📒 Files selected for processing (3)
  • ci/standardized_smoke_sketches.py
  • ci/tests/test_standardized_smoke_sketches.py
  • tests/platforms/_standard/SMOKE_SKETCHES.txt

Comment thread ci/standardized_smoke_sketches.py Resolved
Comment thread ci/standardized_smoke_sketches.py Resolved
Comment thread ci/standardized_smoke_sketches.py Resolved
Comment thread ci/standardized_smoke_sketches.py Resolved
Comment thread ci/standardized_smoke_sketches.py Resolved
- Decorate SmokeSketch with @TypeChecked for runtime validation.
- Remove default values from manifest_path / load_smoke_sketches /
  load_smoke_sketches_detailed signatures (repo rule: no parameter
  defaults); update tests + CLI to pass None explicitly.
- Replace list comprehension in load_smoke_sketches with explicit loop.
- Hoist sys import to module top.
- Handle KeyboardInterrupt first in _main(), routing through the project
  handle_keyboard_interrupt(ki) helper (KBI002).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit ea12291 into master Jun 5, 2026
27 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 5, 2026
@zackees
zackees deleted the feat/2411-standardize-smoke-sketches 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