Public: anyone can read this; the crew can change it.
Pinned forges live on /infra: /pinned folds in and redirects #17497
Merged 20h 39m ago, live in production
scout/forge:scout/17372-pinned-forges-live-on-infra-pinned-folds → main 0 commits fork 3 threads · 3 unresolved
24 files
changed +118
−75
- docs/features/experiments.md
- docs/features/infra.md
- docs/features/pinned-forge.md
- docs/features/pricing.md
- src/actions/infra.ts
- src/http/infra_routes.ts
- src/http/mcp/tools/pinned_forge.ts
- src/http/pinned_routes.ts
- src/maintain/duties/pinned_lifetimes.ts
- src/tui/screens/experiments.ts
- src/tui/screens/infra.ts
- src/web/pages/cloud.ts
- src/web/pages/infra.ts
- src/web/pages/pinned.ts
- src/web/pinned.ts
- test/experiments-routes.test.ts
- test/experiments.test.ts
- test/infra-page.test.ts
- test/pinned-claim.test.ts
- test/pinned-domain-doors.test.ts
- test/pinned-lifetimes.test.ts
- test/pinned-page.test.ts
- test/pinned-retire-doors.test.ts
- test/pinned-watch.test.ts
docs/features/experiments.md +1 −1
| @@ -9,7 +9,7 @@ Every cloud dollar answers a question. An experiment is that question, the pinne | ||
| 9 | 9 | |
| 10 | 10 | ## Where |
| 11 | 11 | |
| 12 | - **Web:** the top of `/pinned` (`src/web/pages/pinned.ts`). One row per experiment: its question, the machines it runs on, what they cost a month now, what it has cost, and its result, with Record result under it while it runs. It is a live region on `/events`: it updates in place when anyone changes an experiment, from any door. | |
| 12 | - **Web:** the Pinned forges block of `/infra` (`src/web/pages/pinned.ts`; `/pinned` answers 301 to `/infra`). One row per experiment: its question, the machines it runs on, what they cost a month now, what it has cost, and its result, with Record result under it while it runs. It is a live region on `/events`: it updates in place when anyone changes an experiment, from any door. | |
| 13 | 13 | - **Terminal:** the Experiments screen (`src/tui/screens/experiments.ts`, after Pinned forges in the palette). `b` begins one, `a` attaches machines to the selected one, `r` records its result. |
| 14 | 14 | - **Agents:** the `infra` MCP tool, which took the place of `experiments` ([](infra.md)): `list` (and `idle`), `show` by id or words of the question, `begin`, `attach`, `record_result`. |
| 15 | 15 |
docs/features/infra.md +1 −1
| @@ -9,7 +9,7 @@ What runs on your own cloud, what it's for, what it costs, and when it ends; and | ||
| 9 | 9 | |
| 10 | 10 | ## Where |
| 11 | 11 | |
| 12 | - **Web:** `/infra` (`src/web/pages/infra.ts`, routes in `src/http/infra_routes.ts`). Each account's month against its ceiling, one sentence a line ("$13.00 of $50 a month on DigitalOcean"); a line for anything the hourly watch found at a provider that the forge did not make, linking that account's row on Cloud accounts; then each machine that bills, grouped by its experiment's question or by its app, with where it runs in plain words, its monthly cost and when it ends, Keep 7 more days and End now beside it; End now shows only where something exists at the provider (`existsAtProvider` in `src/cloud/billing.ts`, the same test /pinned's Retire uses), so a first deploy that made nothing offers none. What ended in the last 30 days, and anything retired that still bills, stays under a quiet **Ended** disclosure, each in the shared billing sentence with its day: "retired Mon 30 Nov; nothing bills", or "…; its kept disk still bills $1.00 a month" with a link to delete it on Pinned forges; older ones that bill nothing are one line with their count. A dead row (a first deploy that failed and left nothing at its provider) says "nothing exists at DigitalOcean; clear this row", with Clear this row through the confirm (`clearPinned`, event `pinned.cleared`). Build something opens the compose form: an app, a place (the cheapest two in each city, each a row of at least 44px; a filter of city, provider or size words narrows the whole catalog on the server, `/infra/live?part=places`, so the page never carries it; one that cannot be ordered is listed, dimmed, with why), what it is for (a new question, a running experiment, or running the app itself), and when it ends (1, 3, 7 or 30 days; no end only for an app). The plan tray sits at the foot of the form. | |
| 12 | - **Web:** `/infra` (`src/web/pages/infra.ts`, routes in `src/http/infra_routes.ts`). Each account's month against its ceiling, one sentence a line ("$13.00 of $50 a month on DigitalOcean"); a line for anything the hourly watch found at a provider that the forge did not make, linking that account's row on Cloud accounts; then each machine that bills, grouped by its experiment's question or by its app, with where it runs in plain words, its monthly cost and when it ends, Keep 7 more days and End now beside it; End now shows only where something exists at the provider (`existsAtProvider` in `src/cloud/billing.ts`, the same test Retire on Pinned forges uses), so a first deploy that made nothing offers none. What ended in the last 30 days, and anything retired that still bills, stays under a quiet **Ended** disclosure, each in the shared billing sentence with its day: "retired Mon 30 Nov; nothing bills", or "…; its kept disk still bills $1.00 a month" with a link to delete it on Pinned forges; older ones that bill nothing are one line with their count. A dead row (a first deploy that failed and left nothing at its provider) says "nothing exists at DigitalOcean; clear this row", with Clear this row through the confirm (`clearPinned`, event `pinned.cleared`). Build something opens the compose form: an app, a place (the cheapest two in each city, each a row of at least 44px; a filter of city, provider or size words narrows the whole catalog on the server, `/infra/live?part=places`, so the page never carries it; one that cannot be ordered is listed, dimmed, with why), what it is for (a new question, a running experiment, or running the app itself), and when it ends (1, 3, 7 or 30 days; no end only for an app). The plan tray sits at the foot of the form. | |
| 13 | 13 | - **Terminal:** the Infrastructure screen (`src/tui/screens/infra.ts`, after Cloud accounts in the palette, and `I` on the Cloud accounts screen). What ended is listed after what runs, each in its billing sentence. `n` composes one question at a time and shows the plan with Build; `l` looks at the DNS records against Cloudflare now; `m` makes one (type, name, host, what it points to, a port for SRV, then the plan with Make the record); `u` removes the selected record after a confirm; `+` keeps the selected machine 7 more days; `x` ends it now after a confirm (only where something exists at its provider), and `c` clears a dead row after a confirm. A build's steps lead the list as they happen. |
| 14 | 14 | - **API:** `GET /api/v1/admin/infra` (`?plan=<id>` adds a build's steps), `POST /api/v1/admin/infra/plan`, `POST /api/v1/admin/infra/apply` (202). Keep is `POST /api/v1/admin/pinned/:name/keep`. |
| 15 | 15 | - **Agents:** the `infra` MCP tool, in Talk's slot where `experiments` was: `list` (first `says`: one paragraph naming what runs, the dead rows, what ended in the last 30 days with each one's billing sentence, and the total, at most ten names a group then "and N more", so a reader of `says` alone misses no machine; then everything `experiments` listed, plus each machine's end and what it bills for, and `ended`: what retired in the last 30 days or still bills, so a question about one is answered from its row; a dead row's `clear` sentence), `show` (an experiment, a plan id's build, or a machine by name, running or ended, with its billing sentence; a name with no row says "nothing called … has existed here" only when no event ever named it), `plan` a `want`, `check` (looks at the DNS records against Cloudflare now), `apply` a plan id (a plan of dead row `names` clears them; Talk offers it, the person allows it), `keep`, `begin`, `attach`, `record_result`. Only `apply` spends money, so the forge asks the person first. |
docs/features/pinned-forge.md +7 −7
| @@ -12,9 +12,9 @@ A pinned forge is a forge the owner put on their own cloud. The forge that deplo | ||
| 12 | 12 | |
| 13 | 13 | - HTTP: `GET /api/v1/admin/pinned` (forges, their changes, the targets), `POST /api/v1/admin/pinned` (deploy; the answer holds `claim.link`), `POST /api/v1/admin/pinned/:name/update`, `POST /api/v1/admin/pinned/:name/rollback`, `POST /api/v1/admin/pinned/:name/claim` (a new claim link). |
| 14 | 14 | - Terminal: palette → **Pinned forges** (forge admin): `d` deploy, `u` update, `r` roll back, `f` files the forge's machine and volume in its account's cloud project, `n` a new claim link (asked first); a deploy and `n` show the link in a dialog to copy; it follows the bus, so a change made at any door shows at once (`src/tui/screens/pinned.ts`). |
| 15 | - File in a project (#16340): an account's project (set on Settings → Cloud accounts, `P` in the terminal, `set_project` over MCP; DigitalOcean only, since a Hetzner token already belongs to one project) is where a deploy files the machine and volume it makes, both tagged with the forge. A forge made before the project was set is filed by `file`: the **File in project** button on `/pinned`, `f` on the terminal screen, or the MCP `pinned_forge` verb `file`, all through `fileForge` in `src/actions/pinned.ts`; it is safe to repeat. A deploy into a project that does not exist is refused before anything is made. If the cloud refuses the filing after the machine exists, the machine is kept and a `pinned.unfiled` event says the forge stayed in the default project; run `file` to file it. | |
| 15 | - File in a project (#16340): an account's project (set on Settings → Cloud accounts, `P` in the terminal, `set_project` over MCP; DigitalOcean only, since a Hetzner token already belongs to one project) is where a deploy files the machine and volume it makes, both tagged with the forge. A forge made before the project was set is filed by `file`: the **File in project** button in the Pinned forges block of `/infra`, `f` on the terminal screen, or the MCP `pinned_forge` verb `file`, all through `fileForge` in `src/actions/pinned.ts`; it is safe to repeat. A deploy into a project that does not exist is refused before anything is made. If the cloud refuses the filing after the machine exists, the machine is kept and a `pinned.unfiled` event says the forge stayed in the default project; run `file` to file it. | |
| 16 | 16 | - Web: `/deploy-to` (forge admin; linked from Cloud accounts) is a server-rendered form for cloud account, app, source, version, name and hostname. Its answer is a page with the claim link, sent `no-store`, not a redirect. The link `/deploy-to?app=owner/name&source=https://…&version=v1.2.3` (`deployToHref` in `src/web/pinned.ts`) lands on it with those filled in after one sign-in; nothing deploys until the button is pressed. The POST is same-origin checked and calls the same `deployPinned` (`src/http/pinned_routes.ts`). |
| 17 | - Web list: `/pinned` (forge admin; 404 otherwise) is server-rendered, with actions; one block of plain rows per forge: name, app, version, address (a link), health (the state), when the last check ran (the newest `pinned.check` event; `never checked` before the first), and the last change with who and when, from the same `pinnedForges` read as the API (`src/web/pages/pinned.ts`). The intro links `/deploy-to`; an empty list says so. A person can update, roll back and check a forge from `/pinned`, as the terminal's `u`, `r` and `c` do: each row has four buttons (Update, Roll back, Check, New claim link), and each goes through the confirm page before it runs (Update also asks for the version). The row also shows the DNS record and when the claim link runs out. They post to `POST /pinned/:name/:act` (`act` is `update`, `rollback`, `check` or `claim`; admin only, same-origin, 404 for non-admins and unknown acts); the result, or the sentence that refuses it, is shown as a flash on `/pinned` (`src/http/pinned_routes.ts`). | |
| 17 | - Web list: the Pinned forges block of `/infra` (forge admin; 404 otherwise; `GET /pinned` is a 301 to it, `/pinned#forge-<name>` lands on the forge's block, #17372; the POST routes under `/pinned/` are unchanged) is server-rendered, with actions; one block of plain rows per forge: name, app, version, address (a link), health (the state), when the last check ran (the newest `pinned.check` event; `never checked` before the first), and the last change with who and when, from the same `pinnedForges` read as the API (`src/web/pages/pinned.ts`). The intro links `/deploy-to`; an empty list says so. A person can update, roll back and check a forge from the Pinned forges block of `/infra`, as the terminal's `u`, `r` and `c` do: each row has four buttons (Update, Roll back, Check, New claim link), and each goes through the confirm page before it runs (Update also asks for the version). The row also shows the DNS record and when the claim link runs out. They post to `POST /pinned/:name/:act` (`act` is `update`, `rollback`, `check` or `claim`; admin only, same-origin, 404 for non-admins and unknown acts); the result, or the sentence that refuses it, is shown as a flash on `/infra` (`src/http/pinned_routes.ts`). | |
| 18 | 18 | - MCP: `pinned_forge` with `verb` `list`, `deploy`, `claim`, `update`, `rollback` (and `check`) — the same words and the same checks (`src/actions/pinned.ts`). |
| 19 | 19 | |
| 20 | 20 | A deploy names a cloud account (Settings → Cloud accounts, **writes allowed**), the app (`owner/name`), a git `source` (https), a `version` (a 40-character commit id or a tag like `v1.2.3` — never a branch, so nothing moves under it) and a `host`: the DNS name the forge is served on. Left empty, `source` is this forge's own repository at its public address (`<FORGE_URL>/<forgeRepo>.git`, which must be public) and `version` the commit this forge runs (`FORGE_COMMIT`); either refusal says which is missing (`ownCode` in `src/actions/pinned.ts`). |
| @@ -81,17 +81,17 @@ A deploy is made at a place from the Places catalog (`GET /api/v1/places`): `pro | ||
| 81 | 81 | The row records its place (`datacenter` and `size`, in `pinned_size`); the volume and the machine are made in that datacenter, and every replace (Update, Roll back, a new claim link) orders the row's own place, never today's default, because the volume lives there. The ceiling prices that place. A forge deployed before places were kept has none recorded and is read as the place the drivers once hard-coded (DigitalOcean `nyc3` `s-1vcpu-2gb`, Hetzner `nbg1`). |
| 82 | 82 | |
| 83 | 83 | ## The forge waits for its own forges (#16372) |
| 84 | After a deploy, an Update, a Roll back and a new claim link the forge itself looks every 5 seconds (`src/actions/pinned_watch.ts`): it reads the machine's address while there is none, writes the DNS record at once, and goes on until the forge answers over HTTPS, for 5 minutes at most. Nobody has to press Check. The time of each step (address, record, answer, giving up) is kept in `pinned_watch` (`src/core/pinned_watch.ts`) and each is one `pinned.watch` event. One loop a forge, held in memory, and `main.ts` starts it again at boot for every forge still waiting. At the bound it says so once: a `pinned.waiting_long` event for admins and a sentence on the forge's row on `/pinned` (and in the terminal screen, `src/tui/screens/pinned.ts`) saying what is missing and what to try. Check still works and reads the same things by hand. | |
| 84 | After a deploy, an Update, a Roll back and a new claim link the forge itself looks every 5 seconds (`src/actions/pinned_watch.ts`): it reads the machine's address while there is none, writes the DNS record at once, and goes on until the forge answers over HTTPS, for 5 minutes at most. Nobody has to press Check. The time of each step (address, record, answer, giving up) is kept in `pinned_watch` (`src/core/pinned_watch.ts`) and each is one `pinned.watch` event. One loop a forge, held in memory, and `main.ts` starts it again at boot for every forge still waiting. At the bound it says so once: a `pinned.waiting_long` event for admins and a sentence on the forge's row on `/infra` (and in the terminal screen, `src/tui/screens/pinned.ts`) saying what is missing and what to try. Check still works and reads the same things by hand. | |
| 85 | 85 | |
| 86 | 86 | ## Pay and go: no DNS work for the buyer (#16205) |
| 87 | 87 | |
| 88 | An admin names the **domain for deployed forges** (`forges.example.com`) on Pinned forges (`/pinned`; the terminal's `b`; `PATCH /api/v1/admin/settings` with `{"pinnedDomain": "forges.example.com"}`, `null` to clear; the MCP tool's `domain` verb). It is a forge setting (`settings/pinned_domain.ts`, `pinned.base_domain`, every change kept with who and when). With one set, a deploy needs no hostname: the forge is served on `<name>.<domain>`; a full hostname may still be given (the terminal's `-` takes the default). | |
| 88 | An admin names the **domain for deployed forges** (`forges.example.com`) on Infrastructure (`/infra`, under Pinned forges; the terminal's `b`; `PATCH /api/v1/admin/settings` with `{"pinnedDomain": "forges.example.com"}`, `null` to clear; the MCP tool's `domain` verb). It is a forge setting (`settings/pinned_domain.ts`, `pinned.base_domain`, every change kept with who and when). With one set, a deploy needs no hostname: the forge is served on `<name>.<domain>`; a full hostname may still be given (the terminal's `-` takes the default). | |
| 89 | 89 | |
| 90 | 90 | With a **Cloudflare** cloud account attached and writes allowed, the forge then writes the record itself: after the machine has an address (the deploy, and every Update, Roll back and new claim link), and again on Check, it upserts `<host> A <address>` in the zone that holds the name, through the first such account whose token can edit that zone: found by name and updated, or made, so a replaced machine's new address changes the record and never adds one; DNS only (not proxied, so the machine gets its own certificate), TTL 60. The calls go to `api.cloudflare.com` only (`upsertARecord`, `src/cloud/providers.ts`), the token in the Authorization header alone, each call audited as `pinned:dns` like the other cloud calls; the record's id and zone are kept (`pinned_dns`) with the account that wrote it. A zone the token cannot see or edit, a CNAME already at the name, or any refusal leaves the record for a person to make, and the deploy answer and Check say that instead (`dnsWrittenBy` is empty). The token needs DNS edit on the zone; the cloud account's check cannot tell that, so the first write is the proof. |
| 91 | 91 | |
| 92 | 92 | ## Paid forges on a cloud machine (#16205) |
| 93 | 93 | |
| 94 | An admin chooses where **paid forges run** on Pinned forges (`/pinned`; the terminal's `p`; `PATCH /api/v1/admin/settings` with `{"paidPlacement": "digitalocean/main"}`, `"hosted"` or `null` for the default; `GET` answers it as `paidPlacement`). It is a forge setting (`settings/paid_placement.ts`, `paid.placement`, every change kept with who and when). `hosted`, the default, is today's: a bought forge runs inside this one. A cloud account (one a pinned forge can be deployed to, with writes allowed) makes each paid order a pinned forge of its own (`src/spawn/cloud_placement.ts`). Free forges always stay hosted. | |
| 94 | An admin chooses where **paid forges run** on Infrastructure (`/infra`, under Pinned forges; the terminal's `p`; `PATCH /api/v1/admin/settings` with `{"paidPlacement": "digitalocean/main"}`, `"hosted"` or `null` for the default; `GET` answers it as `paidPlacement`). It is a forge setting (`settings/paid_placement.ts`, `paid.placement`, every change kept with who and when). `hosted`, the default, is today's: a bought forge runs inside this one. A cloud account (one a pinned forge can be deployed to, with writes allowed) makes each paid order a pinned forge of its own (`src/spawn/cloud_placement.ts`). Free forges always stay hosted. | |
| 95 | 95 | |
| 96 | 96 | - **Told before paying.** `/pricing` (and the terminal's pricing screen) asks the cloud placement's `room` before the checkout is made: no domain for deployed forges, a catalog never read, a default place that cannot be ordered, or a deploy the account's ceiling would refuse, each is said in the deploy's own sentence, and nothing is held or charged. |
| 97 | 97 | - **Deployed as the order.** Once paid, the forge is deployed at the catalog's default place for the plan, with no hostname (it is served on `<name>.<domain>`), running the forge's own source repository (public) at the commit this forge runs (`FORGE_COMMIT`; a forge run from source refuses, and so does one that knows only a release tag: a sale takes a commit). The source is where the owner says (see *Money and trust* below), never this forge's own address. The deploy acts as the order, never a borrowed admin: the row's history says `order:<id>`, its events carry `order` and no actor, and the token reads name the order in their run. Every refusal an admin's deploy has (target, catalog, place, ceiling) applies. |
| @@ -101,7 +101,7 @@ An admin chooses where **paid forges run** on Pinned forges (`/pinned`; the term | ||
| 101 | 101 | |
| 102 | 102 | ## Retiring a forge (#16219) |
| 103 | 103 | |
| 104 | A test forge, or one whose buyer left, would bill forever without a way out. **Retire** (`POST /api/v1/admin/pinned/:name/retire`, the `pinned_forge` tool's `retire` verb, Retire on `/pinned`, `x` in the terminal) deletes the forge's machine and the DNS record the forge wrote for it (job above), and keeps its data volume: the answer says what keeping it costs a month at list price. The row ends `retired`, and the account's ceiling counts it at that volume's price alone. The volume is deleted only by the second word: `withData` on the API and the tool, **Retire and delete its data** on the page (which asks for the forge's name), and a second choice and the name in the terminal. That call is the data-destroying one under the delete tier (`tier: "delete"` on the tool, `test/delete-tier.test.ts`): the forge's own agent is refused it with the page to use. A **retired forge** can be retired again with its data, and nothing else: Update, Roll back, a new claim link and Check refuse it. It is idempotent: a machine or volume already gone at the cloud (a 404) is done, so asking again finishes a retire whose volume the cloud would not delete (the machine is gone and the forge `retired` by then, its data kept). A forge its buyer has claimed, as the forge itself says when asked (or as recorded), is refused with the sentence that its data is on that volume, unless `despiteClaim` says the owner means it (the page's form for a claimed forge carries it; the terminal asks in its question). One event, `pinned.retired`, says who, whether the data went, and what became of the record. | |
| 104 | A test forge, or one whose buyer left, would bill forever without a way out. **Retire** (`POST /api/v1/admin/pinned/:name/retire`, the `pinned_forge` tool's `retire` verb, Retire in the Pinned forges block of `/infra`, `x` in the terminal) deletes the forge's machine and the DNS record the forge wrote for it (job above), and keeps its data volume: the answer says what keeping it costs a month at list price. The row ends `retired`, and the account's ceiling counts it at that volume's price alone. The volume is deleted only by the second word: `withData` on the API and the tool, **Retire and delete its data** on the page (which asks for the forge's name), and a second choice and the name in the terminal. That call is the data-destroying one under the delete tier (`tier: "delete"` on the tool, `test/delete-tier.test.ts`): the forge's own agent is refused it with the page to use. A **retired forge** can be retired again with its data, and nothing else: Update, Roll back, a new claim link and Check refuse it. It is idempotent: a machine or volume already gone at the cloud (a 404) is done, so asking again finishes a retire whose volume the cloud would not delete (the machine is gone and the forge `retired` by then, its data kept). A forge its buyer has claimed, as the forge itself says when asked (or as recorded), is refused with the sentence that its data is on that volume, unless `despiteClaim` says the owner means it (the page's form for a claimed forge carries it; the terminal asks in its question). One event, `pinned.retired`, says who, whether the data went, and what became of the record. | |
| 105 | 105 | |
| 106 | 106 | ## Experiments |
| 107 | 107 | |
| @@ -113,7 +113,7 @@ A forge can end on its own. `lifetimeDays` at deploy (1 to 90) sets when, and a | ||
| 113 | 113 | |
| 114 | 114 | ## After the claim: what the host can still do (#16204) |
| 115 | 115 | |
| 116 | Nobody marks a forge claimed by hand: the deployed forge says so. Check, and every Update, Roll back and request for a new claim link, asks it first; when one hears `claimed` (The claim, above), the selling forge records it once (`pinned_forge.claimed_at`, event `pinned.claimed`). From then it refuses `update`, `rollback` and a new claim link for that forge, each with the same sentence (`CLAIMED_REFUSAL`): updates are the buyer's to take, and no machine of theirs is replaced from here. A forge that cannot be asked is never recorded as claimed, and is not taken as unclaimed either: once its current machine has answered about its claim (`pinned_forge.reached`), silence from it (a broken DNS record, a forge that is down) refuses Update, Roll back and a new claim link, with a sentence saying the forge could not be reached to confirm nobody claimed it and to run Check until it answers. A forge whose current machine has never answered (still booting, DNS not pointed yet, a first boot that failed) may still be replaced, or it could never be recovered. The question starts with a read of the machine at its cloud: when the cloud refuses that read the change is refused with the cloud's answer, before anything is recorded; a machine that is gone (404) has nobody to ask and is replaced. `/pinned` (once, when any forge is claimed) and `/deploy-to` say what the host still can while the machine is in the host's cloud account (`HOST_CAN` in `src/core/pinned.ts`): open its console, boot it into rescue, snapshot its disk, read its boot data. It never says "no access". The path that gives the host none is the buyer's own cloud account: deploy there (the account picker on `/deploy-to`; choosing it at purchase is #16203). | |
| 116 | Nobody marks a forge claimed by hand: the deployed forge says so. Check, and every Update, Roll back and request for a new claim link, asks it first; when one hears `claimed` (The claim, above), the selling forge records it once (`pinned_forge.claimed_at`, event `pinned.claimed`). From then it refuses `update`, `rollback` and a new claim link for that forge, each with the same sentence (`CLAIMED_REFUSAL`): updates are the buyer's to take, and no machine of theirs is replaced from here. A forge that cannot be asked is never recorded as claimed, and is not taken as unclaimed either: once its current machine has answered about its claim (`pinned_forge.reached`), silence from it (a broken DNS record, a forge that is down) refuses Update, Roll back and a new claim link, with a sentence saying the forge could not be reached to confirm nobody claimed it and to run Check until it answers. A forge whose current machine has never answered (still booting, DNS not pointed yet, a first boot that failed) may still be replaced, or it could never be recovered. The question starts with a read of the machine at its cloud: when the cloud refuses that read the change is refused with the cloud's answer, before anything is recorded; a machine that is gone (404) has nobody to ask and is replaced. The Pinned forges block of `/infra` (once, when any forge is claimed) and `/deploy-to` say what the host still can while the machine is in the host's cloud account (`HOST_CAN` in `src/core/pinned.ts`): open its console, boot it into rescue, snapshot its disk, read its boot data. It never says "no access". The path that gives the host none is the buyer's own cloud account: deploy there (the account picker on `/deploy-to`; choosing it at purchase is #16203). | |
| 117 | 117 | |
| 118 | 118 | ## Targets: what runs, what it costs, what is refused |
| 119 | 119 |
docs/features/pricing.md +1 −1
| @@ -29,7 +29,7 @@ as what will happen; the terminal screen hides them. | ||
| 29 | 29 | |
| 30 | 30 | ## Price follows the place, and at-cost codes (#16205) |
| 31 | 31 | |
| 32 | When paid forges run on a cloud account (Pinned forges → "paid forges run on"), the buyer may pick where it runs. The plan's price is for the plan's default place. A dearer place adds the difference to the monthly price, rounded up to the next dollar: "Show the price" renders the plans with the chosen place and says on each plan what the place adds, and the checkout line says it too ("Small forge (digitalocean:nyc3:s-2vcpu-4gb: +$12 a month)"). The amount is fixed when the order is placed and kept on the order, and the checkout charges exactly it (inline `price_data`, no dashboard setup). | |
| 32 | When paid forges run on a cloud account (Infrastructure → Pinned forges → "paid forges run on"), the buyer may pick where it runs. The plan's price is for the plan's default place. A dearer place adds the difference to the monthly price, rounded up to the next dollar: "Show the price" renders the plans with the chosen place and says on each plan what the place adds, and the checkout line says it too ("Small forge (digitalocean:nyc3:s-2vcpu-4gb: +$12 a month)"). The amount is fixed when the order is placed and kept on the order, and the checkout charges exactly it (inline `price_data`, no dashboard setup). | |
| 33 | 33 | |
| 34 | 34 | An **at-cost code** is made where a gift code is (Settings → Billing → Codes, `POST /api/v1/codes` with `kind: "at_cost"`, the terminal's codes screen with `c`), with uses and an expiry as now; the link it gives is `/pricing?code=…`. A buyer with one pays the place's monthly cost plus the payment fee (`src/billing/at_cost.ts`: 2.9% and 30 cents, grossed up so the forge keeps the cost), rounded up to the next dollar: the plan row shows "was" the normal price and "at cost" with the amount. A code is for one plan and never gives a plan free: the gift door refuses it (`wrong_kind`), and a gift code is refused here. A use is held by each open checkout (name held for 30 minutes) and spent when it is paid, so one use cannot fund many pending orders; a checkout that lapses gives its use back. Revoking stops new checkouts; one already open and paid is honoured at the price it quoted. Every look at a code, by the link or by Show the price, counts a try for the client, as a gift code's does. |
| 35 | 35 |
src/actions/infra.ts +1 −1
| @@ -651,7 +651,7 @@ function fixOf(r: Refusal, wants: readonly Want[]): { why: string; href: string; | ||
| 651 | 651 | const provider = account.split("/")[0] ?? ""; |
| 652 | 652 | const label = isProvider(provider) ? LABEL[provider] : account; |
| 653 | 653 | if (r.why === READ_ONLY) return { why: r.why, href: accountHref(account), label: `Allow writes on ${label}` }; |
| 654 | if (r.why === HOST_NEEDED) return { why: r.why, href: "/pinned#domain", label: "Set a domain for deployed forges" }; | |
| 654 | if (r.why === HOST_NEEDED) return { why: r.why, href: "/infra#domain", label: "Set a domain for deployed forges" }; | |
| 655 | 655 | if (/ is held to \$\d+ a month/.test(r.why)) return { why: r.why, href: accountHref(account), label: `Raise the ceiling on ${label}` }; |
| 656 | 656 | if (/ shows (an orphan|\d+ orphans) /.test(r.why)) |
| 657 | 657 | return { why: r.why, href: accountHref(account), label: `See what the watch found at ${label}` }; |
src/http/infra_routes.ts +3 −1
| @@ -19,6 +19,7 @@ import { html } from "../web/html.ts"; | ||
| 19 | 19 | import { flashTo, fragment, page } from "../web/layout.ts"; |
| 20 | 20 | import { machineView } from "../actions/machine_view.ts"; |
| 21 | 21 | import { INFRA_CSS, cloudPage, consolePage, endingPage, buildTray, placesRegion, composeForm, infraJs, infraPage, planTray, recordForm, runningRegion, type ComposeState } from "../web/pages/infra.ts"; |
| 22 | import { pinnedBlock } from "./pinned_routes.ts"; | |
| 22 | 23 | import type { Ctx, Handler } from "./context.ts"; |
| 23 | 24 | import type { Router } from "./router.ts"; |
| 24 | 25 | |
| @@ -73,7 +74,8 @@ async function render( | ||
| 73 | 74 | const projects = timePhase(ctx.request, "projects", () => projectsView(ctx.app, user)); |
| 74 | 75 | // What each provider says, as kept: no page waits on a provider; a fresh reading redraws the live region. |
| 75 | 76 | const cloud = cloudFactsAll(ctx.app, view.value.groups.flatMap((g) => g.machines.map((m) => m.name))); |
| 76 | const body = infraPage(view.value, compose, build, { composing: o.composing, code: code.ok ? code.value : [], records: recordForm(recordAccounts(ctx.app)), projects: projects.ok ? projects.value : [], cloud }); | |
| 77 | const pinned = pinnedBlock(ctx); | |
| 78 | const body = infraPage(view.value, compose, build, { composing: o.composing, code: code.ok ? code.value : [], records: recordForm(recordAccounts(ctx.app)), projects: projects.ok ? projects.value : [], cloud, ...(pinned ? { pinned } : {}) }); | |
| 77 | 79 | return page({ ctx, title: "Infrastructure", scriptJs: SCRIPT, styleCss: INFRA_CSS, body, ...(o.flash ? { flash: o.flash } : {}) }, status); |
| 78 | 80 | } |
| 79 | 81 |
src/http/mcp/tools/pinned_forge.ts +1 −1
| @@ -10,7 +10,7 @@ export const tool: Tool = { | ||
| 10 | 10 | description: "Pinned forges on your cloud: list, deploy, claim, update, rollback, check, retire (admin).", |
| 11 | 11 | tier: "delete", |
| 12 | 12 | deletes: (args) => args["verb"] === "retire" && args["withData"] === true, |
| 13 | where: "on the Pinned forges page (/pinned), where Retire and delete its data asks for the forge's name", | |
| 13 | where: "on the Infrastructure page (/infra), where Retire and delete its data asks for the forge's name", | |
| 14 | 14 | inputSchema: { |
| 15 | 15 | type: "object", |
| 16 | 16 | properties: { |
src/http/pinned_routes.ts +19 −17
| @@ -17,9 +17,8 @@ import { getUsersByIds } from "../core/users.ts"; | ||
| 17 | 17 | import { notFoundPage, signInFirst } from "../web/chrome.ts"; |
| 18 | 18 | import { field, readForm } from "../web/form.ts"; |
| 19 | 19 | import { flashTo, page } from "../web/layout.ts"; |
| 20 | import { liveRegionsJs } from "../web/client.ts"; | |
| 21 | import { behaviorsJs } from "../web/behaviors.ts"; | |
| 22 | import { pinnedListPage } from "../web/pages/pinned.ts"; | |
| 20 | import { pinnedRegion } from "../web/pages/pinned.ts"; | |
| 21 | import type { Html } from "../web/html.ts"; | |
| 23 | 22 | import { deployPage, issuedPage, nameFor, type DeployForm } from "../web/pinned.ts"; |
| 24 | 23 | import type { Handler, Ctx } from "./context.ts"; |
| 25 | 24 | import type { Router } from "./router.ts"; |
| @@ -78,10 +77,13 @@ async function deployToSubmit(ctx: Ctx): Promise<Response> { | ||
| 78 | 77 | return shown(ctx, `Deployed ${made.value.name}`, made.value); |
| 79 | 78 | } |
| 80 | 79 | |
| 81 | function listPage(ctx: Ctx): Response { | |
| 82 | if (!ctx.auth.user) return signInFirst(ctx); | |
| 80 | /** `/pinned` is folded into /infra: forever (301); the browser keeps `#forge-<name>`. */ | |
| 81 | const listPage = (): Response => new Response(null, { status: 301, headers: { location: "/infra" } }); | |
| 82 | ||
| 83 | /** The pinned forges' block of /infra, for a forge admin; nothing for anyone else. */ | |
| 84 | export function pinnedBlock(ctx: Ctx): Html | undefined { | |
| 83 | 85 | const forges = pinnedForges(ctx.app, ctx.auth.user); |
| 84 | if (!forges.ok) return notFoundPage(ctx); | |
| 86 | if (!forges.ok) return undefined; | |
| 85 | 87 | const users = getUsersByIds(ctx.app.db, forges.value.flatMap((p) => p.changes.slice(0, 1).map((c) => c.by))); |
| 86 | 88 | const names = new Map([...users].map(([id, u]) => [id, u.username])); |
| 87 | 89 | const checks = new Map<string, string>(); |
| @@ -89,7 +91,7 @@ function listPage(ctx: Ctx): Response { | ||
| 89 | 91 | const at = lastCheckOf(ctx.app.db, p.name); |
| 90 | 92 | if (at) checks.set(p.name, at); |
| 91 | 93 | } |
| 92 | return page({ ctx, title: "Pinned forges", scriptJs: `${liveRegionsJs}\n${behaviorsJs}`, body: pinnedListPage(forges.value, { names, checks, domain: getBaseDomain(ctx.app.db), paid: paidOf(ctx), experiments: experiments(ctx.app.db) }) }); | |
| 94 | return pinnedRegion(forges.value, { names, checks, domain: getBaseDomain(ctx.app.db), paid: paidOf(ctx), experiments: experiments(ctx.app.db) }); | |
| 93 | 95 | } |
| 94 | 96 | |
| 95 | 97 | /** |
| @@ -109,26 +111,26 @@ async function pinnedAct(ctx: Ctx): Promise<Response> { | ||
| 109 | 111 | else if (act === "rollback") done = await rollbackPinned(ctx.app, user, name); |
| 110 | 112 | else if (act === "check") { |
| 111 | 113 | const seen = await checkPinned(ctx.app, user, name); |
| 112 | return flashTo(ctx, "/pinned", seen.ok ? { tone: seen.value.healthy ? "success" : "attn", message: checkWords(seen.value) } : { tone: "danger", message: seen.error }); | |
| 114 | return flashTo(ctx, "/infra", seen.ok ? { tone: seen.value.healthy ? "success" : "attn", message: checkWords(seen.value) } : { tone: "danger", message: seen.error }); | |
| 113 | 115 | } else if (act === "retire" || act === "retire-data") { |
| 114 | 116 | // Retire keeps the data; Retire and delete its data is its own act, behind the name typed on |
| 115 | 117 | // the confirm page. A claimed forge is retired only when the form says the owner means it. |
| 116 | 118 | const gone = await retirePinned(ctx.app, user, name, { withData: act === "retire-data", despiteClaim: field(form, "despite_claim") === "1" }); |
| 117 | return flashTo(ctx, "/pinned", gone.ok ? { tone: "success", message: retireWords(gone.value) } : { tone: "danger", message: gone.error }); | |
| 119 | return flashTo(ctx, "/infra", gone.ok ? { tone: "success", message: retireWords(gone.value) } : { tone: "danger", message: gone.error }); | |
| 118 | 120 | } else if (act === "keep") { |
| 119 | 121 | const kept = keepPinned(ctx.app, user, name); |
| 120 | return flashTo(ctx, "/pinned", kept.ok ? { tone: "success", message: `${name} now ends ${endsWords(kept.value.endsAt!)}.` } : { tone: "danger", message: kept.error }); | |
| 122 | return flashTo(ctx, "/infra", kept.ok ? { tone: "success", message: `${name} now ends ${endsWords(kept.value.endsAt!)}.` } : { tone: "danger", message: kept.error }); | |
| 121 | 123 | } else if (act === "file") { |
| 122 | 124 | const filed = await fileForge(ctx.app, user, name); |
| 123 | return flashTo(ctx, "/pinned", filed.ok ? { tone: "success", message: filed.value } : { tone: "danger", message: filed.error }); | |
| 125 | return flashTo(ctx, "/infra", filed.ok ? { tone: "success", message: filed.value } : { tone: "danger", message: filed.error }); | |
| 124 | 126 | } else if (act === "claim") { |
| 125 | 127 | const made = await claimPinned(ctx.app, user, name, { host: field(form, "host") }); |
| 126 | return made.ok ? shown(ctx, `A new claim link for ${name}`, made.value) : flashTo(ctx, "/pinned", { tone: "danger", message: made.error }); | |
| 128 | return made.ok ? shown(ctx, `A new claim link for ${name}`, made.value) : flashTo(ctx, "/infra", { tone: "danger", message: made.error }); | |
| 127 | 129 | } else return notFoundPage(ctx); |
| 128 | if (!done.ok) return flashTo(ctx, "/pinned", { tone: "danger", message: done.error }); | |
| 130 | if (!done.ok) return flashTo(ctx, "/infra", { tone: "danger", message: done.error }); | |
| 129 | 131 | const at = done.value.version.slice(0, 12); |
| 130 | 132 | const message = act === "update" ? `Updated ${name} to ${at}.` : `Rolled ${name} back to ${at}.`; |
| 131 | return flashTo(ctx, "/pinned", { tone: "success", message }); | |
| 133 | return flashTo(ctx, "/infra", { tone: "success", message }); | |
| 132 | 134 | } |
| 133 | 135 | |
| 134 | 136 | /** |
| @@ -151,7 +153,7 @@ async function experimentAct(ctx: Ctx): Promise<Response> { | ||
| 151 | 153 | ? attachMachine(ctx.app, who, field(form, "id"), field(form, "name")) |
| 152 | 154 | : recordResult(ctx.app, who, field(form, "id"), field(form, "result")); |
| 153 | 155 | const said = act === "begin" ? "Experiment begun." : act === "attach" ? `Attached ${field(form, "name")}.` : "Result recorded: the experiment is done."; |
| 154 | return flashTo(ctx, "/pinned", done.ok ? { tone: "success", message: said } : { tone: "danger", message: EXPERIMENT_WORDS[done.error] }); | |
| 156 | return flashTo(ctx, "/infra", done.ok ? { tone: "success", message: said } : { tone: "danger", message: EXPERIMENT_WORDS[done.error] }); | |
| 155 | 157 | } |
| 156 | 158 | |
| 157 | 159 | /** Save the domain deployed forges are served on: the same change the API, MCP and terminal make. */ |
| @@ -162,7 +164,7 @@ async function domainSubmit(ctx: Ctx): Promise<Response> { | ||
| 162 | 164 | if (form instanceof Response) return form; |
| 163 | 165 | const set = changeBaseDomain(ctx.app, ctx.auth.user, field(form, "domain")); |
| 164 | 166 | if (!set.ok && set.error === "not_found") return notFoundPage(ctx); |
| 165 | return flashTo(ctx, "/pinned", set.ok ? { message: set.value === "" ? "Domain for deployed forges cleared." : `Deployed forges are served on <name>.${set.value}.` } : { tone: "danger", message: `${DOMAIN_WORDS}. Nothing was saved.` }); | |
| 167 | return flashTo(ctx, "/infra", set.ok ? { message: set.value === "" ? "Domain for deployed forges cleared." : `Deployed forges are served on <name>.${set.value}.` } : { tone: "danger", message: `${DOMAIN_WORDS}. Nothing was saved.` }); | |
| 166 | 168 | } |
| 167 | 169 | |
| 168 | 170 | const paidOf = (ctx: Ctx): string => { |
| @@ -178,7 +180,7 @@ async function paidSubmit(ctx: Ctx): Promise<Response> { | ||
| 178 | 180 | if (form instanceof Response) return form; |
| 179 | 181 | const set = changePaidPlacement(ctx.app, ctx.auth.user, field(form, "paid")); |
| 180 | 182 | if (!set.ok && set.error === "not_found") return notFoundPage(ctx); |
| 181 | return flashTo(ctx, "/pinned", set.ok ? { message: set.value === "hosted" ? "Paid forges run hosted, inside this forge." : `Paid forges are deployed on ${set.value}.` } : { tone: "danger", message: `${PAID_PLACEMENT_WORDS}. Nothing was saved.` }); | |
| 183 | return flashTo(ctx, "/infra", set.ok ? { message: set.value === "hosted" ? "Paid forges run hosted, inside this forge." : `Paid forges are deployed on ${set.value}.` } : { tone: "danger", message: `${PAID_PLACEMENT_WORDS}. Nothing was saved.` }); | |
| 182 | 184 | } |
| 183 | 185 | |
| 184 | 186 | export function pinnedRoutes(router: Router<Handler>): void { |
src/maintain/duties/pinned_lifetimes.ts +1 −1
| @@ -55,7 +55,7 @@ export async function tickLifetimes( | ||
| 55 | 55 | if (ends - now.getTime() <= WARN_MS && markWarned(app.db, p.id, now.toISOString())) { |
| 56 | 56 | app.bus.append({ kind: "pinned.ending_soon", payload: { name: p.name, endsAt: l.endsAt } }); |
| 57 | 57 | findings.push({ |
| 58 | summary: `${p.name} ends ${endsWords(l.endsAt, now)}: Keep it on /pinned for ${LIFETIME_DAYS} more days, or let it retire with its data kept`, | |
| 58 | summary: `${p.name} ends ${endsWords(l.endsAt, now)}: Keep it on /infra for ${LIFETIME_DAYS} more days, or let it retire with its data kept`, | |
| 59 | 59 | }); |
| 60 | 60 | } |
| 61 | 61 | } |
src/tui/screens/experiments.ts +3 −3
| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | /** |
| 2 | * Experiments in the terminal, a forge admin's (#16583): the same read as the /pinned page, each | |
| 2 | * Experiments in the terminal, a forge admin's (#16583): the same read as the /infra page, each | |
| 3 | 3 | * experiment with its machines, what it costs a month now, what it has cost and its result, then |
| 4 | 4 | * every machine that costs money on no experiment as idle spend. `b` begins one (a question, then |
| 5 | 5 | * the machines it runs on), `a` attaches machines to the selected experiment, `r` records its |
| 6 | 6 | * result, each through `cloud/experiments.ts`, so the event every write appends updates the page |
| 7 | * of anyone watching /pinned. Retiring stays on the pinned forges screen. Anyone else sees nothing. | |
| 7 | * of anyone watching /infra. Retiring stays on the pinned forges screen. Anyone else sees nothing. | |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | import { |
| @@ -144,7 +144,7 @@ export function experimentsScreen(f: Session, ctx: Ctx): Screen { | ||
| 144 | 144 | return screen; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | /** Experiments, as the /pinned page and the MCP have them: a forge admin. */ | |
| 147 | /** Experiments, as the /infra page and the MCP have them: a forge admin. */ | |
| 148 | 148 | export const entry: PaletteEntry = { |
| 149 | 149 | rank: 871, |
| 150 | 150 | id: "experiments", |
src/tui/screens/infra.ts +1 −1
| @@ -633,7 +633,7 @@ export function infraScreen(f: Session, ctx: Ctx): Screen { | ||
| 633 | 633 | confirmScreen(ctx, screen, { |
| 634 | 634 | title: `End ${picked.name} now?`, |
| 635 | 635 | body: [ |
| 636 | "Its machine is deleted and stops billing. Its disk is kept, and keeps costing what a disk costs, until you delete it on Pinned forges.", | |
| 636 | "Its machine is deleted and stops billing. Its disk is kept, and keeps costing what a disk costs, until you delete it on the Pinned forges screen.", | |
| 637 | 637 | ...(offered ? [picked.offer] : []), |
| 638 | 638 | ], |
| 639 | 639 | actions: offered |
src/web/pages/cloud.ts +1 −1
| @@ -210,7 +210,7 @@ export async function cloudPage(ctx: Ctx): Promise<Response> { | ||
| 210 | 210 | ${settingsLayout( |
| 211 | 211 | accountSections("cloud", { admin: true, ssh: sshOn(ctx.app.db) }), |
| 212 | 212 | html`${accountsCard(ctx.app.db, accounts, reads, uses)}${readsCard(reads)} |
| 213 | <p class="muted small"><a href="/settings/cloud/audit">Every vendor call today</a> · <a href="/infra">Infrastructure</a> · <a href="/pinned">Pinned forges</a> · <a href="/deploy-to">Deploy a pinned forge</a></p>`, | |
| 213 | <p class="muted small"><a href="/settings/cloud/audit">Every vendor call today</a> · <a href="/infra">Infrastructure</a> · <a href="/deploy-to">Deploy a pinned forge</a></p>`, | |
| 214 | 214 | "Account settings", |
| 215 | 215 | )}`, |
| 216 | 216 | }); |
src/web/pages/infra.ts +4 −3
| @@ -225,7 +225,7 @@ export function runningRegion(v: InfraView, cloud: ReadonlyMap<string, { label: | ||
| 225 | 225 | v.ended.map((r) => |
| 226 | 226 | row({ |
| 227 | 227 | title: html`<span class="mono">${r.name}</span>`, |
| 228 | meta: html`${r.billing}${r.bills === "disk" ? html` · <a href="/pinned#forge-${r.name}">delete it on Pinned forges</a>` : null}`, | |
| 228 | meta: html`${r.billing}${r.bills === "disk" ? html` · <a href="#forge-${r.name}">delete its disk below</a>` : null}`, | |
| 229 | 229 | ...(r.monthlyCents > 0 ? { trail: html`<span>${money(r.monthlyCents)}<span class="muted"> a month</span></span>` } : {}), |
| 230 | 230 | data: { bills: r.bills }, |
| 231 | 231 | }), |
| @@ -618,7 +618,7 @@ export function infraPage( | ||
| 618 | 618 | v: InfraView, |
| 619 | 619 | compose: Html, |
| 620 | 620 | build: Build | undefined, |
| 621 | s: { composing: boolean; records?: Html; code?: readonly CodeFile[]; projects?: readonly ProjectView[]; cloud?: ReadonlyMap<string, { label: string; value: string }> }, | |
| 621 | s: { composing: boolean; records?: Html; code?: readonly CodeFile[]; projects?: readonly ProjectView[]; cloud?: ReadonlyMap<string, { label: string; value: string }>; pinned?: Html }, | |
| 622 | 622 | ): Html { |
| 623 | 623 | const open = s.composing || v.groups.length === 0; |
| 624 | 624 | return html`${pageHead("Infrastructure", { sub: "What runs on your own cloud, what it's for, what it costs, and when it ends." })} |
| @@ -632,7 +632,8 @@ export function infraPage( | ||
| 632 | 632 | ${disclosure("Build something", compose, { id: "compose-open", open })} |
| 633 | 633 | </section>`} |
| 634 | 634 | ${s.records === undefined ? null : html`<section class="settings-block" data-record-block>${disclosure("Make a DNS record", s.records, { id: "record-open", open: false })}</section>`} |
| 635 | <p class="muted small"><a href="/pinned">Pinned forges</a> · <a href="/settings/cloud">Cloud accounts</a></p> | |
| 635 | ${s.pinned ?? null} | |
| 636 | <p class="muted small"><a href="/settings/cloud">Cloud accounts</a></p> | |
| 636 | 637 | </div>`; |
| 637 | 638 | } |
| 638 | 639 |
src/web/pages/pinned.ts +16 −10
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | * `/pinned` (#10106): the pinned forges, one block of plain rows each, read | |
| 3 | * from the same `pinnedForges` the API, MCP and terminal use. The last check | |
| 4 | * is when the newest `pinned.check` event for the forge was written. | |
| 2 | * The pinned forges' part of `/infra` (#10106, folded in by #17372; `/pinned` redirects): one block | |
| 3 | * of plain rows each, read from the same `pinnedForges` the API, MCP and terminal use. The last | |
| 4 | * check is when the newest `pinned.check` event for the forge was written. | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | import { LIFETIME_DAYS, endsWords, type PinnedView } from "../../actions/pinned.ts"; |
| @@ -9,7 +9,6 @@ import type { Experiment, Experiments, Machine } from "../../cloud/experiments.t | ||
| 9 | 9 | import { dollars } from "../../cloud/prices.ts"; |
| 10 | 10 | import { billsWords, existsAtProvider } from "../../cloud/billing.ts"; |
| 11 | 11 | import { HOST_CAN } from "../../core/pinned.ts"; |
| 12 | import { pageHead } from "../chrome.ts"; | |
| 13 | 12 | import { html, type Html } from "../html.ts"; |
| 14 | 13 | import { badge, btn, field, row, rowList, time, type Tone } from "../ui.ts"; |
| 15 | 14 | |
| @@ -32,8 +31,9 @@ const none = (text: string): Html => html`<span class="muted">${text}</span>`; | ||
| 32 | 31 | |
| 33 | 32 | /** |
| 34 | 33 | * Retire, or delete what a retired forge kept (`act`), through the confirm page, which posts to |
| 35 | * `/pinned/<name>/<act>`; a claimed forge's form says the owner means it (`despite_claim`). The | |
| 36 | * forge's own block and its idle spend row both call this, so the two never drift. | |
| 34 | * `/pinned/<name>/<act>` (the routes keep that path; the pages that show them are /infra); a | |
| 35 | * claimed forge's form says the owner means it (`despite_claim`). The forge's own block and its | |
| 36 | * idle spend row both call this, so the two never drift. | |
| 37 | 37 | */ |
| 38 | 38 | const retireForm = (name: string, act: "retire" | "retire-data", label: string, claimed: boolean): Html => html`<form method="get" action="/-/confirm"> |
| 39 | 39 | <input type="hidden" name="to" value="/pinned/${name}/${act}" /> |
| @@ -205,9 +205,14 @@ function forge(p: PinnedView, f: PinnedFacts): Html { | ||
| 205 | 205 | </section>`; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | export function pinnedListPage(forges: PinnedView[], f: PinnedFacts): Html { | |
| 209 | return html`${pageHead("Pinned forges", { sub: "The forges you run on your own cloud, and the question each one's spend answers." })} | |
| 210 | <p><a href="/infra">Infrastructure</a>: what runs on your cloud, by what it is for · <a href="/deploy-to">Deploy a pinned forge</a></p> | |
| 208 | /** | |
| 209 | * The pinned forges' part of /infra: experiments, the domain and paid settings, then each forge's | |
| 210 | * block. | |
| 211 | */ | |
| 212 | export function pinnedRegion(forges: PinnedView[], f: PinnedFacts): Html { | |
| 213 | return html`<div id="pinned-forges"> | |
| 214 | <h2>Pinned forges</h2> | |
| 215 | <p class="muted small"><a href="/deploy-to">Deploy a pinned forge</a> to one of your cloud accounts.</p> | |
| 211 | 216 | ${f.experiments === undefined ? null : experimentsSection(f.experiments, forges)} |
| 212 | 217 | <form method="post" action="/pinned/domain" class="stack" id="domain"> |
| 213 | 218 | ${field({ name: "domain", label: "Domain for deployed forges", value: f.domain, placeholder: "forges.example.com", mono: true, maxlength: 253, spellcheck: false, hint: "A forge deployed with no hostname is served on <name>.<domain>, so its buyer configures no DNS. With a Cloudflare account that allows writes and a token that can edit the zone, the forge writes the record itself, after every replace too. Empty for none." })} |
| @@ -218,5 +223,6 @@ export function pinnedListPage(forges: PinnedView[], f: PinnedFacts): Html { | ||
| 218 | 223 | ${btn("Save", { variant: "secondary", label: "Save where paid forges run" })} |
| 219 | 224 | </form> |
| 220 | 225 | ${forges.some((p) => p.claimedAt !== "") ? html`<p class="muted small">${HOST_CAN}</p>` : null} |
| 221 | ${forges.length === 0 ? html`<p role="status">No pinned forge yet. Deploy one to a cloud account that allows writes.</p>` : forges.map((p) => forge(p, f))}`; | |
| 226 | ${forges.length === 0 ? html`<p role="status">No pinned forge yet. Deploy one to a cloud account that allows writes.</p>` : forges.map((p) => forge(p, f))} | |
| 227 | </div>`; | |
| 222 | 228 | } |
src/web/pinned.ts +1 −1
| @@ -52,7 +52,7 @@ export function issuedPage(title: string, v: Issued): Html { | ||
| 52 | 52 | ${copyField("pinned-claim-link", v.claim.link, `Claim link for ${v.name}`, "Copy the link")} |
| 53 | 53 | <p class="muted small"> |
| 54 | 54 | Hand it to the person the forge is for, by a channel you trust. This forge keeps only its hash: if the |
| 55 | link is lost or runs out, issue a new one from <a href="/pinned">Pinned forges</a>, and this one stops working. | |
| 55 | link is lost or runs out, issue a new one from <a href="/infra">Infrastructure</a>, and this one stops working. | |
| 56 | 56 | </p>`, |
| 57 | 57 | )}`; |
| 58 | 58 | } |
test/experiments-routes.test.ts +5 −5
| @@ -33,7 +33,7 @@ describe("experiment routes", () => { | ||
| 33 | 33 | /** The flash a redirect to /pinned carries in its cookie (`web/flash.ts`). */ |
| 34 | 34 | const landed = async (r: Response, _tok: string): Promise<string> => { |
| 35 | 35 | expect(r.status).toBe(303); |
| 36 | expect(r.headers.get("location") ?? "").toStartWith("/pinned"); | |
| 36 | expect(r.headers.get("location") ?? "").toStartWith("/infra"); | |
| 37 | 37 | return decodeURIComponent(r.headers.get("set-cookie") ?? ""); |
| 38 | 38 | }; |
| 39 | 39 | |
| @@ -64,14 +64,14 @@ describe("experiment routes", () => { | ||
| 64 | 64 | // As pinned-page.test.ts has it: signed out, /pinned sends to sign-in; a non-admin's admin-scope |
| 65 | 65 | // token is refused (403) before any form route runs; a signed-out POST changes nothing. |
| 66 | 66 | test("a guest is sent to sign in, and anyone but an admin is refused", async () => { |
| 67 | const page = await fetch(`${servers.url}/pinned`, { redirect: "manual" }); | |
| 68 | expect(page.status, "a guest reading /pinned").toBe(303); | |
| 67 | const page = await fetch(`${servers.url}/infra`, { redirect: "manual" }); | |
| 68 | expect(page.status, "a guest reading /infra").toBe(303); | |
| 69 | 69 | expect(page.headers.get("location") ?? "", "where a guest is sent").toContain("/signin"); |
| 70 | 70 | const guest = await post("/pinned/experiment/begin", { question: "q" }); |
| 71 | 71 | expect([303, 401, 403], `a guest's POST answered ${guest.status}`).toContain(guest.status); |
| 72 | expect(guest.headers.get("location") ?? "", "a guest's POST never lands on /pinned").not.toStartWith("/pinned"); | |
| 72 | expect(guest.headers.get("location") ?? "", "a guest's POST never lands on /infra").not.toStartWith("/infra"); | |
| 73 | 73 | expect((await post("/pinned/experiment/begin", { question: "q" }, bobTok)).status, "a non-admin's POST").toBe(403); |
| 74 | expect((await fetch(`${servers.url}/pinned`, { redirect: "manual", headers: { authorization: `Bearer ${bobTok}` } })).status, "a non-admin reading /pinned").not.toBe(200); | |
| 74 | expect((await fetch(`${servers.url}/infra`, { redirect: "manual", headers: { authorization: `Bearer ${bobTok}` } })).status, "a non-admin reading /infra").not.toBe(200); | |
| 75 | 75 | expect(experiments(app.db).items, "nothing was begun").toEqual([]); |
| 76 | 76 | }); |
| 77 | 77 |
test/experiments.test.ts +3 −3
| @@ -20,7 +20,7 @@ import { tool } from "../src/http/mcp/tools/infra.ts"; | ||
| 20 | 20 | import { createForgeApp } from "../src/tui/forge.ts"; |
| 21 | 21 | import { experimentsScreen } from "../src/tui/screens/experiments.ts"; |
| 22 | 22 | import { headlessTerminal } from "../src/tui/term/terminal.ts"; |
| 23 | import { pinnedListPage } from "../src/web/pages/pinned.ts"; | |
| 23 | import { pinnedRegion } from "../src/web/pages/pinned.ts"; | |
| 24 | 24 | import { quietLogs } from "./helpers/globals.ts"; |
| 25 | 25 | import { seedPlaces } from "./helpers/places-fixture.ts"; |
| 26 | 26 | import { settleApp } from "./helpers/tui.ts"; |
| @@ -35,7 +35,7 @@ describe("experiments", () => { | ||
| 35 | 35 | const render = (): string => { |
| 36 | 36 | const forges = pinnedForges(app, admin); |
| 37 | 37 | if (!forges.ok) throw new Error("not admin"); |
| 38 | return String(pinnedListPage(forges.value, { names: new Map(), checks: new Map(), domain: "", experiments: experiments(app.db) })); | |
| 38 | return String(pinnedRegion(forges.value, { names: new Map(), checks: new Map(), domain: "", experiments: experiments(app.db) })); | |
| 39 | 39 | }; |
| 40 | 40 | const call = async (args: Record<string, unknown>): Promise<any> => |
| 41 | 41 | tool.run({ app, auth: { user: admin, scope: "admin" } } as any, admin, args); |
| @@ -128,7 +128,7 @@ describe("experiments", () => { | ||
| 128 | 128 | expect(x.idle.map((m) => m.name)).toEqual(["spare", "test1"]); |
| 129 | 129 | |
| 130 | 130 | const page = render(); |
| 131 | expect(page).toContain("the question each one's spend answers"); | |
| 131 | expect(page).toContain("Deploy a pinned forge"); | |
| 132 | 132 | expect(page).toContain(`data-experiment="${e.id}"`); |
| 133 | 133 | expect(page).toContain(`${dollars(e.monthlyCents)} a month`); |
| 134 | 134 | const region = page.slice(page.indexOf('id="experiments"'), page.indexOf("</section>", page.indexOf('id="experiments"'))); |
test/infra-page.test.ts +35 −3
| @@ -12,7 +12,8 @@ import { createApp, type App } from "../src/app.ts"; | ||
| 12 | 12 | import { addAccount, allowWrite, net as cloudNet } from "../src/actions/cloud.ts"; |
| 13 | 13 | import { buildOf, composeChoices, infraOf, nameFor, planCompose, type Compose } from "../src/actions/infra.ts"; |
| 14 | 14 | import { placesShown } from "../src/web/pages/infra.ts"; |
| 15 | import { dayWords, deployPinned, net } from "../src/actions/pinned.ts"; | |
| 15 | import { dayWords, deployPinned, net, pinnedForges } from "../src/actions/pinned.ts"; | |
| 16 | import { issuedPage } from "../src/web/pinned.ts"; | |
| 16 | 17 | import { WATCH } from "../src/actions/pinned_watch.ts"; |
| 17 | 18 | import { commitToBranch } from "../src/actions/repos.ts"; |
| 18 | 19 | import { beginExperiment } from "../src/cloud/experiments.ts"; |
| @@ -362,7 +363,7 @@ describe("infrastructure", () => { | ||
| 362 | 363 | expect(listed.value.ended.find((m) => m.name === "plain")!.billing).toBe(gone.billing); |
| 363 | 364 | }); |
| 364 | 365 | |
| 365 | test("a machine with nothing at its provider offers no End, here or on /pinned", async () => { | |
| 366 | test("a machine with nothing at its provider offers no End, here or on /infra", async () => { | |
| 366 | 367 | const d = await deployPinned(app, admin, { name: "canary", host: "", target: "digitalocean", account: "main", app: "ada/shop", source: "https://forge.example.net/ada/shop.git", version: "a".repeat(40), place: "digitalocean:nyc3:s-1vcpu-2gb" }); |
| 367 | 368 | if (!d.ok) throw new Error(d.error); |
| 368 | 369 | setRemote(app.db, "canary", { remote: "", volume: "", address: "", state: "failed" }); |
| @@ -370,11 +371,42 @@ describe("infrastructure", () => { | ||
| 370 | 371 | expect(running).toContain('id="machine-canary"'); |
| 371 | 372 | expect(running).not.toContain('value="/infra/canary/end"'); |
| 372 | 373 | expect(running).toContain(`href="/infra/shop-test/ending"`); |
| 373 | const pinned = await (await get("/pinned")).text(); | |
| 374 | const pinned = await (await get("/infra")).text(); | |
| 374 | 375 | expect(pinned).not.toContain('value="/pinned/canary/retire"'); |
| 375 | 376 | expect(pinned).not.toContain('value="/pinned/canary/retire-data"'); |
| 376 | 377 | }); |
| 377 | 378 | |
| 379 | test("/pinned folds into /infra: a 301, each forge's row there, its disk deleted from it, and no page links back (#17372)", async () => { | |
| 380 | const moved = await get("/pinned"); | |
| 381 | expect(moved.status).toBe(301); | |
| 382 | expect(moved.headers.get("location")).toBe("/infra"); | |
| 383 | setRemote(app.db, "plain", { remote: "", address: "", state: "retired", volume: "vol-plain" }); | |
| 384 | const page = await (await get("/infra")).text(); | |
| 385 | // Its row is here, with the ended list's link to it and the typed-name confirm for its disk. | |
| 386 | expect(page).toContain('id="forge-plain"'); | |
| 387 | expect(page).toContain('href="#forge-plain"'); | |
| 388 | expect(page).toContain('name="to" value="/pinned/plain/retire-data"'); | |
| 389 | expect(page).toContain('action="/pinned/domain"'); | |
| 390 | expect(page).toContain('action="/pinned/paid"'); | |
| 391 | const confirm = await (await get("/-/confirm?to=/pinned/plain/retire-data")).text(); | |
| 392 | expect(confirm).toContain("Type plain to continue"); | |
| 393 | // The POST deletes the disk and lands back on /infra. | |
| 394 | const gone = await post("/pinned/plain/retire-data", {}); | |
| 395 | expect(gone.status).toBe(303); | |
| 396 | expect(gone.headers.get("location")).toBe("/infra"); | |
| 397 | expect(getPinned(app.db, "plain")!.volume).toBe(""); | |
| 398 | // No page the forge serves to its admin links to /pinned: the claim page and the confirm page too. | |
| 399 | const bodies = new Map<string, string>(); | |
| 400 | for (const path of ["/infra", "/infra/live?part=running", "/settings/cloud", "/deploy-to", "/", "/-/confirm?to=/pinned/plain/check"]) { | |
| 401 | bodies.set(path, await (await get(path)).text()); | |
| 402 | } | |
| 403 | const forges = pinnedForges(app, admin); | |
| 404 | if (!forges.ok) throw new Error(forges.error); | |
| 405 | const claim = { link: "https://plain.example.com/first-admin#code", expiresAt: "2026-12-09T00:00:00Z" }; | |
| 406 | bodies.set("claim issued", issuedPage("Claim link", { ...forges.value[0]!, claim }).toString()); | |
| 407 | for (const [path, body] of bodies) expect(body, path).not.toMatch(/href="\/pinned(["#?])/); | |
| 408 | }); | |
| 409 | ||
| 378 | 410 | test("places: the cheapest few in each city, and a filter narrows the catalog on the server", async () => { |
| 379 | 411 | const c = composeChoices(app); |
| 380 | 412 | const first = placesShown(c, "", ""); |
test/pinned-claim.test.ts +3 −3
| @@ -56,7 +56,7 @@ import { serve, type Servers } from "../src/http/server.ts"; | ||
| 56 | 56 | import { sha256 } from "../src/kernel/hash.ts"; |
| 57 | 57 | import type { Ctx, Screen } from "../src/tui/app/app.ts"; |
| 58 | 58 | import { pinnedScreen } from "../src/tui/screens/pinned.ts"; |
| 59 | import { pinnedListPage } from "../src/web/pages/pinned.ts"; | |
| 59 | import { pinnedRegion } from "../src/web/pages/pinned.ts"; | |
| 60 | 60 | import { deployPage } from "../src/web/pinned.ts"; |
| 61 | 61 | import { Session } from "../src/tui/session.ts"; |
| 62 | 62 | import { recordCloud, sequence } from "./helpers/recorded-cloud.ts"; |
| @@ -331,7 +331,7 @@ describe("a deployed forge is claimed with the link its deployer was shown, and | ||
| 331 | 331 | const tok = createToken(seller.db, admin().id, "admin", "admin").token; |
| 332 | 332 | const get = async (path: string) => |
| 333 | 333 | (await fetch(sellerServers.url + path, { headers: { authorization: `Bearer ${tok}` } })).text(); |
| 334 | const list = await get("/pinned"); | |
| 334 | const list = await get("/infra"); | |
| 335 | 335 | expect(list.split("snapshot its disk").length - 1).toBe(1); |
| 336 | 336 | expect(list).not.toContain("no access"); |
| 337 | 337 | expect(list).toContain('value="/pinned/acme/check"'); |
| @@ -699,7 +699,7 @@ describe("claimed is what the deployed forge says, never what the seller says (# | ||
| 699 | 699 | // The pages, drawn from the rows every door reads (#16220's assertions, kept). |
| 700 | 700 | const page = (): string => { |
| 701 | 701 | const rows = pinnedForges(app, alice); |
| 702 | return rows.ok ? String(pinnedListPage(rows.value, { names: new Map(), checks: new Map(), domain: "" })) : ""; | |
| 702 | return rows.ok ? String(pinnedRegion(rows.value, { names: new Map(), checks: new Map(), domain: "" })) : ""; | |
| 703 | 703 | }; |
| 704 | 704 | const offered = (name: string): string[] => |
| 705 | 705 | ["update", "rollback", "claim", "check"].filter((act) => page().includes(`value="/pinned/${name}/${act}"`)); |
test/pinned-domain-doors.test.ts +1 −1
| @@ -172,7 +172,7 @@ describe("the domain for deployed forges", () => { | ||
| 172 | 172 | expect((await post("forges.test")).status).toBe(303); |
| 173 | 173 | expect(getBaseDomain(app.db)).toBe("forges.test"); |
| 174 | 174 | const page = await ( |
| 175 | await fetch(`${servers.url}/pinned`, { headers: headers(adminTok) }) | |
| 175 | await fetch(`${servers.url}/infra`, { headers: headers(adminTok) }) | |
| 176 | 176 | ).text(); |
| 177 | 177 | expect(page).toContain('name="domain"'); |
| 178 | 178 | expect(page).toContain('value="forges.test"'); |
test/pinned-lifetimes.test.ts +3 −3
| @@ -22,7 +22,7 @@ import { ok } from "../src/kernel/result.ts"; | ||
| 22 | 22 | import { createForgeApp } from "../src/tui/forge.ts"; |
| 23 | 23 | import { pinnedScreen } from "../src/tui/screens/pinned.ts"; |
| 24 | 24 | import { headlessTerminal } from "../src/tui/term/terminal.ts"; |
| 25 | import { pinnedListPage } from "../src/web/pages/pinned.ts"; | |
| 25 | import { pinnedRegion } from "../src/web/pages/pinned.ts"; | |
| 26 | 26 | import { quietLogs } from "./helpers/globals.ts"; |
| 27 | 27 | import { seedPlaces } from "./helpers/places-fixture.ts"; |
| 28 | 28 | import { settleApp } from "./helpers/tui.ts"; |
| @@ -176,7 +176,7 @@ describe("pinned forge lifetimes", () => { | ||
| 176 | 176 | |
| 177 | 177 | const page = await post("/pinned/route1/keep", adminTok); |
| 178 | 178 | expect(page.status, "the page's form").toBe(303); |
| 179 | expect(page.headers.get("location") ?? "").toStartWith("/pinned"); | |
| 179 | expect(page.headers.get("location") ?? "").toStartWith("/infra"); | |
| 180 | 180 | expect(end()).toBe(t0 + LIFETIME_DAYS * DAY); |
| 181 | 181 | expect([403, 404], "a non-admin at the page").toContain((await post("/pinned/route1/keep", bobTok)).status); |
| 182 | 182 | expect(end(), "a refused keep changes nothing").toBe(t0 + LIFETIME_DAYS * DAY); |
| @@ -227,7 +227,7 @@ describe("pinned forge lifetimes", () => { | ||
| 227 | 227 | test("the doors: the page's Ends fact with Keep and End now, the MCP keep, the terminal's e", async () => { |
| 228 | 228 | const forges = pinnedForges(app, admin); |
| 229 | 229 | if (!forges.ok) throw new Error("not admin"); |
| 230 | const page = String(pinnedListPage(forges.value, { names: new Map(), checks: new Map(), domain: "" })); | |
| 230 | const page = String(pinnedRegion(forges.value, { names: new Map(), checks: new Map(), domain: "" })); | |
| 231 | 231 | const ends = getPinned(app.db, "exp1")!; |
| 232 | 232 | expect(page).toContain(`<dt>Ends</dt><dd>${endsWords(lifetimeOf(app.db, ends.id)!.endsAt)}</dd>`); |
| 233 | 233 | expect(page).toContain('action="/pinned/exp1/keep"'); |
test/pinned-page.test.ts +3 −3
| @@ -132,7 +132,7 @@ describe("pinned list page", () => { | ||
| 132 | 132 | } |
| 133 | 133 | const adminTok = createToken(app.db, getUserByName(app.db, "alice")!.id, "admin", "admin").token; |
| 134 | 134 | const bobTok = createToken(app.db, getUserByName(app.db, "bob")!.id, "admin", "admin").token; |
| 135 | const get = (tok?: string) => fetch(servers.url + "/pinned", { redirect: "manual", headers: tok ? { authorization: `Bearer ${tok}` } : {} }); | |
| 135 | const get = (tok?: string) => fetch(servers.url + "/infra", { redirect: "manual", headers: tok ? { authorization: `Bearer ${tok}` } : {} }); | |
| 136 | 136 | expect((await get()).status).toBe(303); |
| 137 | 137 | expect((await get(bobTok)).status).toBe(403); |
| 138 | 138 | const empty = await (await get(adminTok)).text(); |
| @@ -218,7 +218,7 @@ describe("pinned list page actions", () => { | ||
| 218 | 218 | const dep = await act("/deploy-to", adminTok, { name: "acme", host: "acme.forge.test", account: "main", app: "alice/shop", source: SOURCE, version: V }); |
| 219 | 219 | expect(dep.status).toBe(200); |
| 220 | 220 | |
| 221 | const list = await (await get("/pinned", adminTok)).text(); | |
| 221 | const list = await (await get("/infra", adminTok)).text(); | |
| 222 | 222 | for (const w of ["/pinned/acme/update", "/pinned/acme/rollback", "/pinned/acme/check"]) expect(list).toContain(w); |
| 223 | 223 | |
| 224 | 224 | // The confirm page words each and carries the version to the POST. |
| @@ -264,7 +264,7 @@ describe("pinned list page actions", () => { | ||
| 264 | 264 | const chk = await act("/pinned/acme/check", adminTok); |
| 265 | 265 | expect(chk.status).toBe(303); |
| 266 | 266 | expect(calls.length).toBeGreaterThan(before); |
| 267 | const checked = await (await get("/pinned", adminTok)).text(); | |
| 267 | const checked = await (await get("/infra", adminTok)).text(); | |
| 268 | 268 | expect(checked).not.toContain("never checked"); |
| 269 | 269 | expect((await act("/pinned/nope/check", adminTok)).status).toBe(303); |
| 270 | 270 | } finally { |
test/pinned-retire-doors.test.ts +2 −2
| @@ -197,7 +197,7 @@ describe("retire at its doors", () => { | ||
| 197 | 197 | }); |
| 198 | 198 | expect(deletes).toEqual(["/v2/droplets/7", "/v2/volumes/vol-1"]); |
| 199 | 199 | const page = await ( |
| 200 | await fetch(`${servers.url}/pinned`, { headers: headers(adminTok) }) | |
| 200 | await fetch(`${servers.url}/infra`, { headers: headers(adminTok) }) | |
| 201 | 201 | ).text(); |
| 202 | 202 | expect(page).toContain("retired"); |
| 203 | 203 | expect(page).toContain("deleted"); |
| @@ -207,7 +207,7 @@ describe("retire at its doors", () => { | ||
| 207 | 207 | await make("theirs"); |
| 208 | 208 | expect(markClaimed(app.db, "theirs")).toBe(true); |
| 209 | 209 | const page = await ( |
| 210 | await fetch(`${servers.url}/pinned`, { headers: headers(adminTok) }) | |
| 210 | await fetch(`${servers.url}/infra`, { headers: headers(adminTok) }) | |
| 211 | 211 | ).text(); |
| 212 | 212 | expect(page).toContain('name="despite_claim"'); |
| 213 | 213 | expect(page).toContain("Retire this buyer"); |
test/pinned-watch.test.ts +2 −2
| @@ -19,7 +19,7 @@ import { createUser, getUserByName } from "../src/core/users.ts"; | ||
| 19 | 19 | import { quietLogs } from "./helpers/globals.ts"; |
| 20 | 20 | import { seedPlaces } from "./helpers/places-fixture.ts"; |
| 21 | 21 | import { pinnedScreen } from "../src/tui/screens/pinned.ts"; |
| 22 | import { pinnedListPage } from "../src/web/pages/pinned.ts"; | |
| 22 | import { pinnedRegion } from "../src/web/pages/pinned.ts"; | |
| 23 | 23 | import { quietCtx, screenText, sessionFor } from "./helpers/tui-text.ts"; |
| 24 | 24 | |
| 25 | 25 | quietLogs(); |
| @@ -155,7 +155,7 @@ describe("the forge writes the record without a Check", () => { | ||
| 155 | 155 | if (!r.ok) throw new Error(r.error); |
| 156 | 156 | return r.value; |
| 157 | 157 | }; |
| 158 | const page = () => String(pinnedListPage(view(), { names: new Map(), checks: new Map(), domain: "forges.test" })); | |
| 158 | const page = () => String(pinnedRegion(view(), { names: new Map(), checks: new Map(), domain: "forges.test" })); | |
| 159 | 159 | const stuck = view().find((v) => v.name === "gamma")!.stuck; |
| 160 | 160 | expect(stuck).toContain("does not answer over HTTPS"); |
| 161 | 161 | expect(stuck.split(". ").length).toBe(1); |
new above
offline
Box 3: 'the File in project button on
/pinned' should say the Pinned forges block of/infra.