fix(qov-2191): plan blueprint Terraform variable updates - #2932
Conversation
- Offer a Terraform plan before applying blueprint-backed variable changes - Cover planned and default deployment actions with tests
|
View your CI Pipeline Execution ↗ for commit 612f039
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
🟡 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
useEditServicewith an opt-inplanTerraformChangesflag that switches the post-save action toTerraformDeployRequestActionEnum.PLANfor 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.
| jest.mock('@tanstack/react-query', () => ({ | ||
| useMutation: (_mutation: unknown, options: unknown) => { | ||
| mockMutationOptions = options | ||
| return {} | ||
| }, | ||
| useQueryClient: () => ({ invalidateQueries: mockInvalidateQueries }), | ||
| })) |
| expect(mockDeployService).toHaveBeenCalledWith({ | ||
| serviceId: 'service-id', | ||
| serviceType: 'TERRAFORM', | ||
| }) | ||
| }) | ||
| }) |
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
1 issue found across 3 files
Confidence score: 5/5
libs/domains/services/feature/src/lib/hooks/use-edit-service/use-edit-service.spec.tslacks coverage forplanTerraformChanges: truewith a non-TERRAFORMserviceType, 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' }, |
There was a problem hiding this comment.
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>
Summary
Issue: QOV-2191
Screenshots / Recordings
Not applicable.
Testing
yarn testoryarn test -u(if you need to regenerate snapshots)yarn formatyarn lintPR Checklist
.cursor/rules)feat(service): add new Terraform service) - required for semantic-releaseSummary 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.
useEditServiceacceptsplanTerraformChanges, which triggers a Terraform plan and updates the success notification copy.blueprint_id.Written for commit 612f039. Summary will update on new commits.