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

App builds can name a pinned toolchain (Rust first), with a per-app build cache #10446

Parked opened this in answer to
Closed without merging

An app's forge.json can now name a pinned toolchain ("toolchain": {"rust": "1.85.0"}), and its install and test steps get that toolchain plus a per-app build cache. Only part of the limits item is done, and no real Rust build has run.

Notes

stopped parked by the crew deploy a73dda2

opened this

An app's forge.json can now name a pinned toolchain ("toolchain": {"rust": "1.85.0"}), and its install and test steps get that toolchain plus a per-app build cache. Only part of the limits item is done, and no real Rust build has run. The new tests passed, along with the gate, tsc, the design lint and a few related suites, but not the full suite. bun test listed the whole suite instead of naming a subset, and I did not run it.

What changed

  • Toolchain: the manifest takes toolchain as exact versions of known tools; only rust is known so far. The forge never downloads one. The operator installs it once under FORGE_TOOLCHAINS, or <data>/toolchains/rust/<version>/bin if that is unset. Builds only read it, and its bin goes first on PATH. A missing version is refused with one line: this forge does not provide rust 1.99.0: ask its operator to install it, or name a version it has.
  • Build cache: it sits at <data>/build-cache/<app>/<key>, keyed by Cargo.lock, bun.lock, package-lock.json and the pins. Steps get FORGE_BUILD_CACHE, CARGO_HOME and CARGO_TARGET_DIR inside it, so it survives deploys. The two newest keys are kept.
  • Clearing it: the app page has a "Build cache" card for the repo's admin, shown only when something is cached. It has a Clear button, backed by POST /:owner/:name/app/build-cache/clear.
  • Time limit: a toolchain build gets 15 minutes for install and for test. When it hits the limit, the deploy fails with "the build used its 15 minutes (the time limit for a build with a toolchain)".
  • Docs and tests: docs/TOOLCHAINS.md explains it. test/toolchain.test.ts covers manifest validation, cache keying, rotation and clearing, the missing-toolchain refusal, and a hello-world app that builds with a stand-in cargo and serves.

Left out

  • There are no CPU or memory caps beyond the cell's existing limits. Only time is bounded.
  • The time-limit message appears only as the deploy's failure line, not as a separate note on the app page.
  • No real Rust toolchain is installed on the forge. Until the operator installs one, Exact's Rust build is refused with the missing-toolchain line.
  • Nothing populates a framework checkout such as ~/.exact/exact2/<commit>. The cache gives the build a place to keep it ($FORGE_BUILD_CACHE), but the build has to put it there.

To try it

  1. Install a toolchain at <data>/toolchains/rust/1.85.0/bin, with cargo in it.
  2. Add "toolchain": {"rust": "1.85.0"} to an app's forge.json and push.
  3. Open the app page as its admin and press "Clear build cache".

Closes #10426

3 earlier comments · 1 event
commented

An app's forge.json can now name a pinned toolchain ("toolchain": {"rust": "1.85.0"}), and its install and test steps get that toolchain plus a per-app build cache. Only part of the limits item is done, and no real Rust build has run. The new tests passed, along with the gate, tsc, the design lint and a few related suites, but not the full suite. bun test listed the whole suite instead of naming a subset, and I did not run it.

What changed

  • Toolchain: the manifest takes toolchain as exact versions of known tools; only rust is known so far. The forge never downloads one. The operator installs it once under FORGE_TOOLCHAINS, or <data>/toolchains/rust/<version>/bin if that is unset. Builds only read it, and its bin goes first on PATH. A missing version is refused with one line: this forge does not provide rust 1.99.0: ask its operator to install it, or name a version it has.
  • Build cache: it sits at <data>/build-cache/<app>/<key>, keyed by Cargo.lock, bun.lock, package-lock.json and the pins. Steps get FORGE_BUILD_CACHE, CARGO_HOME and CARGO_TARGET_DIR inside it, so it survives deploys. The two newest keys are kept.
  • Clearing it: the app page has a "Build cache" card for the repo's admin, shown only when something is cached. It has a Clear button, backed by POST /:owner/:name/app/build-cache/clear.
  • Time limit: a toolchain build gets 15 minutes for install and for test. When it hits the limit, the deploy fails with "the build used its 15 minutes (the time limit for a build with a toolchain)".
  • Docs and tests: docs/TOOLCHAINS.md explains it. test/toolchain.test.ts covers manifest validation, cache keying, rotation and clearing, the missing-toolchain refusal, and a hello-world app that builds with a stand-in cargo and serves.

Left out

  • There are no CPU or memory caps beyond the cell's existing limits. Only time is bounded.
  • The time-limit message appears only as the deploy's failure line, not as a separate note on the app page.
  • No real Rust toolchain is installed on the forge. Until the operator installs one, Exact's Rust build is refused with the missing-toolchain line.
  • Nothing populates a framework checkout such as ~/.exact/exact2/<commit>. The cache gives the build a place to keep it ($FORGE_BUILD_CACHE), but the build has to put it there.

To try it

  1. Install a toolchain at <data>/toolchains/rust/1.85.0/bin, with cargo in it.
  2. Add "toolchain": {"rust": "1.85.0"} to an app's forge.json and push.
  3. Open the app page as its admin and press "Clear build cache".
commented

App builds can now name a pinned toolchain (Rust first), with a per-app build cache that an app admin can clear from the app page ("Clear build cache").

The earlier check failed on one gate rule: the pull adds src/actions/build_cache.ts, but no commit message had a "Why now:" line. I added an empty commit whose message carries one, and pushed it. No code changed, so I did not re-run tsc or the tests. bun scripts/gate.ts now passes locally (exit 0); the forge's check is the next run to confirm it.

To try it, open an app page after a toolchain build and press "Clear build cache" as an app admin.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

Both failing tests are fixed and pushed. I ran the two affected test files and the type check here, and all pass. I did not re-run the full check.

  • Docs link: docs/TOOLCHAINS.md wasn't linked from the "Where the rest is" section of docs/REFERENCE.md. I added a line for it under "Using it".
  • Cart test: test/build-cart.test.ts slept a fixed 50 ms for the first capture to fail. Under load the failure could land after the next test's importCapture and overwrite its "done" state. The test now polls until the capture has failed. I couldn't reproduce the race here, since the file passed on its own, so this is my best explanation for the shard failure. The test was wrong, not the code.

No app behaviour changed in this fix.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs