Fix stackql binary resolution in the test harnesses (WSL spawn ENOENT) - #3
Merged
Merged
Conversation
fs.existsSync resolves bare names against the CWD while spawn() resolves
them against PATH, so 'STACKQL=stackql' could pass the exists-check (a
repo-root file) and then crash node with an unhandled spawn ENOENT.
- test-meta-routes.cjs (both providers) + smoke.cjs: resolve the binary
to an ABSOLUTE path — $STACKQL/--stackql/config (path or PATH-resolved
command) → <provider>/stackql → ./stackql → 'stackql' on PATH → download
the latest release into the provider dir (the same fallback
bin/start-server.sh has always had)
- handle the spawn 'error' event (friendly message instead of a raw
unhandled-event stack trace); skip the 'stopping server (pid
undefined)' log when the spawn never succeeded
- package.json: drop the 'STACKQL=${STACKQL:-stackql}' prefix from
test-meta-routes (non-portable on Windows cmd, and the bare-name
default defeated the harness's own resolution)
All paths verified: bare unresolvable env var → download → 104-method
walk zero errors; admin harness self-downloads → zero errors; absolute
STACKQL and repo-local binary paths → smoke 13/13 and 20/20.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M5qQSBivc7W458yqJG9i5a
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.
Fixes the
npm run test-meta-routescrash on a fresh WSL clone:Root cause
Two bugs compounding:
STACKQL=${STACKQL:-stackql}— a bare command name.fs.existsSync('stackql')resolves bare names against the CWD (so astackqlfile in the repo root passes the check), butspawn('stackql')resolves against PATH — so the exists-check passed and the spawn died.errorhandler on the spawned child, so the ENOENT surfaced as an unhandled'error'event and crashed node with a raw stack trace (plus a confusingstopping server (pid undefined)on the way down).Fix
test-meta-routes.cjs(both providers) andtests/smoke.cjs, always resolving to an absolute path before spawn:$STACKQL/--stackql/manifest config (as a path, or PATH-resolved when a bare command) →<provider>/stackql→./stackql→stackqlon PATH → download the latest release into the provider dir (the same fallbackbin/start-server.shhas always had; linux/darwin, amd64/arm64).errorhandler → friendly one-line failure instead of an unhandled-event stack trace; suppressed thepid undefinedstop log when the spawn never succeeded.STACKQL=${STACKQL:-stackql}prefix (also non-portable on Windowscmd);STACKQLremains an optional override.stackql.gitignore entry added on main.Verification (all resolution paths exercised)
STACKQL=stackqlwith no binary anywhere (the reported case) → warns, downloads, full 12/26/104 meta walk, zero errorsSTACKQL=/abs/path→ smoke 13/13🤖 Generated with Claude Code
https://claude.ai/code/session_01M5qQSBivc7W458yqJG9i5a
Generated by Claude Code