Skip to content

Show meaningful paths in kpt pkg diff output - #4646

Merged
aravindtga merged 2 commits into
kptdev:mainfrom
Nordix:pkg-diff-meaningful-paths
Jul 20, 2026
Merged

Show meaningful paths in kpt pkg diff output#4646
aravindtga merged 2 commits into
kptdev:mainfrom
Nordix:pkg-diff-meaningful-paths

Conversation

@aravindtga

Copy link
Copy Markdown
Contributor

Description

  • What changed: kpt pkg diff output now shows the real local package path and semantic upstream labels instead of raw temp directory paths that no longer exist after the command completes.
  • Why it's needed: The temp paths (e.g. /tmp/kpt-941888986/local-v0.9/deploy.yaml) are meaningless and not actionable. The directories are deleted before the user sees the output.
  • How it works: The diff tool output is captured to a buffer. Before writing to the user, staging paths are replaced: the local staging path (local-<ref>) becomes the real filesystem path, and remote staging paths (remote-<ref>, target-<ref>) are stripped to just their semantic directory name.
    • Before: diff -r /tmp/kpt-941888986/local-v0.9/deploy.yaml /tmp/kpt-941888986/remote-v0.9/deploy.yaml
    • After: diff -r /home/user/my-package/deploy.yaml remote-v0.9/deploy.yaml

Related Issue(s)

Type of Change

  • Bug fix
  • New feature
  • Enhancement
  • Refactor
  • Documentation
  • Tests
  • Other: ________

Checklist

  • Code follows project style guidelines
  • Self-reviewed changes
  • Tests added/updated
  • Documentation added/updated
  • All tests and gating checks pass

AI Disclosure

  • I have used AI in the creation of this PR.

If so, please describe how:
- Kiro to analyse the issue, help in the fix, write the unit test and PR message.

Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
@aravindtga aravindtga self-assigned this Jul 17, 2026
@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 6262e63
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a5de331a56ff90008e6b8c3
😎 Deploy Preview https://deploy-preview-4646--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI 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.

Pull request overview

This PR improves kpt pkg diff usability by rewriting diff tool output so it shows actionable local filesystem paths and semantic upstream labels instead of ephemeral staging temp directory paths (per #591).

Changes:

  • Capture diff tool output and post-process it to replace staging paths with the real local package path and semantic upstream directory names.
  • Thread the original local package path (LocalPath) into the default differ to support rewriting.
  • Add a unit test to validate that diff output includes meaningful paths/labels.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
pkg/lib/pkg/diff/diff.go Captures diff tool output and rewrites staging paths to meaningful local/remote/target paths before printing.
pkg/lib/pkg/diff/diff_test.go Adds a test intended to validate the updated diff output path behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/lib/pkg/diff/diff.go
Comment thread pkg/lib/pkg/diff/diff.go Outdated
Comment thread pkg/lib/pkg/diff/diff_test.go
@aravindtga
aravindtga marked this pull request as ready for review July 17, 2026 15:55
@aravindtga
aravindtga requested review from a team July 17, 2026 15:55
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working enhancement New feature or request labels Jul 17, 2026
mozesl-nokia
mozesl-nokia previously approved these changes Jul 20, 2026
Comment thread pkg/lib/pkg/diff/diff_test.go Outdated
@dosubot dosubot Bot added the lgtm label Jul 20, 2026
liamfallon
liamfallon previously approved these changes Jul 20, 2026
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
@aravindtga
aravindtga dismissed stale reviews from liamfallon and mozesl-nokia via 6262e63 July 20, 2026 08:58
@aravindtga
aravindtga force-pushed the pkg-diff-meaningful-paths branch from e4b7ed2 to 6262e63 Compare July 20, 2026 08:58
@liamfallon
liamfallon requested review from a team July 20, 2026 09:44
@aravindtga
aravindtga merged commit 92e8d75 into kptdev:main Jul 20, 2026
26 checks passed
@aravindtga
aravindtga deleted the pkg-diff-meaningful-paths branch July 20, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request lgtm size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kpt pkg diff doesn't show host paths

5 participants