| 1 | # Preview hosts: Equipo pairs with a CARLOS preview host |
| 2 | |
| 3 | Status: 2026-11-12, fast lane, built on `release-preview-devbox` from main |
| 4 | a0d22a0, with a self-review instead of an Astra round. It builds on the |
| 5 | preview slice (`2026-11-11-equipo-release-preview.md`) and reuses its |
| 6 | export: committed static files read from git objects, never a build. |
| 7 | |
| 8 | ## What it is |
| 9 | |
| 10 | Equipo is designed to pair with a CARLOS preview host. A preview host is |
| 11 | an adapter behind one interface (`previewHost` in |
| 12 | `internal/runner/thin/preview_devbox.go`): where an approved candidate's |
| 13 | export is published, under which name, and where its marker is fetched. |
| 14 | Two adapters exist, and others can be added: |
| 15 | |
| 16 | | Host | Name | Reach | Ends | |
| 17 | |---|---|---|---| |
| 18 | | CARLOS devbox | `eq-<task>` | the tailnet only | `carlos devbox unshare` when the task ends | |
| 19 | | Carloku temporary sites | `tmp-<task>` | public | expires after 7 days | |
| 20 | |
| 21 | Devbox wins when a runner has both. |
| 22 | |
| 23 | ## Pairing is explicit, and visible |
| 24 | |
| 25 | - **Opting in:** a runner pairs with devbox only when its configuration |
| 26 | says `EQUIPO_PREVIEW_HOST=devbox` and its carlos (`EQUIPO_CARLOS_PATH`, |
| 27 | else `PATH`, else `~/.local/bin`) answers `carlos devbox list`. |
| 28 | - `scripts/staging-thin.py` sets this for the owner's staging runner |
| 29 | (not the suite's), so the barber task needs nothing from Paul. |
| 30 | - Carloku temporary sites pair as before, through the credential file. |
| 31 | - **The hello:** the runner reports the host in its hello |
| 32 | (`Capabilities.PreviewHost {kind, domain}`, protocol 11; below it only |
| 33 | the previews flag stays, and the first hello carries neither). The |
| 34 | devbox domain is learnt from the first share's link, saved, and sent in |
| 35 | the next hello. |
| 36 | - **Settings → Machines:** the page gains a Previews section. It names the |
| 37 | machine that hosts previews ("Previews: docs-t1 (on your tailnet)"), |
| 38 | online first, devbox first. With none paired, it explains how to pair |
| 39 | one. |
| 40 | - **An exploration's card with nothing paired:** it says "Pair a preview |
| 41 | host to open previews in your browser." It links to that section and |
| 42 | still to the branch. |
| 43 | |
| 44 | ## A devbox preview |
| 45 | |
| 46 | 1. **Prepare:** export and report built, as before. |
| 47 | 2. **Authorize:** one publish check for this export's digest, right before |
| 48 | the command. |
| 49 | 3. **Record:** the phase (publishing) and the intent are recorded. |
| 50 | 4. **Share:** `carlos devbox share --dir <the export> eq-<task>`, the one |
| 51 | share template. Sharing again under the same name replaces the copy in |
| 52 | place for a newer approved candidate. |
| 53 | 5. **Confirm:** the link devbox prints (exactly `https://eq-<task>.<domain>`) |
| 54 | is confirmed by fetching the marker, with no redirect followed and the |
| 55 | exact task, candidate, step, attempt and digest. |
| 56 | 6. **Clean up:** devbox serves its own copy, so the export goes, except |
| 57 | the marker that a restart's reconcile reads. |
| 58 | 7. **The card:** it says "Preview: <link> (on your tailnet)", with no |
| 59 | expiry, and the line leaves once the task ends. |
| 60 | 8. **The task ends:** done, dropped or cancelled, the instance's |
| 61 | ForgetTask runs `carlos devbox unshare eq-<task>`, but only for a link |
| 62 | this runner recorded sharing. |
| 63 | - A link that is already gone counts as gone. |
| 64 | - Any other failure keeps the record for the next end. |
| 65 | |
| 66 | **Access:** tailnet-wide, with no `--allow`. Equipo does not know a task |
| 67 | creator's tailnet login, and this is what Paul's own shares do. |
| 68 | |
| 69 | **Commands** run from the runner process, outside every namespace: devbox |
| 70 | needs AF_UNIX to reach its registrar. They come from fixed templates |
| 71 | only: `list`, `share --dir <absolute export> eq-<task>` and |
| 72 | `unshare eq-<task>`. Each runs from an empty private directory, with a |
| 73 | private HOME and no credential. Repository content is never run. |
| 74 | |
| 75 | ## Self-review |
| 76 | |
| 77 | - **Authority:** a share is preceded by the instance's publish check, |
| 78 | bound to the digest. Unshare has no separate check: it only removes |
| 79 | exposure, and it runs on the instance's own ForgetTask for that task, |
| 80 | for a link this runner recorded. |
| 81 | - **What the instance accepts:** |
| 82 | - a devbox result only as `eq-<task>`, at `https://eq-<task>.<domain>/`; |
| 83 | - a hello's preview host only with previews on, a known kind and a |
| 84 | clean domain. |
| 85 | - **Wire:** |
| 86 | - protocol 11 adds one optional, validated capability field; |
| 87 | - below 11, `Encode` drops it and the flag stays; |
| 88 | - the first hello drops both; |
| 89 | - mixed versions: an old instance sees only the flag, and an old runner |
| 90 | sends no host, so Machines shows none. |
| 91 | - **Known limits:** |
| 92 | - only the primary runs previews; |
| 93 | - a folded task is no ending (Undo restores it), so its devbox link |
| 94 | stays up, though its card line goes; |
| 95 | - a runner that lost its state can't unshare an old link, which then |
| 96 | stays until someone unshares it by hand; |
| 97 | - the devbox domain is unknown until the first share, so the first |
| 98 | hello says the host without its domain. |
| 99 | - **Copy:** Astra's delegated pass. Its replacements were taken, except |
| 100 | the Previews lede, which keeps "Equipo is designed to pair with a CARLOS |
| 101 | preview host", as Paul asked. |
| 102 | - **Tests and mutations:** |
| 103 | - a fake `carlos devbox` covers share, replace in place, the marker, |
| 104 | the learnt domain, unshare (gone, failed, repeated), the allowlist, |
| 105 | explicit pairing and the fallback; |
| 106 | - contracts cover the Machines line, the tailnet card that goes when the |
| 107 | task ends, and the pairing link; |
| 108 | - each guard was broken once and its test seen to fail. |
| 109 | |