Skip to content

feat: add --skip-acceleration-wait flag to skip image acceleration po…#158

Open
mozhou52 wants to merge 1 commit into
masterfrom
skip-acceleration-wait
Open

feat: add --skip-acceleration-wait flag to skip image acceleration po…#158
mozhou52 wants to merge 1 commit into
masterfrom
skip-acceleration-wait

Conversation

@mozhou52
Copy link
Copy Markdown
Collaborator

@mozhou52 mozhou52 commented Jun 1, 2026

…lling after deploy

Summary by CodeRabbit

  • New Features

    • Added a deploy option to skip image acceleration waiting so deployments can bypass image-acceleration waits.
  • Documentation

    • Help text updated to document the new --skip-acceleration-wait CLI flag.
  • Tests

    • Added and updated tests covering skip-acceleration-wait behavior across deploy flows and function readiness checks.

@mozhou52 mozhou52 requested a review from rsonghuster June 1, 2026 02:43
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5f590ff6-a895-4364-a64d-99118e277077

📥 Commits

Reviewing files that changed from the base of the PR and between 0190158 and 396a27d.

📒 Files selected for processing (7)
  • __tests__/ut/commands/deploy/deploy_test.ts
  • __tests__/ut/commands/deploy/impl/function_test.ts
  • __tests__/ut/resources/fc/index_test.ts
  • src/commands-help/deploy.ts
  • src/resources/fc/index.ts
  • src/subCommands/deploy/impl/function.ts
  • src/subCommands/deploy/index.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/commands-help/deploy.ts
  • src/subCommands/deploy/index.ts
  • src/subCommands/deploy/impl/function.ts
  • src/resources/fc/index.ts

📝 Walkthrough

Walkthrough

Adds a --skip-acceleration-wait flag that threads from CLI parse and help into Service and FC deploy logic; FC's deploy/untilFunctionStateOK accept the flag and, when true for custom-container runtimes, skip the image acceleration wait. Tests updated accordingly.

Changes

Skip Acceleration Wait Feature

