Handle hint and errors in yaml#3
Merged
Merged
Conversation
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new EditorController to support live YAML validation by talking to a long-lived esphome vscode --ace subprocess, and wires it into the DeviceBuilder lifecycle/command registry.
Changes:
- Introduce
EditorControllerwith aneditor/validate_yamlWebSocket command. - Start/stop the editor controller alongside existing controllers.
- Implement subprocess protocol handling (
validate,read_file,result) for structured YAML errors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
esphome_device_builder/device_builder.py |
Registers and lifecycle-manages the new EditorController. |
esphome_device_builder/controllers/editor.py |
New controller implementing persistent subprocess-based YAML validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
- Reframe module/class docstrings to describe purpose and usage rather than internal mechanics. - Add docstrings to the lifecycle, subprocess management, and validation helpers. - Replace the single editor-wide lock with per-configuration sessions so concurrent edits on different devices no longer queue behind each other. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
marcelveldt
reviewed
Apr 28, 2026
Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
bdraco
added a commit
that referenced
this pull request
May 7, 2026
Three inline comments addressed: - Move NO_WIFI_VARIANTS / BOARDS imports + the lowercase _ESP32_NO_WIFI_VARIANTS derivation under the 'except ImportError' fallback branch. The 'upstream helper present' path now has zero coupling to upstream's implementation-detail tables — once the dep floor moves past the release that lands esphome/esphome#16300 the whole try/except block can collapse to a plain import. Fallback-correctness tests get a skipif marker since the constants are empty when upstream is loaded. - Update _infer_native_wifi docstring: dropped the stale 'Anything else → True' wording and replaced with the explicit allowlist semantics (esp8266 / bk72xx / rtl87xx / ln882x / libretiny + ESP32 / RP2040 dispatch branches → True; nrf52, host, unknown platforms → False). - _make_board docstring: clarified that connectivity=None produces a board with the hardware object present and an empty connectivity list (not a missing hardware block). Plus add 'libretiny' (legacy umbrella key for bk72xx / rtl87xx / ln882x) to the fallback's _FALLBACK_WIFI_FIRST_PLATFORMS and the test parametrisation, matching the upstream PR's LIBRETINY_OLDSTYLE addition.
bdraco
added a commit
that referenced
this pull request
May 11, 2026
* On-disk validation of cleanup_ttl_seconds (Copilot). The WS validator on set_settings gates write-through-WS, but the on-disk decode path didn't apply the same not_bool / range check. A sidecar with cleanup_ttl_seconds: true would deserialise as 1 (bool is an int subclass) and the sweep would treat anything older than 1s as cold. Other wrong types (string, float, None) would propagate to the sweep's now - ttl_seconds arithmetic and raise TypeError every cycle. New __post_init__ on RemoteBuildSettings coerces non-int / bool back to DEFAULT_CLEANUP_TTL_SECONDS and clamps the result to [MIN, MAX]. Doesn't reject the row (no ValueError) — the load path stays robust against partially-corrupt sidecars; the operator's last-good enabled toggle survives even if the TTL field is broken. Six new tests in test_config_controller.py pin the coerce-to-default branches, the clamp-to-MIN / clamp-to-MAX branches, and the pass-through-on-valid branch. * Public seam on FirmwareController for in-flight remote-peer jobs (reviewer concern #1). Reaching into firmware._jobs from the cleanup loop coupled the two controllers to the private dict shape — a future refactor (lock-wrapped jobs, QUEUED + RUNNING split into two dicts, indexed view) would silently break this loop. New FirmwareController.active_remote_peer_jobs generator filters to QUEUED / RUNNING + non-empty remote_peer. The cleanup loop now consumes through that seam. Two new tests pin every filter branch (local skip, remote queued / running yielded, remote completed skipped, empty case). * Named constant for the parse_from_configuration tail-segment count (reviewer nit). The +3 magic was folklore; replaced with _TAIL_SEGMENT_COUNT and a docstring explaining the three required tail parts (dashboard_id, device_name, YAML filename under the device subtree). Reviewer concern #2 (RAM-canonical settings) and #4 (rate-limit per cycle) deferred per their "worth a small follow-up" framing. Concern #3 (first-sweep latency) was considered but YAGNI for this PR: the receiver-side cleanup ships ahead of any production user (alpha, ~10 beta testers), so no accumulated subtrees exist before this code's first cycle — and the default 24h TTL means even a fresh receiver has nothing to reclaim for the first day regardless.
This was referenced May 14, 2026
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.
No description provided.