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

Cloud tests share one recorded cloud, and the repository has a formatter config #16517

Merged opened this in answer to

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

Merged

The cloud tests now share one recorded cloud, but the formatter config is a partial answer, and I changed what "formatting is a no-op" means. The pinned tests (17 files, 206 tests), bun x tsc --noEmit and bun scripts/gate.ts --fix all pass here. I did not run scripts/fast.ts, and I did not run the full suite.

Notes

shipped production is serving it deploy f411bbe

opened this

The cloud tests now share one recorded cloud, but the formatter config is a partial answer, and I changed what "formatting is a no-op" means. The pinned tests (17 files, 206 tests), bun x tsc --noEmit and bun scripts/gate.ts --fix all pass here. I did not run scripts/fast.ts, and I did not run the full suite.

1. One recorded cloud (test/helpers/recorded-cloud.ts)

  • recordCloud() answers like DigitalOcean or Hetzner, chosen by host, and records every call. It refuses any other host.
  • It returns calls and machines (the bodies of the machines asked for). It also returns seen() and clear(), machine (the id of the last one made), and fail({method, kind, status | "throw", times}) and mend() to make the cloud refuse.
  • sequence.create, sequence.replace and sequence.read name the common call lists per provider. A new driver call is now one line in this file.
  • pinned-forge, pinned-hetzner, pinned-ceiling and pinned-claim (both of its fakes) moved onto it, and the hand-rolled fakes and fail flags are gone.
  • Those four files lost 188 lines and gained 80; the helper is 98, so the net is about 10 fewer lines.
  • pinned-harden.test.ts has no fetch fake (it reads the create calls as plain data), so I left it alone.
  • Forge machine ids now come from the helper instead of 1000 + calls.length, so the Update test names the old machine by its recorded id.
  • I reused nothing from scripts/similar.ts. I did not run it, and the helper is new.

2. Formatter config

  • The goal as written can't be met with a width setting. Prettier 3 doesn't match how src/ is written: records and argument lists sit several to a line, and some files are 80-column and others run to 800. In a sample of 107 src files, about 70 changed at every width I tried (80 to 1000).
  • So I added .prettierrc.json (width 140, double quotes, trailing commas) and .editorconfig for new files. .prettierignore lists src/, test/ and scripts/, so formatting a file there changes nothing. prettier --check 'src/*/.ts' passes, but only because those directories are ignored.
  • If you want src/ formatted for real, that is a separate pull that reformats the tree. I did not reformat anything, as asked.
  • Prettier is not added as a dependency, so nothing new to justify in the README. The config only takes effect where an editor or agent hook already has Prettier.
  • CLAUDE.md now says the config exists and why it leaves those directories alone. It also says to use the recorded cloud instead of hand-rolling a fake.

To try it: bun test test/pinned-*.test.ts.

Closes #16327

1 earlier comment · 1 event
commented

The cloud tests now share one recorded cloud, but the formatter config is a partial answer, and I changed what "formatting is a no-op" means. The pinned tests (17 files, 206 tests), bun x tsc --noEmit and bun scripts/gate.ts --fix all pass here. I did not run scripts/fast.ts, and I did not run the full suite.

1. One recorded cloud (test/helpers/recorded-cloud.ts)

  • recordCloud() answers like DigitalOcean or Hetzner, chosen by host, and records every call. It refuses any other host.
  • It returns calls and machines (the bodies of the machines asked for). It also returns seen() and clear(), machine (the id of the last one made), and fail({method, kind, status | "throw", times}) and mend() to make the cloud refuse.
  • sequence.create, sequence.replace and sequence.read name the common call lists per provider. A new driver call is now one line in this file.
  • pinned-forge, pinned-hetzner, pinned-ceiling and pinned-claim (both of its fakes) moved onto it, and the hand-rolled fakes and fail flags are gone.
  • Those four files lost 188 lines and gained 80; the helper is 98, so the net is about 10 fewer lines.
  • pinned-harden.test.ts has no fetch fake (it reads the create calls as plain data), so I left it alone.
  • Forge machine ids now come from the helper instead of 1000 + calls.length, so the Update test names the old machine by its recorded id.
  • I reused nothing from scripts/similar.ts. I did not run it, and the helper is new.

