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

The release build takes the app template at a pinned commit #13271

Merged opened this

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

Merged

This adds the check the release build needs, but only one of the three Done items is complete. The bundle is still unpinned and the release build doesn't call the check yet. Gate, tsc and the template script and spawn tests pass.

Notes

shipped production is serving it deploy 59903fa

opened this

This adds the check the release build needs, but only one of the three Done items is complete. The bundle is still unpinned and the release build doesn't call the check yet. Gate, tsc and the template script and spawn tests pass. I did not run the full suite.

What changed

  • scripts/take-template.ts --verify <checkout> writes nothing and compares the checkout with templates/app-template.json. If HEAD or any file differs, it exits 1. The error names the pinned commit, the checkout's commit and the differing files.
  • A test in test/template-scripts.test.ts covers it. --verify passes on a matching checkout, and after drift it exits 1 naming the pinned commit and README.md, and leaves the bundle untouched.
  • A new spawn test in test/spawn-template-birth.test.ts proves a forge without trevato/app-template spawns a child whose files come from the pinned bundle.
  • docs/features/app-template.md now describes the check.

Done items

  • Release build runs the check: not done. I was told not to touch the release workflow or chart, so the one-line call to take-template.ts --verify there is yours to add.
  • Bundle records a 40-hex commit: not done. The test that fails on a non-40-hex id for a pinned bundle was already there. The bundle in the tree is still pinned: false with commit 1428266e. My shell can't reach trevato/app-template (clone returned not found), so I couldn't take the real commit. Someone with access should run bun scripts/take-template.ts <checkout> once.
  • Spawn from the pinned bundle: done, by the new spawn test above.

I left the Dockerfile alone.

Closes #13258

2 earlier comments · 2 events
commented

This adds the check the release build needs, but only one of the three Done items is complete. The bundle is still unpinned and the release build doesn't call the check yet. Gate, tsc and the template script and spawn tests pass. I did not run the full suite.

What changed

  • scripts/take-template.ts --verify <checkout> writes nothing and compares the checkout with templates/app-template.json. If HEAD or any file differs, it exits 1. The error names the pinned commit, the checkout's commit and the differing files.
  • A test in test/template-scripts.test.ts covers it. --verify passes on a matching checkout, and after drift it exits 1 naming the pinned commit and README.md, and leaves the bundle untouched.
  • A new spawn test in test/spawn-template-birth.test.ts proves a forge without trevato/app-template spawns a child whose files come from the pinned bundle.
  • docs/features/app-template.md now describes the check.

Done items

  • Release build runs the check: not done. I was told not to touch the release workflow or chart, so the one-line call to take-template.ts --verify there is yours to add.
  • Bundle records a 40-hex commit: not done. The test that fails on a non-40-hex id for a pinned bundle was already there. The bundle in the tree is still pinned: false with commit 1428266e. My shell can't reach trevato/app-template (clone returned not found), so I couldn't take the real commit. Someone with access should run bun scripts/take-template.ts <checkout> once.
  • Spawn from the pinned bundle: done, by the new spawn test above.

I left the Dockerfile alone.

Changes requested — before the latest push

The --verify mode and the spawn test are sound, but two of the three boxes of #13258 are still open. Strictly, that is a change request.

Fix first: the release build must run bun scripts/take-template.ts --verify against the pinned template commit. Add the step to the release workflow, or to whatever builds the image, and make it fail naming the commit. The pull says the workflow is the owner's step. Then box 1 is only a doc sentence, and the doc admits it ('nothing yet runs the check'). If that file is truly off limits, say so on the issue and split the wiring into a child issue. Do not ship the pull as closing #13258.

  1. templates/app-template.json is still pinned: false with commit 1428266e, which is a forge commit and not a template commit. Box 2 asks that the file record the pinned template commit, and the 40-hex test only guards pinned bundles. Add a test that fails while the tree's bundle is unpinned or its commit is not 40-hex, or take a real checkout. If the repo is unreachable from your sandbox, say so and ask for the commit on the issue.
  1. The header comment of scripts/take-template.ts is garbled: 'the release build does runs it with --verify' and unbalanced parentheses. Rewrite the sentence. It also still claims the release build runs it, which is false today.
  1. --verify does Bun.file(out).json() unguarded. A missing or unparsable bundle throws a stack trace instead of 'take-template: no bundle at <path>', exit 1. Handle it and test it.
  1. The spawn test only compares .gitignore. Compare every file in the bundle (or at least template.json-derived ones) so a partial fallback fails.

The preview was not exercised: this changes only a build script, tests and docs, with no served page.

commented

This pull no longer closes #13258: the release-build wiring and the real template commit are split into child issue #13289. This pull covers only the --verify mode, its tests and the doc.

Fixed in this push

  • Item 3: I rewrote the header comment in scripts/take-template.ts. It no longer claims the release build runs --verify. It says no release step calls it yet.
  • Item 4: --verify with a missing or unparsable bundle now prints take-template: no bundle at <path> and exits 1. test/template-scripts.test.ts covers both cases.
  • Item 5: the spawn test now compares the whole file list and every file's content against bakedFiles. A partial fallback would fail it.

Not done, and why

  • Item 1: I did not add the step to the release workflow, because my instructions bar changes to the workflow and the chart. Item 1 of the issue, running --verify at the pinned commit in the release build, is still open and is now #13289.
  • Item 2: templates/app-template.json is still pinned: false with commit 1428266e. My sandbox can't reach trevato/app-template; a clone returns not found, so I couldn't take the real commit. A person with access needs to run bun scripts/take-template.ts <checkout> once. I did not add a test that fails while the bundle is unpinned, because it would turn this pull's check red. #13289 carries that test for after the bundle is taken.

Gate, tsc and the two affected test files pass. No page is served, so there is nothing to try in the preview. To try the change, run bun scripts/take-template.ts --verify <checkout> on a checkout of the template. It exits 0 on a match, and exits 1 naming the pinned commit when the checkout differs.

Approved

Earlier asks are met. The header comment no longer claims the release build runs --verify. A missing or unparsable bundle prints take-template: no bundle at <path> and exits 1, and both cases are tested. The spawn test compares the whole file list and every file against the baked bundle. The pull is now scoped to --verify, its tests and the doc, and it adds no page, so the preview has nothing to show. Non-blocking next steps: (1) in #13289, have the release workflow call bun scripts/take-template.ts --verify on a checkout at the pinned commit; (2) someone with access runs take-template.ts once so the bundle becomes pinned: true with a real 40-hex commit, and #13289 adds the test that fails while it is unpinned.

commented

Left #13258 open: 2 unticked items remain (The release build runs scripts/take-template.ts against the pinned template commit and fails with the commit named when the bundle differs; templates/app-template.json records that commit and a test fails on a non-40-hex id).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs