Skip to content

fix(kubernetes): close gaps found field-testing Kustomize GitOps delivery - #2905

Merged
Erik Osterman (Cloud Posse) (osterman) merged 12 commits into
mainfrom
osterman/kustomize-gitops-field-test-fixes
Aug 10, 2026
Merged

Erik Osterman (Cloud Posse) (osterman) merged 12 commits into
mainfrom
osterman/kustomize-gitops-field-test-fixes

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

what

Field-tested the Kustomize/git-delivery GitOps pipeline shipped in #2874 (real k3s cluster, real local git remotes, real fixtures — not mocks) and fixed the gaps found:

  • validate: "false" (a quoted YAML string, an easy typo) was silently ignored by atmos kubernetes validate/apply/deploy, leaving validation enabled with no warning. It now fails closed with a clear error.
  • provision.targets.<name>.split had no type enforcement in the runtime-embedded JSON Schema (pkg/datafetcher/schema/atmos/manifest/1.0.json) — only in the docs-facing copy (stacks/stack-config/1.0.json) — so split: "yes" passed atmos validate stacks and was silently dropped at runtime, falling back to path-based auto-inference. The embedded schema is now synced, and the git target's parseConfig also fails closed as defense in depth (since kubernetes validate/apply/deploy don't go through the stack-config schema path).
  • Flipping a git delivery target between directory and single-file mode now emits a warning before the unconditional RemoveAll that replaces whatever currently exists at the managed path.
  • The managed git workdir cache never reconciled with a changed git.repositories.<name>.uri — an already-cloned repo kept using its original remote forever. reconcile now syncs the local remote URL to the configured URI before fetching.
  • The DNS-1123 invalid-name error embeds a regex containing [, ], (, ) with no spaces; rendered as plain markdown it was both mangled (brackets collide with link syntax) and hard-wrapped mid-token. It's now backtick-fenced as a code span, so it renders verbatim.
  • Fixed a copy-pasted config example in the atmos-git skill doc: it showed a nested signing: {mode: auto} instead of the real flat signing: auto string field — copying it verbatim fails to parse.
  • Documented that atmos kubernetes validate --server fails on a manifest set that creates its own namespace and delivers into it in the same batch (inherent to Kubernetes server-side dry-run semantics — each object's dry-run is evaluated independently against already-persisted state), even though apply/deploy of the identical objects succeeds.

Also includes an unrelated, incidental fix: bumped js-yaml/mermaid pnpm overrides in website/ to close 7 open Dependabot alerts (triggered by this repo's post-push security-remediate automation).

why

A /field-test pass is a hands-on DX pass that builds real fixtures and runs the actual CLI against them, specifically to catch "looks fine in review, breaks or misleads a real user" gaps that unit tests (which mostly exercise fake clients and hand-built inputs) don't cover. Every fix here was independently reproduced live before being fixed, and re-verified live after. The pass also confirmed several things work correctly as documented (directory/single-file delivery, the Kustomize metadata.name exemption, validate:false + --server interaction, offline validation gating delivery) — those aren't included here since nothing needed to change for them.

references

…very (#2874)

A field-test pass against the merged Kustomize/git-delivery pipeline
(validate:false, git error surfacing, single-file delivery, metadata.name
exemption) found several confirmed gaps and fixed them:

- validate: "false" (a quoted string) was silently ignored by `atmos
  kubernetes validate/apply/deploy`, leaving validation enabled with no
  warning; it now fails closed with a clear error.
- provision.targets.<name>.split had no type enforcement in the runtime
  JSON Schema (only in the docs-facing copy), so a bad value like
  split: "yes" passed `atmos validate stacks` and was silently dropped at
  runtime; the schema is now synced and the git target fails closed too.
- Flipping a git delivery target between directory and single-file mode
  now warns before the unconditional RemoveAll that replaces whatever is
  at the managed path.
- The managed git workdir cache never reconciled with a changed
  git.repositories.<name>.uri; reconcile now syncs the local remote URL.
- The DNS-1123 invalid-name error embeds a regex with '[', ']', '(', ')'
  and no spaces, which the CLI's markdown renderer both mangled and
  hard-wrapped; it's now backtick-fenced as a code span.
- Fixed a copy-pasted config example in the atmos-git skill doc
  (nested signing: {mode: auto} instead of the real flat signing: auto
  field) that fails to parse if used as-is.
- Documented that `atmos kubernetes validate --server` fails on a
  manifest set that creates its own namespace and delivers into it in
  the same batch (inherent to server-side dry-run semantics), even
  though apply/deploy of the same objects succeeds.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Bumps the existing pnpm overrides for two transitive website
dependencies to their patched versions, closing 7 open Dependabot
alerts (2 high, 4 medium, 1 low), all npm/transitive:

- js-yaml 3.x -> 3.15.1, 4.x -> 4.3.1 (GHSA-5p4m-2wfm-xmqj,
  quadratic CPU consumption in !!omap resolution)
- mermaid -> 11.16.1 (GHSA-rhh3-jpg6-66xh, GHSA-c4c3-pg64-4m4v,
  GHSA-6x64-9x62-f2gx, GHSA-3rrr-jr9j-h3q3, GHSA-2v8p-3f2j-5mp7)

No CodeQL alerts were open. All fixes stay within the same major
version, so none are blocked by dependabot.yml's major-bump ignore
policy. Verified via `pnpm install` (lockfile now resolves only the
patched versions) and `npm run build`.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@atmos-pro

atmos-pro Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@osterman Erik Osterman (Cloud Posse) (osterman) added the patch A minor, backward compatible change label Aug 7, 2026
@github-actions github-actions Bot added the size/m Medium size PR label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

go.mod

PackageVersionLicenseIssue Type
github.com/go-git/go-git/v55.19.2NullUnknown License
Allowed Licenses: MIT, MIT-0, Apache-2.0, BSD-2-Clause, BSD-2-Clause-Views, BSD-3-Clause, ISC, MPL-2.0, 0BSD, Unlicense, CC0-1.0, CC-BY-3.0, CC-BY-4.0, CC-BY-SA-3.0, Python-2.0, OFL-1.1, LicenseRef-scancode-generic-cla, LicenseRef-scancode-unknown-license-reference, LicenseRef-scancode-unicode, LicenseRef-scancode-google-patent-license-golang
Excluded from license check: pkg:golang/github.com/antlr4-go/antlr/v4, pkg:golang/github.com/google/cel-go, pkg:golang/golang.org/x/image, pkg:golang/modernc.org/libc, pkg:golang/github.com/opencontainers/go-digest, pkg:npm/pako, pkg:npm/sax

Scanned Files

  • go.mod
  • website/pnpm-lock.yaml

@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes add strict Kubernetes and Git target configuration validation, synchronize Git remote URLs for existing workdirs, handle split-mode path transitions, update schemas and tests, and revise repository guidance, dependencies, and CI upload conditions.

Changes

Kubernetes validation

Layer / File(s) Summary
Validation resolution and formatting
errors/errors.go, pkg/component/kubernetes/validate.go, pkg/component/kubernetes/validate_test.go
Non-boolean validate values return ErrKubernetesValidateSectionInvalid. Metadata-name patterns render as code spans.
Executor error propagation
pkg/component/kubernetes/executor.go, pkg/component/kubernetes/executor_test.go, website/docs/cli/commands/kubernetes/kubernetes-validate.mdx
Apply and validate operations return resolution errors before further validation. Documentation describes the --server namespace limitation.

Git target split mode

Layer / File(s) Summary
Split configuration contract
errors/errors.go, pkg/datafetcher/schema/atmos/manifest/1.0.json, pkg/datafetcher/schema_condition_validation_test.go
Git provision targets support an optional boolean split setting. Schema tests cover accepted and rejected values.
Parsing and artifact delivery
pkg/provisioner/target/git/git.go, pkg/provisioner/target/git/git_test.go
Invalid split values return ErrGitTargetSplitInvalid. Delivery and fetch propagate parse errors. Split-mode changes warn before replacing files and directories.

Git remote reconciliation

Layer / File(s) Summary
Remote URL synchronization
pkg/git/providers/cli/cli.go, pkg/git/providers/cli/cli_test.go, pkg/git/providers/cli/integration_test.go
Existing workdirs compare and update the configured remote URL before fetch. Tests cover matching, changed, empty, and failing URL operations.

Repository maintenance

Layer / File(s) Summary
Guidance and workflow updates
agent-skills/skills/atmos-git/SKILL.md, website/docs/cli/commands/kubernetes/kubernetes-validate.mdx, .github/workflows/codeql.yml
Signing examples use scalar configuration. Kubernetes server-validation guidance documents namespace bootstrapping. SARIF uploads skip merge_group events.
Dependency and license updates
go.mod, NOTICE, website/package.json
Go and website dependency versions are updated. NOTICE license URLs match newer Go dependency versions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant reconcile
  participant syncRemoteURL
  participant GitRemote
  reconcile->>syncRemoteURL: configured URI
  syncRemoteURL->>GitRemote: remote get-url
  GitRemote-->>syncRemoteURL: current URL
  syncRemoteURL->>GitRemote: remote set-url when URLs differ
  reconcile->>GitRemote: fetch and branch reconciliation
Loading

Possibly related PRs

Suggested reviewers: aknysh

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.24% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies Kubernetes fixes for field-tested Kustomize and GitOps delivery gaps, which matches the main changes.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch osterman/kustomize-gitops-field-test-fixes

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (3)
pkg/datafetcher/schema_condition_validation_test.go (1)

221-230: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a case table for split values.

These three scenarios duplicate the same test structure. Put true, false, and "yes" in one table with the expected validity. This makes future invalid-type coverage direct.

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 `@pkg/datafetcher/schema_condition_validation_test.go` around lines 221 - 230,
Consolidate the three split-validation subtests into one table-driven test near
the existing schema validation tests, with cases for true, false, and "yes"
paired with their expected validity. Iterate over the table and call the
appropriate assertion based on each case, preserving the existing test naming
context and coverage.

Source: Coding guidelines

pkg/provisioner/target/git/git_test.go (1)

337-385: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert warning behavior, not only absence of a panic.

These tests pass if ui.Warningf is removed or if either warning reports the wrong mode. Extract warning-message selection into a helper that returns an empty string or the warning text. Test that helper with a table of missing, unchanged, and changed path modes.

Proposed direction
 func warnOnSplitModeFlip(absPath, path string, split bool) {
+    if message := splitModeFlipWarning(absPath, path, split); message != "" {
+        ui.Warningf("%s", message)
+    }
+}
+
+func splitModeFlipWarning(absPath, path string, split bool) string {
     info, err := os.Stat(absPath)
     if err != nil {
-        return
+        return ""
     }
     existingIsDir := info.IsDir()
     if existingIsDir == split {
-        return
+        return ""
     }
     if existingIsDir {
-        ui.Warningf("replacing existing managed directory %q with a single file: split mode changed to false", path)
-    } else {
-        ui.Warningf("replacing existing managed file %q with a directory: split mode changed to true", path)
+        return fmt.Sprintf("replacing existing managed directory %q with a single file: split mode changed to false", path)
     }
+    return fmt.Sprintf("replacing existing managed file %q with a directory: split mode changed to true", path)
 }

As per coding guidelines, “Prefer behavior-focused, table-driven unit tests with mocks; avoid tautological, stub, always-skipped, or coverage-only tests.”

🤖 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/provisioner/target/git/git_test.go` around lines 337 - 385, The
TestWarnOnSplitModeFlip tests only verify that warnOnSplitModeFlip does not
panic, so they do not validate warning behavior or mode selection. Extract the
warning-message selection from warnOnSplitModeFlip into a helper returning an
empty string when no warning is needed or the appropriate warning text
otherwise, then replace the panic-only tests with table-driven cases covering
missing, unchanged, and changed path modes and assert the returned result.

Source: Coding guidelines

pkg/component/kubernetes/validate_test.go (1)

126-146: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a table-driven test for the resolver cases.

These lines cover five input scenarios across two test functions. Put the nil, empty, true, false, and non-boolean cases in one table. Assert require.ErrorIs for the invalid case.

As per coding guidelines, Go tests must use table-driven tests for multiple scenarios.

Proposed refactor
-func TestResolveComponentValidateEnabled(t *testing.T) {
-	enabled, err := resolveComponentValidateEnabled(nil)
-	require.NoError(t, err)
-	assert.True(t, enabled, "unset defaults to enabled")
-
-	enabled, err = resolveComponentValidateEnabled(map[string]any{})
-	require.NoError(t, err)
-	assert.True(t, enabled, "unset defaults to enabled")
-
-	enabled, err = resolveComponentValidateEnabled(map[string]any{"validate": true})
-	require.NoError(t, err)
-	assert.True(t, enabled)
-
-	enabled, err = resolveComponentValidateEnabled(map[string]any{"validate": false})
-	require.NoError(t, err)
-	assert.False(t, enabled)
-}
-
-func TestResolveComponentValidateEnabledRejectsNonBool(t *testing.T) {
-	_, err := resolveComponentValidateEnabled(map[string]any{"validate": "false"})
-	require.Error(t, err, "a present but non-bool value fails closed instead of silently defaulting to enabled")
-	assert.ErrorIs(t, err, errUtils.ErrKubernetesValidateSectionInvalid)
+func TestResolveComponentValidateEnabled(t *testing.T) {
+	tests := []struct {
+		name    string
+		section map[string]any
+		want    bool
+		wantErr error
+	}{
+		{name: "nil defaults to enabled", section: nil, want: true},
+		{name: "empty defaults to enabled", section: map[string]any{}, want: true},
+		{name: "true remains enabled", section: map[string]any{"validate": true}, want: true},
+		{name: "false disables validation", section: map[string]any{"validate": false}},
+		{
+			name:    "non-bool is rejected",
+			section: map[string]any{"validate": "false"},
+			wantErr: errUtils.ErrKubernetesValidateSectionInvalid,
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			enabled, err := resolveComponentValidateEnabled(tt.section)
+			if tt.wantErr != nil {
+				require.ErrorIs(t, err, tt.wantErr)
+				return
+			}
+			require.NoError(t, err)
+			assert.Equal(t, tt.want, enabled)
+		})
+	}
 }
🤖 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/component/kubernetes/validate_test.go` around lines 126 - 146, Refactor
TestResolveComponentValidateEnabled and
TestResolveComponentValidateEnabledRejectsNonBool into a single table-driven
test covering nil, empty, true, false, and non-boolean inputs. Store each case’s
expected enabled value and error expectation, assert successful cases with
NoError and True/False, and use require.ErrorIs with
ErrKubernetesValidateSectionInvalid for the invalid case.

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-git/SKILL.md`:
- Line 39: Update the later GitOps guidance in SKILL.md to use the scalar
commit.signing: auto configuration key instead of signing.mode: auto, matching
the example and leaving the rest of the guidance unchanged.

---

Nitpick comments:
In `@pkg/component/kubernetes/validate_test.go`:
- Around line 126-146: Refactor TestResolveComponentValidateEnabled and
TestResolveComponentValidateEnabledRejectsNonBool into a single table-driven
test covering nil, empty, true, false, and non-boolean inputs. Store each case’s
expected enabled value and error expectation, assert successful cases with
NoError and True/False, and use require.ErrorIs with
ErrKubernetesValidateSectionInvalid for the invalid case.

In `@pkg/datafetcher/schema_condition_validation_test.go`:
- Around line 221-230: Consolidate the three split-validation subtests into one
table-driven test near the existing schema validation tests, with cases for
true, false, and "yes" paired with their expected validity. Iterate over the
table and call the appropriate assertion based on each case, preserving the
existing test naming context and coverage.

In `@pkg/provisioner/target/git/git_test.go`:
- Around line 337-385: The TestWarnOnSplitModeFlip tests only verify that
warnOnSplitModeFlip does not panic, so they do not validate warning behavior or
mode selection. Extract the warning-message selection from warnOnSplitModeFlip
into a helper returning an empty string when no warning is needed or the
appropriate warning text otherwise, then replace the panic-only tests with
table-driven cases covering missing, unchanged, and changed path modes and
assert the returned result.
🪄 Autofix

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: 1adeee94-a48b-4ab9-a89a-f012d25542cb

📥 Commits

Reviewing files that changed from the base of the PR and between 8ab15a3 and 8890283.

⛔ Files ignored due to path filters (1)
  • website/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (14)
  • agent-skills/skills/atmos-git/SKILL.md
  • errors/errors.go
  • pkg/component/kubernetes/executor.go
  • pkg/component/kubernetes/validate.go
  • pkg/component/kubernetes/validate_test.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/datafetcher/schema_condition_validation_test.go
  • pkg/git/providers/cli/cli.go
  • pkg/git/providers/cli/cli_test.go
  • pkg/git/providers/cli/integration_test.go
  • pkg/provisioner/target/git/git.go
  • pkg/provisioner/target/git/git_test.go
  • website/docs/cli/commands/kubernetes/kubernetes-validate.mdx
  • website/package.json

Comment thread agent-skills/skills/atmos-git/SKILL.md Resolved
@codecov

codecov Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.77%. Comparing base (1107de3) to head (5891b63).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2905      +/-   ##
==========================================
- Coverage   82.77%   82.77%   -0.01%     
==========================================
  Files        1863     1863              
  Lines      180609   180652      +43     
==========================================
+ Hits       149500   149533      +33     
- Misses      23314    23322       +8     
- Partials     7795     7797       +2     
Flag Coverage Δ
unittests 82.77% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
errors/errors.go 100.00% <ø> (ø)
pkg/component/kubernetes/executor.go 84.28% <100.00%> (+0.32%) ⬆️
pkg/component/kubernetes/validate.go 100.00% <100.00%> (ø)
pkg/git/providers/cli/cli.go 84.55% <100.00%> (+1.98%) ⬆️
pkg/provisioner/target/git/git.go 85.71% <100.00%> (+1.23%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Fix a stale signing.mode: auto reference in the atmos-git skill's
  GitOps guidance (the config example above it already uses the real
  flat commit.signing: auto field; per CodeRabbit review on #2905).
- Close Codecov patch-coverage gaps flagged on the same PR by adding
  real behavioral tests for the new error-propagation and
  remote-URL-sync branches in reconcile/syncRemoteURL,
  executeKubernetesOperation, and parseConfig/Deliver/Fetch.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
pkg/component/kubernetes/executor_test.go (1)

664-685: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use one table-driven test for both operations.

The apply and validate cases duplicate the setup, client-hook replacement, manifest, component section, and error assertion. Parameterize OperationApply and OperationValidate as table rows and run subtests. This keeps the fail-closed contract in one place.

As per coding guidelines, Go tests must use table-driven tests for testing multiple scenarios.

Also applies to: 687-709

🤖 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/component/kubernetes/executor_test.go` around lines 664 - 685, Refactor
the duplicated tests around TestRunOperationApplyPropagatesValidateSectionError
and its validate counterpart into one table-driven test with OperationApply and
OperationValidate rows. Keep the shared client hook, manifest, component
section, fail-closed assertion, and ErrKubernetesValidateSectionInvalid check in
the common subtest body, using each row’s operation via t.Run.

Source: Coding guidelines

pkg/git/providers/cli/cli_test.go (1)

128-156: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a table-driven test for these reconciliation scenarios.

These tests repeat the runner, provider, workdir, clone options, and error assertions. Move the scenario-specific setup and expected outcomes into a table. This reduces duplication and keeps future reconciliation cases consistent.

As per coding guidelines, use behavior-focused, table-driven unit tests for multiple scenarios in Go.

Also applies to: 158-182, 184-207

🤖 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/cli/cli_test.go` around lines 128 - 156, The reconciliation
tests around TestCloneReconcileSkipsRemoteSyncWhenURIEmpty and the additional
scenarios should be consolidated into a table-driven test. Keep shared runner,
provider, temporary workdir, Clone invocation, error assertion, and call
inspection in the common test loop, while moving each scenario’s CloneOptions
and expected command outcomes into table entries.

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/component/kubernetes/executor_test.go`:
- Around line 664-685: Extend
TestRunOperationApplyPropagatesValidateSectionError with the existing invalid
ConfigMap name input “Bad_Name” from
TestRunOperationApplyGateSkippedWhenValidateDisabled, while keeping validate set
to the non-boolean string “false”. Assert the returned error remains caused by
ErrKubernetesValidateSectionInvalid, confirming component validate-section
resolution takes precedence over structural object validation.

---

Nitpick comments:
In `@pkg/component/kubernetes/executor_test.go`:
- Around line 664-685: Refactor the duplicated tests around
TestRunOperationApplyPropagatesValidateSectionError and its validate counterpart
into one table-driven test with OperationApply and OperationValidate rows. Keep
the shared client hook, manifest, component section, fail-closed assertion, and
ErrKubernetesValidateSectionInvalid check in the common subtest body, using each
row’s operation via t.Run.

In `@pkg/git/providers/cli/cli_test.go`:
- Around line 128-156: The reconciliation tests around
TestCloneReconcileSkipsRemoteSyncWhenURIEmpty and the additional scenarios
should be consolidated into a table-driven test. Keep shared runner, provider,
temporary workdir, Clone invocation, error assertion, and call inspection in the
common test loop, while moving each scenario’s CloneOptions and expected command
outcomes into table entries.
🪄 Autofix

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: aaca5ac3-44e8-4eb1-94d2-e54f9fa545f7

📥 Commits

Reviewing files that changed from the base of the PR and between 8890283 and 2eb20fe.

📒 Files selected for processing (4)
  • agent-skills/skills/atmos-git/SKILL.md
  • pkg/component/kubernetes/executor_test.go
  • pkg/git/providers/cli/cli_test.go
  • pkg/provisioner/target/git/git_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/provisioner/target/git/git_test.go

…n precedence

TestRunOperationApplyPropagatesValidateSectionError and its validate-op
mirror used an already-valid ConfigMap name, so they couldn't
distinguish "validate-section resolved first" from "structural check
first, but this object happens to pass" -- both orderings return the
same error with a valid object. Switching to an invalid name means only
the correct precedence still returns ErrKubernetesValidateSectionInvalid.

Per CodeRabbit review on #2905.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 7, 2026
@aknysh
Andriy Knysh (aknysh) added this pull request to the merge queue Aug 8, 2026
@atmos-pro

atmos-pro Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@atmos-pro

atmos-pro Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 8, 2026
The merge queue's ephemeral gh-readonly-queue/main/pr-<n>-<sha> ref is
deleted as soon as the queue cycles (observed every ~7-13 minutes), which
routinely races the multi-minute CodeQL analysis and golangci-lint SARIF
uploads and fails them with "ref not found" / "CodeQL job status was
configuration error" -- even though nothing is actually wrong with the
code. This was blocking every PR in the merge queue, not just this one
(confirmed the same failure on #2908 at the same time).

Both jobs still run and still report pass/fail on merge_group events, so
the merge queue's required checks get a result -- they just skip the
upload, which can't succeed against a ref that's already gone by the
time it completes. pull_request/push events are unaffected: the upload
still runs there, where the ref is stable, so it stays fully required
and enforced on PRs.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mergify

mergify Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label Aug 8, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/codeql.yml (2)

196-196: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Stop the uploader when the workflow is canceled.

always() at Line 196 can keep the step running after cancellation. The uploader can then run with incomplete output and delay cancellation. Use !cancelled() to retain post-failure uploads without continuing canceled runs. GitHub documents this cancellation behavior and recommends the inverse cancelled() check. (docs.github.com)

Proposed fix
-        if: always() && github.event_name != 'merge_group'
+        if: ${{ !cancelled() && github.event_name != 'merge_group' }}
🤖 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 @.github/workflows/codeql.yml at line 196, Update the conditional guarding
the uploader step to use !cancelled() instead of always(), while preserving the
existing github.event_name != 'merge_group' exclusion so uploads still run after
failures but stop when the workflow is canceled.

74-80: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Align the SARIF comments with the configured event graph.

The workflow declares schedule, so the CodeQL condition at Line 81 also permits scheduled uploads. The lint-golangci job is gated at Line 94 to pull_request and merge_group, so Line 196 cannot upload on push. The changed comments say pull_request/push. Update the comments or change the event guards to match the intended behavior. (raw.githubusercontent.com)

Also applies to: 190-195

🤖 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 @.github/workflows/codeql.yml around lines 74 - 80, Align the SARIF upload
comments and event guards in the CodeQL workflow: update the condition near the
CodeQL upload to reflect the declared schedule event, and reconcile the
lint-golangci upload guard with its pull_request/merge_group job triggers rather
than documenting pull_request/push. Ensure comments and configured event
conditions consistently describe the actual upload behavior.
🤖 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 @.github/workflows/codeql.yml:
- Line 81: Update the CodeQL workflow’s upload setting to use the string modes
`never` for `merge_group` events and `always` for all other events, replacing
the current boolean expression on `upload`.

---

Nitpick comments:
In @.github/workflows/codeql.yml:
- Line 196: Update the conditional guarding the uploader step to use
!cancelled() instead of always(), while preserving the existing
github.event_name != 'merge_group' exclusion so uploads still run after failures
but stop when the workflow is canceled.
- Around line 74-80: Align the SARIF upload comments and event guards in the
CodeQL workflow: update the condition near the CodeQL upload to reflect the
declared schedule event, and reconcile the lint-golangci upload guard with its
pull_request/merge_group job triggers rather than documenting pull_request/push.
Ensure comments and configured event conditions consistently describe the actual
upload behavior.
🪄 Autofix

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: c4ce4072-2661-463e-8523-92ebcc19a0e1

📥 Commits

Reviewing files that changed from the base of the PR and between f4d10ea and cd9d966.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml

Comment thread .github/workflows/codeql.yml Resolved
Its job was gated to `if: github.event_name == 'pull_request'`, so it
never produced a check run for the merge queue's synthetic commit.
Since it's a required status check, the merge queue waited out its
full check-response timeout (75 min) hoping for a check that would
never appear, then dequeued the PR -- even when every other required
check (Tests, CodeQL, Codeowners, symlinks) had already succeeded
comfortably within the window (confirmed: this run's other checks
finished at 64m38s, but the PR wasn't dequeued until 79 min).

The label-check step itself stays pull_request-only (merge_group has
no github.event.pull_request for it to check labels against, and the
label was already verified before the PR entered the queue); only the
job's own if: was widened so it reports a pass for merge_group.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@aknysh
Andriy Knysh (aknysh) added this pull request to the merge queue Aug 9, 2026
@atmos-pro

atmos-pro Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 9, 2026
@aknysh
Andriy Knysh (aknysh) added this pull request to the merge queue Aug 9, 2026
@atmos-pro

atmos-pro Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 10, 2026
@atmos-pro

atmos-pro Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 10, 2026
The earlier fix (skip the upload entirely on merge_group) traded one
problem for a worse one: it dodged the "ref not found" upload failure,
but the native "CodeQL" required status check is only ever created
when a SARIF upload actually happens for that commit -- so skipping
the upload left that required check permanently missing on merge_group
commits. The merge queue then waits out its full check-response
timeout for a check that will never report, exactly like the PR
Semver Labels gap, except invisibly this time (every check-run showed
success; the queue was just stuck waiting on one that never existed).

Confirmed directly: diffed required_status_checks.contexts against the
actual check-runs reported for a recent merge_group commit where every
workflow run had already succeeded -- "CodeQL" was the only one absent.

Fix: explicitly set the codeql-action ref/sha inputs to the merge
group's target branch ref (event.merge_group.base_ref, e.g.
refs/heads/main -- a ref that persists) and the actual queued merge
commit (event.merge_group.head_sha), instead of letting the action
auto-detect from GITHUB_REF/GITHUB_SHA (the ephemeral, soon-deleted
gh-readonly-queue/... ref). This lets the upload succeed for real
instead of needing to skip it. pull_request/push are unaffected --
ref/sha are only overridden for merge_group.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@aknysh
Andriy Knysh (aknysh) added this pull request to the merge queue Aug 10, 2026
@atmos-pro

atmos-pro Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@osterman
Erik Osterman (Cloud Posse) (osterman) removed this pull request from the merge queue due to a manual request Aug 10, 2026
@atmos-pro

atmos-pro Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

Merged via the queue into main with commit 4aec494 Aug 10, 2026
90 checks passed
@osterman
Erik Osterman (Cloud Posse) (osterman) deleted the osterman/kustomize-gitops-field-test-fixes branch August 10, 2026 17:44
@atmos-pro

atmos-pro Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Aug 10, 2026
@github-actions

Copy link
Copy Markdown

These changes were released in v1.226.0-rc.4.

This branch was successfully deployed

1 active and 1 inactive deployments
preview — 5891b636 Deployed Aug 10, 2026 by github-actions[bot]
screengrabs — 5891b636 Deployed Aug 10, 2026 by osterman via build #1242
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants