gen_common.sh fails silently when pnpm is missing, surfaces a confusing unrelated error
Description
Running go generate ./... invokes pkg/lib/harness/generated/gen_common.sh, which calls pnpm install and pnpm run build to build the harness UI. If pnpm is not installed, these commands fail, but the script has no set -e and does not check the exit status. Execution continues into the compress step, which then fails with a confusing, seemingly unrelated error:
./gen_common.sh: line 12: pnpm: command not found
./gen_common.sh: line 13: pnpm: command not found
Compressing ../../../../frontend/dev-mode/dist to ../ui.tar.gz
tar: could not chdir to '../../../../frontend/dev-mode/dist'
A new contributor debugging the tar error has no clear path back to "install pnpm" — the real cause is buried two commands earlier in the log.
Expected Behavior
The script should fail fast with a clear, actionable error message (e.g. "pnpm is required but was not found on PATH. Install it: https://pnpm.io/installation") as soon as a required tool is missing, rather than continuing and producing a misleading downstream error.
Proposed Solution
- Add
set -e(or explicit exit-code checks) togen_common.shto stop execution on the first failure. - Add a preflight check at the top of the script that verifies required tools (
pnpm,sha256sum/shasum,curl,tar) are available on PATH, and print a clear installation hint if not. - Optionally note in CONTRIBUTING.md that
pnpmis a required prerequisite forgo generate ./...(it is currently missing from the Prerequisites section, which only lists Go and Git).
Additional Notes
- The script uses
#!/bin/shwithpushd/popd, which are bash-only builtins and undefined in POSIXsh(e.g.dashon many Linux systems). This should probably be#!/bin/bashor rewritten to avoidpushd/popdfor portability. - Happy to submit a PR for this if assigned.
I'd like to work on this one — happy to add a preflight check for required tools (pnpm, sha256sum/shasum, curl, tar) and a set -e guard, plus update CONTRIBUTING.md's Prerequisites section to mention pnpm. Will open a PR shortly.