Skip to content

fix: Avoid redundant autoscaling start request - #4683

Merged
jwongmongodb merged 3 commits into
masterfrom
CLOUDP-422510
Aug 26, 2026
Merged

fix: Avoid redundant autoscaling start request#4683
jwongmongodb merged 3 commits into
masterfrom
CLOUDP-422510

Conversation

@jwongmongodb

Copy link
Copy Markdown
Collaborator

Summary

Fixes a post-merge issue in the vertical autoscaling support added by #4665.

The provider persists autoscaling through the preceding Create or PATCH request. When a processor is started, it no longer resends the same autoscaling configuration through :startWith, which MMS/SPM treats as an additional autoscaling modification.

Validation

  • go test ./internal/service/streamprocessor -count=1
  • make verify
  • Cloud Dev direct Create → STARTED test using the local provider build
    • Create persisted autoscaling
    • :startWith sent only tier
    • processor reached STARTED successfully

Follow-up

The underlying MMS/SPM :startWith autoscaling path remains a backend issue for direct API clients and is being tracked separately.

processorName = "new-processor-autoscaling-started-" + randomSuffix
)

resource.Test(t, resource.TestCase{

@jwongmongodb jwongmongodb Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this tests the STARTED flow from the CREATE call which is not covered in the TestAccStreamProcessor_withOptionsDLQAutoscaling which calls the STARTED flow in the UPDATE call, which is why this was missed.

This edge case bug only affected the from scratch STARTED state generation, this will be fixed separately internally, but this change is still worth pushing to work in prod and also to clean up the redundant autoscaling config being set.

@jwongmongodb
jwongmongodb marked this pull request as ready for review August 26, 2026 16:30
@jwongmongodb
jwongmongodb requested a review from a team as a code owner August 26, 2026 16:30
Copilot AI lite review requested due to automatic review settings August 26, 2026 16:30
@jwongmongodb
jwongmongodb requested a review from a team as a code owner August 26, 2026 16:30
@augmentcode

augmentcode Bot commented Aug 26, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Fixes redundant autoscaling updates when a stream processor is started.

Changes:

  • Removes top-level autoscaling payload construction from both create and update :startWith requests.
  • Retains tier selection on the start request.
  • Relies on the preceding create or PATCH request to persist autoscaling configuration.
  • Adds acceptance coverage for creating an autoscaling-enabled processor directly in STARTED state.

Technical Notes: This avoids triggering the backend's separate autoscaling-modification behavior while preserving configured min/max tiers.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a regression in stream processor vertical autoscaling where the provider was redundantly re-sending autoscaling configuration on the :startWith request, which MMS/SPM interprets as an additional autoscaling modification. The change ensures autoscaling is persisted only via the preceding Create/PATCH request, and :startWith sends only tier when starting.

Changes:

  • Stop sending autoscaling configuration on StreamsAPI.StartStreamProcessorWith during both Create and Update start flows.
  • Add an acceptance test covering the “Create → STARTED with autoscaling configured” path.
  • Add a bugfix release note entry.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/service/streamprocessor/resource.go Removes autoscaling from :startWith payload in Create/Update start logic to avoid redundant autoscaling modifications.
internal/service/streamprocessor/resource_test.go Adds acceptance coverage for creating a processor directly into STARTED with autoscaling configured.
.changelog/4683.txt Documents the bugfix in release notes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +199 to +203
func TestAccStreamProcessor_withOptionsDLQAutoscalingCreateStarted(t *testing.T) {
var (
projectID, workspaceName = acc.ProjectIDExecutionWithStreamInstance(t)
_, clusterName = acc.ClusterNameExecution(t, false)
randomSuffix = acctest.RandString(5)
@github-actions

Copy link
Copy Markdown
Contributor

APIx bot: a message has been sent to Docs Slack channel

@github-actions github-actions Bot added the bug label Aug 26, 2026

@AgustinBettati AgustinBettati left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread .changelog/4683.txt Outdated
@@ -0,0 +1,3 @@
```release-note:bug

@AgustinBettati AgustinBettati Aug 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it safe to say this bug never existed for users (autoscaling has not yet been released)? In that case would avoid this changelog, we can use skip changelog entry for passing the CI check

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yea this never existed before this, it only affected the most recent autoscaling config. Granted I only tested in DEV so it may be a timing issue. But its still good to remove the redundant autoscaling config from being set

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In that case I would remove this changelog entry to avoid confusion on the user side

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

okay, this is now removed

Comment on lines -114 to -120
// On the :startWith endpoint, `autoscaling` is TOP-LEVEL (no options wrapper).
autoscaling, diags := autoscalingFromOptions(ctx, plan.Options)
if diags.HasError() {
resp.Diagnostics.Append(diags...)
return
}
startWithOptions.Autoscaling = autoscaling

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

to understand, was this additional property simply redundant, or actually causing a failures? And what would be the change planned on the API side?

@jwongmongodb jwongmongodb Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is redundant, but there appears to be a race condition with the service that the api calls when the autoscaling payload was included. I believe that this 404 returned in the endpoint call is a bug that we will fix. But it's good to also remove the redundant config and fix this error path in the meantime. My understanding that any payload sent the startsWithOptions in this flow will trigger this issue: here is the ticket filed

@jwongmongodb
jwongmongodb merged commit 6b631a2 into master Aug 26, 2026
58 of 61 checks passed
@jwongmongodb
jwongmongodb deleted the CLOUDP-422510 branch August 26, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants