founding: the CGNAT pre-check measures the operator's connection, not the gateway's #326

Closed
opened 2026-08-07 17:32:40 +00:00 by ben · 3 comments
Owner

RunPreCheck (internal/founding/access.go:297-316) calls resolver.PreCheck, whose production implementation reflects the connection the wizard is running on off myip.opendns.com via 208.67.222.222:53 (internal/dns/resolver.go:119-138, :159-178), then blocks on RFC 6598 100.64.0.0/10.

On the self-hosted path the wizard runs on the operator's laptop. The verdict is therefore only correct when the laptop and the intended gateway share a connection. An operator running the wizard on a phone hotspot, at work, or over a VPN gets a verdict about the wrong network — in either direction:

  • false pass: laptop on a clean connection, gateway destined for a CGNAT'd line — the operator is sent into the walkthrough for a machine that can never accept visitors, which is exactly the outcome ADR 0026 exists to prevent;
  • false fail: laptop on CGNAT'd mobile, gateway on a fine fibre line — a viable self-hosted path is refused.

ADR 0026's reasoning ("the CGNAT pre-check runs before the operator touches any router config") is sound; the measurement is taken from the wrong place.

Definition of done

The pre-check states which connection it measured, or measures the gateway's. Note the ordering constraint: on the self-hosted path no gateway exists yet at S4, which is why the laptop was used — so this likely needs a design answer, not just a code fix.


Found 2026-08-07 while scoping home-gateway reachability (dynamic address / automatic port opening / IPv6). Full trace in docs/research/2026-08-07-home-gateway-reachability-scope.md.

`RunPreCheck` (`internal/founding/access.go:297-316`) calls `resolver.PreCheck`, whose production implementation reflects **the connection the wizard is running on** off `myip.opendns.com` via `208.67.222.222:53` (`internal/dns/resolver.go:119-138`, `:159-178`), then blocks on RFC 6598 `100.64.0.0/10`. On the self-hosted path the wizard runs on the operator's laptop. The verdict is therefore only correct when the laptop and the intended gateway share a connection. An operator running the wizard on a phone hotspot, at work, or over a VPN gets a verdict about the wrong network — in either direction: - false pass: laptop on a clean connection, gateway destined for a CGNAT'd line — the operator is sent into the walkthrough for a machine that can never accept visitors, which is exactly the outcome ADR 0026 exists to prevent; - false fail: laptop on CGNAT'd mobile, gateway on a fine fibre line — a viable self-hosted path is refused. ADR 0026's reasoning ("the CGNAT pre-check runs before the operator touches any router config") is sound; the measurement is taken from the wrong place. ## Definition of done The pre-check states which connection it measured, or measures the gateway's. Note the ordering constraint: on the self-hosted path no gateway exists yet at S4, which is why the laptop was used — so this likely needs a design answer, not just a code fix. --- Found 2026-08-07 while scoping home-gateway reachability (dynamic address / automatic port opening / IPv6). Full trace in `docs/research/2026-08-07-home-gateway-reachability-scope.md`.
Author
Owner

This was generated by AI during triage.

Verified: RunPreCheck confirmed to call resolver.PreCheck, whose production implementation resolves the public IP of whatever connection the process making the DNS query is running on (via an external resolver) and blocks on the RFC 6598 CGNAT range. Confirmed this runs at S4, before any gateway machine exists on the self-hosted path — there's no gateway to measure yet at that point in the sequence. Claim holds.

Routing to ready-for-human, not ready-for-agent: the ticket names its own ordering constraint as the blocker — "on the self-hosted path no gateway exists yet at S4, which is why the laptop was used." Any fix has to answer what the pre-check should measure when the thing it's meant to characterize doesn't exist yet: state the caveat and let a false pass/fail stand (a UX/copy decision about how much to trust an unverified claim), defer the real check to a later step once a gateway exists (a sequencing change to the founding state machine, potentially moving where ADR 0026's guarantee gets enforced), or something else entirely. Each is a different shape of fix with different consequences for ADR 0026's guarantee, not a bug an agent can close by picking one silently. Recommend: rule on whether the pre-check should be deferred to a step where a gateway exists, or stay early with explicit uncertainty in its copy — then this can be re-filed as an agent brief.

> *This was generated by AI during triage.* **Verified:** `RunPreCheck` confirmed to call `resolver.PreCheck`, whose production implementation resolves the public IP of whatever connection the process making the DNS query is running on (via an external resolver) and blocks on the RFC 6598 CGNAT range. Confirmed this runs at S4, before any gateway machine exists on the self-hosted path — there's no gateway to measure yet at that point in the sequence. Claim holds. **Routing to ready-for-human, not ready-for-agent:** the ticket names its own ordering constraint as the blocker — "on the self-hosted path no gateway exists yet at S4, which is why the laptop was used." Any fix has to answer *what* the pre-check should measure when the thing it's meant to characterize doesn't exist yet: state the caveat and let a false pass/fail stand (a UX/copy decision about how much to trust an unverified claim), defer the real check to a later step once a gateway exists (a sequencing change to the founding state machine, potentially moving where ADR 0026's guarantee gets enforced), or something else entirely. Each is a different shape of fix with different consequences for ADR 0026's guarantee, not a bug an agent can close by picking one silently. Recommend: rule on whether the pre-check should be deferred to a step where a gateway exists, or stay early with explicit uncertainty in its copy — then this can be re-filed as an agent brief.
Author
Owner

