Skip to content

Conversation

@skitt
Copy link
Contributor

@skitt skitt commented Jul 3, 2025

Summary

This matches other dependencies and means the non-modular will be dropped once other dependencies are bumped to versions that no longer pull it in.

Related issue(s)

Fixes #

Summary by CodeRabbit

  • Chores
    • Updated the version of the json-patch library to improve compatibility.
    • Reorganized and updated import statements in several test and utility files for consistency and to reflect the new library version.

@coderabbitai
Copy link

coderabbitai bot commented Jul 3, 2025

Walkthrough

The changes update the import path and version of the github.com/evanphx/json-patch package to use the semver-compatible v5 module throughout the codebase. Only import paths and dependency declarations were modified, with no changes to logic or exported entities.

Changes

Files/Paths Change Summary
go.mod Updated direct dependency on json-patch to github.com/evanphx/json-patch/v5 v5.9.11; indirect reverted.
pkg/utils/helpers.go Updated jsonpatch import path to github.com/evanphx/json-patch/v5.
test/integration/cloudevents/agent_deploy_test.go
test/integration/cloudevents/agent_hook_deploy_test.go
test/integration/cloudevents/agent_hosting_deploy_test.go
test/integration/cloudevents/agent_hosting_hook_deploy_test.go
Updated jsonpatch import path to v5 module and reorganized import blocks, including repositioning work package imports.

Suggested labels

lgtm, ok-to-test

Suggested reviewers

  • qiujian16
  • zhujian7

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4baa95c and 807875a.

📒 Files selected for processing (6)
  • go.mod (2 hunks)
  • pkg/utils/helpers.go (1 hunks)
  • test/integration/cloudevents/agent_deploy_test.go (2 hunks)
  • test/integration/cloudevents/agent_hook_deploy_test.go (2 hunks)
  • test/integration/cloudevents/agent_hosting_deploy_test.go (2 hunks)
  • test/integration/cloudevents/agent_hosting_hook_deploy_test.go (2 hunks)
✅ Files skipped from review due to trivial changes (3)
  • test/integration/cloudevents/agent_hosting_hook_deploy_test.go
  • test/integration/cloudevents/agent_hosting_deploy_test.go
  • test/integration/cloudevents/agent_deploy_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • pkg/utils/helpers.go
  • test/integration/cloudevents/agent_hook_deploy_test.go
  • go.mod
⏰ 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). (8)
  • GitHub Check: integration
  • GitHub Check: e2e-hosted
  • GitHub Check: e2e-cloudevents
  • GitHub Check: e2e
  • GitHub Check: verify
  • GitHub Check: unit
  • GitHub Check: build
  • GitHub Check: cloudevents-integration
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci openshift-ci bot requested review from zhiweiyin318 and zhujian7 July 3, 2025 15:00
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: 2

🧹 Nitpick comments (1)
test/integration/cloudevents/agent_deploy_test.go (1)

29-29: Package alias work collides with the local variable work used throughout the tests

Inside multiple test cases a variable named work is declared:

var work *workv1.ManifestWork

This silently shadows the imported package alias work in those scopes, which is legal but error-prone and confusing when reading or refactoring the code.

Consider one of:

-import "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/work"
+import workclient "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/work"

or renaming the local variable to mw/manifestWork.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 314995d and 4baa95c.

📒 Files selected for processing (6)
  • go.mod (2 hunks)
  • pkg/utils/helpers.go (1 hunks)
  • test/integration/cloudevents/agent_deploy_test.go (2 hunks)
  • test/integration/cloudevents/agent_hook_deploy_test.go (2 hunks)
  • test/integration/cloudevents/agent_hosting_deploy_test.go (2 hunks)
  • test/integration/cloudevents/agent_hosting_hook_deploy_test.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: cloudevents-integration
  • GitHub Check: integration
  • GitHub Check: e2e-hosted
  • GitHub Check: build
  • GitHub Check: e2e
  • GitHub Check: unit
  • GitHub Check: e2e-cloudevents
  • GitHub Check: verify
🔇 Additional comments (6)
go.mod (1)

6-6: Dependency path correctly updated to the v5 module

Switching the direct requirement to github.com/evanphx/json-patch/v5 v5.9.11 is the right move and unblocks future drops of the legacy import path.

pkg/utils/helpers.go (1)

12-12: Import path update looks good

The alias is unchanged, so no downstream edits are needed. 👍

test/integration/cloudevents/agent_hosting_hook_deploy_test.go (1)

9-9: Test now tracks the v5 module

Import path change is correct; nothing else to do.

test/integration/cloudevents/agent_hook_deploy_test.go (1)

9-9: Import path updated

Looks good – tests will compile against the new module.

test/integration/cloudevents/agent_hosting_deploy_test.go (1)

9-9: v5 import path applied

No issues spotted with the switch here.

test/integration/cloudevents/agent_deploy_test.go (1)

21-23: LGTM – internal imports merely re-ordered

Only the import block was re-arranged; no functional impact.

"open-cluster-management.io/addon-framework/pkg/agent"
"open-cluster-management.io/addon-framework/pkg/utils"

jsonpatch "github.com/evanphx/json-patch/v5"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Ensure go.mod / go.sum are tidied after the major-version bump

The import path now points to the v5 module. Double-check that:

  1. go.mod contains

    github.com/evanphx/json-patch/v5 v5.9.11 // indirect?
    

    and that the old github.com/evanphx/json-patch line is gone.

  2. go mod tidy has been run so no redundant entries remain.


🏁 Script executed:

#!/bin/bash
# Fails if any pre-v5 import or module reference is still present.
rg --no-heading -n $'github.com/evanphx/json-patch"' || true
grep -n 'github.com/evanphx/json-patch"' go.{mod,sum} || true

Length of output: 124


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "🔍 Checking for v5 module require in go.mod..."
grep -nE 'github.com/evanphx/json-patch/v5 ' go.mod || echo "⚠️ v5 module not found in go.mod"

echo "🔍 Checking for v5 references in go.sum..."
grep -nE 'github.com/evanphx/json-patch/v5 ' go.sum || echo "⚠️ v5 references not found in go.sum"

echo "🔍 Ensuring no pre-v5 references remain in go.mod or go.sum..."
# Match the base path without `/v5`
grep -nE 'github\.com/evanphx/json-patch($| )' go.mod go.sum && {
  echo "❌ Found pre-v5 references"
  exit 1
} || echo "✅ No pre-v5 references detected"

echo "✅ Verification complete."

Length of output: 1124


Remove lingering pre-v5 json-patch entries in go.mod/go.sum

The verification script found that the old, incompatible v5 entry is still present:

  • go.mod:55
    github.com/evanphx/json-patch v5.9.0+incompatible // indirect
    
  • go.sum:77–78
    github.com/evanphx/json-patch v5.9.0+incompatible h1:…
    github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:…
    

Please remove those lines and ensure only the /v5 module remains:

Suggested diff:

--- go.mod
@@
-   github.com/evanphx/json-patch v5.9.0+incompatible // indirect
    github.com/evanphx/json-patch/v5 v5.9.11 // indirect
--- go.sum
@@
- github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls=
- github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
    github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU=
    github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=

After updating, run:

go get github.com/evanphx/json-patch/[email protected]
go mod tidy

to purge any residual entries and keep your module files clean.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In test/integration/cloudevents/agent_deploy_test.go around line 9, remove the
old incompatible v5 entry for github.com/evanphx/json-patch from go.mod and
go.sum files. Then run 'go get github.com/evanphx/json-patch/[email protected]'
followed by 'go mod tidy' to update dependencies and clean up any lingering
references, ensuring only the proper /v5 module remains.

@skitt
Copy link
Contributor Author

skitt commented Jul 3, 2025

/cc @qiujian16

@openshift-ci openshift-ci bot requested a review from qiujian16 July 3, 2025 16:35
@skitt
Copy link
Contributor Author

skitt commented Jul 11, 2025

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 11, 2025

@skitt: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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 kubernetes-sigs/prow repository.

This matches other dependencies and means the non-modular will be
dropped once other dependencies are bumped to versions that no longer
pull it in.

Signed-off-by: Stephen Kitt <[email protected]>
@qiujian16
Copy link
Member

/approve
/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16, skitt

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

The pull request process is described 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

@openshift-merge-bot openshift-merge-bot bot merged commit 5d62be0 into open-cluster-management-io:main Jul 18, 2025
16 checks passed
@skitt skitt deleted the json-patch-module branch July 18, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants