Repository navigation
fix(sdk-ts): reject FIFO uploads without blocking - #3355
Open
Elon-Jiang wants to merge 1 commit into
Open
Elon-Jiang wants to merge 1 commit into
Elon-Jiang wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: fa90e9e The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
This branch has not been deployed
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.
why
Locator.setInputFiles(path)opens a path before checking the descriptor's file type. On POSIX, opening a FIFO for reading waits for a writer, so a FIFO (or a symlink to one) can hang the upload before the existing non-file rejection is reached. No browser RPC is sent.Reproduction on macOS with a FIFO that has no writer:
Before: waits for a writer. After: rejects with the existing
TypeError("setInputFiles(): expected a file")without waiting. The Python SDK already handles this case (see #2559); this fixes the TypeScript path.what changed
O_RDONLY | O_NONBLOCK(falling back to0when the nonblocking flag is unavailable), then retain the descriptor's existingisFile()check and cleanup. Regular-file reads and upload-size limits are unchanged.Page.locator().setInputFiles()regressions for a real FIFO and a symlink to it. The tests verify rejection before any RPC and unblock the old implementation during cleanup, so a regression does not leave a blocked filesystem worker behind. FIFO tests are skipped on Windows.test plan
Local checks on macOS arm64; pnpm 11.11.0 uses Node 24.22.1:
b7a4b899(blocked after 1 second); the full object-wrapper file passes 91 tests with the fix.packageContract.test.tsat its temporary consumer'spnpm exec tsc ... verify.tsstep. It also fails at the same step in a clean, detachedb7a4b899worktree after rebuilding that unmodified SDK; it is not reported as passing here.pnpm buildpassed.pnpm checkpassed all 49 tasks (format, lint and types). Changeset/changelog/version checks passed.The full monorepo test/evaluation suite and Linux/Windows execution were not run locally. No claim of merge or upstream CI approval.
AI assistance: OpenAI Codex assisted with source inspection, reproduction, implementation and validation. The prior Python FIFO fix in #2559 provided useful cross-SDK context.
Summary by cubic
Fixes
setInputFilesblocking indefinitely when the path points to a FIFO (or symlink to one) on POSIX. Local paths are now opened withO_NONBLOCKbefore the file-type check, so the existingTypeError("setInputFiles(): expected a file")rejection fires without waiting. Regular file uploads are unaffected. Adds regressions for direct and symlinked FIFOs (skipped on Windows) and a patch changeset.Written for commit fa90e9e. Summary will update on new commits.