Repository navigation
Conversation
The Dockerfile hardcoded an x86_64 wasmtime CLI download, so the published image only ran on amd64 (arm64 hosts like Apple Silicon had to emulate or build from source, and the build failed there anyway). Dockerfile: - Drop the wasmtime CLI download entirely: the runtime uses wasmtime-py (a core dependency with prebuilt wheels for both arches) since the JSON-RPC engine was replaced by the component engine. - Build the frontend in a separate stage pinned to $BUILDPLATFORM: bun is unreliable under QEMU user emulation, and the JS/CSS output is architecture-independent, so cross-builds never run it emulated. The build backend then skips its bun step because the prebuilt static assets are fresher than the frontend sources. - Pre-fetch the (arch-independent) rustledger component wasm into the image so containers work offline and the first request does not stall on a download. - Bind dual-stack ([::]) by default: Docker publishes ports on IPv6 too, and browsers resolve localhost to ::1 first, so an IPv4-only bind made http://localhost:<port> fail on many hosts. publish.yml docker job: - Build and push linux/amd64 + linux/arm64 via buildx/QEMU on tags. - Run the build + smoke (no push) on PRs and main too, so multi-arch regressions surface before a release. - Fix the (previously never-executed) smoke step: keep the container for docker logs, avoid the grep -q SIGPIPE/pipefail flake, and assert on rendered ledger data + a query API round trip instead of the string "rustfava" (the page only contains it by accident when the ledger's file path does). Co-Authored-By: Claude Fable 5 <[email protected]>
robcohen
left a comment
There was a problem hiding this comment.
Thanks for this — the reasoning in the description is unusually careful, and I checked the load-bearing claims rather than taking them on trust. They all hold. Two things block merging, neither of them about the substance.
Claims verified
The wasmtime CLI really is dead weight. src/rustfava/rustledger/backend.py documents that the CLI JSON-RPC engine was removed and that the component backend needs the wasmtime Python package; there's no subprocess/which use of a wasmtime binary anywhere in src/rustfava. Dropping it is what makes the image arch-independent, so this is the right thread to have pulled.
The touch trick genuinely skips the bun step. _build_backend.py:53-55 takes max(st_mtime_ns) over the frontend sources and skips when app_js is newer, so overlaying the prebuilt assets and touching them does short-circuit the rebuild. Good — that's load-bearing for the cross-build, since bun isn't installed in the final stage.
The old smoke assertion could not have passed. I ran the server against a ledger whose path contains no "rustfava" and fetched /:
| assertion | result |
|---|---|
grep -qi rustfava (current) |
no match — would fail |
grep -q 'id="ledger-data"' (yours) |
matches |
So your diagnosis is exactly right: the wheel smoke passes only because the runner's checkout path leaks rustfava into the ledger-data JSON, and in the container the path is /data/example.beancount. id="ledger-data" is emitted by _layout.html:21, so it's a real invariant rather than an accident.
The dual-stack bind works. With RUSTFAVA_HOST=:: on Linux, [::1], 127.0.0.1 and localhost all served (302 each).
The workflow changes are safe to run on PRs. Registry login is gated to push + tag, push: is gated the same way, both new actions are SHA-pinned, and persist-credentials: false is preserved. Running build+smoke unpushed on PRs is a real improvement given the job was previously tag-only — which is precisely why the broken smoke went unnoticed.
Blocking: this now conflicts
.github/workflows/publish.yml conflicts with main. The cause is the github-actions dependency bumps that landed since you opened this (#275, and #288 earlier today), which moved the same SHA pins you're editing.
On rebase, note that #288 bumped docker/setup-buildx-action to v4.3.0 (37fe631027851001ddb9b187196cc803df7f5f0e); this branch still pins v4.2.0, so take main's value. Your new docker/setup-qemu-action pin is fine as-is.
Blocking: CI has never run
This PR shows a single check (license/cla, signed — thank you). The rest are gated behind outside-contributor workflow approval, so none of it has executed here. Your fork run is good evidence, but a maintainer will need to approve the runs so it's verified against this repo. Worth flagging that the check list gives no visual hint that anything is waiting — the same trap that left #282 parked for six days.
Non-blocking notes
grep -qi rustfavasurvives at publish.yml:105 and :225 (the wheel smokes). By your own analysis those pass only because the runner's path happens to contain the string — they'd break if the checkout path changed. Out of scope here, but worth a follow-up.- With
RUSTFAVA_HOST=::the startup banner printsStarting Fava on http://:::5198, which is a bit unfortunate. Pre-existing formatting, but this PR makes it the default users see. - FYI, #292 landed today and put the pinned version into the component wasm filename. Your prefetch step is unaffected —
_default_wasm_pathand_download_component_wasmare unchanged, and I confirmed the one-liner still resolves and downloads. Nice side effect: the baked-in component is now version-tagged.
Rebase and I'll get the runs approved.
|
Superseded by #298, which is your commit rebased onto current Thank you for this. The description did the hard part: it correctly identified that the wasmtime CLI download was the only arch-specific piece and had become dead weight, that bun can't be trusted under QEMU, and — the find I most appreciated — that the docker smoke test could never have passed, because the page only contains the string "rustfava" when the ledger's file path happens to. I reproduced that: serving a ledger from a path without "rustfava" in it, The only change I made to your work was quoting Worth reporting back: on #298 the |
Why
The published
ghcr.io/rustledger/rustfavaimage is amd64-only, and the Dockerfile hardcodes anx86_64-linuxwasmtime CLI download, so it can't even be built on an arm64 host (Apple Silicon, Graviton, Raspberry Pi). This PR makes the image build and publish for bothlinux/amd64andlinux/arm64.Dockerfile
wasmtime-py(a core dependency with prebuilt wheels for both arches) since the JSON-RPC engine was replaced by the component engine — the CLI binary was dead weight, and it was the only arch-specific piece of the image.$BUILDPLATFORM. bun is unreliable under QEMU user emulation, and its JS/CSS output is architecture-independent, so cross-builds never run it emulated. The build backend then skips its bun step in the final stage because the prebuilt static assets are fresher than the frontend sources (bun isn't installed there at all).[::]) by default. Docker publishes ports on IPv6 too, and browsers resolvelocalhostto::1first, so the previous IPv4-only (0.0.0.0) bind madehttp://localhost:<port>fail (connection reset) on common setups even though the container was healthy. An explicit--hoststill overrides this.The final image is also slimmer: no apt packages, no bun, no wasmtime CLI, and the source tree is removed after
pip install.publish.yml (docker job)
linux/amd64,linux/arm64via buildx/QEMU on tags. Only the Python install runs emulated (pure Python + prebuilt wheels); the frontend builds natively.curl | grep -qunderpipefailis flaky (early grep exit SIGPIPEs curl) — capture the body instead.grep -qi rustfavacan't pass here: the page HTML doesn't contain the string "rustfava". The wheel smoke only matches because the runner's checkout path (/home/runner/work/rustfava/...) leaks into the ledger-data JSON; in the container the path is/data/example.beancount. Assert on rendered ledger data and a query API round trip instead.--rm) sodocker logsstill works after a startup crash, and dump logs/body on every failure path.Verification
Full workflow run on my fork (workflow_dispatch, same code): quanuanc/rustfava run 30208362401 — wheel build ✅, wheel smoke ✅, docker job ✅ (amd64 image built + container smoke passed, multi-arch amd64+arm64 buildx build completed; push correctly skipped on non-tag).
Also built and ran the image natively on an arm64 Mac: server starts, ledger loads, pages render, and the query API responds.
🤖 Generated with Claude Code