Skip to content

Conversation

@jsbroks
Copy link
Member

@jsbroks jsbroks commented Dec 30, 2025

…ArgoCD and Terraform Cloud dispatchers

Summary by CodeRabbit

  • Refactor

    • Improved internal template data handling to ensure consistent key formatting across dispatching workflows.
  • Chores

    • Code cleanup and optimization for better maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Walkthrough

Introduces a new structToMap() helper function to convert structs into maps with lowercase JSON tag keys. Two job dispatch files (ArgoCD and Terraform Cloud) now use this converted map as template data during execution instead of passing the raw struct. One unused parameter is marked in a version selector function.

Changes

Cohort / File(s) Summary
Job Dispatch Template Data Conversion
apps/workspace-engine/pkg/workspace/jobdispatch/argocd.go, apps/workspace-engine/pkg/workspace/jobdispatch/terraformcloud.go
Adds structToMap() helper function to normalize struct fields to lowercase-keyed maps. Both dispatcher implementations now convert templatable job data to a map before template execution, with error handling added for the conversion step.
Version Selector Unused Parameter
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/versionselector/versionselector.go
Marks first parameter of evaluateCEL() function as explicitly unused by renaming ctx to _.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • chore: templatable release #718: Builds on templatable-release changes by converting the templatable job/release structs into lowercase-key maps for template execution in the same jobdispatch files.
  • chore: init argocd integration #716: Modifies ArgoCD and Terraform Cloud dispatch template logic in the same files, directly related to the template rendering changes in this PR.

Poem

🐰 Structs transform to maps with keys so neat,
Lowercase whispers make templates complete,
From chaos to order, the dispatch flows free,
One unused parameter bows gracefully.

Pre-merge checks and finishing touches

✅ 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: standardizing template data conversion to lowercase keys across dispatchers.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 97d35b6 and 1add8ec.

📒 Files selected for processing (3)
  • apps/workspace-engine/pkg/workspace/jobdispatch/argocd.go
  • apps/workspace-engine/pkg/workspace/jobdispatch/terraformcloud.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/versionselector/versionselector.go
🧰 Additional context used
📓 Path-based instructions (1)
apps/workspace-engine/**/*.go

📄 CodeRabbit inference engine (apps/workspace-engine/CLAUDE.md)

apps/workspace-engine/**/*.go: Do not add extraneous inline comments that state the obvious
Do not add comments that simply restate what the code does
Do not add comments for standard Go patterns (e.g., noting WaitGroup or semaphore usage)
Write comments that explain why, document complex logic/algorithms, provide non-obvious context, include TODO/FIXME, and document exported functions/types/methods

Files:

  • apps/workspace-engine/pkg/workspace/jobdispatch/terraformcloud.go
  • apps/workspace-engine/pkg/workspace/jobdispatch/argocd.go
  • apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/versionselector/versionselector.go
🧠 Learnings (3)
📚 Learning: 2025-08-12T18:13:54.630Z
Learnt from: CR
Repo: ctrlplanedev/ctrlplane PR: 0
File: apps/workspace-engine/CLAUDE.md:0-0
Timestamp: 2025-08-12T18:13:54.630Z
Learning: Applies to apps/workspace-engine/**/*.go : Write comments that explain why, document complex logic/algorithms, provide non-obvious context, include TODO/FIXME, and document exported functions/types/methods

Applied to files:

  • apps/workspace-engine/pkg/workspace/jobdispatch/terraformcloud.go
📚 Learning: 2025-08-12T18:13:54.630Z
Learnt from: CR
Repo: ctrlplanedev/ctrlplane PR: 0
File: apps/workspace-engine/CLAUDE.md:0-0
Timestamp: 2025-08-12T18:13:54.630Z
Learning: Applies to apps/workspace-engine/**/*.go : Do not add comments for standard Go patterns (e.g., noting WaitGroup or semaphore usage)

Applied to files:

  • apps/workspace-engine/pkg/workspace/jobdispatch/terraformcloud.go
📚 Learning: 2025-08-12T18:13:54.630Z
Learnt from: CR
Repo: ctrlplanedev/ctrlplane PR: 0
File: apps/workspace-engine/CLAUDE.md:0-0
Timestamp: 2025-08-12T18:13:54.630Z
Learning: Applies to apps/workspace-engine/pkg/mapping/protobuf_mappings.go : Add mapping functions for the new condition in pkg/mapping/protobuf_mappings.go

Applied to files:

  • apps/workspace-engine/pkg/workspace/jobdispatch/argocd.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build (linux/amd64)
  • GitHub Check: Lint
  • GitHub Check: Typecheck
  • GitHub Check: workspace-engine-tests
  • GitHub Check: tests
🔇 Additional comments (4)
apps/workspace-engine/pkg/workspace/releasemanager/policy/evaluator/versionselector/versionselector.go (1)

113-113: LGTM: Proper unused parameter marking.

Marking the unused context.Context parameter with _ is the standard Go idiom. The function doesn't use the context in its body, so this clearly communicates the parameter is intentionally unused while maintaining the function signature.

apps/workspace-engine/pkg/workspace/jobdispatch/terraformcloud.go (1)

202-209: LGTM: Consistent template data normalization.

The conversion to map-based template data with lowercase keys improves consistency with CEL selectors and verification providers. The error handling properly traces and wraps errors, and the comment provides valuable context for the change.

apps/workspace-engine/pkg/workspace/jobdispatch/argocd.go (2)

103-109: LGTM: Template data standardization implemented correctly.

The conversion to map-based template data with proper error handling maintains consistency with the Terraform Cloud dispatcher. The approach ensures lowercase keys across all template contexts, aligning with CEL selector and verification provider conventions.

Also applies to: 121-121


354-368: LGTM: Clean helper implementation.

The structToMap function provides a straightforward way to normalize template data through JSON serialization. The JSON round-trip correctly produces lowercase keys from struct tags, and the documentation clearly explains the consistency rationale.


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.

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