Skip to content

Fix xDS reference links broken when resource id contains slashes - #1329

Merged
minwoox merged 1 commit into
line:mainfrom
minwoox:fix_xds_ui
Jul 9, 2026
Merged

Fix xDS reference links broken when resource id contains slashes#1329
minwoox merged 1 commit into
line:mainfrom
minwoox:fix_xds_ui

Conversation

@minwoox

@minwoox minwoox commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Motivation:

resolveReference() built the id for navigation links by taking only the last path segment of a resource name such as
groups/dx/clusters/centraldogma-oss-mdc/alpha, producing alpha instead of the correct centraldogma-oss-mdc/alpha.

Modifications:

  • In resolveReference(), replace segments[segments.length - 1] with segments.slice(idStart).join('/'), where idStart skips the resource-type prefix (1 for regular paths, 2 for k8s paths).

Result:

  • Reference links for resource names containing / (e.g. groups/dx/clusters/centraldogma-oss-mdc/alpha) now navigate to the correct resource.

@minwoox minwoox added this to the 0.85.0 milestone Jul 9, 2026
@minwoox
minwoox requested review from ikhoon and jrhee17 as code owners July 9, 2026 02:58
@minwoox minwoox added the defect label Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 877bdc37-76f3-41ee-98ad-0f13c75c2ae9

📥 Commits

Reviewing files that changed from the base of the PR and between ba674e1 and 3aaaf38.

📒 Files selected for processing (2)
  • webapp/src/dogma/features/xds/xdsReferences.ts
  • webapp/tests/dogma/features/xds/xdsReferences.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • webapp/tests/dogma/features/xds/xdsReferences.test.ts

📝 Walkthrough

Walkthrough

Adds a new test file that introduces a resolveReference test suite validating parsing of XDS/CDS-like reference names into { group, id, k8s } across standard group paths, k8s-prefixed paths, and bare-name fallback.

Changes

resolveReference Test Suite

Layer / File(s) Summary
resolveReference parsing tests
webapp/tests/dogma/features/xds/xdsReferences.test.ts
New test suite asserts parsing of groups/{group}/{type}/{id} (including multi-segment IDs), groups/{group}/k8s/{type}/{id} with k8s flag detection and prefix stripping, and bare-name fallback using the current group with k8s: false.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing xDS reference links for slash-containing resource IDs.
Description check ✅ Passed The description directly explains the resolveReference fix and the added behavior covered by tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Motivation:

`resolveReference()` built the `id` for navigation links by taking only
the last path segment of a resource name such as
`groups/dx/clusters/centraldogma-oss-mdc/alpha`, producing `alpha`
instead of the correct `centraldogma-oss-mdc/alpha`.

Modifications:

- In `resolveReference()`, replace `segments[segments.length - 1]` with
  `segments.slice(idStart).join('/')`, where `idStart` skips the
  resource-type prefix (1 for regular paths, 2 for k8s paths).

Result:

- Reference links for resource names containing `/` (e.g.
  `groups/dx/clusters/centraldogma-oss-mdc/alpha`) now navigate to the
  correct resource.

@ikhoon ikhoon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 👍

@ikhoon

ikhoon commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

xdsReferences.ts is shown as a binary file. This looks like a GitHub bug but could you double check whether the file header or content is not broken?
image

@minwoox

minwoox commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

xdsReferences.ts is shown as a binary file. This looks like a GitHub bug but could you double check whether the file header or content is not broken?

Yeah, I fixed it in this PR. The previous file has a null byte that Git considers as a binary file.

@minwoox
minwoox merged commit 93f5356 into line:main Jul 9, 2026
13 of 14 checks passed
@minwoox
minwoox deleted the fix_xds_ui branch July 9, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants