Skip to content

Compile Deployed Configs in CI and Lint ESPHome Warnings - #281

Merged
ptr727 merged 10 commits into
developfrom
ci/lint-production-and-warnings
Oct 30, 2026
Merged

ptr727 merged 10 commits into
developfrom
ci/lint-production-and-warnings

Conversation

@ptr727

@ptr727 ptr727 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Closes two gaps in the compile gate that let warnings reach the dashboard unreported.

  • Deployed configs were never compiled in CI. The matrix held only test/, so a lambda that exists only in a top-level device config was never linted. The matrix now lists test/*.yaml and the top-level *.yaml configs, and the change gate runs the legs when a top-level config changes. Legs are named by config path.
  • ESPHome's own warnings were invisible to the lint. A deprecated key or a pin conflict is printed as a WARNING line while ESPHome reads the config and generates code, and no compiler sees it. In --from-log and --compile mode the lint now reports each one as a finding on line 1 of the config, so it annotates, lands in the summary and the VS Code Problems pane, and fails the leg. It reads from the config read to the build path line, so toolchain retries during the build are not findings. A relative config path in a log resolves against the config root.
  • Unfixable warnings go in tools/compile-lint/allowed-warnings.yaml. Each entry holds a regex matched against the warning's whole first line, the configs it applies to, and the reason. It starts with network and git cache fallbacks on any config, which refuse a permanent HTTP error, the esp32_improv deprecation from the Konnected and Apollo packages, the CeilSense GPIO20 LED, and the WROOM-2 N32R8V experimental IDF opt-in. --verbose lists what was allowed.
  • OPERATIONS.md "Compile Lint" documents both, plus forcing a rebuild by deleting the build directory, since esphome clean also deletes the shared pio_components and PlatformIO cache.

Verified: 59 tests pass, ruff and pyright are clean, and the lint over fresh compile logs of all 32 configs on 2026.10.1 allows exactly the expected warnings. The gate fan findings it used to report were fixed by #280, now merged.

🤖 Generated with Claude Code

- Add every top-level device config to the compile matrix beside the test/ example devices, and run the legs when one changes, so a deployed config's own lambdas are linted.
- Report ESPHome's own WARNING lines from the compile output as findings on the config, such as a deprecated key, which no compiler sees.
- Let known unfixable warnings through tools/compile-lint/allowed-warnings.yaml, each entry scoped to the configs it names and carrying its reason.
- Document both in OPERATIONS.md "Compile Lint", plus deleting a build directory rather than running esphome clean, which wipes the shared pio_components and PlatformIO cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 30, 2026 02:01
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 393899e5-6dc1-47dc-9e99-02b4fe79e997
Commits

Reviewing files that changed from the base of the PR and between cfdd79d and d1b818e.

Files selected for processing: 6
  • .github/workflows/test-pull-request.yml
  • OPERATIONS.md
  • tests/compile_lint/test_lint.py
  • tools/compile-lint/allowed-warnings.yaml
  • tools/compile-lint/pyproject.toml
  • tools/compile-lint/src/compile_lint/lint.py
  • 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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.20253% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.89%. Comparing base (cfdd79d) to head (d1b818e).

Files with missing lines Patch % Lines
tools/compile-lint/src/compile_lint/lint.py 96.20% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #281      +/-   ##
===========================================
+ Coverage    84.61%   85.89%   +1.28%     
===========================================
  Files            3        3              
  Lines          624      695      +71     
===========================================
+ Hits           528      597      +69     
- Misses          96       98       +2     
Flag Coverage Δ
python-3.13 85.89% <96.20%> (+1.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI 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.

🟡 Changes recommended

The main factor is a moderate active finding: build_from_log returns the whole log, so warnings from an earlier compile can be attributed to the last config's line 1, and two additional nit findings also remain open.

3 open issues
What changed in this PR

This PR closes two gaps that let warnings reach the dashboard unreported. Deployed device configs were never compiled in CI, and ESPHome's own WARNING lines were not checked by the compile lint. Both are now covered, and known unfixable warnings are listed in an allow file with reasons.

Changes:

  • CI compiles every test/*.yaml example device and every top-level device config. The change gate also runs when a top-level config changes, and each leg is named by its config path.
  • In --compile and --from-log mode, the lint reads ESPHome WARNING lines and reports each one as a finding on line 1 of the config. Repeated warnings are reported once.
  • A new allowed-warnings.yaml lets through known warnings that cannot be fixed here. Each entry has a whole-message regex, the configs it applies to, and a reason. --verbose lists what was allowed.
  • OPERATIONS.md documents both behaviors and explains how to force a rebuild by deleting the build directory instead of running esphome clean.
File Description
tools/​compile-lint/​src/​compile_lint/​lint.py Reads ESPHome warnings from compile output, matches them against the allow list, and reports the rest as findings on line 1.
tools/​compile-lint/​allowed-warnings.yaml New allow list for three known warnings, each with the configs it applies to and a reason.
tests/​compile_lint/​test_lint.py Adds tests for warning findings, repeated and colored warnings, allowances, malformed allow lists, and compile mode.
OPERATIONS.md Documents the warning checks, the allow list, and how to force a rebuild without esphome clean.
.github/​workflows/​test-pull-request.yml Builds the compile matrix from test/ and top-level configs, and runs the change gate for top-level YAML changes.

Review effort: Lite

@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 30, 2026
@ptr727

ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head c05bb7d7f39576444657c19dc1592068b48caafc, the content this pull request carries at that commit against develop, and it recorded 2 findings.

@ptr727

ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 9be1bcc08ad50eb974c53c8d0ed7449c255cb3f0, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head d1b818e7a9770b2a94944fe7a069ca1b3be6b112, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727
ptr727 merged commit 8eec435 into develop Oct 30, 2026
45 checks passed
@ptr727
ptr727 deleted the ci/lint-production-and-warnings branch October 30, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants