Public: anyone can read this; the crew can change it.

Hetzner Cloud is a cloud account provider and a pinned-forge target #16201

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

Hetzner Cloud is now a cloud-account provider and a pinned-forge target, with an EU location. I tested only against a recorded fetch. I could not reach api.hetzner.cloud from here, so the real deploy with the owner's token has not happened.

Notes

shipped production is serving it deploy 496afdb

opened this

Hetzner Cloud is now a cloud-account provider and a pinned-forge target, with an EU location. I tested only against a recorded fetch. I could not reach api.hetzner.cloud from here, so the real deploy with the owner's token has not happened. Tests for the changed areas pass and tsc is clean. The full suite will run on the forge's check.

What changed

  • Provider. hetzner is in PROVIDERS, VENDOR_OF, LABEL and shape, and in the "bring it home" text. Verify and audit are reads of api.hetzner.cloud/v1: servers and volumes, and unattached volumes and powered-off servers for the audit. shape is the text on the cloud accounts page's provider options, and it now says a token is scoped to one project and is read or read-write, nothing narrower. api.hetzner.cloud is added to forge.json egress.
  • Shared sequence (point 4). The boot config, provision, replace and read now live once in src/cloud/machine.ts behind a small Driver interface. droplet.ts shrank to DigitalOcean's calls and hetzner.ts holds Hetzner's. drivers.ts maps a target to its driver. A third provider needs one calls file, one line there, one entry in TARGETS and one in PROVIDERS.
  • Location and type (the correction). LOCATION is nbg1, one constant a setting can later replace. Before anything is made, the driver reads /server_types and /datacenters. It picks the cheapest x86 CX type with at least 2 GiB that is in stock there.
  • When none can be ordered. Deploy or Update fails with a plain message ("Hetzner has no CX server … can be ordered in nbg1 right now; nothing was made") before the volume is created or the old server deleted.
  • Volume and server. The volume is created with the location, format ext4 and size 10, then the server with volumes:[id] and automount:true. FORGE_APP_DATA is /mnt/HC_Volume_<id>.
  • Target and page. hetzner is a first target. The deploy page lists write-enabled accounts of any deployable provider, and its account field is now provider/name. The route splits it, and a bare name still means DigitalOcean. The MCP pinned_forge tool accepts target: "hetzner" through the existing enum.

Tests

  • test/pinned-hetzner.test.ts covers:
    • provision and type choice;
    • failure after the volume exists, then a retry that reuses the volume;
    • replace keeping the volume;
    • an Update with nothing in stock keeping the running server;
    • address read-back;
    • verify refusing a bad token.
  • I changed two assertions in pinned-forge.test.ts that counted targets, now six.

Left out

  • Stock check on the page. The pinned page does not show stock before you press Deploy; it reports the refusal when you try.
  • Unconfirmed API shapes. I did not confirm against the live API that /datacenters still carries server_types.available, nor the price shape in /server_types. Both are what I recall of the reference. If either has moved, pickType in src/cloud/hetzner.ts is the one function to adjust, and it errors with "none can be ordered" rather than ordering blindly.
  • Out of scope per the issue. No Stripe wiring, DNS or TLS, or backups.
  • Region setting. Hetzner's location is not yet a setting.

Try it

  • Add a Hetzner project token on /settings/cloud and allow writes.
  • Open /deploy-to as an admin and pick "Hetzner Cloud / main".
  • Deploy, then check: the address should answer and /first-admin should claim it.
  • Press Update and confirm the data is still there.
[
  {"go": "/settings/cloud", "look": "the provider options", "expect": "Hetzner Cloud appears and says its token is scoped to one project, read or read-write"},
  {"go": "/deploy-to", "look": "the Cloud account select", "expect": "write-enabled DigitalOcean and Hetzner Cloud accounts are listed as Provider / name; the intro mentions both"}
]

🤖 Generated with Claude Code

Closes #16200

Show 2 earlier items

7 earlier comments · 1 event
commented

The check failed on the "both doors" rule: the pull adds src/cloud/drivers.ts, hetzner.ts and machine.ts but no terminal screen or how-to doc. I didn't add either. Instead I pushed an empty commit with a "No door:" line and a "Looks: /deploy-to" line. I haven't re-run the check, so I don't know yet whether it accepts that.

The "No door:" line says the new files are internals of pinned deploys and the doors already exist. The /deploy-to page lists Hetzner accounts. The pinned terminal screen's deploy prompt already takes provider/account, so hetzner/main works there with no code change. The pinned_forge tool takes target: "hetzner".

If the gate wants an actual terminal screen or a docs/features/ page for Hetzner instead, that is a separate change, and I haven't made it.

The other gate notes were not failures: the comment-length warning is rewrapped by the nightly job, and the look-page note is covered by the "Looks:" line.

The api.hetzner.cloud egress notice stands. Preview and check can't reach it until this lands, which is fine because the tests use a recorded fetch.

commented

I pushed a commit that names the page the gate couldn't infer, so I expect the look-pages note to clear, but I haven't seen the gate re-run.

The gate's note was written against 6a5847f, which had no "Looks:" line. I had already added Looks: /deploy-to in f9af325. The new commit 77b8057 puts that line first in its message and says why: /deploy-to is the page src/web/pinned.ts renders, and its account select now lists Hetzner Cloud accounts beside DigitalOcean.

The gate couldn't trace /settings/security/controls, which isn't a page this pull touches. That is a gap in the gate's route tracing, not something to fix here.

No code changed, so the earlier test run still applies.

commented

<!-- look-pages 77b805755093 --> Look pages for 77b8057, from the gate:

  • look pages (none): "Looks: /deploy-to" is not a page of app.looks in forge.json; this pull changes src/web/pinned.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

This pull makes Hetzner Cloud a cloud account provider and a pinned-forge target. The provision, replace and read sequence lives once in cloud/machine.ts. This push fixes the dead-code check, the one failure in the last run that this pull caused.

  • Fixed: readDroplet and readServer were exported but only a test called them, so the dead-code check failed. I removed both wrappers and left their drivers in place. test/pinned-forge-address.test.ts now reads through read(digitalocean, …) directly. unused-exports.test.ts and pinned-forge-address.test.ts pass, and bun x tsc --noEmit is clean.
  • tui-offers.test.ts and spawn-app-links.test.ts: I couldn't reproduce either failure in this clone. Both pass when I run them alone, and neither goes near the cloud code. I take the tui-offers not_member error and the spawn-app-links failures to be shard interference or flakiness. I changed nothing for them.
  • Not caused by this pull: web-apps.test.ts is red on main at 6fbf6e6 as well, with the same tests. I didn't investigate the blob-page failure; it came from shard 21, which the check did not compare against main.

To try it, open /deploy-to as an admin with a write-enabled Hetzner Cloud account and pick it in the account list.

commented

<!-- look-pages 63cf10edd377 --> Look pages for 63cf10e, from the gate:

  • look pages (none): "Looks: /deploy-to" is not a page of app.looks in forge.json; this pull changes src/web/pinned.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I pushed an empty commit with a "No look:" line, which is the second option the gate offered. I didn't change any code, and I didn't re-run anything.

/deploy-to isn't listed in app.looks in forge.json. The gate also couldn't trace the route behind /settings/security/controls, so it had no page to infer from. The commit message says the change adds one provider to the account list on an existing page, so there is no new page to look at.

I didn't add /deploy-to to app.looks. It's an admin page that needs a write-enabled Hetzner account, so it would need seeded data to render. If you want a visual look anyway, tell me and I'll add it, or name a nearer page for a "Looks:" line.

The earlier feedback is unchanged. The dead-code fix is on the branch, and tui-offers.test.ts and spawn-app-links.test.ts passed when I ran them alone.

Changes requested — before the latest push

Hetzner works through a clean shared Driver in machine.ts, and the security floor holds: fixed host, bearer header, egress declared, no secret in the repo. I am requesting changes on these points.

  1. Both doors. The pull adds a provider and a target, but there is no docs/features/ how-to for deploying to Hetzner. It also has no terminal test showing the pinned screen takes hetzner/main. The 'No door' commit message claims it does, and nothing in the diff proves it. Add the how-to (token scope, read-write requirement, Nuremberg, type choice, what happens when none is in stock). Add a TUI test that deploys with hetzner/<account>.
  2. Untested behaviour. The provider/name split in deployToSubmit (including the bare-name-means-DigitalOcean fallback) has no test. The deploy page's DEPLOYABLE filter and provider/name option value have no test. The Hetzner audit branch has no test. Each would pass unchanged if reverted, so each needs one that fails without it.
  3. Audit price. The audit prices a powered-off server with prices[0], which is whichever location Hetzner lists first, not the server's own location. Pick the entry matching x.datacenter?.location?.name.
  4. Design principles 1 and 8. The deploy page intro hard-codes 'DigitalOcean or Hetzner Cloud' in two places. Derive it from TARGETS/LABEL or say 'your own cloud account', so the next provider does not mean editing prose. Also, cost in TARGETS hard-codes a CX23 price 'as last read'. State the rule instead (cheapest in-stock CX with 2 GiB) and leave out a number that goes stale.
  5. Cleanliness. A const readDroplet sits in the middle of the import block in test/pinned-forge-address.test.ts. Move it below the imports or call read(digitalocean, ...) directly. DRIVERS is typed Driver<any> and read with !; type it so a missing target is a plain error.
  6. Unverified API shape. pickType relies on /datacenters server_types.available and the /server_types price shape. The pull says these were recalled, not checked, and the test fixture only mirrors that recall. Check them against the reference and say so in the pull.
  7. Direction. The owner's direction is pipeline first, and this is a feature pull. If the issue is deliberately exempt, say so in the description.
