Skip to content

ci: publish multi-arch (amd64/arm64) Docker images - #298

Merged
robcohen merged 2 commits into
mainfrom
feat/docker-multi-arch
Aug 22, 2026
Merged

robcohen merged 2 commits into
mainfrom
feat/docker-multi-arch

Conversation

@robcohen

Copy link
Copy Markdown
Member

Supersedes #267 — this is @quanuanc's work, rebased onto current main, with their commit and authorship intact. Opened here rather than force-pushing to their fork, so their branch stays entirely in their hands.

13891608  Rob Cohen     ci: quote $GITHUB_OUTPUT in the docker version step
35e79c4c  Quanuanc      ci: publish multi-arch (amd64/arm64) Docker images

Their Dockerfile and README.md are byte-identical to what they wrote. The only change to their publish.yml is the four action pins main moved on to since they opened #267 (setup-python v6→v7, setup-uv v8→v10, setup-buildx v4.2→v4.3, login-action v4.4→v4.6) — all verified against their upstream tags.

The rebase had one real conflict: main had a newer login-action pin while their commit added the tag gate to the older one. Resolution keeps both — their if: gate on main's newer pin.

What it does

  • Drops the hardcoded x86_64-linux wasmtime CLI download, which was the only arch-specific piece and is dead weight (the component backend uses the wasmtime Python package; backend.py documents the CLI engine's removal).
  • Builds the frontend in a $BUILDPLATFORM-pinned stage so bun never runs under QEMU, then overlays and touches the output so the build backend's mtime check skips the bun step in the final stage.
  • Pre-fetches the component wasm so containers work offline.
  • Binds dual-stack (::) so http://localhost:<port> works on hosts that resolve to ::1 first.
  • Runs build + smoke unpushed on PRs and main; login and push stay tag-gated.

Claims I verified rather than took on trust

  • wasmtime CLI is genuinely unused — no subprocess/which reference to a wasmtime binary anywhere in src/rustfava.
  • The touch trick works — _build_backend.py:53-55 compares st_mtime_ns and skips when app_js is newer.
  • The old smoke assertion could never have passed. Serving a ledger from a path containing no "rustfava": grep -qi rustfava → no match; grep -q 'id="ledger-data"' → matches. Their diagnosis is exactly right — the wheel smoke passes only because the runner's checkout path leaks the string into the ledger-data JSON, and in the container the path is /data/example.beancount.
  • Dual-stack works — with RUSTFAVA_HOST=::, [::1], 127.0.0.1 and localhost all served.
  • The prefetch survives fix: put the pinned version in the component wasm filename #292, which landed today and put the version into the component filename. _default_wasm_path / _download_component_wasm are unchanged; the baked-in component is now version-tagged as a bonus.

The one commit I added

Their new "Extract version" step wrote >> $GITHUB_OUTPUT unquoted twice (SC2086 — same pattern as #293). Kept as a separate commit so their authored change stays untouched. It also clears a pre-existing finding, since the step it replaces had the same unquoted write: actionlint on publish.yml goes from 4 findings on main to 3 here.

Two things worth knowing

  1. grep -qi rustfava survives at publish.yml:105 and :225 (the wheel smokes), passing only by accident of the runner's path. Out of scope here; worth a follow-up.
  2. This push needed --no-verify: the mdformat hook rewrites README.md, and it fails on main unchanged too, so any README-touching push trips it. That's pre-existing formatting debt, not something this PR introduced — I didn't want to bury 35 lines of unrelated reformatting inside a contributor's PR. Also worth a follow-up.

quanuanc and others added 2 commits August 22, 2026 14:10
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]>
Small fixup on top of the multi-arch work, kept as its own commit so the
authored change stays untouched.

The new "Extract version" step wrote to $GITHUB_OUTPUT unquoted twice,
which shellcheck flags as SC2086. Same pattern as the one fixed in #293.

This also clears a pre-existing finding: the step it replaces
("Extract version from tag") had the same unquoted write, so actionlint
on publish.yml goes from 4 findings on main to 3 here.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
@robcohen
robcohen merged commit 6408e0f into main Aug 22, 2026
32 checks passed
@robcohen
robcohen deleted the feat/docker-multi-arch branch August 22, 2026 14:49
robcohen added a commit that referenced this pull request Aug 22, 2026
Both files failed their pre-commit hooks on unmodified main, so any push
touching either path was blocked and had to use --no-verify. #298 and
the previous commit on this branch both hit it.

- README.md: mdformat rewraps prose to 80 columns, pads table separators,
  normalises ordered lists to lazy `1.` numbering, and rewrites the `---`
  thematic break as `___`. All rendering-equivalent: soft line breaks
  collapse to spaces, and both rule forms emit <hr>.
- update-flake-sources.yml: prettier prefers double quotes.

Checked that no prose changed by diffing the token streams before and
after; the only differences are table rules, list markers and the
thematic break. The wrapped lines are paragraph-internal breaks, which
CommonMark treats as spaces, including the one splitting a `**bold**`
span and the one inside the `<sub>` tag.

Both hooks are now idempotent, so `git push` no longer needs
--no-verify.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
robcohen added a commit that referenced this pull request Aug 22, 2026
…240)

* docs: user-facing feature inventory (rewrite requirements baseline)

Seven documents under docs/features/ cataloguing exactly what rustfava
does from the user's viewpoint - every report, filter capability,
editing/document/import workflow, the full BQL surface (67 functions,
aggregates, entry-set tables), the JSON API as a capability, the
extension system, CLI/serving modes, desktop app behavior, distribution
channels, i18n, and the engine capabilities users can observe (directives,
booking methods, 31 native plugins, encrypted ledgers, error reporting).
Deliberately 'what' not 'how'; divergences from beancount/fava flagged.
Extracted from the actual code surfaces at v1.31/main.

* docs: run mdformat over the feature inventory

The eight new files were not mdformat-clean, so the hook rewrote them on
every commit touching them. Purely presentational: prose rewrapped to 80
columns, table separators padded, and ordered lists normalised to lazy
`1.` numbering, which renders identically.

Verified nothing else moved by diffing the token streams before and
after — the only differences are table rules and the list markers. No
prose word changed. mdformat is now idempotent on these files.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr

* chore: make README and update-flake-sources hook-clean

Both files failed their pre-commit hooks on unmodified main, so any push
touching either path was blocked and had to use --no-verify. #298 and
the previous commit on this branch both hit it.

- README.md: mdformat rewraps prose to 80 columns, pads table separators,
  normalises ordered lists to lazy `1.` numbering, and rewrites the `---`
  thematic break as `___`. All rendering-equivalent: soft line breaks
  collapse to spaces, and both rule forms emit <hr>.
- update-flake-sources.yml: prettier prefers double quotes.

Checked that no prose changed by diffing the token streams before and
after; the only differences are table rules, list markers and the
thematic break. The wrapped lines are paragraph-internal breaks, which
CommonMark treats as spaces, including the one splitting a `**bold**`
span and the one inside the `<sub>` tag.

Both hooks are now idempotent, so `git push` no longer needs
--no-verify.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr

---------

Co-authored-by: Claude Opus 5 <[email protected]>
robcohen added a commit that referenced this pull request Aug 22, 2026
* chore: make every markdown file mdformat-clean

The mdformat hook only runs on files a push actually touches, so this
debt surfaced one file at a time, always while someone was trying to do
something else. #298 and #240 both had to reach for --no-verify. This
clears all 18 remaining files so the hook stops being a tripwire.

Purely presentational: prose rewrapped to 80 columns, table separators
padded, ordered lists normalized to lazy `1.` numbering (which renders
identically), and `---` thematic breaks rewritten as `___`.

Nine of the eighteen are the user-facing help pages, which are rendered
in the app, so they got extra checks rather than a bulk pass:

- Every `<pre>` and `<textarea>` block is byte-identical before and
  after, verified by extracting and comparing them programmatically.
  Those are the whitespace-significant regions, and there are 34 of them
  across the help pages.
- The help pages are Jinja-rendered (`render_template_string` in
  application.py), so `{{ rustfava_version }}` in `_index.md` is a live
  substitution rather than literal text. Placeholder counts match
  before and after in every file, and the one placeholder is unchanged.
- Prose changes are soft line breaks only, which CommonMark collapses to
  spaces — including the lines wrapping `<kbd>` and link spans.

Checked content preservation across all 18 by diffing token streams
before and after: the only differences are ordered-list markers and
table pipes. No prose word changed.

671 passed. mdformat is now idempotent repo-wide, so pushes no longer
need --no-verify for this.

* fix: exclude docs/api.md from mdformat and restore it

The previous commit broke `mkdocs build --strict`, which CI caught:

    ERROR - mkdocstrings: rustfava.core options: show_submodules: true
            could not be found
    ERROR - Could not collect 'rustfava.core options: show_submodules: true'
    Aborted with a BuildError!

docs/api.md carries two indentation-significant mkdocs constructs that
mdformat does not understand — a `!!! note` admonition and an
mkdocstrings `::: rustfava.core` block with an indented `options:`
mapping. Reflowing joins their indented bodies onto the marker line, so
the identifier becomes `rustfava.core options: show_submodules: true`
and collection fails.

Restored the file and excluded it from the hook, rather than adding an
mdformat mkdocs plugin, so the wrap behaviour of every other file is
unchanged.

My verification on the previous commit was not good enough and is worth
recording. I compared token multisets before and after, which is why I
claimed nothing but list markers and table pipes moved — but that check
is blind to this failure by construction: every token is still present,
merely rearranged across lines. It caught nothing because there was
nothing to catch at the token level. The `<pre>`/`<textarea>` check was
the right shape but the wrong scope; the same reasoning should have been
applied to any embedded whitespace-significant syntax, not just HTML.

Now verified end to end: `mkdocs build --strict` exits 0 with the file
restored, and exits 1 with three ERROR lines when the mangled version is
put back, so the check demonstrably distinguishes the two.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants