feat(sdk/js): add OSSFS volume backend support#515
feat(sdk/js): add OSSFS volume backend support#515perhapzz wants to merge 1 commit intoalibaba:mainfrom
Conversation
Add Alibaba Cloud OSSFS mount backend to the JavaScript/TypeScript sandbox SDK, aligning it with the Python SDK implementation. Changes: - Add OSSFS interface to models/sandboxes.ts with full type definitions (bucket, endpoint, version, options, accessKeyId, accessKeySecret) - Update Volume interface to include ossfs as a third backend option - Update volume validation in sandbox.ts to check [host, pvc, ossfs] - Export OSSFS type from index.ts - Add 3 tests: OSSFS volume creation, no-backend rejection, multi-backend rejection Partially addresses alibaba#476 (SDK parity gaps - OSSFS support)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55704bb598
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (opts.volumes) { | ||
| for (const vol of opts.volumes) { | ||
| const backendsSpecified = [vol.host, vol.pvc].filter((b) => b !== undefined).length; | ||
| const backendsSpecified = [vol.host, vol.pvc, vol.ossfs].filter((b) => b !== undefined).length; |
There was a problem hiding this comment.
Treat null backends as absent when counting volume backends
The new backend count includes vol.ossfs but uses b !== undefined, so a payload like { name, mountPath, ossfs: null } is now treated as having one backend and bypasses the SDK's "none provided" check. This is a regression for OSSFS callers that pass JSON-normalized null optionals (common in plain JS), and it can also incorrectly trigger the "multiple backends" path when ossfs: null is present alongside a real backend. Counting only non-null values (e.g., b != null) keeps validation aligned with server semantics.
Useful? React with 👍 / 👎.
Summary
Add Alibaba Cloud OSSFS mount backend support to the JavaScript/TypeScript sandbox SDK, aligning it with the Python SDK which already supports OSSFS.
Changes:
models/sandboxes.ts: AddOSSFSinterface with full type definitions (bucket,endpoint,version,options,accessKeyId,accessKeySecret)models/sandboxes.ts: UpdateVolumeinterface to includeossfsas a third backend option alongsidehostandpvcsandbox.ts: Update volume validation to check[host, pvc, ossfs]backendsindex.ts: ExportOSSFStype for SDK consumerstests/sandbox.create.test.mjs: Add 3 test cases for OSSFS volumesPartially addresses #476 (SDK parity gaps — OSSFS support for JavaScript SDK).
Testing
tsc --noEmitpasses)Breaking Changes
The
Volumeinterface is extended with an optionalossfsfield. Existing code usinghostorpvcbackends is unaffected.Checklist