Skip to content

feat: add micro-sandbox runtime support#156

Open
rsonghuster wants to merge 1 commit into
masterfrom
feat/micro-sandbox-runtime
Open

feat: add micro-sandbox runtime support#156
rsonghuster wants to merge 1 commit into
masterfrom
feat/micro-sandbox-runtime

Conversation

@rsonghuster
Copy link
Copy Markdown
Contributor

@rsonghuster rsonghuster commented May 25, 2026

micro-sandbox uses container images like custom-container runtime, requiring getFunction polling until state becomes Active after deploy.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for the micro-sandbox runtime option for serverless function deployment and local development.
    • micro-sandbox runtime now works with local invocation and start commands.
  • Tests

    • Added unit test coverage for the new runtime validation.
  • Chores

    • Updated dependencies and component version to 0.1.22.

Review Change Stack

micro-sandbox uses container images like custom-container runtime,
requiring getFunction polling until state becomes Active after deploy.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

📝 Walkthrough

Walkthrough

This PR adds support for a new 'micro-sandbox' runtime by extending type definitions, schema validation, utility functions, and local command routing to treat it identically to 'custom-container'. Version updates align the dependency and component versions with the change.

Changes

Micro-sandbox runtime support

Layer / File(s) Summary
Runtime type and utility function
src/interface/base.ts, src/resources/fc/impl/utils.ts, __tests__/ut/resources/fc/impl/utils_test.ts
Runtime enum gains 'micro-sandbox' member. isCustomContainerRuntime() returns true for both 'custom-container' and 'micro-sandbox'. Test verifies the function recognizes the new runtime.
Schema type and conditional validation
src/schema.json
IRuntime runtime enum adds "micro-sandbox" option. Schema conditional that requires customContainerConfig broadens from matching only "custom-container" to matching both "custom-container" and "micro-sandbox".
Local command routing
src/subCommands/local/index.ts
ComponentLocal.invoke and ComponentLocal.start route both 'custom-container' and 'micro-sandbox' runtimes to CustomContainerLocalInvoke and CustomContainerLocalStart respectively.
Version and dependency updates
package.json, publish.yaml
@alicloud/fc20230330 dependency bumped from 4.7.4 to 4.7.5. Component version incremented from 0.1.21 to 0.1.22.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A sandbox so micro, yet mighty and true,
We've treated it custom, like containers do.
From types to the schema, the routing flows bright,
A new runtime blooms in the Alibaba light! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat: add micro-sandbox runtime support' clearly and concisely summarizes the main change across all modified files, which collectively add support for the new micro-sandbox runtime throughout the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/micro-sandbox-runtime

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/subCommands/local/index.ts`:
- Around line 86-90: The routing sends 'micro-sandbox' to the CustomContainer
flows but the guard in baseLocal.ts only recognizes 'custom-container', causing
guard failures; update the runtime check used in the custom container guard
inside src/subCommands/local/impl/baseLocal.ts (the method that validates
runtime before invoke/start) to accept both 'custom-container' and
'micro-sandbox' (e.g., check runtime === 'custom-container' || runtime ===
'micro-sandbox') or centralize the mapping so the guard and the switch routing
(where CustomContainerLocalInvoke is constructed) use the same canonical runtime
values (CustomContainerLocalInvoke, the guard method in baseLocal.ts).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3582b2a8-e946-4a74-bab3-7fa51339d56e

📥 Commits

Reviewing files that changed from the base of the PR and between c56b0ed and d147219.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • __tests__/ut/resources/fc/impl/utils_test.ts
  • package.json
  • publish.yaml
  • src/interface/base.ts
  • src/resources/fc/impl/utils.ts
  • src/schema.json
  • src/subCommands/local/index.ts

Comment on lines +86 to 90
case 'custom-container':
case 'micro-sandbox': {
const customContainerLocalInvoker = new CustomContainerLocalInvoke(inputs);
await customContainerLocalInvoker.invoke();
break;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix micro-sandbox/custom-container guard mismatch before routing.

At Line 87 and Line 161, micro-sandbox is routed to custom-container handlers, but downstream src/subCommands/local/impl/baseLocal.ts still treats only 'custom-container' as custom-container runtime. This will trip guard checks (and can throw) in custom-container invoke/start flows.

Suggested fix (root cause)
diff --git a/src/subCommands/local/impl/baseLocal.ts b/src/subCommands/local/impl/baseLocal.ts
@@
   isCustomContainerRuntime(): boolean {
-    return this.inputs.props.runtime === 'custom-container';
+    return (
+      this.inputs.props.runtime === 'custom-container' ||
+      this.inputs.props.runtime === 'micro-sandbox'
+    );
   }

Also applies to: 160-164

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/subCommands/local/index.ts` around lines 86 - 90, The routing sends
'micro-sandbox' to the CustomContainer flows but the guard in baseLocal.ts only
recognizes 'custom-container', causing guard failures; update the runtime check
used in the custom container guard inside
src/subCommands/local/impl/baseLocal.ts (the method that validates runtime
before invoke/start) to accept both 'custom-container' and 'micro-sandbox'
(e.g., check runtime === 'custom-container' || runtime === 'micro-sandbox') or
centralize the mapping so the guard and the switch routing (where
CustomContainerLocalInvoke is constructed) use the same canonical runtime values
(CustomContainerLocalInvoke, the guard method in baseLocal.ts).

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