✨ Update new resources split skeleton and patches - #151
Conversation
Updating plugin system creationg new resources to have better fit to crane transfor&apply structure. Returning structure better handled by crane code to prepare skeleton resources (type and name) to new/ stage directory and set of patches to be applied on thise skeletons during apply step. Related to migtools/crane#728 Signed-off-by: Marek Aufart <maufart@redhat.com>
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a function that splits a plugin-generated Kubernetes resource into a minimal skeleton and an RFC 6902 JSON patch. The implementation preserves identity metadata, sorts patch operations, escapes JSON Pointer paths, and validates common resource shapes. ChangesNew resource splitting
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Signed-off-by: Marek Aufart <maufart@redhat.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@transform/new_resource_test.go`:
- Line 176: Check and assert the error returned by json.Unmarshal at the first
site before inspecting result, and likewise handle the error from
result.UnmarshalJSON at the second site. Ensure unmarshaling failures terminate
the test with the underlying error before subsequent result assertions run.
In `@transform/new_resource.go`:
- Around line 132-151: Replace the hand-rolled replaceAll implementation with
the standard library’s strings.ReplaceAll, preserving the existing
escapeJSONPointer call order so "~" is still escaped before "/". Update the
imports accordingly and retain the replaceAll helper’s current behavior for
arbitrary UTF-8 input.
- Around line 12-14: The doc comment for the NewResourceAnnotation constant
claims the crane CLI writer routes resources to a new/ subdirectory, but this
routing behavior does not exist in the codebase. Remove the inaccurate claim
about CLI routing from the comment block above NewResourceAnnotation, and either
leave only the annotation's purpose or rewrite it to accurately reflect actual
usage of this constant in the repository.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e4cd9b70-357e-4487-a6b1-28f24107895d
📒 Files selected for processing (2)
transform/new_resource.gotransform/new_resource_test.go
Signed-off-by: Marek Aufart <maufart@redhat.com>
| // in the returned patch. | ||
| // | ||
| // This allows new resources to follow the same skeleton + patches flow as transformed | ||
| // resources, keeping the stage directory structure consistent and transparent. |
There was a problem hiding this comment.
We might discuss this approach if needed, but this should have better fit to crane transform&apply flow and not add an additional complexity to plugins.
|
/rfr |
Updating plugin system creationg new resources to have better fit to crane transfor&apply structure. Returning structure better handled by crane code to prepare skeleton resources (type and name) to new/ stage directory and set of patches to be applied on thise skeletons during apply step.
Related to migtools/crane#728
Summary by CodeRabbit
New Features
Bug Fixes
Tests