Skip to content

Conversation

@miguelhbrito
Copy link

Update model to 0.0.439

  • Add patch operation on version gates

@openshift-ci
Copy link

openshift-ci bot commented Nov 26, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: miguelhbrito
Once this PR has been reviewed and has the lgtm label, please assign oriadler for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link

coderabbitai bot commented Nov 26, 2025

Walkthrough

The changes introduce an Update workflow for the VersionGate resource, adding a PATCH operation to the OpenAPI specification, corresponding client-side request/response types with builder pattern support, JSON marshaling helpers, and bumping transitive dependencies to v0.0.439.

Changes

Cohort / File(s) Summary
VersionGate Update Core Implementation
clustersmgmt/v1/version_gate_client.go
Adds VersionGateClient.Update() method returning a new VersionGateUpdateRequest. Implements full builder pattern with Parameter(), Header(), Impersonate(), and Body() methods. Adds Send() and SendContext() methods to execute PATCH requests with transport, response parsing, and error handling. Introduces VersionGateUpdateResponse type with status, header, error, and body accessors.
VersionGate Update JSON Helpers
clustersmgmt/v1/version_gate_resource_request_json.go
Adds writeVersionGateUpdateRequest() helper to marshal request body using MarshalVersionGate(). Adds readVersionGateUpdateResponse() helper to unmarshal response body using UnmarshalVersionGate() with error propagation.
OpenAPI Specification
openapi/clusters_mgmt/v1/openapi.json
Adds PATCH operation at /api/version_gates/{version_gate_id} accepting VersionGate request body and returning VersionGate on 200 success or Error on failure.
Dependency Version Bumps
go.mod, examples/go.mod, metamodel_generator/go.mod
Bumps github.com/openshift-online/ocm-api-model dependencies from v0.0.438 to v0.0.439 across all three module files.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant UpdateReq as VersionGateUpdateRequest
    participant Transport as HTTP Client
    participant UpdateResp as VersionGateUpdateResponse

    Client->>UpdateReq: Update()
    Client->>UpdateReq: Parameter(name, value)
    Client->>UpdateReq: Header(name, value)
    Client->>UpdateReq: Body(versionGate)
    Client->>UpdateReq: Send()
    
    UpdateReq->>UpdateReq: Construct PATCH request
    UpdateReq->>Transport: Execute PATCH
    Transport-->>UpdateReq: Response
    
    UpdateReq->>UpdateReq: Unmarshal response body
    UpdateReq->>UpdateResp: Create response
    UpdateResp-->>Client: Return result or error
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the builder pattern implementation is consistent across all VersionGateUpdateRequest methods
  • Confirm Send() and SendContext() methods properly construct and execute PATCH requests with correct error handling for non-2xx statuses
  • Validate that VersionGateUpdateResponse accessors (Status(), Header(), Error(), Body(), GetBody()) follow the same semantics as existing Get/Delete response types
  • Ensure JSON marshal/unmarshal helpers in version_gate_resource_request_json.go follow established patterns consistent with readVersionGateGetResponse

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding a patch operation for version gates to support partial updates, which is directly reflected in the codebase changes.
Description check ✅ Passed The description is related to the changeset, mentioning the model update to 0.0.439 and the addition of a patch operation on version gates.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
clustersmgmt/v1/version_gate_resource_request_json.go (1)

38-45: Update helpers correctly mirror existing Get semantics

writeVersionGateUpdateRequest and readVersionGateUpdateResponse cleanly reuse MarshalVersionGate / UnmarshalVersionGate and are consistent with the existing readVersionGateGetResponse pattern. This keeps all wire-format logic centralized on the VersionGate marshaller while making Update symmetric with Get.

Only usage caveat: callers should ensure VersionGateUpdateRequest.Body is set to a non-nil *VersionGate before SendContext, so the marshaller can construct the intended PATCH payload. The implementation here looks correct.

clustersmgmt/v1/version_gate_client.go (1)

437-578: PATCH request/response flow is consistent and sound

The new VersionGateUpdateRequest/VersionGateUpdateResponse types and Send/SendContext implementation closely follow the existing Get/Delete conventions:

  • Builder methods (Parameter, Header, Impersonate, Body) match other request types and reuse helpers utilities.
  • SendContext:
    • Copies query/headers to avoid mutation.
    • Serializes the body via writeVersionGateUpdateRequest into a bytes.Buffer.
    • Issues a PATCH request with that buffer as the body.
    • Uses the same bufio.Peek check and errors.UnmarshalErrorStatus path for non-2xx responses as Get/Delete.
    • Delegates successful body parsing to readVersionGateUpdateResponse, which mirrors the Get path.

