authoravatarclover caruso<git@paperclover.net>2026-11-10 10:52:35-08:00
committeravatarclover caruso<git@paperclover.net>2026-11-12 16:08:55-08:00
log97b5aceb6cd7fb036fe8b18c8cee7b24065b0b82
tree133af43ba5487476d3013341c5f626656cb58698
parentc742fe629c76859587fee2f9bb699800813fec62
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Update Substation to v0.1.237

Pin the reviewed upstream release and build it with Snow Globe's container recipe. Install locked build dependencies, run format, lint, type and 64 offline runtime suites, and embed the source revision and release version. Export the container recipe from the selected infrastructure snapshot so production keeps using reviewed main. Preserve existing accounts, keys and history; the in-app updater stays disabled in the immutable image. Validated ten deployment export tests, staging API key separation, proxy identity and host guards, cross-origin preflight rejection, settings persistence across restart, dashboard rendering and healthy polling. Assisted-by: gpt-6.1-sol

5 files changed, 100 insertions(+), 25 deletions(-)

service/substation/Dockerfile created+27
......@@ -0,0 +1,27 @@
1FROM docker.io/oven/bun:1.4.4@sha256:3f23864d3e8c923975c61971cabe67ee3d5a728f1e25a559256b95af719a3478 AS build
2WORKDIR /src
3RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
4ENV BUN_INSTALL=/opt/tools BUN_INSTALL_BIN=/opt/tools/bin
5RUN bun install --global --trust @anthropic-ai/claude-code@2.1.318 @openai/codex@0.166.0 \
6 && install -m 0755 /opt/tools/install/global/node_modules/@anthropic-ai/claude-code-linux-x64/claude /usr/local/bin/claude \
7 && install -m 0755 /opt/tools/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex /usr/local/bin/codex \
8 && claude --version && codex --version
9RUN chown bun:bun /src
10COPY --chown=bun:bun . .
11USER bun
12RUN bun install --frozen-lockfile --cache-dir /tmp/bun-cache
13RUN bun fmt --no-script --check && bun run lint && bun run typecheck
14# The updater's compilation test requires a checkout; immutable images contain source exports.
15RUN sed -i '/^ "dashboard\/test-update.ts",$/d' tests.ts
16RUN bun tests.ts
17RUN bun build --compile --bytecode --sourcemap \
18 --no-compile-autoload-dotenv --no-compile-autoload-bunfig --reject-unresolved \
19 --define "SUBSTATION_COMMIT=$(bun -e 'console.log(JSON.stringify(require("./.snowglobe-source.json").sources[0].revision))')" \
20 --define "SUBSTATION_VERSION=$(bun -e 'console.log(JSON.stringify(require("./.snowglobe-source.json").version))')" \
21 --define "SUBSTATION_BUILT_AT=$(bun -e 'console.log(JSON.stringify(new Date().toISOString()))')" \
22 substation.ts --outfile /tmp/substation
23FROM docker.io/oven/bun:1.4.4@sha256:3f23864d3e8c923975c61971cabe67ee3d5a728f1e25a559256b95af719a3478
24COPY --from=build /tmp/substation /usr/local/bin/substation
25COPY --from=build /usr/local/bin/claude /usr/local/bin/codex /usr/local/bin/
26RUN substation --version && claude --version && codex --version
27ENTRYPOINT ["/usr/local/bin/substation"]
service/substation/build-source.json+44-21
......@@ -1,25 +1,48 @@
11{
2 "source": "../substation",
3 "revision": "b3083b6316d928fbc2e01f8941941c9e3769bdce",
4 "dockerfile": "Dockerfile.snowglobe",
2 "dockerfile": "Dockerfile",
3 "version": "0.1.237",
54 "includeManifest": true,
6 "include": [
7 ".gitignore",
8 "package.json",
9 "README.md",
10 "build.ts",
11 "build-info.ts",
12 "running.ts",
13 "settings.ts",
14 "substation.ts",
15 "tests.ts",
16 "test-settings.ts",
17 "update.ts",
18 "restore.ts",
19 "hub",
20 "dashboard",
21 "ops",
22 "m0",
23 "docs"
5 "sources": [
6 {
7 "source": "../substation",
8 "revision": "1a5174afde69ea2f08824f65488c2d6270677928",
9 "include": [
10 ".editorconfig",
11 ".gitignore",
12 ".oxfmtrc.json",
13 ".oxlintrc.json",
14 ".shellcheckrc",
15 "package.json",
16 "bun.lock",
17 "bunfig.toml",
18 "README.md",
19 "apply.ts",
20 "archive.ts",
21 "build.ts",
22 "build-info.ts",
23 "running.ts",
24 "settings.ts",
25 "substation.ts",
26 "tests.ts",
27 "test-settings.ts",
28 "test-apply.ts",
29 "test-archive.ts",
30 "test-lanes.ts",
31 "test-lanes.sources.json",
32 "release-runner.ts",
33 "release-update.ts",
34 "restore.ts",
35 "service-file.d.ts",
36 "unit-texts.ts",
37 "units.ts",
38 "tsconfig.json",
39 "tsconfig.page.json",
40 "hub",
41 "dashboard",
42 "ops",
43 "scripts",
44 "docs"
45 ]
46 }
2447 ]
2548}
tools/deploy-test.py+17
......@@ -191,6 +191,23 @@ class BuildSourceExport(unittest.TestCase):
191191 self.assertEqual((context / "lib/new").read_text(), "uncommitted library")
192192 self.assertEqual((context / "Dockerfile").read_text(), "FROM unfinished\n")
193193
194 def test_local_dockerfile_uses_exported_main_or_working_stage(self):
195 dockerfile = self.manifest.parent / "Dockerfile"
196 dockerfile.write_text("FROM reviewed\n")
197 source = {key: value for key, value in self.spec.items() if key != "dockerfile"}
198 self.manifest.write_text(json.dumps({"dockerfile": "Dockerfile", "sources": [source]}))
199 subprocess.run(["jj", "describe", "-m", "Reviewed container recipe"], cwd=self.repo, check=True, capture_output=True)
200 subprocess.run(["jj", "bookmark", "set", "main"], cwd=self.repo, check=True, capture_output=True)
201 dockerfile.write_text("FROM unfinished\n")
202 for main, expected in ((True, "FROM reviewed\n"), (False, "FROM unfinished\n")):
203 context = self.remote / "releases" / deploy.upload(main=main) / "service/app/build"
204 self.assertEqual((context / "Dockerfile").read_text(), expected)
205 self.assertEqual((context / "run.sh").read_text(), "#!/bin/sh\necho committed\n")
206 for name in ("../outside", "/absolute", "."):
207 self.manifest.write_text(json.dumps({"dockerfile": name, "sources": [source]}))
208 with self.assertRaisesRegex(ValueError, "invalid build context Dockerfile"):
209 deploy.upload()
210
194211 def test_dockerfile_also_selected_by_include_is_retained(self):
195212 self.manifest.write_text(json.dumps({**self.spec, "include": ["src"]}))
196213 context = self.remote / "releases" / deploy.upload() / "service/app/build"
tools/deploy.py+8
......@@ -139,6 +139,14 @@ def upload(main=False):
139139 shutil.copytree(origin, destination, symlinks=True)
140140 else:
141141 shutil.copy2(origin, destination)
142 if "sources" in spec and spec.get("dockerfile"):
143 relative = Path(spec["dockerfile"])
144 dockerfile = manifest.parent / relative
145 if (relative.is_absolute() or ".." in relative.parts or not relative.parts
146 or not dockerfile.resolve(strict=True).is_relative_to(manifest.parent)
147 or not dockerfile.is_file() or (context / "Dockerfile").exists()):
148 raise ValueError(f"invalid build context Dockerfile: {relative}")
149 shutil.copy2(dockerfile, context / "Dockerfile")
142150 if not (context / "Dockerfile").is_file():
143151 raise ValueError(f"missing build source Dockerfile: {manifest.parent.name}")
144152 if spec.get("includeManifest"):
tools/substation.md+4-4
......@@ -80,16 +80,16 @@ Nomad owns the generated keys and OAuth client credentials. Existing numeric
8080service identities remain reserved when a service is retired.
8181
8282`service/substation/build-source.json` pins a local Jujutsu revision of
83`../substation`. That checkout's `Dockerfile.snowglobe` builds the program and
84includes pinned Claude and Codex login tools. The exporter includes its source
85manifest as build provenance. Snow Globe receives source and builds locally;
83`../substation` and its release version. `service/substation/Dockerfile` builds
84the program and includes pinned Claude and Codex login tools. The exporter
85includes its source manifest as build provenance. Snow Globe receives source and builds locally;
8686it receives no GitHub SSH key or repository credentials.
8787
8888Stage with `python3 tools/deploy.py stage substation`. Previews start with empty
8989storage, their own keys, and a separate Snow OAuth client. Updates preserve
9090that preview's state. Use disposable accounts and prompts when testing.
9191Production uses described, conflict-free main and `python3 tools/deploy.py prod`.
92The checkout-dependent updater is unavailable inside the immutable image.
92The in-app updater is unavailable inside the immutable image.
9393
9494CPA's live dataset, preview, keys, and routing are retired after the replacement
9595passes production checks. Restricted off-server recovery copies retain the old