fix(orchestrate): resolve test CLI paths with fileURLToPath - #384
Open
SurefireStudios wants to merge 1 commit into
Open
SurefireStudios wants to merge 1 commit into
SurefireStudios wants to merge 1 commit into
Conversation
Three test files built a filesystem path with `new URL(..., import.meta.url).pathname`. On Windows that yields a leading-slash path (`/C:/...`) that spawnSync cannot launch, so the CLI never starts and the assertions see exit status 1 instead of the expected 2. `.pathname` also leaves percent-encoding in place, so a checkout under a directory with a space breaks the same way on any platform. Use `fileURLToPath`, matching `__tests__/checkpoint-restart.test.ts` and the four other call sites already doing this in the repo. On Windows: 200 pass / 9 fail -> 208 pass / 1 fail. The remaining failure is `operator boundary > requires a current-user 0600 operator flag`, which calls `chmodSync(flag, 0o600)`; NTFS has no POSIX mode bits, so it is left untouched. No change in behaviour on macOS or Linux.
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.
What
Three test files in
orchestrate/skills/orchestrate/scripts/__tests__/build a filesystem path like this:On Windows
URL.pathnamereturns a leading-slash path:spawnSynccan't launch the first one, so the CLI never starts and the assertions see exit status1instead of the expected2— a failure that points at plan validation rather than at the path..pathnamealso leaves percent-encoding in place, so a checkout under a directory containing a space (/home/ci/My Project/…→My%20Project) breaks the same way on any platform.The fix
Use
fileURLToPath, which is what__tests__/checkpoint-restart.test.tsin the same directory already does:Five call sites in the repo already use
fileURLToPath; these were the remaining four using.pathname. 11 lines across 3 files, no behaviour change on macOS or Linux.Verification
Run on Windows 11, bun 1.2.10:
bun testbun run typecheckbiome check(changed files)The one failure left
operator boundary > requires a current-user 0600 operator flagstill fails on Windows. It callschmodSync(flagPath, 0o600)and NTFS has no POSIX mode bits, soisOperatorModeEnabledcan never see0600. The check itself is correct and deliberately strict, so I've left it alone — happy to add atest.skipIf(process.platform === "win32")if you'd prefer it green, but that's your call on a security-relevant test.Why this wasn't caught
.github/workflows/validate-plugins.ymlis the only workflow and it's path-filtered tomarketplace.json,**/plugin.jsonandschemas/**.orchestratedefinestest,typecheck,lintandcheckscripts, but nothing in CI invokes them. Glad to open a separate PR adding that job if it's wanted — didn't want to bundle a CI change into a bug fix.Note
Low Risk
Test-only path resolution changes with no impact on production orchestrate CLI behavior.
Overview
Fixes orchestrate CLI integration tests that spawn
cli.tsviaspawnSyncby resolvingimport.meta.urlwithfileURLToPathinstead ofURL.pathname.Previously,
.pathnameproduced invalid paths on Windows (leading/C:/…) and could leave percent-encoded segments in paths with spaces, so the CLI often failed to start and tests misreported exit codes.comment-cli,kickoff-dedupe, andprompt-plan-validationnow match the existingcheckpoint-restartpattern;SCRIPTS_DIRis derived viadirnameof the resolved CLI path where needed.No production CLI behavior changes—test-only path resolution for cross-platform reliability.
Reviewed by Cursor Bugbot for commit 13fe00e. Bugbot is set up for automated code reviews on this repo. Configure here.