Repository navigation
feat(vendor): native component updater PR workflow - #2756
Conversation
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Note Release Documentation Complete ✅
Thank you! |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. 💤 Files selected but had no reviewable changes (5)
⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR adds native vendor update pull requests, vendor lock verification and cleaning, provenance SBOM generation and upload, OCI retry handling, artifact identity tracking, GitHub PR publishing, expanded vendoring controls, and related CLI, schema, documentation, and skill updates. ChangesNative vendor automation and provenance
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (8)
pkg/vendoring/updater/result_test.go (1)
12-22: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider using a table-driven test.
As per coding guidelines, prefer table-driven tests for testing multiple scenarios. Refactoring this to a table-driven structure will make it easier to add test cases for other scenarios (e.g., when
PullRequestis nil, or whenFailureis present).🛠️ Proposed refactor to a table-driven test
func TestMarkdownSummaryIncludesPRAndDryRun(t *testing.T) { - summary := MarkdownSummary(&Result{ - Scope: "all", Check: true, Updated: 1, Status: "updated", Branch: "atmos/component-updater/all", Commit: "abc123", - PullRequest: &PullRequest{Number: 42, URL: "https://github.com/acme/repo/pull/42"}, - Updates: []vendoring.SourceUpdateResult{{Component: "terraform/vpc", CurrentVersion: "1.0.0", LatestVersion: "1.1.0", Status: vendoring.StatusUpdated}}, - }) - assert.Contains(t, summary, "dry run") - assert.Contains(t, summary, "[`#42`](https://github.com/acme/repo/pull/42)") - assert.Contains(t, summary, "terraform/vpc") - assert.False(t, strings.Contains(summary, "<script")) + tests := []struct { + name string + result *Result + contains []string + }{ + { + name: "includes PR and dry run", + result: &Result{ + Scope: "all", Check: true, Updated: 1, Status: "updated", Branch: "atmos/component-updater/all", Commit: "abc123", + PullRequest: &PullRequest{Number: 42, URL: "https://github.com/acme/repo/pull/42"}, + Updates: []vendoring.SourceUpdateResult{{Component: "terraform/vpc", CurrentVersion: "1.0.0", LatestVersion: "1.1.0", Status: vendoring.StatusUpdated}}, + }, + contains: []string{"dry run", "[`#42`](https://github.com/acme/repo/pull/42)", "terraform/vpc"}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + summary := MarkdownSummary(tt.result) + for _, c := range tt.contains { + assert.Contains(t, summary, c) + } + assert.False(t, strings.Contains(summary, "<script")) + }) + } }🤖 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 `@pkg/vendoring/updater/result_test.go` around lines 12 - 22, Refactor TestMarkdownSummaryIncludesPRAndDryRun into a table-driven test with named cases, keeping the existing PR and dry-run assertions as one scenario. Structure the cases so additional scenarios, such as nil PullRequest or a populated Failure, can be added with their expected summary assertions without duplicating test setup.Source: Coding guidelines
pkg/git/providers/github/pull_request.go (1)
17-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMissing doc comments on exported
ProviderName,Provider, andNew.Per coding guidelines, "Document all exported functions, types, and methods following Go's documentation conventions."
NewWithClientFactoryhas one; these three don't.🤖 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 `@pkg/git/providers/github/pull_request.go` around lines 17 - 41, Add Go-style doc comments to the exported ProviderName constant, Provider type, and New function, with each comment beginning with its corresponding identifier and briefly describing its purpose; leave the existing NewWithClientFactory documentation unchanged.Source: Coding guidelines
cmd/vendor/component_updater_test.go (1)
1-38: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftMissing coverage for
validateUpdateInvocationand the group-empty-set path.The existing tests exercise
updateScope,filterGroupComponents, andrenderPRTemplateswell, butvalidateUpdateInvocation— which gates every mutating flow (--all/--group/--componentconflicts, format, execution/batching modes, PR templates) — has no test coverage at all. Given the critical bug flagged inrunVendorUpdate(group scope falling back to a full repo-wide update when the filtered set is empty), a regression test reproducingatmos vendor update --group <empty-group>would be valuable here per the guideline for bug fixes: "first write a reproducing test, confirm it fails, implement the fix iteratively."🤖 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 `@cmd/vendor/component_updater_test.go` around lines 1 - 38, Add tests in the vendor updater test suite covering validateUpdateInvocation for conflicting scopes and invalid format, execution, batching, and PR-template options. Also add a regression test for runVendorUpdate with a group whose filtered component set is empty, asserting it does not fall back to a repository-wide update and preserves the expected empty-result behavior.Source: Coding guidelines
pkg/git/branch.go (2)
1-118: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftNo test coverage for this new, explicitly "safety-critical" file.
PrepareBranch's own doc comment calls its checks safety-critical (never checks out/pushes base, never force-pushes), yet nobranch_test.gois present in this change. Per coding guidelines, "*_test.go" files should "target more than 85% coverage" and this is exactly the kind of destructive-operation-guarding logic worth locking down with tests (dirty-worktree rejection, existing-remote-branch reuse vs. new-branch-from-base, default-branch parsing, GitHub remote parsing for SSH/HTTPS forms).🤖 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 `@pkg/git/branch.go` around lines 1 - 118, Add branch_test.go coverage for the safety-critical PrepareBranch flow, including dirty-worktree rejection, existing remote feature-branch reuse, and creation from the fetched base branch, while verifying destructive branch operations are not performed. Also test DefaultBranch parsing and GitHubRepository handling of SSH and HTTPS remotes, targeting more than 85% coverage for the symbols in branch.go.Source: Coding guidelines
27-61: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExported I/O functions across the new Git/GitHub PR-publishing path lack
perf.Trackinstrumentation. All four functions do real subprocess/network I/O and are exported, so each should carrydefer perf.Track(atmosConfig, "pkg.FuncName")()per coding guidelines;cmd/vendor/update.go's existingperf.Track(nil, "vendor.updateRunE")()showsnilis an accepted substitute where no config is threaded through.
pkg/git/branch.go#L27-L61: adddefer perf.Track(nil, "git.PrepareBranch")()at the top ofPrepareBranch.pkg/git/branch.go#L65-L80: adddefer perf.Track(nil, "git.DefaultBranch")()at the top ofDefaultBranch.pkg/git/branch.go#L84-L105: adddefer perf.Track(nil, "git.GitHubRepository")()at the top ofGitHubRepository.pkg/git/providers/github/pull_request.go#L44-L101: adddefer perf.Track(nil, "github.Provider.Reconcile")()at the top ofReconcile.🤖 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 `@pkg/git/branch.go` around lines 27 - 61, Instrument all four exported I/O functions with deferred performance tracking: add perf.Track(nil, "git.PrepareBranch") at the start of PrepareBranch in pkg/git/branch.go:27-61, perf.Track(nil, "git.DefaultBranch") at the start of DefaultBranch in pkg/git/branch.go:65-80, perf.Track(nil, "git.GitHubRepository") at the start of GitHubRepository in pkg/git/branch.go:84-105, and perf.Track(nil, "github.Provider.Reconcile") at the start of Reconcile in pkg/git/providers/github/pull_request.go:44-101.Source: Coding guidelines
cmd/vendor/update.go (1)
33-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExample string doesn't cover the new
--all/--group/--formatflags.As per coding guidelines, "Provide comprehensive help text for all commands and flags, include examples in command help." Consider adding at least one example each for
--groupand--all.🤖 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 `@cmd/vendor/update.go` at line 33, Update the vendor update command’s example help text to include representative usage for the new --group and --all flags, while preserving the existing examples; include --format as well if it is part of the newly added flags documented by this command.Source: Coding guidelines
pkg/git/providers/github/pull_request_test.go (1)
16-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftGood test, but only covers the "existing PR" branch.
The create-new-PR path (empty
Listresult), the 401/403 and "bad credentials" error-wrapping branches ingithubError, and the assignees/reviewers request calls are all untested. Consider extending this into a table-driven test per coding guidelines ("use table-driven tests, target more than 85% coverage").🤖 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 `@pkg/git/providers/github/pull_request_test.go` around lines 16 - 44, Extend TestReconcileExistingPullRequest into a table-driven suite covering existing and newly created pull requests, including the empty List result, 401/403 responses, bad-credentials wrapping through githubError, and assignee/reviewer request calls. Configure each case’s mock responses and expected method/path assertions, while preserving the current existing-PR assertions and targeting the repository’s required coverage.Source: Coding guidelines
cmd/vendor/component_updater.go (1)
187-268: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRedundant base-branch lookup, plus complexity-linter bypass instead of extraction.
prepareComponentUpdateBranchandpublishComponentUpdateeach independently callatmosgit.DefaultBranchwhenvendor.ci.pull_request.base_branchis unset, doing two network round trips (git ls-remote) for the same value within a single command run, with a (low but nonzero) chance the two calls disagree if the remote's default branch is retargeted mid-run. Consider havingprepareComponentUpdateBranchreturn the resolvedbasealongside the branch name and threading it intopublishComponentUpdateinstead of re-resolving it.Separately, both this function and
validateUpdateInvocation(line 77) use//nolint:cyclop,funlen,revive///nolint:cyclop,gocognit,reviveto bypass the project's complexity/length limits rather than extracting named helpers. As per coding guidelines, "Keep cyclomatic complexity at or below 15 and functions at or below 60 lines and 40 statements; extract focused named helpers and retain a linear orchestration pipeline."🤖 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 `@cmd/vendor/component_updater.go` around lines 187 - 268, Resolve the base branch once in prepareComponentUpdateBranch, return it with the branch name, and pass it into publishComponentUpdate instead of calling atmosgit.DefaultBranch again. Refactor publishComponentUpdate and validateUpdateInvocation into focused named helpers so each stays within the project’s complexity, length, and statement limits, then remove their cyclop/funlen/gocognit/ revive nolint suppressions while preserving the existing orchestration and behavior.Source: Coding guidelines
🤖 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.
Inline comments:
In `@cmd/vendor/component_updater.go`:
- Around line 315-320: Update renderComponentUpdaterJSON to handle the error
returned by data.WriteJSON(result) instead of discarding it. Propagate or report
the write failure through the existing command error-handling path so JSON
output failures, including broken pipes, do not appear as successful silent
executions.
- Around line 24-56: Update runVendorUpdate so group-scoped execution never
falls through to the unscoped runRepoWideUpdate when filterGroupComponents
returns no components; return an empty report instead. Also avoid repeating
repo-wide discovery for the mutation path: preserve and use the caller’s already
narrowed group selection from update.go rather than overwriting it through a
second discovery.
In `@cmd/vendor/update.go`:
- Around line 88-149: Set result.Status to "updated" only when
report.UpdatedCount() is greater than zero within the report-handling block
around runVendorUpdate; preserve the existing result population and rendering
for zero-update and check runs, allowing their status to remain non-updated. Do
not change the separate selected-component handling or pull/publish logic.
In `@docs/prd/component-updater.md`:
- Around line 48-61: Provision Atmos in both documented GitHub Actions examples
before invoking atmos vendor update: update docs/prd/component-updater.md lines
48-61 and
agent-skills/skills/atmos-migration/references/from-component-updater.md lines
3-7 with an installation or setup step that makes the atmos executable available
on the runner, while preserving the existing update command and workflow
behavior.
In `@pkg/schema/vendor_update.go`:
- Line 12: Document every listed exported identifier using Go-style comments
that begin with the identifier name and end with a period:
VendorUpdateExecutionConfig, VendorUpdateBatchingConfig,
VendorUpdateGroupConfig, VendorPullRequestConfig, and VendorSummaryConfig in
pkg/schema/vendor_update.go (12-12, 17-17, 23-23, 34-34, and 46-46), plus
PullRequestResult, PullRequestPublisherFactory, RegisterPullRequestPublisher,
NewPullRequestPublisher, and RegisteredPullRequestPublishers in
pkg/git/pull_request.go (27-27, 39-39, 46-46, 52-52, and 62-62).
---
Nitpick comments:
In `@cmd/vendor/component_updater_test.go`:
- Around line 1-38: Add tests in the vendor updater test suite covering
validateUpdateInvocation for conflicting scopes and invalid format, execution,
batching, and PR-template options. Also add a regression test for
runVendorUpdate with a group whose filtered component set is empty, asserting it
does not fall back to a repository-wide update and preserves the expected
empty-result behavior.
In `@cmd/vendor/component_updater.go`:
- Around line 187-268: Resolve the base branch once in
prepareComponentUpdateBranch, return it with the branch name, and pass it into
publishComponentUpdate instead of calling atmosgit.DefaultBranch again. Refactor
publishComponentUpdate and validateUpdateInvocation into focused named helpers
so each stays within the project’s complexity, length, and statement limits,
then remove their cyclop/funlen/gocognit/ revive nolint suppressions while
preserving the existing orchestration and behavior.
In `@cmd/vendor/update.go`:
- Line 33: Update the vendor update command’s example help text to include
representative usage for the new --group and --all flags, while preserving the
existing examples; include --format as well if it is part of the newly added
flags documented by this command.
In `@pkg/git/branch.go`:
- Around line 1-118: Add branch_test.go coverage for the safety-critical
PrepareBranch flow, including dirty-worktree rejection, existing remote
feature-branch reuse, and creation from the fetched base branch, while verifying
destructive branch operations are not performed. Also test DefaultBranch parsing
and GitHubRepository handling of SSH and HTTPS remotes, targeting more than 85%
coverage for the symbols in branch.go.
- Around line 27-61: Instrument all four exported I/O functions with deferred
performance tracking: add perf.Track(nil, "git.PrepareBranch") at the start of
PrepareBranch in pkg/git/branch.go:27-61, perf.Track(nil, "git.DefaultBranch")
at the start of DefaultBranch in pkg/git/branch.go:65-80, perf.Track(nil,
"git.GitHubRepository") at the start of GitHubRepository in
pkg/git/branch.go:84-105, and perf.Track(nil, "github.Provider.Reconcile") at
the start of Reconcile in pkg/git/providers/github/pull_request.go:44-101.
In `@pkg/git/providers/github/pull_request_test.go`:
- Around line 16-44: Extend TestReconcileExistingPullRequest into a table-driven
suite covering existing and newly created pull requests, including the empty
List result, 401/403 responses, bad-credentials wrapping through githubError,
and assignee/reviewer request calls. Configure each case’s mock responses and
expected method/path assertions, while preserving the current existing-PR
assertions and targeting the repository’s required coverage.
In `@pkg/git/providers/github/pull_request.go`:
- Around line 17-41: Add Go-style doc comments to the exported ProviderName
constant, Provider type, and New function, with each comment beginning with its
corresponding identifier and briefly describing its purpose; leave the existing
NewWithClientFactory documentation unchanged.
In `@pkg/vendoring/updater/result_test.go`:
- Around line 12-22: Refactor TestMarkdownSummaryIncludesPRAndDryRun into a
table-driven test with named cases, keeping the existing PR and dry-run
assertions as one scenario. Structure the cases so additional scenarios, such as
nil PullRequest or a populated Failure, can be added with their expected summary
assertions without duplicating test setup.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0a878653-83bb-4c5c-ad3a-21ab27f825c5
📒 Files selected for processing (20)
agent-skills/skills/atmos-migration/SKILL.mdagent-skills/skills/atmos-migration/references/from-component-updater.mdagent-skills/skills/atmos-modernization/SKILL.mdagent-skills/skills/atmos-vendoring/SKILL.mdagent-skills/skills/atmos-vendoring/references/component-updater.mdcmd/vendor/component_updater.gocmd/vendor/component_updater_test.gocmd/vendor/update.godocs/prd/component-updater.mddocs/prd/git-ops.mddocs/prd/vendor-update.mderrors/errors.gopkg/git/branch.gopkg/git/providers/github/pull_request.gopkg/git/providers/github/pull_request_test.gopkg/git/pull_request.gopkg/schema/schema.gopkg/schema/vendor_update.gopkg/vendoring/updater/result.gopkg/vendoring/updater/result_test.go
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2756 +/- ##
==========================================
+ Coverage 82.35% 82.52% +0.17%
==========================================
Files 1810 1840 +30
Lines 175753 178374 +2621
==========================================
+ Hits 144744 147211 +2467
- Misses 23277 23342 +65
- Partials 7732 7821 +89
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pkg/git/providers/github/pull_request_test.go (1)
48-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the submitted pull-request and metadata payloads.
These checks only prove that endpoints were called; swapped or omitted title, body, base, head, draft, labels, assignees, or reviewers would still pass. Decode each request body and assert the configured values.
As per coding guidelines, tests must test behavior rather than implementation and provide comprehensive unit coverage.
🤖 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 `@pkg/git/providers/github/pull_request_test.go` around lines 48 - 81, Enhance TestReconcileCreatesPullRequestAndAppliesMetadata by decoding each relevant request body in the test server handler and asserting the configured title, body, base, head, and draft values for the pull-request creation request, plus labels, assignees, and reviewers for their metadata requests. Keep the existing endpoint assertions while validating submitted behavior rather than only call presence.Source: Coding guidelines
🤖 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.
Inline comments:
In `@pkg/git/branch_test.go`:
- Around line 94-100: Update GitHubRepository in branch.go to validate the
remote URL’s actual hostname, rejecting URLs whose path merely contains
“github.com” while preserving valid GitHub hosts. Extend the GitHubRepository
tests in branch_test.go with an example such as
https://example.com/github.com/cloudposse/atmos.git and assert
ErrComponentUpdaterConfig.
---
Nitpick comments:
In `@pkg/git/providers/github/pull_request_test.go`:
- Around line 48-81: Enhance TestReconcileCreatesPullRequestAndAppliesMetadata
by decoding each relevant request body in the test server handler and asserting
the configured title, body, base, head, and draft values for the pull-request
creation request, plus labels, assignees, and reviewers for their metadata
requests. Keep the existing endpoint assertions while validating submitted
behavior rather than only call presence.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1a5fe0ab-22f6-4566-88e3-af05983a0de0
📒 Files selected for processing (11)
agent-skills/skills/atmos-migration/references/from-component-updater.mdcmd/vendor/component_updater.gocmd/vendor/component_updater_test.gocmd/vendor/update.godocs/prd/component-updater.mdpkg/git/branch_test.gopkg/git/providers/github/pull_request.gopkg/git/providers/github/pull_request_test.gopkg/git/pull_request.gopkg/git/pull_request_test.gopkg/schema/vendor_update.go
🚧 Files skipped from review as they are similar to previous changes (6)
- agent-skills/skills/atmos-migration/references/from-component-updater.md
- pkg/git/pull_request.go
- pkg/git/providers/github/pull_request.go
- docs/prd/component-updater.md
- cmd/vendor/update.go
- cmd/vendor/component_updater.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@pkg/schema/task.go`:
- Around line 963-973: Update decodeTaskOutput so errors from
mapstructure.NewDecoder and decoder.Decode are wrapped with descriptive context
using fmt.Errorf and %w rather than returned directly; preserve successful
decoding behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 651c2e1b-aceb-4f30-9021-8b669d30375d
📒 Files selected for processing (14)
cmd/vendor/component_updater.gocmd/vendor/component_updater_test.gocmd/vendor/update.gopkg/git/branch.gopkg/git/branch_test.gopkg/git/git.gopkg/git/git_test.gopkg/git/providers/github/pull_request.gopkg/git/providers/github/pull_request_test.gopkg/schema/schema.gopkg/schema/schema_auth.gopkg/schema/task.gopkg/schema/workflow.gopkg/vendoring/updater/result_test.go
🚧 Files skipped from review as they are similar to previous changes (8)
- pkg/vendoring/updater/result_test.go
- pkg/schema/schema.go
- pkg/git/branch.go
- cmd/vendor/update.go
- pkg/git/providers/github/pull_request.go
- pkg/git/branch_test.go
- cmd/vendor/component_updater.go
- cmd/vendor/component_updater_test.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@pkg/git/git.go`:
- Line 485: Normalize CRLF line endings in the output parsing flow before
splitting the trimmed git output into lines, so each extracted path is free of
trailing carriage returns on Windows while preserving Linux and macOS behavior.
Update the strings processing around the lines assignment and keep the
subsequent path parsing unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1d278d4d-b0e0-4385-98b4-8398e403fdc0
📒 Files selected for processing (14)
cmd/vendor/component_updater.gocmd/vendor/component_updater_test.gocmd/vendor/update.gopkg/git/branch.gopkg/git/branch_test.gopkg/git/git.gopkg/git/git_test.gopkg/git/providers/github/pull_request.gopkg/git/providers/github/pull_request_test.gopkg/schema/schema.gopkg/schema/schema_auth.gopkg/schema/task.gopkg/schema/workflow.gopkg/vendoring/updater/result_test.go
🚧 Files skipped from review as they are similar to previous changes (12)
- pkg/vendoring/updater/result_test.go
- pkg/git/git_test.go
- pkg/schema/schema_auth.go
- pkg/git/providers/github/pull_request.go
- pkg/schema/workflow.go
- pkg/git/branch_test.go
- pkg/schema/schema.go
- cmd/vendor/update.go
- pkg/schema/task.go
- cmd/vendor/component_updater.go
- pkg/git/branch.go
- cmd/vendor/component_updater_test.go
Fixes a test bug where the "create" pull-request-error subtest was masked by an earlier GET request hitting the same path, and adds table-driven/fixture-based coverage for dry-run branches, validation edge cases, publish error paths, and git branch/remote failure modes. Raises patch-scoped statement coverage from 85.07% to 91.94%. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (3)
cmd/vendor/component_updater_test.go (2)
151-156: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert that
--checkleaves the filesystem unchanged.
lister.calls == 1verifies the current implementation, not the dry-run contract. Assert that configured targets remain absent or unchanged so this test catches mutation regressions even if discovery internals change.As per coding guidelines, “test behavior rather than implementation.”
🤖 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 `@cmd/vendor/component_updater_test.go` around lines 151 - 156, Update the test around runVendorUpdate to verify the dry-run contract directly: after invoking it with check enabled, assert that the configured target files or directories remain absent or retain their original contents. Keep the existing result assertions, but replace or supplement the lister.calls implementation-detail assertion with filesystem-state assertions.Source: Coding guidelines
657-689: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLeave the default case unset.
The “enabled by default” case explicitly sets
vendor.ci.summary.enabled=true, so it cannot detect a broken default. Only callSetfor the disabled case.Proposed adjustment
tests := []struct { name string - enabled bool + enabled *bool wantWritten bool }{ - {name: "enabled by default", enabled: true, wantWritten: true}, - {name: "disabled", enabled: false, wantWritten: false}, + {name: "enabled by default", wantWritten: true}, + {name: "disabled", enabled: ptr.To(false), wantWritten: false}, } -viper.GetViper().Set("vendor.ci.summary.enabled", tt.enabled) +if tt.enabled != nil { + viper.GetViper().Set("vendor.ci.summary.enabled", *tt.enabled) +}As per coding guidelines, tests must avoid tautological coverage.
🤖 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 `@cmd/vendor/component_updater_test.go` around lines 657 - 689, Update TestVendorUpdateSummaryRespectsEnabledFlag so the enabled-by-default case leaves vendor.ci.summary.enabled unset, while the disabled case explicitly sets it to false. Preserve the existing table-driven assertions and use tt.enabled only to configure the disabled scenario, allowing the test to verify the actual default behavior.Source: Coding guidelines
pkg/git/branch_test.go (1)
56-64: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRemove the local branch before testing remote reuse.
The local feature branch still exists, so this passes even if
PrepareBranchnever fetches or usesorigin/atmos/component-updater/all. Delete it after checking outmainto isolate the remote-reuse path.Proposed adjustment
runGitCommand(t, workdir, "push", "-u", "origin", "atmos/component-updater/all") runGitCommand(t, workdir, "checkout", "main") +runGitCommand(t, workdir, "branch", "-D", "atmos/component-updater/all") require.NoError(t, PrepareBranch(ctx, PrepareBranchOptions{As per coding guidelines, “test behavior rather than implementation.”
🤖 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 `@pkg/git/branch_test.go` around lines 56 - 64, Update the remote-reuse test around PrepareBranch to delete the local atmos/component-updater/all branch after checking out main and before invoking PrepareBranch. Keep the existing assertions, ensuring the test can pass only when PrepareBranch reuses the branch from origin.Source: Coding guidelines
🤖 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 `@cmd/vendor/component_updater_test.go`:
- Around line 151-156: Update the test around runVendorUpdate to verify the
dry-run contract directly: after invoking it with check enabled, assert that the
configured target files or directories remain absent or retain their original
contents. Keep the existing result assertions, but replace or supplement the
lister.calls implementation-detail assertion with filesystem-state assertions.
- Around line 657-689: Update TestVendorUpdateSummaryRespectsEnabledFlag so the
enabled-by-default case leaves vendor.ci.summary.enabled unset, while the
disabled case explicitly sets it to false. Preserve the existing table-driven
assertions and use tt.enabled only to configure the disabled scenario, allowing
the test to verify the actual default behavior.
In `@pkg/git/branch_test.go`:
- Around line 56-64: Update the remote-reuse test around PrepareBranch to delete
the local atmos/component-updater/all branch after checking out main and before
invoking PrepareBranch. Keep the existing assertions, ensuring the test can pass
only when PrepareBranch reuses the branch from origin.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1406578c-9df3-48b6-b322-b2e9ae459994
📒 Files selected for processing (3)
cmd/vendor/component_updater_test.gopkg/git/branch_test.gopkg/git/providers/github/pull_request_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- pkg/git/providers/github/pull_request_test.go
Pins the transitive websocket-driver dependency (pulled in via faye-websocket and sockjs) to >=0.7.5 via pnpm overrides, fixing a critical message-corruption issue (GHSA-xv26-6w52-cph6) and a medium resource-limit-bypass issue (GHSA-mp7j-qc5w-4988). Both are patched in 0.7.5, a patch-level bump not blocked by dependabot.yml's major-version ignore policy. Co-Authored-By: Claude Sonnet 5 <[email protected]>
- pkg/schema/task.go: wrap decodeTaskOutput's mapstructure errors with context instead of returning them directly. - pkg/git/git.go: normalize CRLF line endings before splitting git rev-parse output, so Windows runs don't leave a trailing \r on parsed repository paths. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏 |
…nent-updater # Conflicts: # pkg/utils/yq_utils.go
|
💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏 |
…nent-updater # Conflicts: # docs/prd/git-ops.md
…n CI
The Windows acceptance job failed in TestTerraformRegistryCache: `atmos
terraform cache trust` ran `certutil -addstore -enterprise -f Root` on the
hosted runner and certutil hung until the 30s command timeout killed it
("certutil timed out after 30s: exit status 1" with no output), leaving the
proxy certificate untrusted.
The package already ships a native crypt32 installer that writes the
LocalMachine Root store directly (the scope windowsTrustStoreScopeForInstall
selects on CI) with no subprocess. Install and removal on Windows CI now try
certutil first and fall back to the native path on any failure, mirroring the
macOS system-keychain to login-keychain fallback in the same file. Removal's
fallback also covers a certificate that a fallback install placed in the
LocalMachine Root store, where certutil's enterprise delstore misses.
Adds fallback-success, double-failure, and fallback-not-taken tests using the
existing runTrustCommandFunc/installWindowsTrustFunc seams.
Co-Authored-By: Claude Fable 5 <[email protected]>
|
💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏 |
…nent-updater # Conflicts: # internal/exec/describe_stacks.go
…ublishing The default GITHUB_TOKEN never triggers downstream on:pull_request/on:push Actions workflows on the PR it opens. Add ATMOS_PRO_GITHUB_TOKEN (the token the github/sts auth integration mints) to the GitHub client's token precedence, between the explicit ATMOS_CI_GITHUB_TOKEN override and the plain GITHUB_TOKEN/GH_TOKEN fallback, so pairing the Component Updater with github/sts (via `atmos auth exec --identity <id> -- atmos vendor update --pull-request`) gets a token that actually triggers downstream workflows. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…reporting Found and fixed via manual end-to-end testing against a real repository (cloudposse/infra-live): - atmos.yaml's vendor.update.*/vendor.ci.* config (groups, execution mode, batching mode, PR title/body/labels/draft/reviewers/assignees, summary enablement) was silently ignored: the reading code used the global viper.GetViper() singleton, which only reflects CLI-flag-bound keys, while LoadConfig parses atmos.yaml into a separate local viper. Bridge the parsed values into the global viper after config load, mirroring the existing profiles.base_path sync. - `--all` (and any multi-type sweep) double-counted every component when a repo vendors exclusively via component.yaml and leaves an unused component type (e.g. packer) unconfigured: GetComponentBasePath silently fell back to the bare atmos base_path for that type, causing a second, mislabeled walk of the entire repo. Skip a type in the multi-type sweep when it has no configured base_path (via config or its env var override). - `--pull-request` created a real pull request but never printed its URL in the default table output, leaving the user with no way to find it. - A pull request's link was discarded entirely when a post-creation step failed (hit for real: GitHub rejecting a review request from the PR's own author) -- the PR itself already existed at that point but every layer (Reconcile, ReconcileComponentUpdatePullRequest, PublishComponentUpdate) returned nil instead of the partial result. - The default PR body template was just a bare markdown table with no branding or explanation, reading as broken/unhelpful to a reviewer seeing it for the first time. Default now includes the Atmos CI badge and a one-line "Automated by `atmos vendor update --pull-request`" note ahead of the table. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…d stub The oci-artifacts coverage entry always claimed "complete: OCI artifacts are represented by Atmos source receipts", even in a project with zero OCI artifacts of any kind -- confirmed empirically in an isolated sandbox with only a git-sourced vendor component. Scan the graph for vendor-domain components whose atmos:kind is "oci" (set by the always-earlier-running appendVendor) and report an honest, count-based detail string either way. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…r-clean page - Add the missing website/docs/cli/commands/vendor/vendor-clean.mdx page (the command was fully implemented and tested but had no doc page). - Document vendor.lock_file/vendor.lock.enforcement and the full vendor.update.*/vendor.ci.* config surface in the vendor configuration reference (previously only described in a blog post and PRD). - Document pairing the Component Updater with the github/sts auth integration for a token that triggers downstream Actions workflows, in the CLI reference, changelog post, and both relevant agent skills. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏 |
…nent-updater # Conflicts: # cmd/root.go # internal/exec/describe_stacks.go # lychee.toml
Splits overlong/compound sentences, converts passive to active voice, removes leading-backtick sentence opens, and unpacks noun clusters across the new vendor-lock, vendor-clean/verify, sbom, and component-updater docs and blog posts. Also aligns new errors.go sentinel error strings and doc comments with existing naming/phrasing conventions (renames ErrComponentFolderNotFound to ErrComponentDirNotFound for consistency with sibling errors). Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
.golangci.yml (1)
365-377: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy liftDo not disable the file-length linter.
Lines 365-377 silence
revive:file-length-limitforpkg/schema/task.goandpkg/vendoring/lockfile/lockfile.go. Split the files and keep the check active. If the split is deferred, link a tracking issue instead of adding an untrackedTODOexemption.As per coding guidelines, keep files smaller than 600 lines and never disable the file-length linter.
🤖 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 @.golangci.yml around lines 365 - 377, Remove the revive file-length-limit exemptions for pkg/schema/task.go and pkg/vendoring/lockfile/lockfile.go from the linter configuration. Split the oversized task and lockfile implementations into appropriately named sibling files so each remains under 600 lines, preserving the existing behavior and keeping file-length validation enabled; if splitting is deferred, replace each untracked TODO with a link to a tracking issue.Source: Coding guidelines
internal/exec/describe_stacks.go (1)
360-380: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy liftUse functional options for the scoped API.
ExecuteDescribeStacksScopedandexecuteDescribeStackspass many settings positionally. The new public function already requires a//nolint:reviveexemption. Use a functional-options API and keep existing wrappers as compatibility adapters. This reduces argument-order errors as more scope controls are added.As per coding guidelines, use the functional options pattern for configurable APIs instead of functions with many parameters.
Also applies to: 399-400
🤖 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 `@internal/exec/describe_stacks.go` around lines 360 - 380, Refactor ExecuteDescribeStacksScoped and executeDescribeStacks to accept functional options for their configurable settings instead of the current long positional parameter lists. Preserve existing public wrappers as compatibility adapters by translating their arguments into the new options, and update all call sites accordingly while retaining the existing behavior and performance tracking.Source: Coding guidelines
🧹 Nitpick comments (2)
pkg/ci/providers/github/client.go (1)
22-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a Go-doc summary for
NewClient.The comment directly above exported
NewClientdoes not describeNewClient. Start the block with a sentence that begins withNewClient, then retain the token-precedence details.Proposed fix
-// Token precedence: ATMOS_CI_GITHUB_TOKEN > ATMOS_PRO_GITHUB_TOKEN > GITHUB_TOKEN > GH_TOKEN. +// NewClient creates a GitHub client with the highest-priority available token. +// +// Token precedence: ATMOS_CI_GITHUB_TOKEN > ATMOS_PRO_GITHUB_TOKEN > GITHUB_TOKEN > GH_TOKEN.As per coding guidelines, “Document all exported functions, types, and methods following Go's documentation conventions.”
🤖 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 `@pkg/ci/providers/github/client.go` around lines 22 - 30, Add a Go-doc summary at the start of the comment immediately preceding NewClient that begins with “NewClient” and describes the function’s purpose, while preserving the existing token-precedence details unchanged.Source: Coding guidelines
internal/exec/vendor_test.go (1)
238-274: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse a table-driven test for the component scenarios.
TestParseVendorFlags_ComponentSliceFlagrepeats the same setup and parse/assert sequence across four subtests. Store the cases in a table and run each case witht.Run. This makes the repeatable-slice contract easier to extend.As per coding guidelines, use table-driven tests for testing multiple scenarios in Go.
🤖 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 `@internal/exec/vendor_test.go` around lines 238 - 274, Refactor the four component scenarios in TestParseVendorFlags_ComponentSliceFlag into a table-driven test, storing each case’s flag setup, expected component, and expected error in a case table. Iterate over the cases with t.Run, reuse the shared parseVendorFlags and assertion flow, and preserve the existing behavior for unset, single-element, multi-element, and string-typed component flags.Source: Coding guidelines
🤖 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.
Inline comments:
In `@agent-skills/skills/atmos-migration/references/from-component-updater.md`:
- Around line 30-33: Add job-level GitHub Actions permissions to the workflow
example in
agent-skills/skills/atmos-migration/references/from-component-updater.md at
lines 30-33: grant contents: write and pull-requests: write, retain issues:
write only when labels or assignees are used, and document id-token: write for
the github/sts OIDC path. Apply the same permission guidance in
agent-skills/skills/atmos-vendoring/references/component-updater.md at line 9,
including the conditional issues permission.
---
Outside diff comments:
In @.golangci.yml:
- Around line 365-377: Remove the revive file-length-limit exemptions for
pkg/schema/task.go and pkg/vendoring/lockfile/lockfile.go from the linter
configuration. Split the oversized task and lockfile implementations into
appropriately named sibling files so each remains under 600 lines, preserving
the existing behavior and keeping file-length validation enabled; if splitting
is deferred, replace each untracked TODO with a link to a tracking issue.
In `@internal/exec/describe_stacks.go`:
- Around line 360-380: Refactor ExecuteDescribeStacksScoped and
executeDescribeStacks to accept functional options for their configurable
settings instead of the current long positional parameter lists. Preserve
existing public wrappers as compatibility adapters by translating their
arguments into the new options, and update all call sites accordingly while
retaining the existing behavior and performance tracking.
---
Nitpick comments:
In `@internal/exec/vendor_test.go`:
- Around line 238-274: Refactor the four component scenarios in
TestParseVendorFlags_ComponentSliceFlag into a table-driven test, storing each
case’s flag setup, expected component, and expected error in a case table.
Iterate over the cases with t.Run, reuse the shared parseVendorFlags and
assertion flow, and preserve the existing behavior for unset, single-element,
multi-element, and string-typed component flags.
In `@pkg/ci/providers/github/client.go`:
- Around line 22-30: Add a Go-doc summary at the start of the comment
immediately preceding NewClient that begins with “NewClient” and describes the
function’s purpose, while preserving the existing token-precedence details
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a4939127-d729-46db-b16b-904cb2d8af1d
📒 Files selected for processing (25)
.golangci.ymlagent-skills/skills/atmos-ci/SKILL.mdagent-skills/skills/atmos-migration/references/from-component-updater.mdagent-skills/skills/atmos-modernization/SKILL.mdagent-skills/skills/atmos-sbom/SKILL.mdagent-skills/skills/atmos-vendoring/references/component-updater.mdcmd/root.gocmd/sbom/sbom.gocmd/vendor/component_updater.gocmd/vendor/component_updater_test.gocmd/vendor/execution_workdir_test.gocmd/vendor/update.gocmd/vendor/update_spinner.godocs/prd/component-updater.mddocs/prd/git-ops.mddocs/prd/sbom-provenance.mderrors/errors.gointernal/exec/describe_stacks.gointernal/exec/vendor.gointernal/exec/vendor_component_utils.gointernal/exec/vendor_test.golychee.tomlpkg/auth/manager_logout.gopkg/ci/providers/github/client.gopkg/ci/providers/github/provider_test.go
🚧 Files skipped from review as they are similar to previous changes (9)
- cmd/root.go
- agent-skills/skills/atmos-modernization/SKILL.md
- docs/prd/git-ops.md
- cmd/vendor/update_spinner.go
- errors/errors.go
- cmd/sbom/sbom.go
- docs/prd/component-updater.md
- docs/prd/sbom-provenance.md
- cmd/vendor/component_updater_test.go
…ent updater The workflow example and token guidance omitted contents: write and pull-requests: write, required under GitHub's read-only default permissions for atmos vendor update --pull-request, and didn't document id-token: write for the github/sts OIDC exchange. Addresses CodeRabbit review comment on PR #2756. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Markdown pipe-tables for flag/argument reference violate the documented convention (CLAUDE.md: use <dl>/<dt>/<dd>, not tables, for CLI arguments and flags). Converts the 5 offending tables found in a repo-wide audit to match the <dl> pattern already used correctly elsewhere (e.g. vendor/vendor-pull.mdx). Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.225.0-rc.7. |
validation
Manually tested end-to-end as a real user — following
--help/docs, in isolated sandboxes, and against a real repository (cloudposse/infra-live):vendor.ci.pull_requestconfig surface (title/body templates, labels, draft, reviewers, assignees) — #1701, #1702 (left as drafts, not merged).--pull-requestcreated a pull request but never printed its URL in the default table output.atmos.yaml'svendor.update.*/vendor.ci.*config (groups, execution mode, PR title/labels/draft/reviewers) was silently ignored — read from the wrongviperinstance instead of the parsed config.--alldouble-counted every component when a repo vendors exclusively viacomponent.yamland leaves an unused component type (e.g.packer) unconfigured.oci-artifactscoverage entry always claimed "complete" regardless of whether any OCI artifact existed in the project.atmos vendor verify/clean/--refresh-lock/--lock-enforcement(all three modes) andatmos sbom generate(CycloneDX vs. SPDX, NTIA mode, experimental gating, upload-outside-CI) in isolated sandboxes.ATMOS_PRO_GITHUB_TOKEN(the tokengithub/stsmints) to the Component Updater's GitHub token precedence, soatmos auth exec --identity <github-sts-identity> -- atmos vendor update --pull-requestgets a token that triggers downstream Actions workflows on the PR it opens — unlike the defaultGITHUB_TOKEN, which GitHub excludes from re-triggering workflows.references
Summary by CodeRabbit
atmos sbom generatewith provenance/NTIA modes, SPDX/CycloneDX output, and optional CI artifact upload.atmos vendor update --pull-requestworkflows with component/group selection and deterministic PR publishing.atmos vendor verify,atmos vendor clean, andvendor.lock.yamldrift protection.