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

test/studio-door.test.ts runs under 10 s #3573

Merged opened this

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

Merged

`test/studio-door.test.ts` now builds one forge for the whole file, deploys nothing for real, and never sleeps. In this sandbox it finished in about 2.1 s, ten runs in a row green. No test takes more than 0.14 s, and the type check is clean. The 10 s target is for the vxrail, and this sandbox can't measure that: apps run without cells here, so the old file took 3.6 s here against 34.2 s recorded.…

shipped production is serving it deploy 8ae6610

opened this

test/studio-door.test.ts now builds one forge for the whole file, deploys nothing for real, and never sleeps. In this sandbox it finished in about 2.1 s, ten runs in a row green. No test takes more than 0.14 s, and the type check is clean. The 10 s target is for the vxrail, and this sandbox can't measure that: apps run without cells here, so the old file took 3.6 s here against 34.2 s recorded. The forge's check gives the real number.

What was slow. The "every open pull's preview" block built a new forge and started an AppsRuntime for each test. Opening a pull then set off real deploys, and one test waited up to 60 s for a preview to come up in a cell. Stopping the runtime then waited for the preview and production deploys.

What changed (only the test file and scripts/test-times.json; no production code):

  • One forge for the file. A top-level beforeAll builds the forge, one runtime that is set up but never started, and alice, bob and carol. Each block now creates only its own repositories on that forge: notes, beacon, vault, widget and signals all belong to alice. The five copies of signIn, the user setup, and the slot type with its put helpers are now shared: person, signIn, putEnv and clearEnvs.
  • The preview block no longer deploys. "A change's page names its preview's data as its own copy" now sets production and the preview as serving directly, as the rest of the file already did. The assertion that a real preview reached running is gone. test/apps.test.ts › "a pull gets a preview with a copy of production's data" already covers a real preview serving with a copy of the data. With the preview's slot taken out, this test fails, so it still proves the note on both pages.
  • The live-fragment block used to build a new forge before each test. It now creates its vault repository once and clears that app's environments before each test. Each test opens its own branch and pull.
  • No sleeps. The app.serving test used Bun.sleep(50) while the stream subscribed. It now reads until the stream sends : connected, which it writes as it subscribes. No test in the file waits on a clock.
  • Fixture details:

- Dan's app slug is now dan-beacon, because slugs are shared across the forge and alice's terminal app holds beacon. - The terminal block sets sshPort/sshHostKey on the shared forge and puts them back afterwards. - Teardown empties the stand-in slots before runtime.stop(), because they have no process to stop.

All 30 tests remain and no assertion was weakened; one expect() was removed (235 → 234), the running check named above. scripts/test-times.json now records 2.1 s, the time measured here; the forge's own timing cache will replace it with the vxrail figure.

To try it: bun test test/studio-door.test.ts

🤖 Generated with Claude Code

Closes #3566

commented

test/studio-door.test.ts now builds one forge for the whole file, deploys nothing for real, and never sleeps. In this sandbox it finished in about 2.1 s, ten runs in a row green. No test takes more than 0.14 s, and the type check is clean. The 10 s target is for the vxrail, and this sandbox can't measure that: apps run without cells here, so the old file took 3.6 s here against 34.2 s recorded. The forge's check gives the real number.

What was slow. The "every open pull's preview" block built a new forge and started an AppsRuntime for each test. Opening a pull then set off real deploys, and one test waited up to 60 s for a preview to come up in a cell. Stopping the runtime then waited for the preview and production deploys.

What changed (only the test file and scripts/test-times.json; no production code):

  • One forge for the file. A top-level beforeAll builds the forge, one runtime that is set up but never started, and alice, bob and carol. Each block now creates only its own repositories on that forge: notes, beacon, vault, widget and signals all belong to alice. The five copies of signIn, the user setup, and the slot type with its put helpers are now shared: person, signIn, putEnv and clearEnvs.
  • The preview block no longer deploys. "A change's page names its preview's data as its own copy" now sets production and the preview as serving directly, as the rest of the file already did. The assertion that a real preview reached running is gone. test/apps.test.ts › "a pull gets a preview with a copy of production's data" already covers a real preview serving with a copy of the data. With the preview's slot taken out, this test fails, so it still proves the note on both pages.
  • The live-fragment block used to build a new forge before each test. It now creates its vault repository once and clears that app's environments before each test. Each test opens its own branch and pull.
  • No sleeps. The app.serving test used Bun.sleep(50) while the stream subscribed. It now reads until the stream sends : connected, which it writes as it subscribes. No test in the file waits on a clock.
  • Fixture details:

- Dan's app slug is now dan-beacon, because slugs are shared across the forge and alice's terminal app holds beacon. - The terminal block sets sshPort/sshHostKey on the shared forge and puts them back afterwards. - Teardown empties the stand-in slots before runtime.stop(), because they have no process to stop.

All 30 tests remain and no assertion was weakened; one expect() was removed (235 → 234), the running check named above. scripts/test-times.json now records 2.1 s, the time measured here; the forge's own timing cache will replace it with the vxrail figure.

To try it: bun test test/studio-door.test.ts

🤖 Generated with Claude Code

Approved

Test-only change; I read the diff and ran test/studio-door.test.ts here: 30 pass, 0 fail. The type check did not run (bun could not write its tempdir in this sandbox). There is no production code, no security surface and no new dependency. The one forge for the file, the stand-in slots, and the : connected wait in place of a sleep are all sound. The one dropped assertion, that a real preview reaches running, is covered by test/apps.test.ts.

Two things I would do next:

  1. Replace the 2.1 s figure in scripts/test-times.json with the number the forge check reports. That figure was measured without cells, so it understates the real one.
  2. Move the casts onto runtime.envs into a small helper in test/helpers, since other suites duplicate the same Slot type and put helper.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs