feat: add micro-sandbox runtime support#156
Conversation
micro-sandbox uses container images like custom-container runtime, requiring getFunction polling until state becomes Active after deploy.
📝 WalkthroughWalkthroughThis 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. ChangesMicro-sandbox runtime support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (7)
__tests__/ut/resources/fc/impl/utils_test.tspackage.jsonpublish.yamlsrc/interface/base.tssrc/resources/fc/impl/utils.tssrc/schema.jsonsrc/subCommands/local/index.ts
| case 'custom-container': | ||
| case 'micro-sandbox': { | ||
| const customContainerLocalInvoker = new CustomContainerLocalInvoke(inputs); | ||
| await customContainerLocalInvoker.invoke(); | ||
| break; |
There was a problem hiding this comment.
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).
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
micro-sandboxruntime option for serverless function deployment and local development.micro-sandboxruntime now works with local invocation and start commands.Tests
Chores
0.1.22.