Skip to content

feat(tracer): validated public IP seeding via seedPublicIP - #81

Merged
dweekly merged 4 commits into
mainfrom
feat/seed-public-ip
Sep 4, 2026
Merged

feat(tracer): validated public IP seeding via seedPublicIP#81
dweekly merged 4 commits into
mainfrom
feat/seed-public-ip

Conversation

@dweekly

@dweekly dweekly commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements phase 3 of Cache and Network-Transition Lifecycle from docs/CACHE-AND-TRANSITION-LIFECYCLE.md:

  • PublicIPSource: Enum identifying the origin of a dynamically seeded public IP (.validatedCallerCache, .gatewayReported).
  • seedPublicIP(_:source:): Actor-isolated method to provide a known-valid public IP so the next classified trace skips discovery.
    • Rejects non-global addresses (RFC 1918, CGNAT 100.64.0.0/10, link-local, loopback, ULA, multicast), malformed strings, and placeholder sentinels like "unknown".
    • Normalizes valid input to canonical inet_ntop format.
    • Associates the seed with the current cache generation so subsequent invalidations (invalidatePublicIP(), clearCaches(), networkChanged()) cleanly discard it.
    • Leaves existing discovery intact when a seed is rejected.
  • Documentation: Updated SwiftFTRConfig.publicIP docstring to clarify that it is an authoritative, immutable configuration override that permanently bypasses discovery, and points callers to seedPublicIP(_:source:) for dynamic seeding across transitions.

Stacked on top of #80 (feat/network-scoped-rdns).

Testing

  • Unit tests in CacheGenerationTests.swift:
    • seedValidPublicIP: Verifies seeding valid IPv4 and IPv6 strings (including non-canonical formatting normalized to canonical inet_ntop).
    • seedRejectsNonGlobalAndSentinels: Verifies rejection of RFC 1918, CGNAT, link-local, loopback, ULA, multicast, and sentinel strings like "unknown", ensuring existing cached value is untouched.
    • seedInvalidationLifecycle: Verifies that invalidatePublicIP(), clearCaches(), and networkChanged() all clear the seeded public IP.
    • seedBypassesDiscovery: Verifies that effectivePublicIPForClassification skips discovery when seeded.
  • All tests pass; docc builds cleanly with --warnings-as-errors; formatting checked with swift format lint --strict.

@dweekly
dweekly force-pushed the feat/network-scoped-rdns branch from 3537be7 to fb9a55a Compare September 3, 2026 00:18
@dweekly
dweekly force-pushed the feat/seed-public-ip branch 2 times, most recently from 9515dec to cc67069 Compare September 3, 2026 00:24
@dweekly
dweekly force-pushed the feat/network-scoped-rdns branch from fb9a55a to 3bdb60b Compare September 3, 2026 01:44
@dweekly
dweekly force-pushed the feat/seed-public-ip branch from cc67069 to 5244313 Compare September 3, 2026 01:44
@dweekly
dweekly force-pushed the feat/network-scoped-rdns branch from 3bdb60b to 65bbbda Compare September 3, 2026 01:49
@dweekly
dweekly force-pushed the feat/seed-public-ip branch from 5244313 to deb2c3a Compare September 3, 2026 01:50
@dweekly
dweekly changed the base branch from feat/network-scoped-rdns to main September 4, 2026 00:00
@dweekly
dweekly merged commit bb9da24 into main Sep 4, 2026
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