This yields predictable status/error handling and returns the updated VersionGate in Body() / GetBody() with the usual nil-safety checks.

One behavioural note for callers: since the payload is entirely derived from VersionGateUpdateRequest.body, ensure Body() is called with a properly-populated *VersionGate (or explicitly rely on whatever semantics MarshalVersionGate(nil, ...) provides) before SendContext.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 63720f2 and f723c45.

⛔ Files ignored due to path filters (3)
  • examples/go.sum is excluded by !**/*.sum
  • go.sum is excluded by !**/*.sum
  • metamodel_generator/go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • clustersmgmt/v1/version_gate_client.go (3 hunks)
  • clustersmgmt/v1/version_gate_resource_request_json.go (1 hunks)
  • examples/go.mod (1 hunks)
  • go.mod (1 hunks)
  • metamodel_generator/go.mod (1 hunks)
  • openapi/clusters_mgmt/v1/openapi.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
clustersmgmt/v1/version_gate_resource_request_json.go (1)
clustersmgmt/v1/version_gate_client.go (2)
  • VersionGateUpdateRequest (438-444)
  • VersionGateUpdateResponse (531-536)
clustersmgmt/v1/version_gate_client.go (3)
helpers/helpers.go (5)
  • AddValue (33-45)
  • AddHeader (61-66)
  • AddImpersonationHeader (79-81)
  • CopyQuery (48-57)
  • CopyHeader (69-75)
request.go (1)
  • Request (32-39)
errors/errors.go (2)
  • UnmarshalErrorStatus (371-379)
  • Error (55-65)
⏰ 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: Lint
  • GitHub Check: Generate
  • GitHub Check: Test (1.21, windows-latest)
  • GitHub Check: Test (1.21, ubuntu-latest)
  • GitHub Check: Test (1.21, macos-latest)
🔇 Additional comments (6)
go.mod (1)

30-31: Based on my verification:

  1. Availability: v0.0.439 of the ocm-api-model module is available in the public Go module registry and can be fetched via standard Go tooling.
  2. Security: No published CVEs or security advisories specifically target ocm-api-model v0.0.439.

Both packages are available at v0.0.439 with no known security vulnerabilities.

The dependency updates to v0.0.439 are verified and safe to proceed with.

metamodel_generator/go.mod (1)

5-5: Based on my verification through public sources, I have confirmed that:

  1. v0.0.439 exists: The version is published in Go module registry package indexes
  2. No security vulnerabilities found: Web searches across public CVE databases and security advisory sources returned no specific security issues for this version

The version bump appears to be a routine patch-level update with no identified security concerns.


Dependency version verified as available with no known security vulnerabilities.

The metamodel_generator dependency is updated to v0.0.439, which is published in the Go module registry and has no known security vulnerabilities identified in public advisory databases.

examples/go.mod (1)

46-47: Version v0.0.439 cannot be verified in public Go module registries.

The web search results indicate that v0.0.439 for both github.com/openshift-online/ocm-api-model/clientapi and github.com/openshift-online/ocm-api-model/model is not publicly available on pkg.go.dev, GitHub releases, or Libraries.io. While no CVEs are associated with the ocm-api-model module itself, the inability to locate these specific versions in standard registries raises a question about their legitimacy.

Verify that v0.0.439 is a valid release or confirm whether these versions are available through a private registry or internal repository.

openapi/clusters_mgmt/v1/openapi.json (1)

13757-13800: Verification of schema references and JSON structure could not be completed due to repository access limitations.

The provided PATCH operation snippet follows OpenAPI 3.0 standards correctly with proper parameter definition, request body structure, and response handling. However, the original review's verification requests could not be executed:

  • Cannot confirm #/components/schemas/VersionGate and #/components/schemas/Error schema definitions exist in the file
  • Cannot validate overall JSON structure closure and path nesting integrity

The code snippet itself appears structurally sound, but confirmation of the referenced schemas and complete JSON validity requires direct file inspection.

clustersmgmt/v1/version_gate_client.go (2)

22-33: New bytes import is appropriate and used

The added bytes import is required for the bytes.Buffer used when building the PATCH request body in VersionGateUpdateRequest.SendContext, so the import is correct and not superfluous.


73-81: Update() constructor aligns with existing client patterns

VersionGateClient.Update() mirrors Delete() and Get() by wiring transport and path into a fresh VersionGateUpdateRequest. This keeps the public API consistent and makes the new Update flow discoverable alongside the other methods.

@rcampos2029 rcampos2029 merged commit f057d92 into openshift-online:main Nov 26, 2025
12 of 13 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.

2 participants