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

An app whose run names a build output is built once per commit before it starts #17899

opened this

Merged 25h 36m ago, live in production

An app whose run names a file under dist/, build/ or out/ that the checkout lacks now gets built before its first start, if its package.json has a build script. The new tests and tsc --noEmit pass; I did not run the full suite, and scripts/fast.ts was not used. What changed The build step.

Notes

opened this

An app whose run names a file under dist/, build/ or out/ that the checkout lacks now gets built before its first start, if its package.json has a build script. The new tests and tsc --noEmit pass; I did not run the full suite, and scripts/fast.ts was not used.

What changed

  • The build step. src/apps/process.ts runs bun install, then bun run build, as a step in the app's cell, under its limits, egress and build time cap. It never runs on the serving process. bun install is skipped when the manifest's install step already ran in the same start. The decision logic is a new module, src/apps/entry_build.ts.
  • Once per commit. A restart of the same commit finds the output and does not rebuild.
  • Failure. The start error is the #17830/#17834 text plus the build's reason and last lines. It reaches the page and terminal the same way that error does. The failure is written next to the checkout (<checkout>.build-failed), so the same commit is not built again, even after the failed checkout is dropped. A new commit has a new checkout and so gets a fresh try.
  • Reuse. I reused missingEntryHint's wording by extracting buildOutputMissing in run_command.ts. I reused runStep, stepCell and stepLimits for the build, and install for the install. I did not run scripts/similar.ts.
  • Tests in test/apps-compound-run.test.ts:
    • a fixture whose build makes dist/server.js starts and answers, and a second start does not re-run the build;
    • a failing build reports its output (boom-line) and runs only once across two starts;
    • an app with no build script gets the unchanged #17834 message.

Left out

  • Compound run commands such as cd sub && bun dist/x.js are not detected, because the path would be relative to another directory.
  • A repository still in review (scriptsOff) never has its build run, so it keeps the #17834 message.
  • No new page or terminal view, since the existing start-error display already carries the message.
  • No docs/features how-to, no README note, and no review block. I made no web change.

Gate and checks

  • bun scripts/gate.ts --fix rewrapped a comment, which I committed. It also flagged a comment line over 100 columns in process.ts, which it says the nightly rewrap handles.
  • test/unused-exports.test.ts passes and only flags unrelated exports under src/http, src/kernel and src/spawn, not mine.
  • Commit messages carry Direction: … (#17891) and No door: lines.

Try it Deploy an app whose forge.json has "run": "bun dist/server.js" and whose package.json has a build script. It now starts instead of stopping at Cannot find module.

Closes #17891

commented

An app whose run names a file under dist/, build/ or out/ that the checkout lacks now gets built before its first start, if its package.json has a build script. The new tests and tsc --noEmit pass; I did not run the full suite, and scripts/fast.ts was not used.

What changed

  • The build step. src/apps/process.ts runs bun install, then bun run build, as a step in the app's cell, under its limits, egress and build time cap. It never runs on the serving process. bun install is skipped when the manifest's install step already ran in the same start. The decision logic is a new module, src/apps/entry_build.ts.
  • Once per commit. A restart of the same commit finds the output and does not rebuild.
  • Failure. The start error is the #17830/#17834 text plus the build's reason and last lines. It reaches the page and terminal the same way that error does. The failure is written next to the checkout (<checkout>.build-failed), so the same commit is not built again, even after the failed checkout is dropped. A new commit has a new checkout and so gets a fresh try.
  • Reuse. I reused missingEntryHint's wording by extracting buildOutputMissing in run_command.ts. I reused runStep, stepCell and stepLimits for the build, and install for the install. I did not run scripts/similar.ts.
  • Tests in test/apps-compound-run.test.ts:
    • a fixture whose build makes dist/server.js starts and answers, and a second start does not re-run the build;
    • a failing build reports its output (boom-line) and runs only once across two starts;
    • an app with no build script gets the unchanged #17834 message.

Left out

  • Compound run commands such as cd sub && bun dist/x.js are not detected, because the path would be relative to another directory.
  • A repository still in review (scriptsOff) never has its build run, so it keeps the #17834 message.
  • No new page or terminal view, since the existing start-error display already carries the message.
  • No docs/features how-to, no README note, and no review block. I made no web change.

Gate and checks

  • bun scripts/gate.ts --fix rewrapped a comment, which I committed. It also flagged a comment line over 100 columns in process.ts, which it says the nightly rewrap handles.
  • test/unused-exports.test.ts passes and only flags unrelated exports under src/http, src/kernel and src/spawn, not mine.
  • Commit messages carry Direction: … (#17891) and No door: lines.

Try it Deploy an app whose forge.json has "run": "bun dist/server.js" and whose package.json has a build script. It now starts instead of stopping at Cannot find module.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs