Skip to content

fix(ci): render the bot's PR body accurately - #289

Merged
robcohen merged 1 commit into
mainfrom
fix/bot-pr-body-accuracy
Aug 21, 2026
Merged

robcohen merged 1 commit into
mainfrom
fix/bot-pr-body-accuracy

Conversation

@robcohen

Copy link
Copy Markdown
Member

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:

  • WIT package version changed: -> (host bindings in likely need changes)

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 pipefail doesn'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-run carries.

Verified by executing the step with the env the workflow supplies:

- WIT package version changed: `3.11.0` -> `4.0.0` (host bindings in `component_engine.py` likely need changes)
- Bumped `_WIT_VERSION` to `4.0.0` (if it changed)

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:

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 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 cp rather than resurrecting vendoring, and makes 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 item that told the reviewer to run wasm-tools component wit against "the vendored file", which is never there.

Risk

No change to what the bot commits — only to the body it writes and to a cp whose 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.

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.
@robcohen
robcohen merged commit 818c3e5 into main Aug 21, 2026
32 checks passed
@robcohen
robcohen deleted the fix/bot-pr-body-accuracy branch August 21, 2026 18:54
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.
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.

1 participant