fix: show raw release binding resource in YAML view#597
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds an optional ChangesResource Field Exposure
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugins/openchoreo-backend/src/services/transformers/release-binding.ts (1)
147-147: ⚡ Quick winConsider trimming noisy metadata from the embedded raw resource.
bindingis the full raw K8s object, soresourcewill includemetadata.managedFieldsand thekubectl.kubernetes.io/last-applied-configurationannotation. SincefetchReleaseBindingsreturns this for every item in the list response (router.ts maps each binding throughtransformReleaseBinding), this can substantially inflate the payload and clutters the YAML view. StrippingmanagedFields(and optionally that annotation) keeps the definition readable and the response lean.♻️ Example: strip managedFields before embedding
- resource: binding as unknown as Record<string, unknown>, + resource: (() => { + const raw = binding as unknown as Record<string, any>; + if (raw?.metadata?.managedFields) { + const { managedFields, ...metadata } = raw.metadata; + return { ...raw, metadata }; + } + return raw; + })(),🤖 Prompt for 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. In `@plugins/openchoreo-backend/src/services/transformers/release-binding.ts` at line 147, The embedded raw `resource` currently contains the full K8s object (the `binding` passed into `transformReleaseBinding`), which includes noisy metadata like `metadata.managedFields` and the `kubectl.kubernetes.io/last-applied-configuration` annotation; before assigning `resource: binding as unknown as Record<string, unknown>` clone the object (so you don’t mutate the original), remove `metadata.managedFields` and, if present, `metadata.annotations['kubectl.kubernetes.io/last-applied-configuration']`, then embed the cleaned clone—this change in `transformReleaseBinding` (affecting results returned by `fetchReleaseBindings` and router.ts mapping) will reduce payload size and unclutter the YAML view.
🤖 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.
Nitpick comments:
In `@plugins/openchoreo-backend/src/services/transformers/release-binding.ts`:
- Line 147: The embedded raw `resource` currently contains the full K8s object
(the `binding` passed into `transformReleaseBinding`), which includes noisy
metadata like `metadata.managedFields` and the
`kubectl.kubernetes.io/last-applied-configuration` annotation; before assigning
`resource: binding as unknown as Record<string, unknown>` clone the object (so
you don’t mutate the original), remove `metadata.managedFields` and, if present,
`metadata.annotations['kubectl.kubernetes.io/last-applied-configuration']`, then
embed the cleaned clone—this change in `transformReleaseBinding` (affecting
results returned by `fetchReleaseBindings` and router.ts mapping) will reduce
payload size and unclutter the YAML view.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 67c0cbe6-314f-4333-bfb0-3468d1bf874c
📒 Files selected for processing (4)
plugins/openchoreo-backend/src/services/transformers/release-binding.tsplugins/openchoreo-common/src/types/bff-types.tsplugins/openchoreo/src/api/OpenChoreoClientApi.tsplugins/openchoreo/src/components/Environments/ReleaseDataRenderer/ResourceTreeView/ReleaseBindingDetailTabs.tsx
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Expose the raw Kubernetes ReleaseBinding resource through the BFF response and render it in the release binding detail YAML tab when available. Signed-off-by: Chathuranga Dassanayake <chathura2ihl@gmail.com>
4d81cf8 to
27ca1cf
Compare
Purpose
Expose the raw Kubernetes ReleaseBinding resource through the BFF response and render it in the release binding detail YAML tab when available.
Goals
Approach
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning
Summary by CodeRabbit