mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-28 20:21:50 +01:00
Everything else drives the backfill through a broker fake, which proves the
lifecycle but not that it terminates in a browser-trusted URL. This adds an
opt-in exercise that runs the real `reconcilePersistedRuntimeServicesOnStartup`
against the production exposure dependencies — real Unix-socket broker client,
real Tailscale MagicDNS resolution, real cert-validating probe — on a
pre-existing HTTP workspace, in place, without recreating it.
It is gated on `PAPERCLIP_LIVE_BROKER_EXERCISE=1` *and* the broker socket being
present, because it mutates host-level Tailscale serve state and must never run
in CI. It uses an ephemeral legacy port rather than the template's 45439 so it
cannot contend with the live workspace runtime on the same host.
Observed on a broker-provisioned host:
beforeUrl http://127.0.0.1:38813
afterUrl https://paperclip-dev.tail29c1aa.ts.net:42001 (exposure ready)
reconcile { backfilled: 1, restarted: 1, restartFailed: 0 }
probe 200 over strict TLS
repeat same URL, backfilled 0
Also fixes a leak the exercise exposed: `workspace-runtime-exposure.test.ts`
spawns real loopback backends but its teardown only cleared in-memory state, so
each run left listeners squatting ports in the dedicated 42xxx/52xxx exposure
range for the life of the host (six were live after one run). Reaping them needs
to stay opt-in — the startup-reconciliation suites deliberately leave backends
running to simulate a Paperclip restart with something to adopt — so
`resetRuntimeServicesForTests` takes a `terminateProcesses` flag and only that
suite passes it. Verified: six strays before, zero after, 9/9 still green.