-
Notifications
You must be signed in to change notification settings - Fork 46
Add exists() method to check file/directory existence #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements a new exists() method across the entire SDK stack that checks whether a file or directory exists at a given path. The method returns a boolean similar to Python's os.path.exists() and JavaScript's fs.existsSync(). Implementation: - Add FileExistsResult and FileExistsRequest types to shared package - Add /api/exists endpoint handler in container layer - Add exists() method to FileClient in SDK layer - Expose exists() through Sandbox class and ExecutionSession wrapper - Update ISandbox and ExecutionSession interfaces Testing: - Add unit tests for FileClient.exists() - Add unit tests for FileHandler.handleExists() - Add E2E test for file and directory existence checks - Add endpoint to E2E test worker 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Naresh <[email protected]>
🦋 Changeset detectedLatest commit: 7a42d7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Claude Code ReviewOverall Assessment: Implementation looks good - clean architecture, proper typing, and thorough test coverage. Issue Foundfile-handler.ts:54 - Missing newline at end of file. The file ends with Minor Observations
|
|
@claude following up on your code review comment on this PR
|
|
Claude finished @ghostwriternr's task —— View job Code review feedback addressedAll issues have been fixed and changes pushed to the PR branch. Tasks Completed
Issues Fixed1. TypeScript Compilation Error (packages/sandbox-container/src/handlers/file-handler.ts:16) The CI build was failing because Fixed: Updated import to use 2. Missing sessionId Parameter (packages/shared/src/types.ts:658) The Fixed: Added 3. Error Handling Issue (packages/sandbox-container/src/services/file-service.ts:723-735) The Fixed: Now properly propagates errors when command execution fails, using Changes MadeCommit:
All fixes follow the project's established patterns:
The CI should now pass - the TypeScript compilation error is resolved and the implementation properly handles errors across all three layers (SDK → DO → Container). --- | View commit |
Address code review feedback on PR #152: - Fix TypeScript compilation by importing FileExistsRequest from @repo/shared - Add sessionId parameter to ISandbox.exists() for API consistency - Fix error handling to propagate execution failures properly Co-authored-by: Naresh <[email protected]>
|
@claude I don't think you ran |
|
Claude finished @ghostwriternr's task —— View job Test failure fixedThe unit test failure has been fixed and changes pushed to the PR branch. Tasks Completed
Issue Found & FixedThe test Root cause: The original implementation treated execution failures defensively - returning
My mistake: In commit c6c6068, I changed it to propagate errors when Fix applied: Reverted the error handling in Changes MadeCommit: The exists() method now correctly treats execution failures as "file doesn't exist" rather than propagating errors, matching the expected behavior and fixing the failing test. |
Revert error propagation change from c6c6068. The exists() method should treat command execution failures as 'file does not exist' rather than propagating errors, matching standard behavior in Python's os.path.exists() and JavaScript's fs.existsSync(). This fixes the failing unit test: FileService > exists > should handle execution failures gracefully Co-authored-by: Naresh <[email protected]>
|
@claude e2e test failing. check the logs from the latest run using gh cli. |
|
Claude finished @ghostwriternr's task —— View job E2E test failure fixedTasks Completed
Issue Found & FixedThe e2e test " Root Cause: The Fix Applied: Added the missing route registration for Changes MadeCommit: The |
The exists() endpoint handler was implemented but the route was never registered in the container's router setup, causing e2e tests to fail with HTTP 500 errors. This adds the missing route registration for POST /api/exists to the file handler in routes/setup.ts. Co-authored-by: Naresh <[email protected]>
Closes #146
Implements a new
exists()method across the entire SDK stack that checks whether a file or directory exists at a given path. The method returns a boolean similar to Python'sos.path.exists()and JavaScript'sfs.existsSync().Changes
FileExistsResultandFileExistsRequesttypes to shared package/api/existsendpoint handler in container layerexists()method to FileClient in SDK layerexists()through Sandbox class and ExecutionSession wrapperTesting
API Usage
Generated with Claude Code