← Back to Pull requests

chore: replace `grandcat/zeroconf` with `hashicorp/mdns` for mDNS discovery #80

Open
unknown opened this pull request with 298 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 22, 2026 14:53 UTC
Author

Description

Replaces the unmaintained github.com/grandcat/zeroconf (last commit Dec 2023, only tag v1.0.0 from 2019, 56 open issues) with github.com/hashicorp/mdns v1.0.7 (actively maintained) for the Freebox mDNS discovery of the _fbx-api._tcp service.

This also removes the dead github.com/cenkalti/backoff v2.2.1+incompatible indirect dependency from the module graph.

Motivation / context

  • grandcat/zeroconf is no longer maintained and drags in the abandoned cenkalti/backoff v2 module (v4/v5 exist upstream).

  • hashicorp/mdns only depends on miekg/dns and golang.org/x/net, both already present in the module graph.

  • Behavioral differences handled in this PR (found by reading both implementations):

  • - hashicorp/mdns never closes the Entries channel and sends to it non-blockingly, so termination relies on the context only (no close(Entries), no ok check);
    - it does not filter answers by service type (explicit TODO in its client.go), so entries are filtered by the _fbx-api._tcp.local. suffix in Discover;
    - the query loop is bounded by QueryParam.Timeout (set to the existing 5s discovery timeout) instead of zeroconf's infinite periodic probing.

    Changes

  • internal/freebox/discovery.go: Discover now uses mdns.QueryContext with a QueryParam (Service: "_fbx-api._tcp", Domain: "local.", Timeout: discoverTimeout, buffered Entries channel, error returned via a buffered channel). parseServiceEntry reads entry.InfoFields / entry.Host / entry.Port.

  • internal/freebox/discovery_test.go: test entries adapted to mdns.ServiceEntry (Host, InfoFields).

  • go.mod / go.sum: github.com/hashicorp/mdns v1.0.7 added; grandcat/zeroconf and cenkalti/backoff removed (verified with go mod graph).
  • Verification checklist

  • go build ./...

  • go vet ./...

  • golangci-lint run — 0 issues

  • gofmt clean on modified files

  • go test -race ./... — all packages pass

  • go mod graph confirms grandcat/zeroconf and cenkalti/backoff are gone

  • Smoke test (temporary, not committed): Discover returns a clean wrapped error when no Freebox answers on the network — no hang, no goroutine leak
  • Note: this PR is independent from the older open PR #45 on chore/replace-zeroconf-with-hashicorp-mdns; it was written from scratch on top of current main.

    Diff: 298 lines (+223 / -75) across 3 files Reviewer: L3n41c Review duration: 277m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 298 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.341
    Real PR Conversation Timeline
    1 comments
    "Review active on #80"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40% (MEDIUM) · Higher = larger blast radius
    40%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.3% · Safe to merge
    21.3%