Repository navigation
fix(bundler): create argocd-helm static/ only when populated - #1944
Conversation
📝 WalkthroughWalkthroughThe argocd-helm deployer now creates Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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/bundler/deployer/argocdhelm/argocdhelm.go`:
- Around line 545-550: Update the writeValuesFiles call sites that handle
ensureStaticDir errors, including the additional occurrence around the later
referenced block, to use errors.PropagateOrWrap instead of unconditional
wrapping. Preserve the existing context message while retaining the original
structured error code for errors returned by ensureStaticDir.
🪄 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: ASSERTIVE
Plan: Enterprise
Run ID: f504da4d-ac36-4496-8cce-9fc1eeacd579
📒 Files selected for processing (2)
pkg/bundler/deployer/argocdhelm/argocdhelm.gopkg/bundler/deployer/argocdhelm/argocdhelm_test.go
Recipe evidence checkNo leaf overlays affected by this PR. This gate is warning-only and never blocks merge. |
2673c80 to
90747ce
Compare
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/bundler/deployer/argocdhelm/argocdhelm.go`:
- Around line 620-624: Update the staticDirReady cleanup logic to inspect
staticDir with os.Lstat before removal, and only remove it when the existing
entry is an actual directory (and empty); preserve non-directory paths such as
regular files and symlinks. Keep the existing missing-path handling and debug
logging behavior in the surrounding deployment flow.
🪄 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: ASSERTIVE
Plan: Enterprise
Run ID: 7e876d52-703c-41b3-9445-21538fb4e689
📒 Files selected for processing (3)
docs/user/cli-reference.mdpkg/bundler/deployer/argocdhelm/argocdhelm.gopkg/bundler/deployer/argocdhelm/argocdhelm_test.go
90747ce to
e682321
Compare
The argocd-helm generator created <output>/static unconditionally, then
wrote a values file into it only for components resolving to a remote Helm
chart (type Helm with a non-empty Source).
A recipe whose components are all local charts contributes nothing, leaving
static/ empty. The bundle inventory validator walks the finished tree and
rejects any directory that contributes no files, so generation failed with:
bundle contains an unexpected directory: "static"
This affected every OCP overlay -- ocp, ocp-training, and ocp-inference --
whose components are all type Helm built from manifestFiles with no upstream
Source. Only the argocd-helm deployer was affected; helm, argocd, and
helmfile bundle the same recipes cleanly.
Create static/ lazily, immediately before the first component values file is
written, so a bundle that contributes no static values omits the directory
entirely rather than emitting an empty one.
Generation writes directly into --output and does not clear it between runs,
so a failed pre-fix run leaves its empty static/ on disk and a plain retry
would reproduce the same error. Remove that directory when nothing was
written. A populated one is kept for validateExactTree to report as
unexpected output.
Guard the path itself in one place, shared by the create and remove routes.
os.Remove unlinks regular files as readily as it removes empty directories,
and MkdirAll reports a non-directory as a generic ENOTDIR, so without a
shared guard the same user error surfaced as INVALID_REQUEST for an all-local
recipe and INTERNAL for any recipe carrying an upstream chart. Lstat also
rejects a symlink planted after checksum.ValidateOutputRoot ran, which
permits pre-existing regular files.
Propagate the resulting error code instead of re-wrapping it, so a bad
--output path reports as INVALID_REQUEST rather than an internal fault --
over the API, a 5xx would withhold the cause from the response.
Verified across the full embedded catalog on the argocd-helm deployer: the
97 previously-working overlays produce byte-identical output, and the 3 OCP
overlays now generate successfully.
Fixes NVIDIA#1942
Signed-off-by: Yuan Chen <[email protected]>
e682321 to
08672a2
Compare
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/bundler/deployer/argocdhelm/argocdhelm_test.go`:
- Around line 850-855: Strengthen the failure assertion in the populated static/
generation subtest around newGen(false).Generate by verifying the returned error
explicitly mentions the stale file or entry reported by validateExactTree,
rather than only checking that an error occurred. Preserve the existing
requirement that the stale file remains present.
🪄 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: ASSERTIVE
Plan: Enterprise
Run ID: 1de50a42-3c71-412e-971b-e858b7af6c41
📒 Files selected for processing (3)
docs/user/cli-reference.mdpkg/bundler/deployer/argocdhelm/argocdhelm.gopkg/bundler/deployer/argocdhelm/argocdhelm_test.go
|
|
||
| // Generation fails because validateExactTree reports the stale file | ||
| // as unexpected output. The file itself must still be there. | ||
| if _, err := newGen(false).Generate(context.Background(), outputDir); err == nil { | ||
| t.Error("Generate() succeeded, want failure on unexpected stale output") | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Assert why generation failed in the populated-static/ case.
err == nil alone passes for any unrelated failure, so this subtest could keep passing after the inventory-validation behavior it targets regresses. Check the error names the stale entry.
♻️ Tighter assertion
- if _, err := newGen(false).Generate(context.Background(), outputDir); err == nil {
- t.Error("Generate() succeeded, want failure on unexpected stale output")
- }
+ _, err := newGen(false).Generate(context.Background(), outputDir)
+ if err == nil {
+ t.Error("Generate() succeeded, want failure on unexpected stale output")
+ } else if !strings.Contains(err.Error(), "leftover.yaml") {
+ t.Errorf("Generate() error = %v, want it to name the unexpected stale file", err)
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Generation fails because validateExactTree reports the stale file | |
| // as unexpected output. The file itself must still be there. | |
| if _, err := newGen(false).Generate(context.Background(), outputDir); err == nil { | |
| t.Error("Generate() succeeded, want failure on unexpected stale output") | |
| } | |
| // Generation fails because validateExactTree reports the stale file | |
| // as unexpected output. The file itself must still be there. | |
| _, err := newGen(false).Generate(context.Background(), outputDir) | |
| if err == nil { | |
| t.Error("Generate() succeeded, want failure on unexpected stale output") | |
| } else if !strings.Contains(err.Error(), "leftover.yaml") { | |
| t.Errorf("Generate() error = %v, want it to name the unexpected stale file", err) | |
| } |
🤖 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/bundler/deployer/argocdhelm/argocdhelm_test.go` around lines 850 - 855,
Strengthen the failure assertion in the populated static/ generation subtest
around newGen(false).Generate by verifying the returned error explicitly
mentions the stale file or entry reported by validateExactTree, rather than only
checking that an error occurred. Preserve the existing requirement that the
stale file remains present.
njhensley
left a comment
There was a problem hiding this comment.
Multi-persona review — Approve ✅
Method: 4 independent persona reviewers (Correctness · Security · Domain/Architecture · Test-coverage), then an adversarial senior meta-reviewer that re-derived every finding from the resolved code at e682321. 8 findings surfaced; all confirmed at nitpick tier (one down-tiered 🟡→🔵), zero refuted, no higher-severity issue found in a fresh adversarial pass.
Legend: 🔴 Blocker · 🟠 Major · 🟡 Minor · 🔵 Nitpick
Overall assessment
Clean, correct, and unusually well-documented bug fix. Lazy static/ creation (ensureStaticDir flips staticDirReady only after a successful MkdirAll that immediately precedes a write, so !staticDirReady is a precise "no static file contributed" signal), the guarded removeStaleStaticDir (Lstat type-check → explicit emptiness check → non-recursive os.Remove that fails closed on any error), and the Wrap→PropagateOrWrap switch are all sound. The meta-reviewer reproduced the crux (a hypothetical Stat swap would follow a symlink-to-dir; the shipped Lstat fails closed) and verified: no empty-dir leak, templates/ is never empty, validateExactTree is genuinely exercised (IncludeChecksums: true), and the only concurrency race is a pre-existing whole-deployer property. Tests pass with -race.
Everything flagged is optional polish — none blocks merge. The two most worth a quick follow-up are the symlink test (inline on the test file) and a log line on the removal branch.
Confirmed non-issues (examined, cleared)
PropagateOrWrapis the correct idiomatic choice — the prior unconditionalWrap(Internal, …)mis-coded the newErrCodeInvalidRequestnon-directory case as a 5xx (which also withholds the cause over the API); the switch fixes it.os.Removeblast radius is safe — no-follow + non-recursive;staticDiris a fixedSafeJoinleaf; the Lstat→ReadDir→Remove TOCTOU window fails closed (ENOTEMPTY ≠ IsNotExist). No path traversal, no external delete.- No remote-chart regression — any run writing ≥1 file keeps
static/; the control test drives realvalidateExactTree. templates/,outputDir, copy-tree mkdirs are never empty when any component exists — the empty-dir pattern is unique to the remote-Helm-onlystatic/.- Doc update in
cli-reference.mdaccurately matches the behavior.
Summary
| 🔴 Blocker | 🟠 Major | 🟡 Minor | 🔵 Nitpick |
|---|---|---|---|
| 0 | 0 | 0 | 8 |
Recommendation: Approve — merge-ready; the eight inline nitpicks are optional polish.
| }) | ||
| values["cert-manager"] = map[string]any{"replicaCount": 1} | ||
| } | ||
| rr := newRecipeResult("v1.0.0", refs) |
There was a problem hiding this comment.
🔵 Nitpick — Lstat-vs-Stat symlink rationale has no regression test
The code comment justifies os.Lstat over os.Stat to reject a symlink planted after ValidateOutputRoot ran, but the only test hitting the !info.IsDir() branch seeds a regular file — non-dir under both Lstat and Stat. A future refactor to Stat would pass every test yet follow a symlink-to-dir, skip the rejection, and silently keep an unexpected tree. Shipped code is correct; this is future-refactor hardening (down-tiered from Minor).
Blast radius: Test-only gap; production is correct today.
Fix: Add a symlink-to-dir subcase asserting Generate fails with "is not a directory" and the target is untouched.
| // Emptiness is checked explicitly rather than inferred from an os.Remove | ||
| // errno, which keeps the intent readable and avoids platform-specific error | ||
| // values. A populated static/ is kept: its contents are reported by | ||
| // validateExactTree as unexpected output, though only when checksums are |
There was a problem hiding this comment.
🔵 Nitpick — State-changing removal is silent; the no-op keep logs
The keep-populated branch emits slog.Debug("keeping populated static directory..."), but the os.Remove branch that actually deletes a directory under the user's --output logs nothing. The action worth an audit trail is the one without a log line.
Blast radius: Diagnostics only — an operator debugging "why did my static/ disappear between runs" has no signal.
Fix: Add slog.Debug("removed stale empty static directory", "path", staticDir) on successful removal.
| staticFiles, staticSize, dynamicOnlyValues, err := g.writeStaticValuesAndBuildStubs(outputDir) | ||
| if err != nil { | ||
| return errors.Wrap(errors.ErrCodeInternal, "failed to write static values", err) | ||
| return errors.PropagateOrWrap(err, errors.ErrCodeInternal, "failed to write static values") |
There was a problem hiding this comment.
🔵 Nitpick — PropagateOrWrap fallback is dead code today
Every error writeStaticValuesAndBuildStubs returns is already a *StructuredError, so PropagateOrWrap always propagates and the ErrCodeInternal fallback + message never apply.
Blast radius: None functionally — correct and defensive against a future non-coded return.
Fix: No change required; the comment at 442-446 already documents the intent.
| @@ -593,9 +621,91 @@ func (g *Generator) writeStaticValuesAndBuildStubs(outputDir string) ([]string, | |||
| totalSize += staticSize | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
🔵 Nitpick — No test for staticDirReady=true + stale leftover skip path
removeStaleStaticDir only runs when the run wrote no static files. When a run does write static files but a stale foreign file also sits in static/, removal is skipped and validateExactTree is the sole (here untested) backstop.
Blast radius: Small; validateExactTree is the real backstop.
Fix: Optionally extend the remote-chart case with a pre-seeded static/leftover.yaml and assert Generate fails while the real static file is still written.
| switch { | ||
| case os.IsNotExist(statErr): | ||
| return nil | ||
| case statErr != nil: |
There was a problem hiding this comment.
🔵 Nitpick — Lstat/ReadDir/Remove error branches uncovered
The three errors.Wrap(ErrCodeInternal, ...) failure paths need filesystem fault injection (unreadable/perm-denied dirs) and are unexercised.
Blast radius: Minimal — standard unreachable-without-fault-injection error paths.
Fix: Acceptable to leave uncovered; a chmod-based subcase could cover ReadDir-error if desired.
| if err := removeStaleStaticDir(staticDir); err != nil { | ||
| return nil, 0, nil, err | ||
| } | ||
| } |
There was a problem hiding this comment.
🔵 Nitpick — Stale-dir cleanup is a per-deployer point patch, not a shared contract
The lazy-create half matches localformat, but the removeStaleStaticDir stale-sweep is unique to argocd-helm; flux (#1947) still eager-MkdirAll's sources/ and localformat has lazy-create only — three levels of the same non-cleared-output concern with no shared helper.
Blast radius: Architecture/maintainability — each deployer re-derives its own output hygiene; drift increases with the flux twin (#1947).
Fix: Non-blocking. Follow-up: factor an ensure-dir-lazily + reap-if-stale-empty helper into pkg/bundler/deployer.
| case statErr != nil: | ||
| return errors.Wrap(errors.ErrCodeInternal, | ||
| "failed to inspect static directory", statErr) | ||
| case info.Mode()&os.ModeSymlink != 0: |
There was a problem hiding this comment.
🔵 Nitpick — Absolute output path echoed in a 4xx error detail
The non-dir rejection embeds the absolute staticDir in an ErrCodeInvalidRequest, which server.WriteErrorFromErr surfaces in details["error"] for 4xx.
Blast radius: Minor server filesystem-layout disclosure — effectively unreachable because the API path bundles into a fresh per-request os.MkdirTemp; consistent with existing SafeJoin/ValidateOutputRoot 4xx messages.
Fix: None required; optionally log the path server-side and return a generic message.
| staticDirReady := false | ||
| ensureStaticDir := func() error { | ||
| if staticDirReady { | ||
| return nil |
There was a problem hiding this comment.
🔵 Nitpick — Directory-permission literal divergence across deployers
New MkdirAll(staticDir, 0755) matches this file's convention (359/389/1466), but flux uses 0750 and there is no pkg/defaults constant for bundle dir perms.
Blast radius: Cosmetic/negligible — user-local bundle artifacts.
Fix: None for this PR; the package would benefit from a single defaults.BundleDirPerm constant.
Follow-up to NVIDIA#1944, which merged before these review fixes landed. Add end-to-end coverage for the fix itself. No test bundled a real OCP recipe through --deployer argocd-helm: the chainsaw suite used the default helm deployer, and kwok-recipes.yaml skips service==ocp for every deployer, so the merged fix had unit coverage only. The new steps bundle the same recipe the suite already generates and assert static/ is omitted rather than emitted empty. Verified against a binary built from the commit before the fix, where the step fails with the original error. The error-code assertion added in NVIDIA#1944 could not fail. stdlib errors.Is walks the Unwrap chain and StructuredError.Is matches on Code, so under an outer Wrap(ErrCodeInternal, ...) the chain is INTERNAL -> INVALID_REQUEST and the positive assertion still passes. ExitCodeFromError reads the outermost StructuredError, so reverting writeValuesFiles to Wrap flipped aicr bundle from exit 2 to exit 8 with the suite green. Assert the negative direction as well -- no ErrCodeInternal anywhere in the chain -- which is what pins that call to PropagateOrWrap. The "populated static dir is preserved" subtest accepted any error from Generate, unlike its siblings. Assert the specific message. The validator reports the stale directory rather than the file inside it: for an all-local recipe static/ is not an expected directory at all, so the walk rejects it before reaching its contents. Promote the kept-stale-directory log from Debug to Warn. It reports artifact residue surviving into the bundle, which Debug puts below the CLI's default level. Scope the checkStaticPath threat model to what the code delivers. Lstat rejects a symlink already present when generation reaches the path, but this is a check-then-act on a path name, so one planted between the check and the following MkdirAll or Remove is not caught. Closing that would need openat-based operations throughout and buys nothing in a supported configuration: it requires a local process with write access to --output, and anything with that access can already rewrite the finished bundle and its checksums. No behavior change beyond the log level. Related: NVIDIA#1942, NVIDIA#1944 Signed-off-by: Yuan Chen <[email protected]>
Follow-up to NVIDIA#1944, which merged before these review fixes landed. Add end-to-end coverage for the fix itself. No test bundled a real OCP recipe through --deployer argocd-helm: the chainsaw suite used the default helm deployer, and kwok-recipes.yaml skips service==ocp for every deployer, so the merged fix had unit coverage only. The new steps bundle the same recipe the suite already generates and assert static/ is omitted rather than emitted empty. Verified against a binary built from the commit before the fix, where the step fails with the original error. Make the scaffold presence checks fail closed. A bare `test -f` returns 1 without terminating the script, and Chainsaw reads only the final exit status, so a missing Chart.yaml or values.yaml left the guard passing. The pre-existing assert-folder-structure step had the same shape and the same false pass. Both now run under set -eu and report which file is missing. The error-code assertion added in NVIDIA#1944 could not fail. stdlib errors.Is walks the Unwrap chain and StructuredError.Is matches on Code, so under an outer Wrap(ErrCodeInternal, ...) the chain is INTERNAL -> INVALID_REQUEST and the positive assertion still passes. ExitCodeFromError reads the outermost StructuredError, so reverting writeValuesFiles to Wrap flipped aicr bundle from exit 2 to exit 8 with the suite green. Assert the negative direction as well -- no ErrCodeInternal anywhere in the chain -- which is what pins that call to PropagateOrWrap. The "populated static dir is preserved" subtest accepted any error from Generate, unlike its siblings. Assert the specific message. The validator reports the stale directory rather than the file inside it: for an all-local recipe static/ is not an expected directory at all, so the walk rejects it before reaching its contents. Promote the kept-stale-directory log from Debug to Warn. It reports artifact residue surviving into the bundle, which Debug puts below the CLI's default level. Scope the checkStaticPath threat model to what the code delivers. Lstat rejects a symlink already present when generation reaches the path, but this is a check-then-act on a path name, so one planted between the check and the following MkdirAll or Remove is not caught. Closing that would need openat-based operations throughout and buys nothing in a supported configuration: it requires a local process with write access to --output, and anything with that access can already rewrite the finished bundle and its checksums. No behavior change beyond the log level. Related: NVIDIA#1942, NVIDIA#1944 Signed-off-by: Yuan Chen <[email protected]>
Follow-up to NVIDIA#1944, which merged before these review fixes landed. Add end-to-end coverage for the fix itself. No test bundled a real OCP recipe through --deployer argocd-helm: the chainsaw suite used the default helm deployer, and kwok-recipes.yaml skips service==ocp for every deployer, so the merged fix had unit coverage only. The new steps bundle the same recipe the suite already generates and assert static/ is omitted rather than emitted empty. Verified against a binary built from the commit before the fix, where the step fails with the original error. Make the scaffold presence checks fail closed. A bare `test -f` returns 1 without terminating the script, and Chainsaw reads only the final exit status, so a missing Chart.yaml or values.yaml left the guard passing. The pre-existing assert-folder-structure step had the same shape and the same false pass. Both now run under set -eu and report which file is missing. The error-code assertion added in NVIDIA#1944 could not fail. stdlib errors.Is walks the Unwrap chain and StructuredError.Is matches on Code, so under an outer Wrap(ErrCodeInternal, ...) the chain is INTERNAL -> INVALID_REQUEST and the positive assertion still passes. ExitCodeFromError reads the outermost StructuredError, so reverting writeValuesFiles to Wrap flipped aicr bundle from exit 2 to exit 8 with the suite green. Assert the negative direction as well -- no ErrCodeInternal anywhere in the chain -- which is what pins that call to PropagateOrWrap. The "populated static dir is preserved" subtest accepted any error from Generate, unlike its siblings. Assert the specific message. The validator reports the stale directory rather than the file inside it: for an all-local recipe static/ is not an expected directory at all, so the walk rejects it before reaching its contents. Promote the kept-stale-directory log from Debug to Warn. It reports artifact residue surviving into the bundle, which Debug puts below the CLI's default level. Scope the checkStaticPath threat model to what the code delivers. Lstat rejects a symlink already present when generation reaches the path, but this is a check-then-act on a path name, so one planted between the check and the following MkdirAll or Remove is not caught. Closing that would need openat-based operations throughout and buys nothing in a supported configuration: it requires a local process with write access to --output, and anything with that access can already rewrite the finished bundle and its checksums. No behavior change beyond the log level. Related: NVIDIA#1942, NVIDIA#1944 Signed-off-by: Yuan Chen <[email protected]>
Follow-up to NVIDIA#1944, which merged before these review fixes landed. Add end-to-end coverage for the fix itself. No test bundled a real OCP recipe through --deployer argocd-helm: the chainsaw suite used the default helm deployer, and kwok-recipes.yaml skips service==ocp for every deployer, so the merged fix had unit coverage only. The new steps bundle the same recipe the suite already generates and assert static/ is omitted rather than emitted empty. Verified against a binary built from the commit before the fix, where the step fails with the original error. Make the scaffold presence checks fail closed. A bare `test -f` returns 1 without terminating the script, and Chainsaw reads only the final exit status, so a missing Chart.yaml or values.yaml left the guard passing. The pre-existing assert-folder-structure step had the same shape and the same false pass. Both now run under set -eu and report which file is missing. The error-code assertion added in NVIDIA#1944 could not fail. stdlib errors.Is walks the Unwrap chain and StructuredError.Is matches on Code, so under an outer Wrap(ErrCodeInternal, ...) the chain is INTERNAL -> INVALID_REQUEST and the positive assertion still passes. ExitCodeFromError reads the outermost StructuredError, so reverting writeValuesFiles to Wrap flipped aicr bundle from exit 2 to exit 8 with the suite green. Assert the negative direction as well -- no ErrCodeInternal anywhere in the chain -- which is what pins that call to PropagateOrWrap. The "populated static dir is preserved" subtest accepted any error from Generate, unlike its siblings. Assert the specific message. The validator reports the stale directory rather than the file inside it: for an all-local recipe static/ is not an expected directory at all, so the walk rejects it before reaching its contents. Promote the kept-stale-directory log from Debug to Warn. It reports artifact residue surviving into the bundle, which Debug puts below the CLI's default level. Scope the checkStaticPath threat model to what the code delivers. Lstat rejects a symlink already present when generation reaches the path, but this is a check-then-act on a path name, so one planted between the check and the following MkdirAll or Remove is not caught. Closing that would need openat-based operations throughout and buys nothing in a supported configuration: it requires a local process with write access to --output, and anything with that access can already rewrite the finished bundle and its checksums. No behavior change beyond the log level. Related: NVIDIA#1942, NVIDIA#1944 Signed-off-by: Yuan Chen <[email protected]>
Follow-up to NVIDIA#1944, which merged before these review fixes landed. Add end-to-end coverage for the fix itself. No test bundled a real OCP recipe through --deployer argocd-helm: the chainsaw suite used the default helm deployer, and kwok-recipes.yaml skips service==ocp for every deployer, so the merged fix had unit coverage only. The new steps bundle the same recipe the suite already generates and assert static/ is omitted rather than emitted empty. Verified against a binary built from the commit before the fix, where the step fails with the original error. Make the scaffold presence checks fail closed. A bare `test -f` returns 1 without terminating the script, and Chainsaw reads only the final exit status, so a missing Chart.yaml or values.yaml left the guard passing. The pre-existing assert-folder-structure step had the same shape and the same false pass. Both now run under set -eu and report which file is missing. The error-code assertion added in NVIDIA#1944 could not fail. stdlib errors.Is walks the Unwrap chain and StructuredError.Is matches on Code, so under an outer Wrap(ErrCodeInternal, ...) the chain is INTERNAL -> INVALID_REQUEST and the positive assertion still passes. ExitCodeFromError reads the outermost StructuredError, so reverting writeValuesFiles to Wrap flipped aicr bundle from exit 2 to exit 8 with the suite green. Assert the negative direction as well -- no ErrCodeInternal anywhere in the chain -- which is what pins that call to PropagateOrWrap. The "populated static dir is preserved" subtest accepted any error from Generate, unlike its siblings. Assert the specific message. The validator reports the stale directory rather than the file inside it: for an all-local recipe static/ is not an expected directory at all, so the walk rejects it before reaching its contents. Promote the kept-stale-directory log from Debug to Warn. It reports artifact residue surviving into the bundle, which Debug puts below the CLI's default level. Scope the checkStaticPath threat model to what the code delivers. Lstat rejects a symlink already present when generation reaches the path, but this is a check-then-act on a path name, so one planted between the check and the following MkdirAll or Remove is not caught. Closing that would need openat-based operations throughout and buys nothing in a supported configuration: it requires a local process with write access to --output, and anything with that access can already rewrite the finished bundle and its checksums. No behavior change beyond the log level. Related: NVIDIA#1942, NVIDIA#1944 Signed-off-by: Yuan Chen <[email protected]>
Follow-up to NVIDIA#1944, which merged before these review fixes landed. Add end-to-end coverage for the fix itself. No test bundled a real OCP recipe through --deployer argocd-helm: the chainsaw suite used the default helm deployer, and kwok-recipes.yaml skips service==ocp for every deployer, so the merged fix had unit coverage only. The new steps bundle the same recipe the suite already generates and assert static/ is omitted rather than emitted empty. Verified against a binary built from the commit before the fix, where the step fails with the original error. Make the scaffold presence checks fail closed. A bare `test -f` returns 1 without terminating the script, and Chainsaw reads only the final exit status, so a missing Chart.yaml or values.yaml left the guard passing. The pre-existing assert-folder-structure step had the same shape and the same false pass. Both now run under set -eu and report which file is missing. The error-code assertion added in NVIDIA#1944 could not fail. stdlib errors.Is walks the Unwrap chain and StructuredError.Is matches on Code, so under an outer Wrap(ErrCodeInternal, ...) the chain is INTERNAL -> INVALID_REQUEST and the positive assertion still passes. ExitCodeFromError reads the outermost StructuredError, so reverting writeValuesFiles to Wrap flipped aicr bundle from exit 2 to exit 8 with the suite green. Assert the negative direction as well -- no ErrCodeInternal anywhere in the chain -- which is what pins that call to PropagateOrWrap. The "populated static dir is preserved" subtest accepted any error from Generate, unlike its siblings. Assert the specific message. The validator reports the stale directory rather than the file inside it: for an all-local recipe static/ is not an expected directory at all, so the walk rejects it before reaching its contents. Promote the kept-stale-directory log from Debug to Warn. It reports artifact residue surviving into the bundle, which Debug puts below the CLI's default level. Scope the checkStaticPath threat model to what the code delivers. Lstat rejects a symlink already present when generation reaches the path, but this is a check-then-act on a path name, so one planted between the check and the following MkdirAll or Remove is not caught. Closing that would need openat-based operations throughout and buys nothing in a supported configuration: it requires a local process with write access to --output, and anything with that access can already rewrite the finished bundle and its checksums. No behavior change beyond the log level. Related: NVIDIA#1942, NVIDIA#1944 Signed-off-by: Yuan Chen <[email protected]>
Follow-up to NVIDIA#1944, which merged before these review fixes landed. Add end-to-end coverage for the fix itself. No test bundled a real OCP recipe through --deployer argocd-helm: the chainsaw suite used the default helm deployer, and kwok-recipes.yaml skips service==ocp for every deployer, so the merged fix had unit coverage only. The new steps bundle the same recipe the suite already generates and assert static/ is omitted rather than emitted empty. Verified against a binary built from the commit before the fix, where the step fails with the original error. Make the scaffold presence checks fail closed. A bare `test -f` returns 1 without terminating the script, and Chainsaw reads only the final exit status, so a missing Chart.yaml or values.yaml left the guard passing. The pre-existing assert-folder-structure step had the same shape and the same false pass. Both now run under set -eu and report which file is missing. The error-code assertion added in NVIDIA#1944 could not fail. stdlib errors.Is walks the Unwrap chain and StructuredError.Is matches on Code, so under an outer Wrap(ErrCodeInternal, ...) the chain is INTERNAL -> INVALID_REQUEST and the positive assertion still passes. ExitCodeFromError reads the outermost StructuredError, so reverting writeValuesFiles to Wrap flipped aicr bundle from exit 2 to exit 8 with the suite green. Assert the negative direction as well -- no ErrCodeInternal anywhere in the chain -- which is what pins that call to PropagateOrWrap. The "populated static dir is preserved" subtest accepted any error from Generate, unlike its siblings. Assert the specific message. The validator reports the stale directory rather than the file inside it: for an all-local recipe static/ is not an expected directory at all, so the walk rejects it before reaching its contents. Promote the kept-stale-directory log from Debug to Warn. It reports artifact residue surviving into the bundle, which Debug puts below the CLI's default level. Scope the checkStaticPath threat model to what the code delivers. Lstat rejects a symlink already present when generation reaches the path, but this is a check-then-act on a path name, so one planted between the check and the following MkdirAll or Remove is not caught. Closing that would need openat-based operations throughout and buys nothing in a supported configuration: it requires a local process with write access to --output, and anything with that access can already rewrite the finished bundle and its checksums. No behavior change beyond the log level. Related: NVIDIA#1942, NVIDIA#1944 Signed-off-by: Yuan Chen <[email protected]>
…alth checks Closes NVIDIA#1246. - kueue: resourceflavors/clusterqueues/localqueues.kueue.x-k8s.io (verified via in-tree manifests) - kubeflow-trainer: trainjobs.trainer.kubeflow.org (verified via tests/chainsaw/ai-conformance/kind-training-kubeflow/assert-crds.yaml) - network-operator: nicclusterpolicies.mellanox.com (verified via components/network-operator/manifests/nic-cluster-policy-aks.yaml) - k8s-nim-operator: nimservices/nimcaches/nimpipelines.apps.nvidia.com (verified via docs/conformance/cncf/v1.35/nim-eks/evidence/robust-operator.md) - gatekeeper: constrainttemplates.templates.gatekeeper.sh + configs.config.gatekeeper.sh (needs live-cluster confirmation against chart 3.22.2, flagged inline) - slinky-slurm-operator: negative finding documented - crds.enabled: false, CRDs owned entirely by sibling slinky-slurm-operator-crds chart Signed-off-by: Mohit Yadav <[email protected]> docs: restore slinky-slurm-operator health check, add comment-only negative finding Signed-off-by: Mohit Yadav <[email protected]> fix: address review comments on NVIDIA#1246 CRD backfill fix: sync kubeflow-trainer CRD docs with asserted trainingruntimes (coderabbitai) address review: soften gatekeeper verification wording, fix volatile line refs, rename CRD step for consistency chore: pausing scans chore: skills cleanup chore(deps): Update python Docker tag to v3.14 (NVIDIA#1906) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mark Chmarny <[email protected]> revert(validators): pin aiperf-bench base back to python:3.13-slim (NVIDIA#1909) Signed-off-by: Nathan Hensley <[email protected]> fix(rekor-monitor): correlate identity via release-workflow run history (NVIDIA#1903) Signed-off-by: Brian Lockwood <[email protected]> Co-authored-by: Mark Chmarny <[email protected]> fix(validators): multi-stage aiperf-bench build; bump aiperf to 0.11.0 (NVIDIA#1912) Signed-off-by: Nathan Hensley <[email protected]> feat(skills): download UAT debug bundles for failure triage (NVIDIA#1913) Signed-off-by: Nathan Hensley <[email protected]> chore: deps: bump renovatebot/github-action from 46.1.20 to 46.1.21 (NVIDIA#1923) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> feat(skills): add aicr-triage skill for project board triage (NVIDIA#1911) chore(deps): regenerate stale THIRD_PARTY_NOTICES.md (NVIDIA#1926) Signed-off-by: Nathan Hensley <[email protected]> feat(server): non-interactive bundle attestation for /v1/bundle (NVIDIA#1891) chore(deps): Update dependency awscli to v1.45.52 (NVIDIA#1905) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mark Chmarny <[email protected]> Co-authored-by: Nathan Hensley <[email protected]> ci(stale): drop phantom priority/critical exempt label (NVIDIA#1925) Signed-off-by: Yuan Chen <[email protected]> chore(deps): Update dependency sigstore/cosign to v3.1.2 (NVIDIA#1924) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lalit Adithya <[email protected]> Co-authored-by: Brian Lockwood <[email protected]> feat(skills): add aicr-cross-review skill for multi-agent PR review (NVIDIA#1915) Signed-off-by: Yuan Chen <[email protected]> chore: deps: bump github.com/prometheus/client_golang from 1.24.0 to 1.24.1 (NVIDIA#1922) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lalit Adithya <[email protected]> Co-authored-by: Brian Lockwood <[email protected]> fix: resolve goconst and errorlint warnings across OCI, coverage, validators (NVIDIA#1916) Signed-off-by: Andrew White <[email protected]> chore(deps): Update testing-tools (NVIDIA#1934) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> fix(skills): harden UAT debug-bundle triage against malformed input (NVIDIA#1914) Signed-off-by: Nathan Hensley <[email protected]> chore: deps: bump actions/stale from 10.4.0 to 11.0.0 (NVIDIA#1931) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lalit Adithya <[email protected]> fix(ci): sync coverage docs to 80% and fail closed on bad threshold (NVIDIA#1937) docs: correct issue/PR lifecycle table, fix reminder dedupe (NVIDIA#1921) Signed-off-by: Yuan Chen <[email protected]> Co-authored-by: Nathan Hensley <[email protected]> chore: deps: bump actions/checkout from 7.0.0 to 7.0.1 (NVIDIA#1930) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nathan Hensley <[email protected]> Co-authored-by: Brian Lockwood <[email protected]> fix(recipe,client): reject duplicate ComponentRef names, omit disable… (NVIDIA#1917) Co-authored-by: Nathan Hensley <[email protected]> fix(validators): pass aiperf model via --model flag (NVIDIA#1939) Signed-off-by: Nathan Hensley <[email protected]> fix(skills): recover cross-review lanes, harden consensus/fallback (NVIDIA#1932) Signed-off-by: Yuan Chen <[email protected]> feat(rekor-monitor): resumable identity scan to catch up large backlogs (NVIDIA#1929) Signed-off-by: Brian Lockwood <[email protected]> fix(bundler): create argocd-helm static/ only when populated (NVIDIA#1944) Signed-off-by: Yuan Chen <[email protected]> chore: deps: update hashicorp/azurerm requirement from ~> 4.0 to ~> 5.0 in /infra/uat-azure-account (NVIDIA#1945) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> fix(ci): run validators/ unit tests in make test, exclude from coverage gate (NVIDIA#1918) Signed-off-by: Mohit Yadav <[email protected]> Co-authored-by: Nathan Hensley <[email protected]> feat(corroborate): improve evidence dashboard UX (NVIDIA#1935) Signed-off-by: Nathan Hensley <[email protected]> fix(api): accept versionless legacy bundle recipes (NVIDIA#1943) Signed-off-by: Yuan Chen <[email protected]> test(bundler): cover argocd-helm OCP bundling and pin its error contract (NVIDIA#1950) Signed-off-by: Yuan Chen <[email protected]> chore: remove stray MOFED debug artifacts from repo root (NVIDIA#1955) Signed-off-by: Nathan Hensley <[email protected]> fix(deps): bump network-operator default to v26.4.1 (NVIDIA#1938) Signed-off-by: Atif Mahmood <[email protected]> Co-authored-by: Atif Mahmood <[email protected]> chore: deps: bump renovatebot/github-action from 46.1.21 to 46.2.0 (NVIDIA#1964) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> chore(deps): Update ministackorg/ministack Docker tag to v1.4.7 (NVIDIA#1965) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lalit Adithya <[email protected]> feat(recipe): implement the ADR-015 profile core (NVIDIA#1933) Signed-off-by: Yuan Chen <[email protected]> fix(bom): extract nested operator images (NVIDIA#1960) Signed-off-by: Yuan Chen <[email protected]> address yuanchen8911 review: bump network-operator to 26.4.1 with nicnodepolicies exclusion, close gatekeeper TODO with verification
…alth checks Closes NVIDIA#1246. - kueue: resourceflavors/clusterqueues/localqueues.kueue.x-k8s.io (verified via in-tree manifests) - kubeflow-trainer: trainjobs.trainer.kubeflow.org (verified via tests/chainsaw/ai-conformance/kind-training-kubeflow/assert-crds.yaml) - network-operator: nicclusterpolicies.mellanox.com (verified via components/network-operator/manifests/nic-cluster-policy-aks.yaml) - k8s-nim-operator: nimservices/nimcaches/nimpipelines.apps.nvidia.com (verified via docs/conformance/cncf/v1.35/nim-eks/evidence/robust-operator.md) - gatekeeper: constrainttemplates.templates.gatekeeper.sh + configs.config.gatekeeper.sh (needs live-cluster confirmation against chart 3.22.2, flagged inline) - slinky-slurm-operator: negative finding documented - crds.enabled: false, CRDs owned entirely by sibling slinky-slurm-operator-crds chart Signed-off-by: Mohit Yadav <[email protected]> docs: restore slinky-slurm-operator health check, add comment-only negative finding Signed-off-by: Mohit Yadav <[email protected]> fix: address review comments on NVIDIA#1246 CRD backfill fix: sync kubeflow-trainer CRD docs with asserted trainingruntimes (coderabbitai) address review: soften gatekeeper verification wording, fix volatile line refs, rename CRD step for consistency chore: pausing scans chore: skills cleanup chore(deps): Update python Docker tag to v3.14 (NVIDIA#1906) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mark Chmarny <[email protected]> revert(validators): pin aiperf-bench base back to python:3.13-slim (NVIDIA#1909) Signed-off-by: Nathan Hensley <[email protected]> fix(rekor-monitor): correlate identity via release-workflow run history (NVIDIA#1903) Signed-off-by: Brian Lockwood <[email protected]> Co-authored-by: Mark Chmarny <[email protected]> fix(validators): multi-stage aiperf-bench build; bump aiperf to 0.11.0 (NVIDIA#1912) Signed-off-by: Nathan Hensley <[email protected]> feat(skills): download UAT debug bundles for failure triage (NVIDIA#1913) Signed-off-by: Nathan Hensley <[email protected]> chore: deps: bump renovatebot/github-action from 46.1.20 to 46.1.21 (NVIDIA#1923) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> feat(skills): add aicr-triage skill for project board triage (NVIDIA#1911) chore(deps): regenerate stale THIRD_PARTY_NOTICES.md (NVIDIA#1926) Signed-off-by: Nathan Hensley <[email protected]> feat(server): non-interactive bundle attestation for /v1/bundle (NVIDIA#1891) chore(deps): Update dependency awscli to v1.45.52 (NVIDIA#1905) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mark Chmarny <[email protected]> Co-authored-by: Nathan Hensley <[email protected]> ci(stale): drop phantom priority/critical exempt label (NVIDIA#1925) Signed-off-by: Yuan Chen <[email protected]> chore(deps): Update dependency sigstore/cosign to v3.1.2 (NVIDIA#1924) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lalit Adithya <[email protected]> Co-authored-by: Brian Lockwood <[email protected]> feat(skills): add aicr-cross-review skill for multi-agent PR review (NVIDIA#1915) Signed-off-by: Yuan Chen <[email protected]> chore: deps: bump github.com/prometheus/client_golang from 1.24.0 to 1.24.1 (NVIDIA#1922) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lalit Adithya <[email protected]> Co-authored-by: Brian Lockwood <[email protected]> fix: resolve goconst and errorlint warnings across OCI, coverage, validators (NVIDIA#1916) Signed-off-by: Andrew White <[email protected]> chore(deps): Update testing-tools (NVIDIA#1934) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> fix(skills): harden UAT debug-bundle triage against malformed input (NVIDIA#1914) Signed-off-by: Nathan Hensley <[email protected]> chore: deps: bump actions/stale from 10.4.0 to 11.0.0 (NVIDIA#1931) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lalit Adithya <[email protected]> fix(ci): sync coverage docs to 80% and fail closed on bad threshold (NVIDIA#1937) docs: correct issue/PR lifecycle table, fix reminder dedupe (NVIDIA#1921) Signed-off-by: Yuan Chen <[email protected]> Co-authored-by: Nathan Hensley <[email protected]> chore: deps: bump actions/checkout from 7.0.0 to 7.0.1 (NVIDIA#1930) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nathan Hensley <[email protected]> Co-authored-by: Brian Lockwood <[email protected]> fix(recipe,client): reject duplicate ComponentRef names, omit disable… (NVIDIA#1917) Co-authored-by: Nathan Hensley <[email protected]> fix(validators): pass aiperf model via --model flag (NVIDIA#1939) Signed-off-by: Nathan Hensley <[email protected]> fix(skills): recover cross-review lanes, harden consensus/fallback (NVIDIA#1932) Signed-off-by: Yuan Chen <[email protected]> feat(rekor-monitor): resumable identity scan to catch up large backlogs (NVIDIA#1929) Signed-off-by: Brian Lockwood <[email protected]> fix(bundler): create argocd-helm static/ only when populated (NVIDIA#1944) Signed-off-by: Yuan Chen <[email protected]> chore: deps: update hashicorp/azurerm requirement from ~> 4.0 to ~> 5.0 in /infra/uat-azure-account (NVIDIA#1945) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> fix(ci): run validators/ unit tests in make test, exclude from coverage gate (NVIDIA#1918) Signed-off-by: Mohit Yadav <[email protected]> Co-authored-by: Nathan Hensley <[email protected]> feat(corroborate): improve evidence dashboard UX (NVIDIA#1935) Signed-off-by: Nathan Hensley <[email protected]> fix(api): accept versionless legacy bundle recipes (NVIDIA#1943) Signed-off-by: Yuan Chen <[email protected]> test(bundler): cover argocd-helm OCP bundling and pin its error contract (NVIDIA#1950) Signed-off-by: Yuan Chen <[email protected]> chore: remove stray MOFED debug artifacts from repo root (NVIDIA#1955) Signed-off-by: Nathan Hensley <[email protected]> fix(deps): bump network-operator default to v26.4.1 (NVIDIA#1938) Signed-off-by: Atif Mahmood <[email protected]> Co-authored-by: Atif Mahmood <[email protected]> chore: deps: bump renovatebot/github-action from 46.1.21 to 46.2.0 (NVIDIA#1964) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> chore(deps): Update ministackorg/ministack Docker tag to v1.4.7 (NVIDIA#1965) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lalit Adithya <[email protected]> feat(recipe): implement the ADR-015 profile core (NVIDIA#1933) Signed-off-by: Yuan Chen <[email protected]> fix(bom): extract nested operator images (NVIDIA#1960) Signed-off-by: Yuan Chen <[email protected]> address yuanchen8911 review: bump network-operator to 26.4.1 with nicnodepolicies exclusion, close gatekeeper TODO with verification
Summary
Create the argocd-helm bundle's
static/directory lazily, so a bundle whose components contribute no static values omits it entirely instead of emitting an empty directory that fails bundle inventory validation. Also remove an emptystatic/left behind by an earlier failed run, so retrying into the same output directory succeeds.Motivation / Context
aicr bundle --deployer argocd-helmfailed for every OCP recipe with:writeStaticValuesAndBuildStubscreated<output>/staticunconditionally, then wrote a values file into it only for components resolving to a remote Helm chart:The OCP overlays declare every component as
type: Helmbuilt frommanifestFileswith no upstreamsource, soSource == ""skips all of them and nothing is ever written.validateExactTreeinpkg/bundler/checksum/inventory.gothen walks the finished tree and rejects any directory absent fromexpectedDirectories— an empty directory contributes no files, so it never enters that set.Fixes: #1942
Related: #1947
Type of Change
Component(s) Affected
cmd/aicr,pkg/cli)cmd/aicrd,pkg/server)pkg/recipe)pkg/bundler,pkg/component/*)pkg/collector,pkg/snapshotter)pkg/validator)pkg/errors,pkg/k8s)docs/,examples/)Implementation Notes
The
MkdirAllmoves behind anensureStaticDirclosure invoked immediately before the first component values file is written. Bundles that do write static values are unaffected — the directory is created at the same point in the flow, with the same permissions, before the same write.Lazy creation alone does not help a user who already hit the bug. Generation writes directly into
--outputand does not clear it between runs, so the failed run's emptystatic/is still on disk and a plain retry reproduces the same error. When nothing is written, the directory is therefore removed.The path is guarded in one place,
checkStaticPath, shared by the create and remove routes.os.Removeunlinks regular files as readily as it removes empty directories, so removal must not run blind; andMkdirAllreports a non-directory only as a genericENOTDIR, so without a shared guard the same user error surfaced asINVALID_REQUESTfor an all-local recipe butINTERNALfor any recipe carrying an upstream chart — the outcome decided by recipe shape rather than by the mistake.Lstatrather thanStatalso rejects a symlink planted afterchecksum.ValidateOutputRootran, which permits pre-existing regular files, and a symlink gets its own message rather than being reported as "not a directory".Emptiness is checked explicitly rather than inferred from an
os.Removeerrno, which keeps the intent readable and avoids platform-specific error values. A populatedstatic/is kept and reported byvalidateExactTreeas unexpected output — though only when checksums are enabled, since that validator runs inside theIncludeChecksumspath. With checksums off a stalestatic/survives into the bundle, unchanged from before this fix: a reused--outputwas never cleared, so stale files of any kind already persisted.That new
ErrCodeInvalidRequestis whywriteValuesFilesswitches toerrors.PropagateOrWrap: re-coding it asINTERNALwould present a bad--outputpath as a server fault, and over the API a 5xx withholds the cause from the response.Of the three options in the issue, lazy creation was chosen over pruning after the fact or registering
static/as always-expected. It keeps the emitted tree free of empty directories, preserving the inventory validator's exact-tree contract rather than widening it.Only the
argocd-helmdeployer is touched.helm,argocd, andhelmfilealready bundled OCP recipes cleanly and are unchanged.fluxhas the same defect on its OCI output path —sources/is created unconditionally and stays empty for an OCP recipe — filed as #1947 rather than fixed here. The catalog sweep above did not surface it because it bundles to a local directory, wheregitSourcesis populated. Widening this PR to a second deployer would be scope creep, and the two fixes should be reviewable independently.Testing
The argocd-helm package passes with the race detector, affected-package lint reports 0 issues, and the MDX doc check passes.
Regression sweep. Binaries built from this branch and from the merge-base were run against all 100 embedded catalog overlays on the
argocd-helmdeployer, comparing whole output trees:ocp,ocp-training,ocp-inference)The three OCP overlays go from exit 2 to exit 0, producing 34 files each with
static/correctly absent. The other 97 are unchanged, including theirstatic/contents.Regression tests.
TestGenerate_StaticDirCreatedOnlyWhenPopulatedis table-driven with three cases and setsIncludeChecksums: true, so it exercisesfinalizeOutput→checksum.WriteChecksums→validateExactTree— the check that actually rejected the empty directory — rather than asserting only the proxy thatstatic/is absent. Verified against three source states:static/origin/mainBoth failure modes report the real
bundle contains an unexpected directory: "static"error, and the control case passes in every state, so the test cannot pass vacuously.TestGenerate_StaleStaticPathIsNotDestroyedcovers the guard's safety across both routes to the static path. A regular file is rejected with the path named, its contents intact, and the sameErrCodeInvalidRequestasserted for a recipe with no remote chart (reachingremoveStaleStaticDir) and one with an upstream chart (reachingensureStaticDir) — so the two routes cannot drift apart. A symlink is rejected and left in place, and a populated stale directory is preserved. The two file/symlink cases coveringensureStaticDirfail without the shared guard; theremoveStaleStaticDirand populated-directory cases pass with or without it, serving as controls.Package coverage:
pkg/bundler/deployer/argocdhelm82.6% → 83.7% (+1.1%).make qualifywas not run in full. Twopkg/bundler/attestationtests fail in this environment (TestNewKeyVerificationIdentity_PEM,TestFetchAmbientOIDCToken); both are pre-existing sandbox/network failures in a package this change does not touch, and both pass in CI.Risk Assessment
The change is confined to one deployer. Its effects are to skip creating a directory that would otherwise be empty, and to remove that directory when a previous run left it behind. Bundles that populate
static/follow an identical code path; a non-emptystatic/is never removed, and a non-directory or symlink at that path is reported rather than deleted. Package documentation was updated alongside the code so it no longer describesstatic/as unconditional.Rollout notes: No migration or flag. Bundles previously containing an empty
static/could not be generated at all, so no existing artifact layout changes.Checklist
make testwith-race)make lint)git commit -S) — GPG signing info