commented

I've addressed items 1–5 in code, tests and a new how-to, and pushed. The Hetzner API shapes in item 6 are still unchecked, and item 7 is for you to decide. Here are the new Hetzner tests, unused-exports, pinned-page, pinned-forge-address, pinned-hetzner and pinned-forge. tsc and the gate also pass, and the forge's full check is still to run. scripts/fast.ts exited 2 because forge.json changed, so I picked those test files myself.

  • Both doors: docs/features/deploy-to-hetzner.md is the new how-to. It covers the Read & Write token and the writes-allowed step, Nuremberg, how the type is chosen, what happens when nothing is in stock, and the audit. The pinned-forge targets table now has a Hetzner row. A new terminal test drives the Pinned forges screen with tty hetzner/main … and checks that the forge lands with target hetzner.
  • New tests (test/pinned-hetzner-doors.test.ts):
    • The deploy page offers hetzner/main and digitalocean/main, and does not offer a Vercel account.
    • A posted hetzner/main deploys to Hetzner.
    • A bare name still deploys to DigitalOcean.
    • A value with more than one slash returns 422 and deploys nothing.
    • The audit test fails if the price falls back to the first listed location.
    • I didn't run any of these against the reverted code to confirm they fail.
  • Audit price: a powered-off Hetzner server is now priced at its own location, datacenter.location.name, instead of the first listed.
  • provider/name split: src/http/pinned_routes.ts now rejects more than one slash.
  • Principles 1 and 8: the intro now says "your own cloud account", and the empty-state sentence takes its names from TARGETS. The cost line for Hetzner states the rule (cheapest in-stock CX with at least 2 GiB) and no longer carries a price.
  • Cleanliness: I moved the readDroplet helper below the imports. DRIVERS is private, and driverOf(id) throws a plain error when no driver exists, so the ! is gone.
  • Unverified API shape (item 6): I could not check /datacenters server_types.available or the /server_types price shape. The sandbox only reaches the forge, so the fixtures still mirror my recall. The how-to says so. A different shape stops with "nothing can be ordered" and orders nothing, but a first real deploy is the actual check.
  • Direction (item 7): I can't tell from the repository whether #16200 is exempt from "pipeline first". I'm leaving that call to you.
commented

I removed the as never casts from test/pinned-hetzner-doors.test.ts and pushed (24a5ec25b).

  • Terminal test: it now builds its context from the shared quietCtx() helper with push overridden. Its screens and key events are typed as Screen, so no cast is needed.
  • Audit test: the stubbed fetch is typed as Fetch.
  • Checks run: bun x tsc --noEmit is clean and the 7 tests in that file pass.
  • Gate: after committing, bun scripts/gate.ts printed only its notes; gate=1 is the exit status of the grep filter I piped it through, not the gate's. I read the output as clean but didn't confirm the gate's own exit status.
  • Why it only failed at the check: the cast rule reads the committed diff, not the working tree, so it couldn't see my fix until I committed.
Approved

Earlier asks, met in 1e4f576b4 and 24a5ec25b: (1) the terminal door is covered, with a test driving the Pinned forges screen with hetzner/main; (2) the how-to is docs/features/deploy-to-hetzner.md, and README is untouched; (3) the audit prices a powered-off server at its own location, with a test; (4) the provider/name split rejects more than one slash and the account field cap is 60; (5) the intro no longer names providers or prices, and the empty-state names come from TARGETS; (6) DRIVERS is private and driverOf throws a plain error; (7) the as-never casts are gone from the tests. New lines hold no injection, authorization or secret finding: the token stays in the Authorization header, the host is fixed, api.hetzner.cloud is in egress, and no type is ordered when none is in stock. Non-blocking: the /server_types price shape and /datacenters server_types.available are unverified against the live API, and the how-to says so. A first real deploy is the check. Non-blocking: this is a feature ahead of the pipeline-first list; it is small and self-contained, so I am not blocking on it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs