Repository navigation
fix: repair sync-pre-commit and harden the bot's version step - #293
Merged
Merged
Conversation
Two independent silent failures found while reviewing #284/#287/#289. 1. sync-pre-commit could not parse bun.lock, and hid it. `JSON.parse` rejected the lockfile with "Property name must be a string literal": bun writes JSONC with trailing commas (the first is after "web-tree-sitter" on line 34). `Bun.file().json()` is equally strict, so there was no drop-in. The script then swallowed the failure — `main().catch()` logged the error and left the exit code at 0 — so `just sync-pre-commit` and the `sync-pre-commit` package script both reported success while doing nothing at all. Fixed by stripping trailing commas before parsing, skipping string literals so a comma inside a package name or version range can never be mistaken for a structural one, and by setting `process.exitCode = 1` in the catch. Verified: the lockfile now parses to 385 package entries (previously it threw), a deliberately corrupted lockfile exits 1, and the restored one exits 0. Worth knowing: the script has nothing to rewrite today regardless. It looks for `"name@version"` strings, and .pre-commit-config.yaml no longer contains any — the biome hook pins a `rev:` and the only additional_dependencies entry is unversioned. The format it targets did exist historically. Someone should decide whether the script is still wanted; this change at least means it will say so when it breaks. 2. The bot's "Get version" step interpolated a dispatch payload into bash. `${{ github.event.client_payload.version }}` was pasted into the script text before bash parsed it, which is the standard script-injection shape — the same class as the PR-body bug fixed in #289, and here the value arrives from a repository_dispatch payload. Moved to `env:`. Also quotes $GITHUB_OUTPUT (the SC2086 actionlint has been reporting on this workflow), adds `set -euo pipefail`, and fails loudly when neither input supplies a version instead of continuing with an empty one. Reads use `${VAR:-}` because only one of the two is populated for any given event and `set -u` would otherwise abort on the unused one. actionlint on this workflow now exits 0, from one finding before. Simulated all three paths: workflow_dispatch and repository_dispatch each resolve their version and write it to $GITHUB_OUTPUT, and the neither-supplied case exits 1 with a message.
robcohen
added a commit
that referenced
this pull request
Aug 22, 2026
* ci: publish multi-arch (amd64/arm64) Docker images 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]> * ci: quote $GITHUB_OUTPUT in the docker version step 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 --------- Co-authored-by: Quanuanc <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
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.
Two independent silent failures found while reviewing #284 / #287 / #289. Same family as those: something that looks like it worked, didn't.
1.
sync-pre-commitcouldn't parsebun.lock, and hid itJSON.parserejected the lockfile with "Property name must be a string literal" — bun writes JSONC with trailing commas (first one afterweb-tree-sitter, line 34).Bun.file().json()is equally strict, so there was no drop-in.The script then swallowed it:
main().catch()logged the error and left the exit code at 0. Sojust sync-pre-commitand the package script both reported success while doing nothing.Fixed by stripping trailing commas before parsing — skipping string literals, so a comma inside a package name or version range can't be mistaken for a structural one — and setting
process.exitCode = 1in the catch.Verified:
bun.lockWorth knowing: the script has nothing to rewrite today regardless. It looks for
"name@version"strings and.pre-commit-config.yamlno longer contains any — the biome hook pins arev:, and the soleadditional_dependenciesentry is unversioned. That format did exist historically (it's still invoked fromjustfile:253). Someone should decide whether the script is still wanted; this at least makes it say so when it breaks.2. The bot's "Get version" step interpolated a dispatch payload into bash
VERSION="${{ github.event.client_payload.version }}"${{ }}is pasted into the script text before bash parses it — the standard script-injection shape, and the same class as the PR-body bug fixed in #289. Here the value arrives from arepository_dispatchpayload. Moved toenv:.Also in this step: quotes
$GITHUB_OUTPUT(the SC2086 actionlint has been reporting on this workflow — I'd left it alone in #287 as out of scope), addsset -euo pipefail, and fails loudly when neither input supplies a version instead of continuing with an empty one. Reads use${VAR:-}because only one of the two is populated for any given event, andset -uwould otherwise abort on the unused one.actionlint on this workflow now exits 0, from one finding before — checked via exit code, not grepped output.
Simulated all three paths:
Risk
tscandeslintpass on the changed script. The workflow change affects only how the version is read; no change to what the bot commits.