Skip to content

Add probing, announcing and conflict resolution (RFC 6762 §8-9)#271

Open
backkem wants to merge 4 commits into
mainfrom
probing-conflict-resolution
Open

Add probing, announcing and conflict resolution (RFC 6762 §8-9)#271
backkem wants to merge 4 commits into
mainfrom
probing-conflict-resolution

Conversation

@backkem
Copy link
Copy Markdown
Member

@backkem backkem commented Mar 4, 2026

Summary

  • probe.go: State machine for name probing (delay→probing→announcing→established), simultaneous probe tiebreaking (§8.2), conflict detection across all RR sections (§9), rename + re-probe with rate limiting
  • config.go: WithProbing(), WithConflictHandler() options
  • conn.go: WaitReady(), atomic.Value conflict handler (unexported setter, ready to expose as OnConflict later)
  • server.go: probeManager integration, buildProbeSessions, onProbeRenamed callback
  • 37 unit tests in probe_test.go, deterministic via fake timers + sync.Cond

Opening as draft for early review feedback.

Open questions

  1. probe.go is ~950 lines. Should we split it further, e.g.:

    • probe.go — state machine + manager
    • probe_tiebreak.golexicographicCompare, sortResources, compareResource, packRData
    • probe_rename.godefaultRename, defaultRenameHost, defaultRenameServiceInstance

    Or is one file fine given the tight coupling?

  2. WaitReady(ctx) error is currently exported on Conn. Is this the right API surface, or should readiness be signaled differently (e.g. callback, channel field)?

@backkem backkem force-pushed the probing-conflict-resolution branch from c604b8b to c1b926f Compare March 4, 2026 21:17
@backkem
Copy link
Copy Markdown
Member Author

backkem commented Mar 4, 2026

cc @JoTurk early feedback appreciated.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 92.65734% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.85%. Comparing base (93cf995) to head (5794c46).

Files with missing lines Patch % Lines
probe.go 92.70% 18 Missing and 13 partials ⚠️
server.go 93.93% 3 Missing and 3 partials ⚠️
conn.go 86.48% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #271      +/-   ##
==========================================
+ Coverage   82.05%   83.85%   +1.79%     
==========================================
  Files           8        9       +1     
  Lines        1739     2285     +546     
==========================================
+ Hits         1427     1916     +489     
- Misses        203      244      +41     
- Partials      109      125      +16     
Flag Coverage Δ
go 83.85% <92.65%> (+1.79%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

backkem added 2 commits June 3, 2026 20:52
RFC 6762 §8-9 implementation:
- probe.go: state machine (delay→probing→announcing→established)
- Simultaneous probe tiebreaking with lexicographic compare (§8.2)
- Conflict detection in all resource record sections (§9)
- Rename strategy: "-N" for hosts, " (N)" for services
- Rate limiting: 15 conflicts/10s → 5s backoff, 60s give-up
- Cache-flush bit on unique records in announcements (§10.2)
- WithProbing, WithConflictHandler options
- WaitReady() blocks until initial probing completes
- Conn.setConflictHandler/conflictHandler via atomic.Value
- Name inbound channel buffer size as constant
- Test onProbeRenamed for host, service instance, escaped dots,
  case-insensitive match, and no-match no-op
- Test WaitReady for nil probes, context cancellation, conn close
- Test sequential conflicts (two rename cycles with record header
  verification)
- Test full conflict-rename-announce cycle with wire content
  verification (renamed name, cache-flush bit, preserved rdata)
@backkem backkem force-pushed the probing-conflict-resolution branch from c1b926f to 161bfe1 Compare June 3, 2026 19:31
@backkem backkem marked this pull request as ready for review June 3, 2026 19:31
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.

1 participant