OSAC-3954: populate Name on resolved ClusterTemplateReference and HostTypeReference - #277
Conversation
…tTypeReference validateAndTransformCluster only set Id on resolved references, leaving Name empty. Metering reads Name for the cluster_template billing dimension, which was always empty as a result. Set Name from metadata.name on all three reference resolution sites (create, update, and signal paths). Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: omer-vishlitzky <omer.vishlitzky@gmail.com>
|
@omer-vishlitzky: This pull request references OSAC-3954 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 bug 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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: osac-project/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughPrivate cluster creation now persists resolved template and host-type references with both identifiers and metadata names. Catalog-item creation explicitly resolves template metadata before applying defaults. Tests cover name- and identifier-based resolution. ChangesPrivate cluster reference persistence
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
|
🤖 Finished Review · ✅ Success · Started 11:06 PM UTC · Completed 11:20 PM UTC Commit: |
|
Looks good to me Previous runReviewFindingsHigh
Low
Labels: PR fixes a bug in the fulfillment-service cluster provisioning logic Next steps:
|
Address fullsend review findings: - Set Name on resolved ClusterTemplateReference in validateAndTransformCatalogItem (catalog item creation path was still missing it) - Add Name assertions to host-type-by-name, host-type-by-id, and catalog-item tests - Fix "the the" typo in test comment Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: omer-vishlitzky <omer.vishlitzky@gmail.com>
|
🤖 Finished Review · ✅ Success · Started 12:37 AM UTC · Completed 12:50 AM UTC Commit: |
Superseded by updated review
|
/retest |
|
Re-triggered failed runs:
|
|
/retest |
|
Re-triggered failed runs:
|
masayag
left a comment
There was a problem hiding this comment.
Reviewed with a focus on whether hostType.GetMetadata()/template.GetMetadata() can ever be nil across the resolution paths touched here (Create, validateAndTransformCluster, validateAndTransformCatalogItem).
Confirmed safe in all flows:
- All four
GetMetadata()call sites are already behind an explicithostType != nil/template != nilcheck. - Even without that, the generated protobuf accessors (
GetMetadata(),GetName()) are nil-receiver safe (if x != nil { ... }; return nil/""), so the chain can't panic regardless. generic_dao_get.go/generic_dao_list.goalways construct and attach a non-nilMetadatafor any row successfully hydrated from the DB, so a non-nilhostType/templatereturned fromlookupHostType/lookupTemplatealways has real metadata, not just a nil-safe empty string.
One non-blocking nit:
validateTemplateImmutability()'s comment (around L598-600, unchanged by this PR) says:
// Compare by refKey (Id) rather than proto.Equal because validateAndTransformCluster normalizes the stored reference to Id-only, while the reference validator interceptor may backfill Name on incoming requests.
That's now stale — after this change, validateAndTransformCluster/validateAndTransformCatalogItem set both Id and Name on the resolved reference, not Id-only. Behavior is unaffected (refKey() prefers Id when present), but worth a follow-up comment update so it doesn't mislead future readers.
LGTM otherwise.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: masayag, omer-vishlitzky 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 |
Summary
Name(frommetadata.name) alongsideIdon resolvedClusterTemplateReferenceandHostTypeReferenceinvalidateAndTransformClusterIdwas set, leavingNameempty — metering readsNamefor thecluster_templatebilling dimension, which was always""Nameis preserved after reference resolutionRoot Cause
private_clusters_server.goresolves user-provided template/host-type references to their canonical form (by ID). The resolvedClusterTemplateReferencewas constructed with onlySetId(), dropping theNamefield. Downstream,osac-metering'sClusterBillingDimensions()readsspec.GetTemplate().GetName()for thecluster_templatebilling dimension — always empty.Test plan
ginkgo run --focus="Cluster" internal/servers— 115 passed)GetName()returns expected value after resolutionAssisted-by: Claude Code noreply@anthropic.com
Summary by CodeRabbit