Skip to content

refactor: fix soak time typo#46

Merged
adityachoudhari26 merged 2 commits intomainfrom
soak-time-typo-refactor
Apr 10, 2026
Merged

refactor: fix soak time typo#46
adityachoudhari26 merged 2 commits intomainfrom
soak-time-typo-refactor

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

@adityachoudhari26 adityachoudhari26 commented Apr 10, 2026

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Policy resource: Renamed environment progression field from minimum_sock_time_minutes to minimum_soak_time_minutes. Update your configurations accordingly.
  • Updates

    • Deployment API: Restructured deployment plan target handling with improved status management and result tracking.
    • Removed deprecated job agent fields from deployment creation and update operations.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

The PR corrects a misspelled field name from "sock time" to "soak time" across documentation, API client models, and Terraform provider schemas. Additionally, it restructures deployment plan target modeling, removes deployment job agent fields, and introduces a new DeploymentPlanTargetResult type for handling result data.

Changes

Cohort / File(s) Summary
Documentation & Schema (Typo Correction)
docs/resources/policy.md, internal/provider/policy_resource.go
Renamed field minimum_sock_time_minutes to minimum_soak_time_minutes in documentation and Terraform provider schema, including struct field tags and tfsdk annotations.
API Client Model Restructuring
internal/api/client.gen.go
Removed JobAgentId and JobAgents fields from deployment requests and response models; changed JobAgentSelector to required string in Deployment; restructured DeploymentPlanTarget by extracting result fields into new DeploymentPlanTargetResult type and adding environment/resource metadata fields; renamed DeploymentPlanTargetStatus enum to DeploymentPlanTargetResultStatus; deprecated MinimumSockTimeMinutes while adding MinimumSoakTimeMinutes to EnvironmentProgressionRule; removed DeploymentJobAgent type.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A sock became a soak, oh what a typo!
Through docs and schemas we hopped to and fro,
Results now nested, so tidy and bright,
Job agents departed—our models take flight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 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: fixing a typo where 'sock time' was corrected to 'soak time' throughout the codebase.

✏️ 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 soak-time-typo-refactor

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
internal/provider/policy_resource.go (1)

432-437: ⚠️ Potential issue | 🟠 Major

Preserve backward compatibility for minimum_sock_time_minutes during migration.

This rename is internally consistent, but it is a breaking Terraform surface change: existing configurations using minimum_sock_time_minutes will fail with unsupported argument after upgrade. Please keep the old key as a deprecated alias for at least one release and map both keys to MinimumSoakTimeMinutes in API payload generation.