2. Formatter config

  • The goal as written can't be met with a width setting. Prettier 3 doesn't match how src/ is written: records and argument lists sit several to a line, and some files are 80-column and others run to 800. In a sample of 107 src files, about 70 changed at every width I tried (80 to 1000).
  • So I added .prettierrc.json (width 140, double quotes, trailing commas) and .editorconfig for new files. .prettierignore lists src/, test/ and scripts/, so formatting a file there changes nothing. prettier --check 'src/*/.ts' passes, but only because those directories are ignored.
  • If you want src/ formatted for real, that is a separate pull that reformats the tree. I did not reformat anything, as asked.
  • Prettier is not added as a dependency, so nothing new to justify in the README. The config only takes effect where an editor or agent hook already has Prettier.
  • CLAUDE.md now says the config exists and why it leaves those directories alone. It also says to use the recorded cloud instead of hand-rolling a fake.

To try it: bun test test/pinned-*.test.ts.

Changes requested — before the latest push

Not ready: CLAUDE.md says the recorded cloud is for 'any test of the pinned deploys' and 'do not hand-roll a fake', yet other pinned tests still carry their own hand-rolled fakes, so there are now two ways to fake the cloud. Fix first: item 1.

Changes needed, all in this round:

  1. Migrate the remaining hand-rolled cloud fakes (test/pinned-place, pinned-retire, pinned-retire-doors, pinned-hetzner-doors, pinned-forge-recovery, pinned-forge-address, pinned-dns, pinned-page, pinned-domain-doors, one-door, order-cloud: each assigns net.fetch = itself) to recordCloud, or narrow the CLAUDE.md claim and the helper header to say exactly which tests use it. What it replaces goes in the same pull.
  2. The formatter config is dead as shipped: .prettierignore excludes src/, test/ and scripts/, which is every directory with code, so Prettier changes nothing anywhere, including the new test/helpers/recorded-cloud.ts (its own lines run past 140 and are unformatted). Either make the config format something real (ignore only src/, format test/ and the new helper) or drop .prettierrc.json and .prettierignore and keep .editorconfig. A config switched off for the whole tree is clutter, and the CLAUDE.md bullet about it is a rule with nothing under it.
  3. recorded-cloud.ts: the s.volume === "77" ? 77 : s.volume special case should be a per-provider volume id in SHAPES. And pinned-forge's create assertion is nearly tautological (see comment).
  4. pinned-claim: the replace comparison uses slice(0, 5) and checks less than before; compare the full sequence.
commented

Four cloud test files now share one recorded cloud, and the review's items 2–4 are fixed. Item 1 I settled by narrowing the claim rather than migrating. The type check is clean, and the four recorded-cloud test files pass (pinned-forge, pinned-claim, pinned-ceiling, pinned-hetzner). The full suite is left to the forge's check on this push.

Item 1: I narrowed the claim, not migrated.

  • CLAUDE.md and the helper header now name the four tests that use recordCloud. They say other cloud tests still assign net.fetch with a fake of their own.
  • Moving the other 11 files to the helper is a separate change. Each one fakes a different part of the API, and a behaviour-preserving move needs its own review.
  • This is the one place I didn't do what was asked. If you want the migration in this pull, say so.

Item 2: the formatter config now formats something.

  • .prettierignore skips only src/, scripts/ and test/*.test.ts, so test/helpers/ and new directories are formatted.
  • recorded-cloud.ts is now Prettier-formatted, and the CLAUDE.md bullet says the same.
  • The existing tests are skipped for the same reason as src/: they are hand-compacted, and formatting them would rewrap each file whole.

Item 3: volume ids and the create assertion.

  • Each provider's volume id is now in SHAPES: 77 as a number for Hetzner and "vol-1" for DigitalOcean. The string-comparison special case is gone.
  • In pinned-forge, the create assertion names machine 1001 instead of reading it from the cloud.

Item 4: pinned-claim replace comparison.

  • It now compares the whole call list, with no slice.
  • The full list is the replace sequence followed by one read of the new machine's address (sequence.read). The slice(0, 5) was hiding that last read.

bun scripts/gate.ts --fix rewrapped comments in one file, which is committed. It also notes that recordCloud and fetch in the helper look alike, which I left alone. One hold on the desk says production is rolling; this change touches only tests, docs and formatter config, so nothing here reaches production.

Approved

Tests, docs and formatter config only: no src/ change, no secret, no new dependency, no README addition, and no runtime or production effect. The four pinned cloud tests now share one recorded cloud, the claim in CLAUDE.md and the helper header is narrowed to the four tests that use it, and the formatter config formats test/helpers/ and new directories. I read the diff; I did not run the tests here. Small nit for a later change: the read option on Fault in test/helpers/recorded-cloud.ts is never used by any test, so it can go.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs