OSAC-1552: Reject creation when required editable field has no value - #709
Conversation
When a catalog item field definition is editable with no default value, and the user does not provide a value, return InvalidArgument instead of silently accepting the request. This prevents clusters and compute instances from failing later during AAP provisioning with confusing errors. Assisted-by: Claude Code <noreply@anthropic.com> Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Elad Tabak <etabak@redhat.com>
|
@tzvatot: This pull request references OSAC-1552 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: osac-project/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesRequired-field enforcement in
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Drop strPtr helper in favor of local variable + & pattern used by the rest of the package. Add test for multiple field definitions where one required field is missing among fields with defaults. Assisted-by: Claude Code <noreply@anthropic.com> Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Elad Tabak <etabak@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhernand, tzvatot The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
OSAC-1552: Reject creation when required editable field has no value
Jira: https://redhat.atlassian.net/browse/OSAC-1552
Summary
When a catalog item defines an editable field with no default value (e.g.,
pull_secret), and the user creates a cluster or compute instance without providing that field, the server now rejects the request immediately withInvalidArgument. Previously, the request was silently accepted and failed later during AAP provisioning with a confusing error.Changes
internal/servers/catalog_item_validation.go- InapplyFieldDefinitions(), when an editable field has no default and the user provides no value, returnInvalidArgumentwith a message identifying the missing fieldinternal/servers/catalog_item_validation_test.go- Added 5 unit tests forapplyFieldDefinitionscovering: rejection of missing required fields, acceptance of user-provided values, default application, non-editable field override, and empty field definitionsTesting
applyFieldDefinitionsbehavioral contractsAcceptance Criteria
InvalidArgumentwhen a required editable field is missingSummary by CodeRabbit