Files
PaperClipAI/server
DottaandClaude Opus 4.8 7ac1686b09 feat(runtime-exposure): server-side broker client + exposure lifecycle manager (PAP-17051)
Add the server-side layer of the tailscale_https exposure mode as a
self-contained module so it is testable without a live broker, Tailscale,
or the host-privileged broker package, and without churning the large
concurrently-held workspace-runtime.ts.

- broker-client.ts: Unix-socket client speaking the broker's versioned,
  length-prefixed, byte-bounded wire protocol (expose/remove/list). Injectable
  connector for tests; never logs lease handles.
- port-pair.ts: paired app + Vite HMR companion allocation, only from the
  dedicated allowlisted range, over an injected availability probe.
- exposure-manager.ts: fail-closed lifecycle state machine (pending/ready/
  failed/cleanup_pending/removed) over injected broker + HTTPS health probe.
  Idempotent provision/deprovision with port quarantine on ambiguous cleanup;
  reconcile adopts owned+desired mappings and removes only owned orphans it
  holds a handle for — never an unknown/manual mapping or the primary :443.
- Tests: 29 cases (broker framing/parse/timeout, port-pair scan/skip/exhaust,
  provision/deprovision/reconcile incl. proof reconcile never mutates a
  handle-less orphan).
- Backfill exposure:null in the read-model test fixture for the DB column
  added in 262695ba74.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-16 19:24:27 +00:00
..