You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(oci): share feature and template publish helpers - #1563
Each command keeps its own flags, help text, metadata parsing, and stdout JSON shape.
Helper-level tests move to pkg/image/publish_test.go. Command-wrapper tests stay in cmd/feature.
Why
Feature and template publish were near-identical copies. A single implementation keeps error prefixes and push/log behavior from drifting. This is behavior-preserving: every error and log string is byte-identical, and there are no CLI, output, or exit-code changes.
Validation
Run on the rebased tree (base fa8621043), all passing:
mise run cli:format
mise run cli:lint:ci
golangci-lint run --new-from-rev=origin/main ./cmd/... ./pkg/...
go build ./...
go test ./cmd/feature/... ./cmd/template/... ./pkg/image/...
GOOS=windows go build ./cmd/... ./pkg/image/...
cmd/template has no test files.
CodeRabbit CLI
Ran coderabbit review --agent --committed. It produced 1 minor finding: WritePublishedMetadata ignores stdout write errors. Skipped, because origin/main also ignores them (_, _ = os.Stdout.Write). Handling them would add a new error exit path, which this refactor must not change.
Auto-merge
Eligible: yes. Non-test changed lines: 285 (cmd/feature/publish.go 93, cmd/template/publish.go 89, pkg/image/publish.go 103). Three files, no go.mod, lockfile, or .golangci changes, no //nolint, no new dependencies.
Next
Review the shared helper boundary in pkg/image/publish.go. Confirm CI passes before marking ready.
Summary by CodeRabbit
Improvements
Feature and template publishing now follow consistent behavior for version defaults, image references, and published metadata.
Publishing targets are checked to ensure they exist and are directories before publishing proceeds.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 40b8adde-ed0a-4b00-a5ca-ce230f2d9b75
📥 Commits
Reviewing files that changed from the base of the PR and between fa86210 and 586c363.
📒 Files selected for processing: 5
cmd/feature/publish.go
cmd/feature/publish_test.go
cmd/template/publish.go
pkg/image/publish.go
pkg/image/publish_test.go
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
📝 Walkthrough
Feature and template publishing now use shared helpers in pkg/image for version resolution, reference parsing, image construction and pushing, directory validation, and metadata output.
The new helpers handle publish references, directory validation, image construction, registry pushes, and indented JSON metadata output with a trailing newline. Tests cover these helpers. Writer errors during metadata output are ignored.
Feature and template command integration cmd/feature/publish.go, cmd/feature/publish_test.go, cmd/template/publish.go
Both commands delegate publish operations and directory validation to pkg/image. Their local reference and image-building helpers are removed. Feature-command tests for those helpers are removed; corresponding helper tests are added in pkg/image.
This refactor is described as behavior-preserving, and no concrete merge-blocking issue was found in the supplied changes.
Security architecture risk:⚪ Minimal · up to 586c3
The refactor centralizes publishing without changing the reviewed commands’ validation, registry destinations, credential selection, or output contracts. No introduced or materially worsened security risk was identified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The reviewed publishing path continues to act with the invoking process’s filesystem access and default-keychain registry authority. Its direct effect remains uploading the selected local content to the selected registry reference; helper export alone does not create an independently accessible service or grant additional privileges.
Trust Boundaries and Controls
observed — The filesystem-to-archive and process-to-authenticated-registry boundaries are unchanged for existing callers. Directory checks, command-specific metadata parsing, reference parsing, and default-keychain selection remain in the execution path. No additional destination authorization or archive filtering is added by this refactor.
Resilience and Maintainability Implications
observed — Push errors still stop command execution before metadata output, and success logging follows the registry call. No new retry, locking, rollback, or cleanup mechanism is introduced. Metadata write errors remain ignored as before, so a completed push and successful output delivery are not transactional. Registry-side partial-failure and recovery guarantees remain unestablished rather than newly weakened by this extraction.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Description check
The description explains the refactor, rationale, affected helpers, validation commands, and known review finding. It does not follow the repository template and omits the Type of change, AI assistanc…
Update the description to use the repository template. Mark the refactor type, disclose AI assistance and its usage, complete the testing and checklist sections, state whether integration tests are required, and document manual verification…
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 5 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly describes the main change: sharing OCI publish helpers between feature and template commands.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the refactor, rationale, affected helpers, validation commands, and known review finding. It does not follow the repository template and omits the Type of change, AI assistance declaration, required checklist, manual verification details, and integration-test status.
Resolution
Update the description to use the repository template. Mark the refactor type, disclose AI assistance and its usage, complete the testing and checklist sections, state whether integration tests are required, and document manual verification results.
Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cmd/feature/publish.goandcmd/template/publish.gointopkg/image/publish.go.ResolvePublishVersion,ValidatePublishDir,ParsePublishReference,BuildPublishImage,PushPublishImage,WritePublishedMetadata.pkg/image/publish_test.go. Command-wrapper tests stay incmd/feature.Why
Feature and template publish were near-identical copies. A single implementation keeps error prefixes and push/log behavior from drifting. This is behavior-preserving: every error and log string is byte-identical, and there are no CLI, output, or exit-code changes.
Validation
Run on the rebased tree (base
fa8621043), all passing:mise run cli:formatmise run cli:lint:cigolangci-lint run --new-from-rev=origin/main ./cmd/... ./pkg/...go build ./...go test ./cmd/feature/... ./cmd/template/... ./pkg/image/...GOOS=windows go build ./cmd/... ./pkg/image/...cmd/templatehas no test files.CodeRabbit CLI
Ran
coderabbit review --agent --committed. It produced 1 minor finding:WritePublishedMetadataignores stdout write errors. Skipped, because origin/main also ignores them (_, _ = os.Stdout.Write). Handling them would add a new error exit path, which this refactor must not change.Auto-merge
Eligible: yes. Non-test changed lines: 285 (
cmd/feature/publish.go93,cmd/template/publish.go89,pkg/image/publish.go103). Three files, no go.mod, lockfile, or .golangci changes, no//nolint, no new dependencies.Next
Review the shared helper boundary in
pkg/image/publish.go. Confirm CI passes before marking ready.Summary by CodeRabbit