Skip to content

fix(qov-2191): plan blueprint Terraform variable updates - #2932

Open
rmnbrd wants to merge 1 commit into
stagingfrom
t3code/plan-blueprint-variable-updates
Open

fix(qov-2191): plan blueprint Terraform variable updates#2932
rmnbrd wants to merge 1 commit into
stagingfrom
t3code/plan-blueprint-variable-updates

Conversation

@rmnbrd

@rmnbrd rmnbrd commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Issue: QOV-2191

  • Make Terraform variable updates on blueprint-backed services generate a plan instead of applying immediately.
  • Preserve the existing immediate-save behavior for non-blueprint Terraform services.
  • Refactor blueprint service creation and agent task flows around the new summary step and creation mutation.
  • Remove the agent task execution-mode setting and simplify related settings sections.
  • Update websocket, service-edit, blueprint-flow, and agent task tests to cover the revised behavior.

Screenshots / Recordings

Not applicable.

Testing

  • Changes tested locally in the relevant Console's pages and Storybooks
  • yarn test or yarn test -u (if you need to regenerate snapshots)
  • yarn format
  • yarn lint

PR Checklist

  • I followed naming, styling, and TypeScript rules (see .cursor/rules)
  • I performed a self-review (diff inspected, dead code removed)
  • I titled the PR using Conventional Commits with a scope when possible (e.g. feat(service): add new Terraform service) - required for semantic-release
  • I only kept necessary comments, written in English (watch for useless AI comments)
  • I involved a designer to validate UI changes if I am not a designer
  • I covered new business logic with tests (unit)
  • I confirmed CI is green (Codecov red can be accepted)
  • I reviewed and executed locally any AI-assisted code

Summary by cubic

Terraform variable updates on blueprint-backed services now generate a plan instead of applying immediately. Non-blueprint Terraform services keep the immediate update behavior.

  • useEditService accepts planTerraformChanges, which triggers a Terraform plan and updates the success notification copy.
  • The Terraform variables form passes the flag when the service has a blueprint_id.
  • Adds tests for both the planned and default deployment actions.

Written for commit 612f039. Summary will update on new commits.

Review in cubic

- Offer a Terraform plan before applying blueprint-backed variable changes
- Cover planned and default deployment actions with tests
Copilot AI lite review requested due to automatic review settings September 3, 2026 12:33
@nx-cloud

nx-cloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 612f039

Command Status Duration Result
nx run console:build --parallel=3 --configurati... ✅ Succeeded 59s View ↗
nx affected --target=test --parallel=3 --config... ✅ Succeeded 2m 30s View ↗
nx affected --target=lint --parallel=3 ✅ Succeeded 2m 59s View ↗
nx-cloud record -- yarn nx format:check ✅ Succeeded 4s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-03 12:41:17 UTC

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.

🟡 Changes recommended

The new test file’s React Query mock should preserve actual exports, and an additional regression test should cover the “plan flag + non-Terraform service type” path to prevent future breakage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the service-edit mutation success flow so blueprint-backed Terraform variable changes encourage running a Terraform plan (preview) rather than the default “update/apply” action, aligning variable updates with the blueprint workflow.

Changes:

  • Extend useEditService with an opt-in planTerraformChanges flag that switches the post-save action to TerraformDeployRequestActionEnum.PLAN for Terraform services.
  • Add unit tests for the new planning behavior in useEditService.
  • Enable the new behavior for Terraform variables on blueprint-backed services by wiring the flag based on service.blueprint_id.
File summaries
File Description
libs/domains/services/feature/src/lib/hooks/use-edit-service/use-edit-service.ts Adds conditional “Plan” action for Terraform updates when planTerraformChanges is enabled.
libs/domains/services/feature/src/lib/hooks/use-edit-service/use-edit-service.spec.ts Introduces tests covering the plan-vs-update notification behavior.
apps/console/src/routes/_authenticated/organization/$organizationId/project/$projectId/environment/$environmentId/service/$serviceId/variables/terraform.tsx Enables planning behavior for blueprint-backed Terraform services by passing planTerraformChanges.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

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

Comment on lines +9 to +15
jest.mock('@tanstack/react-query', () => ({
useMutation: (_mutation: unknown, options: unknown) => {
mockMutationOptions = options
return {}
},
useQueryClient: () => ({ invalidateQueries: mockInvalidateQueries }),
}))
Comment on lines +84 to +89
expect(mockDeployService).toHaveBeenCalledWith({
serviceId: 'service-id',
serviceType: 'TERRAFORM',
})
})
})
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 45.68%. Comparing base (b06e033) to head (612f039).
⚠️ Report is 4 commits behind head on staging.

Files with missing lines Patch % Lines
...src/lib/hooks/use-edit-service/use-edit-service.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #2932      +/-   ##
===========================================
- Coverage    49.57%   45.68%   -3.90%     
===========================================
  Files         1301      501     -800     
  Lines        27958    13456   -14502     
  Branches      8163     4162    -4001     
===========================================
- Hits         13861     6147    -7714     
+ Misses       11760     6235    -5525     
+ Partials      2337     1074    -1263     
Flag Coverage Δ
unittests 45.68% <85.71%> (-3.90%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 3 files

Confidence score: 5/5

  • libs/domains/services/feature/src/lib/hooks/use-edit-service/use-edit-service.spec.ts lacks coverage for planTerraformChanges: true with a non-TERRAFORM serviceType, leaving a low-severity regression gap where other service types could incorrectly trigger planning prompts; add this regression case.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="libs/domains/services/feature/src/lib/hooks/use-edit-service/use-edit-service.spec.ts">

<violation number="1" location="libs/domains/services/feature/src/lib/hooks/use-edit-service/use-edit-service.spec.ts:47">
P3: Add a regression case with `planTerraformChanges: true` and a non-`TERRAFORM` `serviceType`; this suite currently cannot catch accidental planning prompts for other service types.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

const options = mockMutationOptions as EditServiceMutationOptions
return options.meta.notifyOnSuccess(undefined, {
serviceId: 'service-id',
payload: { serviceType: 'TERRAFORM' },

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.

P3: Add a regression case with planTerraformChanges: true and a non-TERRAFORM serviceType; this suite currently cannot catch accidental planning prompts for other service types.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At libs/domains/services/feature/src/lib/hooks/use-edit-service/use-edit-service.spec.ts, line 47:

<comment>Add a regression case with `planTerraformChanges: true` and a non-`TERRAFORM` `serviceType`; this suite currently cannot catch accidental planning prompts for other service types.</comment>

<file context>
@@ -0,0 +1,89 @@
+  const options = mockMutationOptions as EditServiceMutationOptions
+  return options.meta.notifyOnSuccess(undefined, {
+    serviceId: 'service-id',
+    payload: { serviceType: 'TERRAFORM' },
+  })
+}
</file context>

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.

2 participants