Repository navigation
Fix dev container: pin lean4game to a revision that exists - #125
Open
gustavdelius wants to merge 1 commit into
Open
gustavdelius wants to merge 1 commit into
gustavdelius wants to merge 1 commit into
Conversation
The dev container could not be built at all. The Dockerfile derived the
lean4game ref from `lean-toolchain`, giving `--branch v4.26.0`, but lean4game
has no such tag (its tags skip v4.24-v4.27), so the image build died with
fatal: Remote branch v4.26.0 not found in upstream origin
Behind that, `lakefile.lean` pinned GameServer to the branch
`chore/bump-v4.26.0`, which GitHub deleted when lean4game PR #438 was merged,
so the `lake update -R` in `onCreateCommand` would have failed next.
- The Dockerfile now reads the lean4game revision out of `lake-manifest.json`,
so the frontend we serve and the GameServer we build against cannot drift
apart. lean4game has no release tag for every Lean version, so the revision
cannot be derived from `lean-toolchain`.
- GameServer is pinned to 213bb24, the newest lean4game commit on `main` still
on Lean v4.26.0. Its `server/` tree is byte-identical to the commit that was
previously pinned through the deleted branch, so this is a drop-in.
- `onCreateCommand` runs `lake exe cache get` before `lake build`, and no
longer runs `lake update -R`: re-resolving would move mathlib's transitive
dependencies and invalidate the cache, and without the cache mathlib is
compiled from scratch.
- The backticks inside the `onCreateCommand`/`postStartCommand` error messages
were shell command substitutions, so a failed `npm install` silently re-ran
`npm install` instead of printing the error.
- Put elan back on PATH for login shells. Debian's `/etc/profile` overwrites
PATH, and a login shell is how VSCode starts its integrated terminal, where
the documented workflow is to run `lake build` after editing a level.
- Add `.dockerignore`: the build context is the whole repo, and `.lake` grows
to several GB once the game has been built through the bind mount.
- Drop the obsolete docker-compose `version` key.
Verified end to end in the container: image build, `npm install`,
`lake exe cache get` and `lake build` all exit 0 (2162/2162 jobs), then
`npm start` serves the game on port 3000 with the relay listening on 8080.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
"Reopen in Container" fails before the container is ever created.
.devcontainer/Dockerfilederives the lean4game ref fromlean-toolchain:but lean4game has no
v4.26.0tag — its tags skip v4.24–v4.27 — so the image build dies with:Three further failures were queued up behind that one:
lakefile.leanpinnedGameServerto the branchchore/bump-v4.26.0, which GitHub deleted when lean4game PR #438 was merged. Thelake update -RinonCreateCommandwould have failed next.onCreateCommandhad nolake exe cache get, so mathlib would have been compiled from scratch — hours instead of minutes. The error message it prints on failure already mentionedcache get; the command itself didn't.PATHlost/usr/local/elan/binin login shells, because Debian's/etc/profileoverwritesPATH. A login shell is how VSCode starts its integrated terminal, solake buildafter editing a level — the documented workflow — would have beencommand not found.The fix
lake-manifest.json, so the frontend we serve and theGameServerwe compile against cannot drift apart. It deliberately does not derive it fromlean-toolchain: lean4game has no release tag for every Lean version. Also adds/etc/profile.d/elan.shfor thePATHissue.GameServerto213bb24, the newest lean4game commit onmainstill on Lean v4.26.0. Itsserver/tree is byte-identical to the commit that was pinned through the deleted branch (git diffbetween them is empty), so this is a drop-in — and it is reachable frommainrather than from a branch that no longer exists.lake exe cache get && lake build, and no longer runslake update -R: re-resolving would also move mathlib's transitive dependencies, which invalidates the mathlib cache. It also replaces the backticks inside theecho "ERROR: ..."messages with quotes — the shell was treating them as command substitutions, so a failednpm installsilently re-rannpm installinstead of printing the error..lakelands on the host. It measured 7.4 GB after one build, and without this it would be sent to the docker daemon on every rebuild.versionkey that Compose warns about.Note on the commit pin
213bb24is a bare commit rather than a version string on purpose. Upstream's convention (documented in GameSkeleton's lakefile as-- Using this assumes that each dependency has a tag of the form v4.X.0) cannot be followed here, because the v4.26.0 bump landed on lean4gamemainas76e7d7fbut was never tagged, whilev4.23.0andv4.28.0both were. I have opened an upstream issue asking for the tag; if it is created, this can become"v4.26.0"again.Verification
Ran the full container-create sequence in the built image, against a throwaway copy of the repo:
docker compose build213bb24,server/lean-toolchain= v4.26.0lake --version(login and non-login shell)npm installlake exe cache getlake buildnpm startNo
error:lines anywhere in the build. The only diagnostics were the pre-existingNo translation (en) found for:warnings and lean4game's "No world introducing X" inventory warnings, both unrelated to this change.🤖 Generated with Claude Code