Derive the advertised mDNS hostname from dashboard_id, not the OS hostname - #1632
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1632 +/- ##
==========================================
- Coverage 99.54% 99.54% -0.01%
==========================================
Files 227 227
Lines 17955 17953 -2
==========================================
- Hits 17874 17872 -2
Misses 81 81
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
|
esphbot
left a comment
There was a problem hiding this comment.
Blocking issues found.
- TXT property table missing the new
friendly_nameentry remote_build_host_addedevent payload doc omitsfriendly_name
There was a problem hiding this comment.
Pull request overview
This PR stabilizes the dashboard’s peer-link mDNS identity by deriving the advertised service-instance name and SRV target from the persisted dashboard_id (instead of the OS hostname), and adds a separate friendly_name TXT entry so peers can still display a human-readable machine label.
Changes:
- Derive the advertised mDNS hostname as
esphome-builder-<dashboard_id[:8]>.local(stable across reboots/hostname changes). - Add
friendly_nameto mDNS TXT and propagate it through peer discovery (RemoteBuildPeer+ TXT parsing). - Update tests and architecture docs to cover the new advertise/TXT behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_remote_build_listener.py | Updates assertions to include the new friendly_name TXT key. |
| tests/test_remote_build_controller.py | Extends service-info fakes and adds coverage for parsing friendly_name from TXT. |
| tests/test_dashboard_advertise.py | Revises hostname construction tests to validate dashboard_id-derived stability and updated TXT contents. |
| esphome_device_builder/models/remote_build/offloader.py | Adds friendly_name to the discovered peer model surfaced to the frontend. |
| esphome_device_builder/helpers/dashboard_advertise.py | Implements stable hostname derivation and emits friendly_name in TXT. |
| esphome_device_builder/controllers/remote_build/_mdns.py | Parses friendly_name from TXT into RemoteBuildPeer. |
| docs/ARCHITECTURE.md | Documents the stable per-install mDNS identity and the new TXT field. |
…tname The dashboard's peer-link mDNS SRV target was composed from socket.gethostname(), read live on every startup. macOS returns different values across reboots (mac vs macbook-pro), so the SRV target flipped even though the machine and IP were unchanged; a paired peer saw the endpoint move and ran a needless rebind on every restart. Derive the service-instance name and SRV target purely from the persisted dashboard_id (esphome-builder-<id>.local), so the advertised identity is stable across reboots. Carry the human machine label in a new friendly_name TXT entry, surfaced on RemoteBuildPeer, so peers can still display it now that the instance name is an opaque identifier.
93be4a9 to
a2856a9
Compare
Add friendly_name to the API.md TXT-property table and the remote_build_host_added payload doc. Drop the instance-label and SRV-target fallback branches that build_mdns_hostname's always-non-empty return made unreachable.
|
Addressed in 69a158a:
|
The event fires peer.to_dict(), so the TypedDict must carry every RemoteBuildPeer field; friendly_name was missing.
The advertised instance name and the peer-link SRV hostname are now opaque per-install identifiers, so log lines that carried them read as esphome-builder-<id>. Add the friendly_name to the advertise log and the receiver label to every peer-link client log so operators can still tell which peer a line refers to.
PR Review — Derive the advertised mDNS hostname from dashboard_id, not the OS hostnameSolid, well-scoped fix; backend correctness and backward-compat are sound. One frontend-coordination gap is worth surfacing before merge. Strengths:
Needs attention:
🟡 Important
1. Discovered-host picker shows opaque IDs until the frontend follow-up lands
|
esphbot
left a comment
There was a problem hiding this comment.
Blocking issues found.
- Discovered-host picker shows opaque IDs until the frontend follow-up lands
|
Agreed — corrected the Frontend coordination section to couple esphome/device-builder-frontend#925 and flagged it as lockstep. Since the frontend ships prebuilt in the wheel, the release carrying this change must bundle #925, otherwise the discovered-host picker shows the opaque |
What does this implement/fix?
The dashboard's peer-link mDNS SRV target was composed from
socket.gethostname(), read live on every startup. macOS returns different values across reboots (macone boot,macbook-prothe next), so the advertised hostname flipped even though the machine and its IP were unchanged; a paired peer saw the endpoint move and ran a needless rebind on every restart.This derives the service-instance name and the SRV target purely from the persisted
dashboard_id(esphome-builder-<id>.local), so the advertised identity is stable across reboots and the OS hostname can no longer flip it. The human machine label now travels in a newfriendly_nameTXT entry, surfaced onRemoteBuildPeer, so peers can still display the friendly name now that the instance name is an opaque identifier.Existing pairings rebind once to the stable name on upgrade and then stay put; older receivers that don't broadcast
friendly_namesimply show the non-friendly identifier until they update.Related issue or feature (if applicable):
Types of changes
bugfixFrontend coordination
Must land lockstep:
namebecomes an opaqueesphome-builder-<id>identifier and the human label moves to thefriendly_nameTXT field. The frontend ships prebuilt inside our wheel, so the bundle in any release carrying this change must include esphome/device-builder-frontend#925, or the discovered-build-server picker shows the opaque id instead of the machine name.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.