Skip to content

fix: dont dereference required job agent selector field#47

Merged
adityachoudhari26 merged 1 commit intomainfrom
job-agent-refactor-cleanup
Apr 10, 2026
Merged

fix: dont dereference required job agent selector field#47
adityachoudhari26 merged 1 commit intomainfrom
job-agent-refactor-cleanup

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

@adityachoudhari26 adityachoudhari26 commented Apr 10, 2026

Summary by CodeRabbit

  • Breaking Changes

    • Job Agent Selector is now required when creating or updating deployments (previously optional)
  • New Features

    • Enhanced deployment plan tracking with comprehensive results per deployment target
    • Deployment targets now include detailed environment and resource information
    • Added configurable minimum soak time option for environment progression rules

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

This PR updates deployment schema definitions by renaming a plan target status enum, restructuring deployment plan target modeling with new result tracking, removing job agent fields from deployment requests, and making job agent selector required as a direct string. Example terraform files are reformatted for alignment.

Changes

Cohort / File(s) Summary
Example Files Formatting
examples/argocd-nginx/deployments.tf, examples/deployment-variables/deployments.tf, examples/github-runner/deployments.tf, examples/gradual-rollout/deployments.tf, examples/relationship-variables/deployments.tf, examples/simple-progression/deployments.tf
Whitespace/alignment adjustments to ctrlplane_deployment.this resource attributes (name and resource_selector) for consistent column alignment; no semantic changes.
API Schema Changes
internal/api/client.gen.go
Renamed DeploymentPlanTargetStatus enum to DeploymentPlanTargetResultStatus; removed JobAgentId and JobAgents from deployment requests/models; changed JobAgentSelector from optional pointer to required string; restructured DeploymentPlanTarget with new fields (EnvironmentId, EnvironmentName, HasChanges, ResourceId, ResourceName, Results); added DeploymentPlanTargetResult type; added MinimumSoakTimeMinutes to EnvironmentProgressionRule.
Provider Resource Logic
internal/provider/deployment_resource.go
Updated DeploymentResource.Read to handle JobAgentSelector as a direct string instead of pointer, removing nil checks and dereferencing logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #37: Both PRs modify internal/provider/deployment_resource.go's deployment job-agent selector handling and field mapping logic.
  • PR #19: Both PRs update deployment job-agent surface across internal/api/client.gen.go and internal/provider/deployment_resource.go with model and selector changes.
  • PR #31: Both PRs continue the same migration pattern of converting deployment selector fields to direct strings and updating deployment plan target/result types in the API schema.

Poem

🐰 A schema so tidy, enums renamed with care,
Job agents removed, selectors laid bare,
Results now nested, in structures we trust,
Plan targets evolving—deployment adjustments we must!
With formatting clean, the examples align,
Like rows in a garden, everything's fine! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing unnecessary dereferencing of the JobAgentSelector field that was changed from optional pointer to required string in the API.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 job-agent-refactor-cleanup

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.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/api/client.gen.go`:
- Around line 410-411: The generated comment for the DependsOn field contains an
example CEL expression that ends with an extra period making it invalid; update
the OpenAPI schema/source that defines the description for the "dependsOn"
property (not the generated internal/api/client.gen.go) to remove the trailing
'.' from the example "version.tag.startsWith('v2.')" so the example becomes
valid CEL; regenerate the client so the DependsOn string field's docstring is
fixed in client.gen.go.
🪄 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: c2162f8d-5a7f-4115-b639-f963cd61fc47

📥 Commits

Reviewing files that changed from the base of the PR and between 0073f4b and 552488f.

📒 Files selected for processing (8)
  • examples/argocd-nginx/deployments.tf
  • examples/deployment-variables/deployments.tf
  • examples/github-runner/deployments.tf
  • examples/gradual-rollout/deployments.tf
  • examples/relationship-variables/deployments.tf
  • examples/simple-progression/deployments.tf
  • internal/api/client.gen.go
  • internal/provider/deployment_resource.go

Comment on lines +410 to 411
// DependsOn CEL expression to match upstream deployment(s) that must have a successful release before this deployment can proceed. The expression can reference both deployment properties (deployment.id, deployment.name, deployment.slug, deployment.metadata) and the currently deployed version properties (version.id, version.tag, version.name, version.status, version.metadata, version.createdAt). For example: deployment.name == 'db-migration' && version.tag.startsWith('v2.').
DependsOn string `json:"dependsOn"`
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 | 🟡 Minor

Trim the trailing period from the CEL example.

Line 410 currently ends the example with version.tag.startsWith('v2.').; copied literally, that final . makes the expression invalid CEL. Since this file is generated, fix the OpenAPI description/source comment rather than patching the generated output directly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/api/client.gen.go` around lines 410 - 411, The generated comment for
the DependsOn field contains an example CEL expression that ends with an extra
period making it invalid; update the OpenAPI schema/source that defines the
description for the "dependsOn" property (not the generated
internal/api/client.gen.go) to remove the trailing '.' from the example
"version.tag.startsWith('v2.')" so the example becomes valid CEL; regenerate the
client so the DependsOn string field's docstring is fixed in client.gen.go.

@adityachoudhari26 adityachoudhari26 merged commit ad0a4b6 into main Apr 10, 2026
9 checks passed
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