GeezerVison is showing github.com — feat: add reconfirm_record per RFC 6762 §10.4 by bluetoothbot · Pull Request #1772 · python-zeroconf/python-zeroconf
Conversation
Summary
Add Zeroconf.reconfirm_record / async_reconfirm_record (and the
AsyncZeroconf wrapper) so callers can hint to the cache that a record
may be stale — e.g. when an application-level connect to a discovered
service fails. Implements the cache-flush-on-failure mechanism described
in RFC 6762 §10.4.
Closes #1413
Behaviour
async_reconfirm_record(record) schedules a background task and
returns True if accepted, False if the record is not in the cache
or a reconfirmation is already in flight (dedupes by cache entry).
- The background task re-queries the record at t=0, 1s, 3s —
the §5.2 doubling-interval pattern and "two or more queries" minimum
from §10.4.
- If no fresh copy of the record lands in the cache by t=10s, the
record is force-expired and listeners (e.g. ServiceBrowser) are
notified through the same goodbye path used for TTL-zero responses.
reconfirm_record is the threadsafe variant for callers off the
event loop.
Constants live in const.py (_RECONFIRM_QUERY_INTERVALS_MS,
_RECONFIRM_TIMEOUT_MS) with RFC citations next to them; please do not
tighten without an interop note.
Changes
Zeroconf.async_reconfirm_record / Zeroconf.reconfirm_record in _core.py
AsyncZeroconf.async_reconfirm_record in asyncio.py
- Background reconfirm pipeline in
RecordManager (_handlers/record_manager.py)
plus .pxd updates for the new cdef public dict _reconfirm_tasks
and the new cpdef entry point
- Timing constants in
const.py
- README section explaining when callers should use it
tests/test_reconfirm.py (9 tests) and a quick_reconfirm_timing
fixture in conftest.py
Test plan
-
pytest tests/test_reconfirm.py (9 passed)
-
pytest tests/ (404 passed, 2 skipped) — no regressions
-
ruff check src/ tests/ — clean
- Cython rebuild of
_handlers/record_manager.py succeeds (no
closures inside cpdef)
Quality Report
Changes: 8 files changed, 331 insertions(+), 6 deletions(-)
Code scan: clean
Tests: passed (4 PASSED)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add Zeroconf.reconfirm_record / async_reconfirm_record and the
AsyncZeroconf wrapper so callers can hint that a cached record may be
stale when an application-level connect fails.
Re-queries the record at t=0/1s/3s (RFC 6762 §5.2 doubling intervals)
and flushes from the cache at t=10s when no fresh response lands.
codecov
Bot
commented
May 22, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
❌ Patch coverage is 85.71429% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.47%. Comparing base (cb81e67) to head (56f1495).
⚠️ Report is 9 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1772 +/- ##
==========================================
- Coverage 99.77% 99.47% -0.31%
==========================================
Files 33 33
Lines 3536 3608 +72
Branches 498 511 +13
==========================================
+ Hits 3528 3589 +61
- Misses 5 10 +5
- Partials 3 9 +6
☔ View full report in Codecov by Harness.
📢 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Merging this PR will not alter performance
✅ 14 untouched benchmarks
Comparing bluetoothbot:koan/implement-1413 (56f1495) with master (cb81e67)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.