Skip to content

fix: expose mount only for capable tracked targets - #2283

Merged
TerryHowe merged 1 commit into
oras-project:mainfrom
kocaemre:fix/tracked-mount-capability
Oct 24, 2026
Merged

TerryHowe merged 1 commit into
oras-project:mainfrom
kocaemre:fix/tracked-mount-capability

Conversation

@kocaemre

@kocaemre kocaemre commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

NewTarget now exposes registry.Mounter only when its underlying graph target supports mounting. Previously every tracked target advertised it; a mount attempt against a tracked OCI layout would panic on the unchecked assertion. Preserve the existing ReferencePusher capability independently of mounting. This is separate from the in-progress oras-go v3 migration (#2002), which also touches these files.

Which issue(s) this PR fixes:
Fixes #2278

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test? TestNewTarget_mountCapabilityMatchesUnderlyingTarget covers memory, OCI layout, remote, reference-only, and reference+mounter targets.
  • Does this change require a documentation update? No; it corrects an internal wrapper capability.
  • Does this introduce breaking changes that would require an announcement or bumping the major version? No public API signature change; non-mounting targets no longer advertise a capability they could not safely use.
  • Do all new files have an appropriate license header? No new files.

Verification (Go 1.26.7 Docker):

  • RED (test first): go test -p 4 ./cmd/oras/internal/display/status/track -run '^TestNewTarget_mountCapabilityMatchesUnderlyingTarget$' -count=1 -v → memory target reported registry.Mounter supported = true, want false (1 failing subtest); remote passed.
  • GREEN: same command → 5 subtests pass, including an OCI-layout store.
  • go test -p 4 ./cmd/oras/internal/display/status/... -count=1 → 5 packages pass.
  • go test -p 4 ./... -count=1 → all reported packages pass.
  • go vet -p 4 ./... and git diff --check HEAD~1..HEAD → pass.

AI assistance was used to prepare the change and tests; the verification commands above were run in Docker.

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.78%. Comparing base (a325603) to head (d0c8f03).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cmd/oras/internal/display/status/track/target.go 71.42% 1 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (71.42%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2283      +/-   ##
==========================================
- Coverage   60.81%   60.78%   -0.03%     
==========================================
  Files         140      140              
  Lines        6091     6092       +1     
==========================================
- Hits         3704     3703       -1     
- Misses       2166     2167       +1     
- Partials      221      222       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TerryHowe
TerryHowe merged commit 9218890 into oras-project:main Oct 24, 2026
9 of 10 checks passed
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.

bug: tracked targets always claim registry.Mounter and panic on non-remote targets

2 participants