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) to gen_common.sh to 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
pnpm is a required prerequisite for go generate ./... (it is currently missing from the Prerequisites section, which only lists Go and Git).
Additional Notes
- The script uses
#!/bin/sh with pushd/popd, which are bash-only builtins and undefined in POSIX sh (e.g. dash on many Linux systems). This should probably be #!/bin/bash or rewritten to avoid pushd/popd for portability.
- Happy to submit a PR for this if assigned.
Description
Running
go generate ./...invokespkg/lib/harness/generated/gen_common.sh, which callspnpm installandpnpm run buildto build the harness UI. Ifpnpmis not installed, these commands fail, but the script has noset -eand does not check the exit status. Execution continues into thecompressstep, which then fails with a confusing, seemingly unrelated error:A new contributor debugging the
tarerror 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
set -e(or explicit exit-code checks) togen_common.shto stop execution on the first failure.pnpm,sha256sum/shasum,curl,tar) are available on PATH, and print a clear installation hint if not.pnpmis a required prerequisite forgo generate ./...(it is currently missing from the Prerequisites section, which only lists Go and Git).Additional Notes
#!/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.