Skip to content

feat(gateway): cloudflared provisioning + quick tunnel driver, terminal QR, run overrides, tunnel_ingress --url (#459) - #462

Draft
kengio wants to merge 10 commits into
mainfrom
feat/gateway-setup-blocks
Draft

kengio wants to merge 10 commits into
mainfrom
feat/gateway-setup-blocks

Conversation

@kengio

@kengio kengio commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

v3.5.2 track T3 — building blocks for onebrain gateway setup.

Closes #459
Closes #361
Refs #423

DRAFT — do not merge. 11 cloudflared output fixtures (tunnel create / list -o json / route dns / token) are ASSUMED until T0b (owner-login live probe), and T0b must also prove --url fixes the 503 of a CLI-created tunnel. Opened early to get the full CI matrix (incl. clippy-windows).

  • Cloudflared driver: login (unbounded, browser) · list/create/route dns/token (60 s timeout, kill + reap) · Quick Tunnel spawn (URL parsed from stderr, output drained for the child's life, killed on Drop and from a panic hook — release is panic = "abort"; Windows panic gap documented)
  • route dns classifier: Created / AlreadyRouted / ConflictingRecord / WrongZone{stray} (FQDN ≠ host) / Failed — never trusts unrecognised exit-0 output
  • RunOverrides { public_url, default_vault } → run_with; effective_config re-validates (error names the Quick Tunnel URL); host guard + issuer follow the override; /approvals untouched
  • tunnel_ingress: local → tunnel agent + manual run line add --url http://127.0.0.1:<port>; local + port: 0 rejected; dashboard tunnels byte-identical
  • daemon: concurrent daemon start can hang indefinitely (macOS CI, intermittent) #361 (found by this PR's macOS CI hang): daemon start's detached __run marks every inherited fd ≥ 3 close-on-exec in pre_exec — on macOS std creates pipes with pipe() then sets CLOEXEC separately, so a concurrent fork leaked a caller's pipe into the daemon and Command::output() hung forever (lsof-proven; stress 3/60 hangs on main, 0/100 with the fix, 2/60 with the call site removed)
  • terminal QR (qrcode 0.14, no default features)

Evidence: spoke: workspace 4167 ✓, clippy 1.98 ×2 + fmt exit 0, coverage.sh --ci-gate 94.89%, 25 sabotages red→green. Hub: gateway:: 678 ✓, clippy --no-default-features exit 0. Cold privilege-boundary review: no blocker; findings fixed.

Behavioral audit (debug binary, scratch copy of real ~/.onebrain, NO_ACTIVATE): dashboard tunnel plist byte-identical to v3.5.1's render; tunnel_ingress: local → --url http://127.0.0.1:17799; local + port: 0 → hinted refusal (exit 1); real LaunchAgent untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TmbNNd9q4jitHGvdtTmK6V

…al QR, run public_url override (#423)

- cloudflare.rs: Cloudflared trait + SystemCloudflared {bin, home}; pure
  parsers for the Quick Tunnel URL (anchored, T0a fixture), route dns
  (B2: FQDN must equal the host, else WrongZone{stray}), tunnel list/create/token.
  Quick Tunnel passes --protocol http2 and keeps draining output (I5).
- qr.rs: render_qr (Unicode half-blocks, 4-module quiet zone).
- gateway.yml tunnel_ingress: local -> tunnel agent and manual run lines
  append --url http://127.0.0.1:<port> (B1); absent = unchanged.
- mod.rs: RunOverrides + effective_config (re-validates) + run_with.
- tunnel.rs: manual_run_lines extracted.

create/list/route-dns/token fixtures are ASSUMED until the T0b probe.
…Quick Tunnel URL source; reject local ingress on port 0; no relative cloudflared fallback
…(one test's panic killed other tests' children); pid files written atomically
…ops inherited fds; hook-path embed gets the same (#361)
…holds a write fd on them (ETXTBSY on Linux CI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant