Skip to content

fix: show raw release binding resource in YAML view#597

Open
ChathurangaKCD wants to merge 1 commit into
openchoreo:mainfrom
ChathurangaKCD:display-releasebinding-definition-properly
Open

fix: show raw release binding resource in YAML view#597
ChathurangaKCD wants to merge 1 commit into
openchoreo:mainfrom
ChathurangaKCD:display-releasebinding-definition-properly

Conversation

@ChathurangaKCD

@ChathurangaKCD ChathurangaKCD commented May 29, 2026

Copy link
Copy Markdown
Contributor

Purpose

Expose the raw Kubernetes ReleaseBinding resource through the BFF response and render it in the release binding detail YAML tab when available.

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • New Features
    • Release bindings now include an optional raw resource payload in responses, allowing the full underlying resource to be surfaced.
    • The UI shows that raw resource as YAML in the release binding detail view, improving visibility into the complete resource definition.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c65aa1fe-ee76-4f52-8715-67b2716fd04f

📥 Commits

Reviewing files that changed from the base of the PR and between 4d81cf8 and 27ca1cf.

📒 Files selected for processing (4)
  • plugins/openchoreo-backend/src/services/transformers/release-binding.ts
  • plugins/openchoreo-common/src/types/bff-types.ts
  • plugins/openchoreo/src/api/OpenChoreoClientApi.ts
  • plugins/openchoreo/src/components/Environments/ReleaseDataRenderer/ResourceTreeView/ReleaseBindingDetailTabs.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • plugins/openchoreo/src/api/OpenChoreoClientApi.ts
  • plugins/openchoreo-common/src/types/bff-types.ts
  • plugins/openchoreo/src/components/Environments/ReleaseDataRenderer/ResourceTreeView/ReleaseBindingDetailTabs.tsx

📝 Walkthrough

Walkthrough

Adds an optional resource field carrying the raw Kubernetes ReleaseBinding through API/types, populates it in the backend transformer, and uses it in the frontend YAML viewer for full-definition display.

Changes

Resource Field Exposure

Layer / File(s) Summary
Resource field type definitions
plugins/openchoreo/src/api/OpenChoreoClientApi.ts, plugins/openchoreo-common/src/types/bff-types.ts
Both ReleaseBinding and ReleaseBindingResponse add an optional resource?: Record<string, unknown> field to carry the raw K8s object.
Backend resource population
plugins/openchoreo-backend/src/services/transformers/release-binding.ts
transformReleaseBinding assigns the incoming binding object (cast to Record<string, unknown>) to the response resource field.
Frontend YAML rendering
plugins/openchoreo/src/components/Environments/ReleaseDataRenderer/ResourceTreeView/ReleaseBindingDetailTabs.tsx
YamlViewer now serializes (releaseBindingData as any).resource when present, falling back to releaseBindingData.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I carried the binding from pod to view,
A raw YAML ribbon now shown through and through,
Types whispered "optional", backend packed the rest,
Frontend unfurled the file for you to digest. 📜✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes only the Purpose section with meaningful content; all other required sections contain only placeholder text with no substantive information. Complete the remaining sections including Goals, Approach, User stories, Release note, Documentation, Security checks, and Automation tests with actual details relevant to this PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: exposing and displaying the raw release binding resource in YAML view.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
plugins/openchoreo-backend/src/services/transformers/release-binding.ts (1)

147-147: ⚡ Quick win

Consider trimming noisy metadata from the embedded raw resource.

binding is the full raw K8s object, so resource will include metadata.managedFields and the kubectl.kubernetes.io/last-applied-configuration annotation. Since fetchReleaseBindings returns this for every item in the list response (router.ts maps each binding through transformReleaseBinding), this can substantially inflate the payload and clutters the YAML view. Stripping managedFields (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

📥 Commits

Reviewing files that changed from the base of the PR and between 8dc676c and 4d81cf8.

📒 Files selected for processing (4)
  • plugins/openchoreo-backend/src/services/transformers/release-binding.ts
  • plugins/openchoreo-common/src/types/bff-types.ts
  • plugins/openchoreo/src/api/OpenChoreoClientApi.ts
  • plugins/openchoreo/src/components/Environments/ReleaseDataRenderer/ResourceTreeView/ReleaseBindingDetailTabs.tsx

@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

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>
@ChathurangaKCD ChathurangaKCD force-pushed the display-releasebinding-definition-properly branch from 4d81cf8 to 27ca1cf Compare May 29, 2026 06:10
@ChathurangaKCD ChathurangaKCD requested a review from Mirage20 as a code owner May 29, 2026 06:10
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.

1 participant