Resolve user-keyed map bases through extends-only wrappers - #2655
Conversation
|
@esphbot review |
Merging this PR will not alter performance
Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2655 +/- ##
=======================================
Coverage 99.72% 99.72%
=======================================
Files 281 281
Lines 23911 23911
=======================================
Hits 23846 23846
Misses 65 65
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Reviewed. Fix correct, scope tight. Verified degraded shape in shipped |
|
|
esphbot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
|
@esphbot review |
0645f2e to
48085a4
Compare
|
@esphbot review |
|
|
esphbot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
There was a problem hiding this comment.
🟡 Changes recommended
The PR includes an additional unrelated generated-catalog change (esp8266) that contradicts the PR description’s stated scope, and the new helper’s docstring violates the repo’s docstring style guidance.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the component-catalog sync logic to correctly detect and collapse user-keyed map fields when the key_type marker is present only in an extends base (i.e., the field entry is an extends-only wrapper), preventing schema regressions that incorrectly render these fields as nested groups.
Changes:
- Add
_extends_map_schema()and extend_convert_field()to resolvekey_typethrough extends-only wrapper chains and collapse tomapusing the base schema’s value template. - Add focused regression tests covering direct
key_type, extends-only wrappers, multi-hop extends, and “don’t collapse” cases. - Update generated catalog entries so
homeassistant.*action/eventdata,data_template, andvariablesrender asmap(plus an additional unrelated generated change inesp8266.json).
File summaries
| File | Description |
|---|---|
script/sync_components.py |
Resolves map schemas through extends-only wrappers and uses the resolved base to build the map value template. |
tests/test_sync_components_map_extends.py |
Adds regression coverage for extends-only wrapper map collapse behavior. |
esphome_device_builder/definitions/automations/actions/homeassistant.action.json |
Generated catalog now renders data, data_template, and variables as map. |
esphome_device_builder/definitions/automations/actions/homeassistant.event.json |
Generated catalog now renders data, data_template, and variables as map. |
esphome_device_builder/definitions/automations/actions/homeassistant.service.json |
Generated catalog now renders data, data_template, and variables as map. |
esphome_device_builder/definitions/components/esp8266.json |
Generated definition changed (includes d1_wroom_02 in board options), which appears unrelated to the PR’s stated scope. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@esphbot review |
|
|
esphbot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
|
@esphbot review |
PR Review — Resolve user-keyed map bases through extends-only wrappersMerge-ready. All three findings from the prior round are fixed in What holds up under verification:
On the two Copilot comments, @bdraco is right on both and I verified independently:
✅ Resolved since last review (1)Previously-flagged issues verified fixed
Checklist
Silent Failure Analysis
🟡 **1. MEDIUM** — guard relying on a helper that silently returns empty on lookup failure
|
esphbot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
What does this implement/fix?
The 2026.9.0b1 schema moved
homeassistant.action'svariablesbehind an extends-only wrapper (api.VARIABLES_SCHEMA), and the map collapse only looks forkey_typeon the raw entry; the nightly sync (#2653) therefore degrades the field from themapeditor to a nested group holding a bogus literalstringfield. The same wrapper shape (api.KEY_VALUE_SCHEMA) has always degradeddataanddata_templateon the homeassistant action and event actions.Resolve
key_typethrough the extends chain, so an extends-only wrapper whose base carrieskey_typecollapses tomapwith the base's value template. A bundle-wide sweep shows exactly six entries change, all of them genuine user-keyed maps:data,data_templateandvariableson the two homeassistant actions. The catalog is regenerated here viascript/sync_components.py --version 2026.9.0b1against esphome 2026.9.0b1; the artifact churn is exactly the nine map repairs across the three homeassistant action bodies, plusesp8266.jsonpicking up thed1_wroom_02board option that landed inboards.index.jsonafter the nightly components run.Related issue or feature (if applicable):
Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocsmaintenancecidependenciesFrontend coordination
Checklist
ruff,codespell, yaml/json/python checks).tests/where applicable.components.index.json/definitions/components/*.jsonhave not been hand-edited (regenerate viascript/sync_components.pyif a sync is needed).docs/ARCHITECTURE.mdand/ordocs/API.md.