You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(platform): share parameter field helpers with daemonclient - #1558
Export PrepareParameters, ParameterFields, RenderParameters, and ParameterTypeBoolean from pkg/platform/form.
Delete the verbatim copy of those helpers, plus FieldParameter and paramTypeBoolean, from pkg/client/clientimplementation/daemonclient/form.go (about 120 lines). Daemonclient now calls form.*.
No behaviour change. Daemonclient's parameterField defaults empty Type to "string", which reaches the same stringParameterField path as the default: branch in platform/form.
Why
Two verbatim copies of about 110 lines of parameter form code drift independently. This follows #1550, which shared the option pickers the same way. Only the helpers are unified here; create and update flows are untouched.
Validation
mise run cli:format (no diff)
mise run cli:lint:ci (0 issues)
go build ./...
go test ./pkg/platform/... ./pkg/client/... (pass)
Eligible: yes. Non-test changed lines: 163 (21 added + 142 deleted) across 2 files. Behaviour-preserving, no restricted paths, no tests removed, no lint rules disabled. Merge decision left to the coordinator.
Next
Unify create and update flows between daemonclient/form.go and platform/form/form.go. Not identical yet: daemonclient create sets Target.Cluster, platform/form does not. Daemonclient's fieldParametersWithValues, assignParameterValue, and assignBoolValue still duplicate platform's buildFieldParameters, assignFieldValue, and assignBoolFieldValue.
AI assistance
AI tools were used: omp agent, anthropic/claude-haiku-5-5. Used for the refactor, validation runs, and the PR body. Change is a mechanical move plus call-site rewrites.
Summary by CodeRabbit
Refactor
Parameter forms for creating and updating instances continue to use the same defaults, existing-value selection, error handling, and YAML output. The change does not alter the behavior users see when filling out or submitting these forms.
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
📝 Walkthrough
The shared form package now exports its parameter form helpers and boolean type constant. Daemon client flows for new instances and instance updates use these helpers instead of local parameter form implementations.
Changes: Parameter Form Reuse
Layer / File(s)
Summary
Export shared parameter form helpers pkg/platform/form/form.go
The parameter preparation, field construction, and rendering helpers, plus the boolean type constant, are exported. Internal call sites use the exported names without behavior changes.
Use shared helpers in daemon client pkg/client/clientimplementation/daemonclient/form.go
New-instance and instance-update flows use the shared helpers. The local parameter form implementation is removed, and error propagation remains in place.
This PR moves daemon parameter forms to shared helpers while preserving defaults, existing values, boolean handling, and error propagation. No actionable merge risk was identified.
Security architecture risk:⚪ Minimal · up to f6dbb
The shared helpers preserve the existing parameter handling and error behavior. The reviewed change does not introduce a new network entrypoint, increase privileges, or change when workspace changes are applied.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The changed execution path remains within the existing workspace create and update parameter flows. Source comparison identifies no new caller with greater authority, different project or cluster scope, or additional sensitive sink; exported package visibility alone does not expand remote attacker reachability.
Trust Boundaries and Controls
observed — Template and project selection remain in the existing client flows. The new helper calls receive parameter data rather than a privileged client or identity, so delegation does not transfer additional service authority into the shared helper contract.
Resilience and Maintainability Implications
observed — Form cancellation or resolution and rendering errors return before instance construction or update application. Each flow defers context cancellation. Successful updates modify a deep copy rather than the input instance, and the refactor adds no shared mutable parameter store or new persistence transition.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 2 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main refactor: sharing parameter field helpers with daemonclient.
Description check
The description explains the change, rationale, behavior impact, validation commands, AI assistance, and follow-up scope. It omits several template headings and checkboxes, but the core information is…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the change, rationale, behavior impact, validation commands, AI assistance, and follow-up scope. It omits several template headings and checkboxes, but the core information is complete enough for review.
Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PrepareParameters,ParameterFields,RenderParameters, andParameterTypeBooleanfrompkg/platform/form.FieldParameterandparamTypeBoolean, frompkg/client/clientimplementation/daemonclient/form.go(about 120 lines). Daemonclient now callsform.*.parameterFielddefaults emptyTypeto"string", which reaches the samestringParameterFieldpath as thedefault:branch in platform/form.Why
Two verbatim copies of about 110 lines of parameter form code drift independently. This follows #1550, which shared the option pickers the same way. Only the helpers are unified here; create and update flows are untouched.
Validation
mise run cli:format(no diff)mise run cli:lint:ci(0 issues)go build ./...go test ./pkg/platform/... ./pkg/client/...(pass)CodeRabbit CLI
coderabbit review --agent --committedonf6dbb8ac0: completed, 0 findings, 2 files reviewed.Auto-merge
Eligible: yes. Non-test changed lines: 163 (21 added + 142 deleted) across 2 files. Behaviour-preserving, no restricted paths, no tests removed, no lint rules disabled. Merge decision left to the coordinator.
Next
Unify create and update flows between
daemonclient/form.goandplatform/form/form.go. Not identical yet: daemonclient create setsTarget.Cluster, platform/form does not. Daemonclient'sfieldParametersWithValues,assignParameterValue, andassignBoolValuestill duplicate platform'sbuildFieldParameters,assignFieldValue, andassignBoolFieldValue.AI assistance
AI tools were used: omp agent, anthropic/claude-haiku-5-5. Used for the refactor, validation runs, and the PR body. Change is a mechanical move plus call-site rewrites.
Summary by CodeRabbit