Proposed compatibility patch (schema + model + mapping)
@@
- "minimum_soak_time_minutes": schema.Int64Attribute{
+ "minimum_soak_time_minutes": schema.Int64Attribute{
    Optional:    true,
    Computed:    true,
    Description: "Minimum time in minutes to wait after the dependency environment is in a success state",
    Default:     int64default.StaticInt64(0),
  },
+ "minimum_sock_time_minutes": schema.Int64Attribute{
+   Optional:    true,
+   Computed:    true,
+   Description: "Deprecated: use minimum_soak_time_minutes",
+   Default:     int64default.StaticInt64(0),
+ },

@@
 type PolicyEnvironmentProgression struct {
@@
   MinimumSoakTimeMinutes       types.Int64   `tfsdk:"minimum_soak_time_minutes"`
+  MinimumSockTimeMinutes       types.Int64   `tfsdk:"minimum_sock_time_minutes"`
   MaximumAgeHours              types.Int64   `tfsdk:"maximum_age_hours"`
 }

@@
- if int64ValueSet(progression.MinimumSoakTimeMinutes) {
-   val := int32(progression.MinimumSoakTimeMinutes.ValueInt64())
+ soak := progression.MinimumSoakTimeMinutes
+ if !int64ValueSet(soak) && int64ValueSet(progression.MinimumSockTimeMinutes) {
+   soak = progression.MinimumSockTimeMinutes
+ }
+ if int64ValueSet(soak) {
+   val := int32(soak.ValueInt64())
    rule.MinimumSoakTimeMinutes = &val
  }

@@
 model := PolicyEnvironmentProgression{
@@
   MinimumSoakTimeMinutes:       types.Int64Null(),
+  MinimumSockTimeMinutes:       types.Int64Null(),
   MaximumAgeHours:              types.Int64Null(),
 }
@@
 if rule.EnvironmentProgression.MinimumSoakTimeMinutes != nil {
   model.MinimumSoakTimeMinutes = types.Int64Value(int64(*rule.EnvironmentProgression.MinimumSoakTimeMinutes))
+  model.MinimumSockTimeMinutes = model.MinimumSoakTimeMinutes
 }

Also applies to: 818-819, 1068-1070, 1323-1331

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

In `@internal/provider/policy_resource.go` around lines 432 - 437, Rename change
broke backward compatibility for the Terraform attribute; add a deprecated alias
"minimum_sock_time_minutes" in the resource schema alongside the new
"minimum_soak_time_minutes" attribute (mark it Optional, Computed, same Default
and Description but include a deprecation note), update the resource/model
mapping code that populates the API model field MinimumSoakTimeMinutes to read
from either attribute (prefer the new key if both present) and ensure the
payload generator uses model.MinimumSoakTimeMinutes only; apply the same alias
addition and mapping logic to the other occurrences referenced (around the other
three spots) so both keys are accepted for at least one release.
internal/api/client.gen.go (1)

386-399: ⚠️ Potential issue | 🔴 Critical

Don't land this Deployment model change without the provider read-path update.

This regen makes JobAgentSelector a plain string and removes the old deployment job-agent fields. internal/provider/deployment_resource.go still nil-checks/dereferences dep.JobAgentSelector, and the current read flow relies on a dep.JobAgentId branch to preserve Terraform Cloud tokens. As-is, this creates a breaking client/provider mismatch.

Minimum provider-side follow-up
- if dep.JobAgentSelector != nil && *dep.JobAgentSelector != "" {
- 	data.JobAgentSelector = types.StringValue(*dep.JobAgentSelector)
+ if dep.JobAgentSelector != "" {
+ 	data.JobAgentSelector = types.StringValue(dep.JobAgentSelector)
  } else {
  	data.JobAgentSelector = types.StringNull()
  }

The dep.JobAgentId-based token-preservation path also needs a replacement in the same PR.

Based on learnings: token preservation currently depends on the dep.JobAgentId branch in internal/provider/deployment_resource.go.

🤖 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 386 - 399, The generated change to
the Deployment model made JobAgentSelector a plain string and removed prior
job-agent fields, but internal/provider/deployment_resource.go still nil-checks
and dereferences dep.JobAgentSelector and relies on dep.JobAgentId to preserve
tokens; update the provider read-path to match the new model by removing
nil-checks for pointer fields, stop using dep.JobAgentId (or add a new
replacement field) in the token-preservation branch, and implement
token-preservation logic that reads the new JobAgentSelector string (or a new
explicit token-preservation field) so the client and provider stay consistent
(update code paths that reference dep.JobAgentSelector and dep.JobAgentId
accordingly).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@internal/api/client.gen.go`:
- Around line 386-399: The generated change to the Deployment model made
JobAgentSelector a plain string and removed prior job-agent fields, but
internal/provider/deployment_resource.go still nil-checks and dereferences
dep.JobAgentSelector and relies on dep.JobAgentId to preserve tokens; update the
provider read-path to match the new model by removing nil-checks for pointer
fields, stop using dep.JobAgentId (or add a new replacement field) in the
token-preservation branch, and implement token-preservation logic that reads the
new JobAgentSelector string (or a new explicit token-preservation field) so the
client and provider stay consistent (update code paths that reference
dep.JobAgentSelector and dep.JobAgentId accordingly).

In `@internal/provider/policy_resource.go`:
- Around line 432-437: Rename change broke backward compatibility for the
Terraform attribute; add a deprecated alias "minimum_sock_time_minutes" in the
resource schema alongside the new "minimum_soak_time_minutes" attribute (mark it
Optional, Computed, same Default and Description but include a deprecation
note), update the resource/model mapping code that populates the API model field
MinimumSoakTimeMinutes to read from either attribute (prefer the new key if both
present) and ensure the payload generator uses model.MinimumSoakTimeMinutes
only; apply the same alias addition and mapping logic to the other occurrences
referenced (around the other three spots) so both keys are accepted for at least
one release.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2acdf9fc-8441-4f59-a969-525c9fc2e516

📥 Commits

Reviewing files that changed from the base of the PR and between 0073f4b and 0b6d60e.

📒 Files selected for processing (3)
  • docs/resources/policy.md
  • internal/api/client.gen.go
  • internal/provider/policy_resource.go

@adityachoudhari26 adityachoudhari26 merged commit d32d6b2 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