Skip to content

feat(sdk/js): add OSSFS volume backend support#515

Open
perhapzz wants to merge 1 commit intoalibaba:mainfrom
perhapzz:fix/js-sdk-ossfs-volume-support
Open

feat(sdk/js): add OSSFS volume backend support#515
perhapzz wants to merge 1 commit intoalibaba:mainfrom
perhapzz:fix/js-sdk-ossfs-volume-support

Conversation

@perhapzz
Copy link

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: Add OSSFS interface with full type definitions (bucket, endpoint, version, options, accessKeyId, accessKeySecret)
  • models/sandboxes.ts: Update Volume interface to include ossfs as a third backend option alongside host and pvc
  • sandbox.ts: Update volume validation to check [host, pvc, ossfs] backends
  • index.ts: Export OSSFS type for SDK consumers
  • tests/sandbox.create.test.mjs: Add 3 test cases for OSSFS volumes

Partially addresses #476 (SDK parity gaps — OSSFS support for JavaScript SDK).

Testing

  • Unit tests
  • TypeScript type check (tsc --noEmit passes)
✔ Sandbox.create passes OSSFS volume to request (0.158ms)
✔ Sandbox.create rejects volume with no backend (0.137ms)
✔ Sandbox.create rejects volume with multiple backends (0.141ms)
ℹ tests 8 | pass 8 | fail 0

Breaking Changes

  • None

The Volume interface is extended with an optional ossfs field. Existing code using host or pvc backends is unaffected.

Checklist

  • Linked Issue or clearly described motivation
  • Added/updated docs (if needed)
  • Added/updated tests (if needed)
  • Security impact considered
  • Backward compatibility considered

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)
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant