Skip to content

test: cover scope_id ipv6 dedupe partial branches#1766

Closed
bdraco wants to merge 2 commits into
masterfrom
test/cover-1764-scope-id-dedupe
Closed

test: cover scope_id ipv6 dedupe partial branches#1766
bdraco wants to merge 2 commits into
masterfrom
test/cover-1764-scope-id-dedupe

Conversation

@bdraco

@bdraco bdraco commented May 20, 2026

Copy link
Copy Markdown
Member

Closes the codecov gap on #1764.

test_scoped_address_kept_when_unscoped_arrives_after_in_cache pins the False branch of _has_more_scope_info inside _get_ip_addresses_from_cache_lifo, where the cache returns the scoped AAAA before the unscoped twin; test_has_more_scope_info_returns_false_for_ipv4 exercises the IPv4 path inside the helper itself.

Stacks on #1764; merge after that lands.

Test plan

poetry run pytest tests/services/test_info.py, 37 passed.
SKIP_CYTHON=1 poetry run pytest tests/services/test_info.py, 37 passed.

bluetoothbot and others added 2 commits May 20, 2026 19:46
When the same link-local IPv6 address arrives as two DNSAddress
records — once over an IPv4 socket (scope_id=None) and once over an
IPv6 socket (scope_id=interface index) — the cache stored both and
ServiceInfo would either return both copies or silently drop the
scoped variant, leaving parsed_scoped_addresses() unable to return
the %<interface_index>-qualified address its docstring promises.

Collapse the two variants in _get_ip_addresses_from_cache_lifo() and
_process_record_threadsafe() by matching addresses on their packed
integer (ignoring scope_id) and keeping the entry that carries a
scope_id when one is available.

Fixes #1567
Add a cache LIFO case where a scoped AAAA is encountered before its
unscoped twin so the unscoped variant fails the _has_more_scope_info
check and the scoped entry stays in place. Add a direct call against
_has_more_scope_info with an IPv4 address so its non-IPv6 short-circuit
return is exercised.
@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.77%. Comparing base (343dc7a) to head (a2c1904).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1766   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files          33       33           
  Lines        3509     3534   +25     
  Branches      493      498    +5     
=======================================
+ Hits         3501     3526   +25     
  Misses          5        5           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq

codspeed-hq Bot commented May 20, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 14 untouched benchmarks


Comparing test/cover-1764-scope-id-dedupe (a2c1904) with master (90a5a39)

Open in CodSpeed

@bdraco bdraco closed this May 20, 2026
@bdraco bdraco deleted the test/cover-1764-scope-id-dedupe branch May 20, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants