Repository navigation
fix(ci): render the bot's PR body accurately - #289
Merged
Merged
Conversation
Two defects in the same PR body, both found reviewing #284. 1. The "why this is held" line lost its values. `${{ steps.gate.outputs.reasons }}` was interpolated into an unquoted heredoc. A `${{ }}` expression is pasted into the script text before bash parses it, so the backticks inside the reason string were parsed as command substitution: their contents were executed and replaced with the empty output. #284's body reads - WIT package version changed: -> (host bindings in likely need changes) losing precisely the two versions and the filename the reviewer needs. `set -euo pipefail` does not catch it, because the substitution's exit status is never examined — it fails silently. Fixed by passing the values through `env:` and referencing them as shell variables. A variable's value is not re-scanned for substitutions, so backticks in it stay literal; the escaped static backticks elsewhere in the heredoc were never affected. This is also the standard remedy for the script-injection surface that `${{ }}`-into-`run` carries. Verified by executing the step with the env the workflow supplies: the body now renders the versions and the filename. The same harness run against the pre-fix step reproduces the blanked line exactly, so the check can report dirty as well as clean. 2. The body claimed a vendored artifact that has never existed. It advertised "refreshed the vendored component (sha256-verified)". The download step did `cp component.wasm src/rustfava/rustledger/rustledger_ffi_component.wasm`, added by #219/#220 to stop a committed artifact going stale — but that path is gitignored (.gitignore:52) and absent from add-paths, so it was never once committed: `git log --all` on the path is empty. The cp wrote into the runner's workspace and was discarded. #243 had already settled the question the other way round: committing the wasm shipped ~6 MB of unconsumed sdist weight per release, so the component is downloaded at runtime against the pinned version instead (#286). Removed the dead cp rather than resurrect vendoring, and made the body describe what actually happens. The download and sha256 verification stay — the WIT gate reads component.wasm from the workspace. Also corrected the checklist's "wasm-tools component wit the vendored file", which pointed at a file that is never there. No functional change to what the bot commits.
This was referenced Aug 21, 2026
robcohen
added a commit
that referenced
this pull request
Aug 21, 2026
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.
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 remaining two defects from the #284 review, both in the upgrade bot's PR body.
1. The "why this is held" line silently lost its values
${{ steps.gate.outputs.reasons }}was interpolated into an unquoted heredoc. A${{ }}expression is pasted into the script text before bash parses it, so the backticks inside the reason string were parsed as command substitution — their contents executed, and replaced with the empty output. #284's body reads:losing precisely the two versions and the filename the reviewer needs in order to do the review the PR is being held for.
set -euo pipefaildoesn't catch it, because the substitution's exit status is never examined.Fix: pass the values through
env:and reference them as shell variables. A variable's value is not re-scanned for substitutions, so backticks inside it stay literal. (The escaped static backticks elsewhere in the heredoc were never affected, which is why only the interpolated line broke.) This is also the standard remedy for the script-injection surface that${{ }}-into-runcarries.Verified by executing the step with the env the workflow supplies:
and the same harness run against the pre-fix step reproduces the blanked line exactly, so the check demonstrably reports dirty as well as clean.
2. The body claimed a vendored artifact that has never existed
It advertised "refreshed the vendored component (sha256-verified)". The download step did:
added by #219/#220 to stop a committed artifact going stale. But that path is gitignored (
.gitignore:52) and absent fromadd-paths, so it was never once committed —git log --allon the path is empty. Thecpwrote into the runner's workspace and was thrown away, meaning the #219/#220 remediation has never had any effect.#243 had already settled the question the other way: committing the wasm shipped ~6 MB of unconsumed sdist weight per release, so the component is downloaded at runtime against the pinned version instead (#286). So this removes the dead
cprather than resurrecting vendoring, and makes the body describe what actually happens.The download and sha256 verification stay — the WIT gate reads
component.wasmfrom the workspace. Also corrected the checklist item that told the reviewer to runwasm-tools component witagainst "the vendored file", which is never there.Risk
No change to what the bot commits — only to the body it writes and to a
cpwhose output was discarded. YAML validated. actionlint reports one SC2086 finding, identical before and after this change (it's in the untouched "Get version" step), so nothing new is introduced; left alone as out of scope.