Layer / File(s) Summary
CLI flag parsing and help text
src/subCommands/deploy/index.ts, src/commands-help/deploy.ts
The deploy command parses the new --skip-acceleration-wait boolean flag and documents it in help text, then passes it as skipAccelerationWait to the Service constructor.
Service class property and forwarding
src/subCommands/deploy/impl/function.ts
Service class adds a readonly skipAccelerationWait property, initializes it from constructor options, and forwards it into fcSdk.deployFunction calls.
FC SDK skip logic in deployFunction and untilFunctionStateOK
src/resources/fc/index.ts
deployFunction accepts and forwards skipAccelerationWait to untilFunctionStateOK. When set for custom container runtime, the method logs and returns early instead of polling for readiness. Both CREATE and UPDATE paths now pass the flag.
Test assertions for skipAccelerationWait behavior
__tests__/ut/commands/deploy/*, __tests__/ut/resources/fc/index_test.ts
Constructor and run tests assert default undefined behavior and verify skipAccelerationWait: true is forwarded; FC tests add cases asserting the skip path logs and avoids getFunction, and several deploy tests now pass skipAccelerationWait: undefined in expectations.

🎯 3 (Moderate) | ⏱️ ~20 minutes

"I nibbled at flags, I hopped through code,
From CLI burrow to FC road,
If acceleration's a bother, just say so true,
I'll skip and dance — quick deploy, off you go! 🐰"

🚥 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 title clearly summarizes the main change: adding a CLI flag to skip image acceleration waiting, which is the primary objective of this PR.
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 skip-acceleration-wait

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.

@mozhou52 mozhou52 force-pushed the skip-acceleration-wait branch from 0190158 to b2322fe Compare June 1, 2026 02:46
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

🧹 Nitpick comments (1)
__tests__/ut/commands/deploy/impl/function_test.ts (1)

246-273: ⚡ Quick win

Add one custom-container runtime case for skipAccelerationWait.

This test verifies option forwarding, but it never exercises the acceleration-specific branch because runtime stays nodejs12. Add a case with runtime: 'custom-container' and customContainerConfig.image to validate the intended behavior path.

🤖 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 `@__tests__/ut/commands/deploy/impl/function_test.ts` around lines 246 - 273,
The test currently never exercises the acceleration branch; update the test case
in function_test (the 'should pass skipAccelerationWait to deployFunction' spec)
to set service runtime to 'custom-container' and provide a
customContainerConfig.image so the code takes the custom-container acceleration
path—e.g., after creating Service(mockInputs, { ...mockOpts,
skipAccelerationWait: true }) set Object.defineProperty(service, 'runtime', {
value: 'custom-container', writable: true }) and set
service.customContainerConfig = { image: 'test/image:latest' } (or via
Object.defineProperty) before calling service.run(), then assert
service.fcSdk.deployFunction was called with expect.objectContaining({
skipAccelerationWait: true }) as before.
🤖 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/resources/fc/index.ts`:
- Around line 96-100: The skip-acceleration-wait log dereferences
config.customContainerConfig.image without ensuring customContainerConfig
exists; update the block guarded by skipAccelerationWait (the conditional using
skipAccelerationWait and logger.info) to first check that
config.customContainerConfig and config.customContainerConfig.image are defined
and only include the image in the log when present, otherwise log a fallback
message (e.g., reference to custom container image unavailable) so that invoking
skipAccelerationWait doesn't throw when customContainerConfig is unset.

---

Nitpick comments:
In `@__tests__/ut/commands/deploy/impl/function_test.ts`:
- Around line 246-273: The test currently never exercises the acceleration
branch; update the test case in function_test (the 'should pass
skipAccelerationWait to deployFunction' spec) to set service runtime to
'custom-container' and provide a customContainerConfig.image so the code takes
the custom-container acceleration path—e.g., after creating Service(mockInputs,
{ ...mockOpts, skipAccelerationWait: true }) set Object.defineProperty(service,
'runtime', { value: 'custom-container', writable: true }) and set
service.customContainerConfig = { image: 'test/image:latest' } (or via
Object.defineProperty) before calling service.run(), then assert
service.fcSdk.deployFunction was called with expect.objectContaining({
skipAccelerationWait: true }) as before.
🪄 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: 979af726-745c-4b91-84cb-ee1e1fd3aeba

📥 Commits

Reviewing files that changed from the base of the PR and between 4ca1c1b and 0190158.

📒 Files selected for processing (5)
  • __tests__/ut/commands/deploy/impl/function_test.ts
  • src/commands-help/deploy.ts
  • src/resources/fc/index.ts
  • src/subCommands/deploy/impl/function.ts
  • src/subCommands/deploy/index.ts

Comment thread src/resources/fc/index.ts
Comment on lines +96 to +100
if (skipAccelerationWait) {
logger.info(
`Skip waiting for ${config.customContainerConfig.image} optimization. The function will be available for invocation once the image acceleration process is complete.`,
);
return;
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

Guard customContainerConfig.image before skip-log access.

Line 98 dereferences config.customContainerConfig.image, but config-only deploy can unset customContainerConfig before this method is called (see Line 297 + Line 300). That can throw at runtime and break --skip-acceleration-wait on custom-container functions.

Proposed fix
-      if (skipAccelerationWait) {
+      const image = _.get(config, 'customContainerConfig.image', 'custom-container image');
+      if (skipAccelerationWait) {
         logger.info(
-          `Skip waiting for ${config.customContainerConfig.image} optimization. The function will be available for invocation once the image acceleration process is complete.`,
+          `Skip waiting for ${image} optimization. The function will be available for invocation once the image acceleration process is complete.`,
         );
         return;
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (skipAccelerationWait) {
logger.info(
`Skip waiting for ${config.customContainerConfig.image} optimization. The function will be available for invocation once the image acceleration process is complete.`,
);
return;
const image = config.customContainerConfig?.image ?? 'custom-container image';
if (skipAccelerationWait) {
logger.info(
`Skip waiting for ${image} optimization. The function will be available for invocation once the image acceleration process is complete.`,
);
return;
}
🤖 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/resources/fc/index.ts` around lines 96 - 100, The skip-acceleration-wait
log dereferences config.customContainerConfig.image without ensuring
customContainerConfig exists; update the block guarded by skipAccelerationWait
(the conditional using skipAccelerationWait and logger.info) to first check that
config.customContainerConfig and config.customContainerConfig.image are defined
and only include the image in the log when present, otherwise log a fallback
message (e.g., reference to custom container image unavailable) so that invoking
skipAccelerationWait doesn't throw when customContainerConfig is unset.

…lling after deploy

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mozhou52 mozhou52 force-pushed the skip-acceleration-wait branch from b2322fe to 396a27d Compare June 1, 2026 05:16
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