Ruled by Ben 2026-08-08 (decision sweep) → DDR 0139 + S4b wireframe (1716193, on main): label the measurement, then ask. S4b states it tested this device's connection (data-field="measured-connection") and asks whether the community machine will use the same one (data-action="same-connection-yes"/"same-connection-no"). Yes binds the verdict as today; No downgrades to data-status="verdict-unknown" — founding proceeds with a caution to verify where the machine will live. Cures the false fail too. → ready-for-agent.

Ruled by Ben 2026-08-08 (decision sweep) → **DDR 0139** + S4b wireframe (`1716193`, on main): **label the measurement, then ask.** S4b states it tested *this device's* connection (`data-field="measured-connection"`) and asks whether the community machine will use the same one (`data-action="same-connection-yes"`/`"same-connection-no"`). Yes binds the verdict as today; No downgrades to `data-status="verdict-unknown"` — founding proceeds with a caution to verify where the machine will live. Cures the false fail too. → `ready-for-agent`.
Author
Owner

Implemented per DDR 0139 (Ben's ruling in-thread): S4b names the connection it measured, then asks — no confident verdict about the wrong network.

Seam (internal/founding) — measurement split from choice:

  • RunPreCheck now measures this device's connection only (records nothing, does not advance).
  • new ConfirmSelfHosted(sameConnection bool) records the self-hosted Access and advances to Address: true binds the verdict (as before), false records a verdict-unknown caution and proceeds anyway — curing the false fail. Wired as stdio op confirm-self-hosted.

Screen (app, S4b, wireframe p1-s4b-connection-pre-check.html contract):

  • data-field="measured-connection" states we tested this device's line, then asks "Will the community machine use this same internet connection?" (data-action="same-connection-yes"/"same-connection-no") before any verdict shows.
  • Yes → measured verdict binds: pass (data-status="pre-check-pass") → Continue to Address; CGNAT (data-status="pre-check-cgnat") → blocked, choose a different option.
  • No → data-status="verdict-unknown" caution → Continue to Address (cures both false pass and false fail).

Tests: Go seam (measure-only; Yes-binds-pass; CGNAT-measurement-records-nothing; different-connection-proceeds-with-caution) + app component tests over the wireframe's data-* contract. gofmt/vet/golangci-lint, vue-tsc + eslint clean; whole-tree go test ./... green (push gate).

Commit 6720321 on origin/main. Real measurement from the gateway's own connection, once one exists, stays future work for the reachability arcs (per DDR 0139).

Implemented per **DDR 0139** (Ben's ruling in-thread): S4b names the connection it measured, then asks — no confident verdict about the wrong network. **Seam (`internal/founding`)** — measurement split from choice: - `RunPreCheck` now measures *this device's* connection only (records nothing, does not advance). - new `ConfirmSelfHosted(sameConnection bool)` records the self-hosted Access and advances to Address: `true` binds the verdict (as before), `false` records a verdict-unknown caution and proceeds anyway — curing the false fail. Wired as stdio op `confirm-self-hosted`. **Screen (`app`, S4b, wireframe `p1-s4b-connection-pre-check.html` contract):** - `data-field="measured-connection"` states we tested this device's line, then asks *"Will the community machine use this same internet connection?"* (`data-action="same-connection-yes"`/`"same-connection-no"`) **before** any verdict shows. - **Yes** → measured verdict binds: pass (`data-status="pre-check-pass"`) → Continue to Address; CGNAT (`data-status="pre-check-cgnat"`) → blocked, choose a different option. - **No** → `data-status="verdict-unknown"` caution → Continue to Address (cures both false pass and false fail). **Tests:** Go seam (measure-only; Yes-binds-pass; CGNAT-measurement-records-nothing; different-connection-proceeds-with-caution) + app component tests over the wireframe's data-* contract. gofmt/vet/golangci-lint, vue-tsc + eslint clean; whole-tree `go test ./...` green (push gate). Commit `6720321` on `origin/main`. Real measurement from the gateway's own connection, once one exists, stays future work for the reachability arcs (per DDR 0139).
ben closed this issue 2026-08-08 20:22:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#326
No description provided.