Match name and preferred address case-insensitively in build_log_name#1693
Draft
bluetoothbot wants to merge 1 commit into
Draft
Match name and preferred address case-insensitively in build_log_name#1693bluetoothbot wants to merge 1 commit into
bluetoothbot wants to merge 1 commit into
Conversation
mDNS / DNS labels are case-insensitive (RFC 6762 §16, RFC 4343). The previous case-sensitive startswith check meant a supplied name 'myesp' with a resolved 'MYESP.local' produced 'myesp @ MYESP.local' instead of dropping the redundant prefix. Adds the first test coverage for build_log_name, including the mixed- case case that exercises the fix.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1693 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 26 26
Lines 4165 4165
=========================================
Hits 4165 4165 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
What does this implement/fix?
build_log_namebuilds the log label that identifies a device session("name @ address"). It already suppresses the prefix when the resolved
address is
name.local, but thestartswithcheck is case-sensitive— so a name
myespwith a resolvedMYESP.localcame out asmyesp @ MYESP.localinstead of justMYESP.local.mDNS / DNS labels are case-insensitive (RFC 6762 §16, RFC 4343), and
the rest of
util.pyalready normalises with.lower()(
address_is_local, fixed in #1681). This bringsbuild_log_nameinto line.
Also adds the first test coverage for
build_log_name. The functionwas previously untested; the new parametrized cases pin the canonical
shapes (bare hostname,
.local, IP-only, with/withoutconnected_address,multiple addresses, bracketed IPv6) plus the mixed-case rows that
exercise the fix.
Types of changes
Related issue or feature (if applicable):
Pull request in esphome (if applicable):
Checklist:
tests/folder).Quality Report
Changes: 2 files changed, 42 insertions(+), 3 deletions(-)
Code scan: clean
Tests: failed (FAILED)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline