Repository navigation
feat(ci): standardized per-platform smoke-sketch manifest (refs #2411) - #2803
Conversation
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]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds 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. ChangesStandardized smoke-sketch manifest system
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
ci/standardized_smoke_sketches.pyci/tests/test_standardized_smoke_sketches.pytests/platforms/_standard/SMOKE_SKETCHES.txt
- 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]>
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 existingexamples/<name>/directory).Canonical sketches in the manifest
BlinkXYMatrixXYMap— the most common 2D abstraction.Apa102Apa102HDbecauseApa102has the smaller exclusion set (onlystm32f103cbis filtered out via@filter) and matches the "PROGMEM gradient/palette tables" intent in the issue.AudioFftParity@filter(esp_dsp.havailability — see #2623); on non-ESP32 boards the existingsketch_filtermachinery 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
@filterdirectives inside each.ino— the manifest itself stays platform-agnostic on purpose. Per-board overrides / additional smoke sketches remain undertests/platforms/<board>/as today.Sample invocation
Python consumers:
Not in scope (deferred)
also_build_with_platformioinput on.github/workflows/build_template.ymland the per-backend pass/fail summary. This PR is the prerequisite; the workflow side lands in a follow-up.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.Refs #2411.
🤖 Generated with Claude Code
Summary by CodeRabbit
Tests
Chores