Repository navigation
feat(ci): GitHub Actions build cache (atmos ci cache) - #2579
Conversation
Restore the well-known Atmos cache root (~/.cache/atmos — toolchain, vendored components, remote import clones, provider/plugin caches) at startup and save it at exit, using the same store actions/cache uses (GitHub Actions Cache Service v2). - New `ci.cache` config (enabled, auto, root, paths, key, restore_keys, compression) with ATMOS_CI_CACHE_* env overrides. - New `atmos ci cache restore|save|list|delete` subcommands. - Modeled as a CI-provider capability (provider.CacheProvider + ci.DetectCache) with a backend registry (pkg/ci/cache) and a GitHub Actions implementation (pkg/ci/cache/github); no-op outside a runner. - Write-once entries + per-run state marker make auto and manual usage idempotent (exact-key hit on restore skips save). - Consolidate default toolchain install path under the XDG cache root. - Add PRD, command/config docs, blog post, and roadmap entry. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency ReviewThe following issues were found:
License Issues.github/workflows/release-major-tag.yml
Scanned Files
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds CI cache configuration, archive/extract and backend primitives, GitHub backend/provider wiring, CLI restore/save/list/delete/paths flows with lifecycle hooks, and supporting tests, docs, actions, and workflow updates. ChangesCI Build Cache
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (22)
pkg/ci/cache/registry.go (1)
49-61: ⚡ Quick winConsider sorting the returned backend types for deterministic output.
GetRegisteredTypesreturns slice entries in map iteration order, which is non-deterministic in Go. This can lead to inconsistent CLI output or flaky tests when the list is displayed or compared.📋 Suggested fix
func GetRegisteredTypes() []string { defer perf.Track(nil, "cache.GetRegisteredTypes")() registryMu.RLock() defer registryMu.RUnlock() types := make([]string, 0, len(factories)) for t := range factories { types = append(types, t) } + sort.Strings(types) return types }Don't forget to add
"sort"to the imports.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/ci/cache/registry.go` around lines 49 - 61, GetRegisteredTypes currently iterates over the factories map which yields non-deterministic order; modify GetRegisteredTypes to sort the resulting slice before returning (use sort.Strings) so callers always receive a deterministic list. Locate GetRegisteredTypes and the variables registryMu and factories, add the "sort" import, and call sort.Strings(types) just before returning the slice.pkg/ci/cache/github/backend_test.go (1)
140-169: 💤 Low valueConsider adding tests for pagination and edge cases.
The current test coverage is solid, but a few additional scenarios would strengthen it:
- List with pagination (multiple pages via Link header)
- Delete of a missing/already-deleted entry (should be no-op per contract)
- List without prefix filter (all entries)
- Blob upload/download HTTP error paths
These are optional given the existing coverage already validates the main flows.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/ci/cache/github/backend_test.go` around lines 140 - 169, Add additional unit tests to cover pagination and edge cases for the GitHub cache backend: extend or add tests alongside TestBackend_ListAndDelete to simulate multi-page List responses using a Link header (exercise b.List and listCachesResponse/githubCache across pages), verify List without a KeyPrefix returns all entries, assert Delete on a non-existent key is a no-op (call b.Delete for a missing ID and expect no error), and add tests that simulate upload/download HTTP error responses to ensure error paths are handled; use the same httptest.Server/mux pattern and the TestBackend_ListAndDelete handlers as references to implement these scenarios.pkg/ci/cache/config.go (1)
152-161: 💤 Low valueConsider documenting the silent skip behavior.
renderRestoreKeyssilently skips restore key templates that fail to render or produce empty strings. While this is good defensive design (one bad template won't break the entire config), adding a brief comment would make the intent explicit.📝 Suggested comment addition
// renderRestoreKeys renders each restore-key template, skipping any that fail. +// Failed templates are skipped silently to prevent one invalid template from +// breaking the entire config resolution. func renderRestoreKeys(templates []string, baseDir string) []string {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/ci/cache/config.go` around lines 152 - 161, Add a brief comment above the renderRestoreKeys function documenting that it intentionally ignores templates that fail to render or produce empty strings (it calls renderKey and only appends non-empty, error-free results), so a single bad template won’t abort processing; reference renderRestoreKeys and renderKey in the comment and note the silent-skip behavior is deliberate for defensive robustness.pkg/ci/cache/state.go (2)
86-109: 💤 Low valueConsider documenting why state save failures are ignored.
Both
recordRestore(line 93) andrecordSaved(line 108) silently ignore errors when saving state. While this follows a best-effort strategy (cache operations should succeed even if state persistence fails), adding brief comments would document the rationale.📝 Suggested comment additions
func recordRestore(root, key, restoredFrom, matchedKey string) { stateMu.Lock() defer stateMu.Unlock() s := loadState(root) s.Entries[key] = &entryState{RestoredFrom: restoredFrom, MatchedKey: matchedKey} + // Save errors are ignored; state tracking is best-effort. _ = saveState(root, s) } func recordSaved(root, key string) { stateMu.Lock() defer stateMu.Unlock() s := loadState(root) e := s.Entries[key] if e == nil { e = &entryState{} s.Entries[key] = e } e.Saved = true + // Save errors are ignored; state tracking is best-effort. _ = saveState(root, s) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/ci/cache/state.go` around lines 86 - 109, Add brief explanatory comments in the recordRestore and recordSaved functions clarifying why the error returned by saveState(root, s) is intentionally ignored: mention this is a best-effort persistence for cache metadata and should not block or fail cache operations, and note any fallback behavior (e.g., state will be retried later or is non-critical). Update the comment near the call to saveState in both recordRestore and recordSaved to reference the function name saveState and the mutex-protected state update so future readers understand the tradeoff.
55-69: 💤 Low valueConsider documenting the intentional error ignoring.
Line 64 silently ignores
json.Unmarshalerrors, returning an empty state when JSON is corrupted. While this is a reasonable degradation strategy (state tracking is best-effort), adding a comment would make the design choice explicit.📝 Suggested comment addition
func loadState(root string) *state { defer perf.Track(nil, "cache.loadState")() s := &state{Entries: map[string]*entryState{}} data, err := os.ReadFile(statePath(root)) if err != nil { return s } + // Unmarshal errors are ignored; corrupted state degrades to empty state. + // State tracking is best-effort and should not block cache operations. _ = json.Unmarshal(data, s)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/ci/cache/state.go` around lines 55 - 69, In loadState, the json.Unmarshal error is intentionally ignored which causes the function to fall back to an empty state on corrupted JSON; add a short comment above the `_ = json.Unmarshal(data, s)` line (inside the loadState function) stating this is deliberate (best-effort state tracking, tolerate corrupted/can't-read state by returning empty `s` rather than failing) so future readers know this behavior is intentional; reference the `loadState` function, the `s` variable, and the `json.Unmarshal` call in the comment.cmd/ci/cache/cache_restore.go (1)
13-13: ⚡ Quick winAdd period to var comment.
All comments must end with periods.
📝 Proposed fix
-// cacheRestoreCmd restores the configured cache into the cache root. +// cacheRestoreCmd restores the configured cache into the cache root. var cacheRestoreCmd = &cobra.Command{🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_restore.go` at line 13, The comment for the variable cacheRestoreCmd (the var doc comment "// cacheRestoreCmd restores the configured cache into the cache root") is missing a terminal period; update that var comment to end with a period (e.g., "...cache root.") so it conforms to the project's comment style and godoc expectations.Source: Coding guidelines
cmd/ci/cache/cache_list.go (6)
124-124: ⚡ Quick winAdd period to function comment.
All comments must end with periods.
📝 Proposed fix
-// buildCacheTableRows converts entries to string rows for the Key/Size/Created table. +// buildCacheTableRows converts entries to string rows for the Key/Size/Created table. func buildCacheTableRows(entries []cachepkg.Entry) [][]string {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_list.go` at line 124, The comment for the function buildCacheTableRows is missing a terminal period; update the function comment "buildCacheTableRows converts entries to string rows for the Key/Size/Created table" to end with a period so it reads "...table." ensuring it follows the project's comment style.Source: Coding guidelines
75-75: ⚡ Quick winAdd period to function comment.
All comments must end with periods.
📝 Proposed fix
-// formatCacheOutput renders cache entries according to the requested format. +// formatCacheOutput renders cache entries according to the requested format. func formatCacheOutput(entries []cachepkg.Entry, formatStr, delimiter string, maxColumns int) (string, error) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_list.go` at line 75, The comment for the function formatCacheOutput is missing a terminal period; update the comment line "// formatCacheOutput renders cache entries according to the requested format" to end with a period so it reads "// formatCacheOutput renders cache entries according to the requested format." ensuring the function-level comment follows the project's punctuation convention.Source: Coding guidelines
165-165: ⚡ Quick winAdd period to function comment.
All comments must end with periods.
📝 Proposed fix
-// buildCacheCSVTSV builds a delimited string (CSV or TSV) from entries. +// buildCacheCSVTSV builds a delimited string (CSV or TSV) from entries. func buildCacheCSVTSV(entries []cachepkg.Entry, delimiter string) string {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_list.go` at line 165, The comment for the function buildCacheCSVTSV is missing a terminal period; update the comment "// buildCacheCSVTSV builds a delimited string (CSV or TSV) from entries." to end with a period so it reads "// buildCacheCSVTSV builds a delimited string (CSV or TSV) from entries." ensuring the function comment now terminates with a period.Source: Coding guidelines
25-25: ⚡ Quick winAdd period to var comment.
All comments must end with periods.
📝 Proposed fix
-// cacheListCmd lists cache entries. +// cacheListCmd lists cache entries. var cacheListCmd = &cobra.Command{🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_list.go` at line 25, The comment for the variable cacheListCmd (the top-line comment "// cacheListCmd lists cache entries.") is missing a terminal period; update the var comment for cacheListCmd so it ends with a period (e.g., "...entries.") to conform with comment style rules.Source: Coding guidelines
137-137: ⚡ Quick winAdd period to function comment.
All comments must end with periods.
📝 Proposed fix
-// buildCacheFullRows converts entries to maps that include all four fields. +// buildCacheFullRows converts entries to maps that include all four fields. func buildCacheFullRows(entries []cachepkg.Entry) []map[string]interface{} {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_list.go` at line 137, The function comment for buildCacheFullRows is missing a terminal period; update the comment that currently reads "buildCacheFullRows converts entries to maps that include all four fields" to end with a period so it reads "...fields." ensuring the function comment follows the project's comment punctuation convention.Source: Coding guidelines
180-180: ⚡ Quick winAdd period to function comment.
All comments must end with periods.
📝 Proposed fix
-// formatCreatedAt formats a CreatedAt timestamp for display. +// formatCreatedAt formats a CreatedAt timestamp for display. func formatCreatedAt(t time.Time) string {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_list.go` at line 180, The comment for the helper function formatCreatedAt is missing a terminal period; update the comment "// formatCreatedAt formats a CreatedAt timestamp for display" to end with a period so it reads "// formatCreatedAt formats a CreatedAt timestamp for display."—locate the comment immediately above the formatCreatedAt function and add the period.Source: Coding guidelines
cmd/ci/cache/cache.go (5)
24-24: ⚡ Quick winAdd period to var comment.
As per coding guidelines, all comments must end with periods.
📝 Proposed fix
-// cacheCmd is the parent for `atmos ci cache` subcommands. +// cacheCmd is the parent for `atmos ci cache` subcommands. var cacheCmd = &cobra.Command{🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache.go` at line 24, The var comment for cacheCmd ("cacheCmd is the parent for `atmos ci cache` subcommands.") needs a trailing period; update the comment associated with the variable cacheCmd in cmd/ci/cache/cache.go so it ends with a period to comply with the code-style rule.Source: Coding guidelines
115-115: ⚡ Quick winAdd period to method comment.
All comments must end with periods.
📝 Proposed fix
-// apply copies any set overrides onto the schema cache config. +// apply copies any set overrides onto the schema cache config. func (o cacheOverrides) apply(cc *schema.CICacheConfig) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache.go` at line 115, Update the method comment for apply so it ends with a period; locate the comment above the apply function (the line starting "// apply copies any set overrides onto the schema cache config") and ensure it terminates with a trailing period to match project comment style.Source: Coding guidelines
108-108: ⚡ Quick winAdd period to type comment.
All comments must end with periods.
📝 Proposed fix
-// cacheOverrides carries CLI flag overrides for the resolved cache config. +// cacheOverrides carries CLI flag overrides for the resolved cache config. type cacheOverrides struct {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache.go` at line 108, The comment for the identifier cacheOverrides is missing a trailing period; update the type comment "// cacheOverrides carries CLI flag overrides for the resolved cache config." to end with a period so it reads "// cacheOverrides carries CLI flag overrides for the resolved cache config." ensuring the comment is properly punctuated for the cacheOverrides declaration.Source: Coding guidelines
21-22: ⚡ Quick winAdd period to const comment.
As per coding guidelines, all comments must end with periods (enforced by
godotlinter).📝 Proposed fix
-// fieldKey is the shared literal for the "key" flag name and "key" log field. +// fieldKey is the shared literal for the "key" flag name and "key" log field. const fieldKey = "key"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache.go` around lines 21 - 22, The comment for the const fieldKey is missing a terminal period; update the comment that currently reads 'fieldKey is the shared literal for the "key" flag name and "key" log field' to end with a period so it complies with the godot linter and project comment style (locate the const named fieldKey in the file and add the missing period to its comment).Source: Coding guidelines
54-55: ⚡ Quick winAdd period to function comment.
All comments must end with periods as per coding guidelines.
📝 Proposed fix
// buildConfigAndStacksInfo creates ConfigAndStacksInfo from global flags so the -// cache commands honor --config-path, --base-path, --profile, etc. +// cache commands honor --config-path, --base-path, --profile, etc. func buildConfigAndStacksInfo(globalFlags *global.Flags) schema.ConfigAndStacksInfo {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache.go` around lines 54 - 55, The function comment for buildConfigAndStacksInfo is missing a terminal period; update the comment above the buildConfigAndStacksInfo declaration so the sentence ends with a period (e.g., change "// buildConfigAndStacksInfo creates ConfigAndStacksInfo from global flags so the\n// cache commands honor --config-path, --base-path, --profile, etc" to include a trailing period). Ensure the comment text still references the same function name and flags.Source: Coding guidelines
cmd/ci/cache/lifecycle.go (2)
73-73: ⚡ Quick winAdd period to function comment.
All comments must end with periods.
📝 Proposed fix
-// registerPendingSave stores the manager for save-on-exit. +// registerPendingSave stores the manager for save-on-exit. func registerPendingSave(manager *cachepkg.Manager) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/lifecycle.go` at line 73, The comment for the function registerPendingSave is missing a terminal period; update the doc comment preceding registerPendingSave to end with a period (e.g., change "// registerPendingSave stores the manager for save-on-exit" to include a trailing "."), ensuring the function comment conforms to the project's comment style.Source: Coding guidelines
60-60: ⚡ Quick winAdd period to function comment.
All comments must end with periods.
📝 Proposed fix
-// autoRestore runs the restore and logs the outcome. +// autoRestore runs the restore and logs the outcome. func autoRestore(manager *cachepkg.Manager, cfg *cachepkg.Config) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/lifecycle.go` at line 60, The comment for the autoRestore function ("autoRestore runs the restore and logs the outcome") is missing a terminal period; update the comment above the autoRestore function so it ends with a period (i.e., "autoRestore runs the restore and logs the outcome."). Ensure you modify the comment associated with the autoRestore declaration in lifecycle.go.Source: Coding guidelines
cmd/ci/cache/cache_save.go (1)
13-13: ⚡ Quick winAdd period to var comment.
All comments must end with periods.
📝 Proposed fix
-// cacheSaveCmd archives the cache root and uploads it under the configured key. +// cacheSaveCmd archives the cache root and uploads it under the configured key. var cacheSaveCmd = &cobra.Command{🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_save.go` at line 13, The comment for the variable cacheSaveCmd is missing a trailing period; update the comment string that precedes the cacheSaveCmd declaration to end with a period so the var comment follows the project's comment style (i.e., change "// cacheSaveCmd archives the cache root and uploads it under the configured key" to include a final period).Source: Coding guidelines
cmd/ci/cache/cache_delete.go (1)
14-14: ⚡ Quick winAdd period to var comment.
All comments must end with periods.
📝 Proposed fix
-// cacheDeleteCmd deletes a cache entry by key. +// cacheDeleteCmd deletes a cache entry by key. var cacheDeleteCmd = &cobra.Command{🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/ci/cache/cache_delete.go` at line 14, The comment for the variable cacheDeleteCmd should end with a period; update the comment on the cacheDeleteCmd declaration so the sentence is terminated with a period (e.g., "cacheDeleteCmd deletes a cache entry by key."). Locate the comment immediately above the cacheDeleteCmd variable and add the missing period to conform to comment style.Source: Coding guidelines
pkg/ci/cache/manager.go (1)
30-35: 💤 Low valueConsider removing perf.Track from trivial getter.
Per coding guidelines, trivial getters/setters should not have
perf.Track. This method just returns a field value.However, if linting enforces perf.Track on all public methods, feel free to keep it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/ci/cache/manager.go` around lines 30 - 35, Remove the unnecessary performance tracking from the trivial getter Manager.Config by deleting the defer perf.Track(nil, "cache.Manager.Config")() call so the method simply returns m.cfg; if your linter mandates perf.Track on all public methods, leave it but add a comment explaining the lint requirement above Config to justify the tracking usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/ci/cache/lifecycle.go`:
- Around line 83-102: RunPendingSave is exported and missing a perf.Track call;
add a defer perf.Track(nil, "cache.RunPendingSave")() as the first statement
inside the RunPendingSave function (immediately after the function brace) and
leave a blank line after that defer to match style; ensure you import/use the
existing perf package symbol and do not change the rest of the function logic
(references: RunPendingSave, pendingSaveMu, pendingSave, manager.Save).
- Around line 29-58: Add a deferred perf.Track call at the start of the exported
AutoRestore function to record performance: insert defer perf.Track(atmosConfig,
"cache.AutoRestore")() immediately after the function signature (use the
existing atmosConfig parameter), followed by a blank line; ensure this is placed
before any early returns so the perf tracking always runs for this exported
function.
In `@docs/prd/native-ci/framework/ci-cache.md`:
- Line 160: Update the table row that currently references the lifecycle hooks
file name `cmd/ci_cache_lifecycle.go` so it points to the actual lifecycle
implementation `cmd/ci/cache/lifecycle.go` and adjust the call-site note (PreRun
restore, `Cleanup()` save) to reference the lifecycle implementation location;
edit the entry that reads "Lifecycle hooks | `cmd/ci_cache_lifecycle.go`, call
sites in `cmd/root.go` (PreRun restore, `Cleanup()` save)" to use the correct
filename and keep the existing call-site description.
In `@pkg/ci/providers/github/cache.go`:
- Around line 9-16: The comment for Provider.Cache is slightly inaccurate about
the error contract; update the comment on the Provider.Cache method to state
that githubcache.NewBackend may return “an error wrapping
errUtils.ErrCacheUnavailable” (or similar phrasing) when ACTIONS_RUNTIME_TOKEN
or ACTIONS_RESULTS_URL are missing, and reference githubcache.NewBackend and
errUtils.ErrCacheUnavailable in the comment so it accurately describes the
%w-wrapped error behavior of Provider.Cache.
In `@website/src/data/roadmap.js`:
- Line 392: The roadmap milestone object with label 'CI build cache via GitHub
Actions Cache' is missing the required pr field; update that object in
website/src/data/roadmap.js (the entry whose properties include label, status,
quarter, changelog, description, benefits) by adding a pr: <number> property
(e.g., pr: 12345) containing the PR number for this change, ensuring the new key
follows the same formatting and quoting as the surrounding fields.
---
Nitpick comments:
In `@cmd/ci/cache/cache_delete.go`:
- Line 14: The comment for the variable cacheDeleteCmd should end with a period;
update the comment on the cacheDeleteCmd declaration so the sentence is
terminated with a period (e.g., "cacheDeleteCmd deletes a cache entry by key.").
Locate the comment immediately above the cacheDeleteCmd variable and add the
missing period to conform to comment style.
In `@cmd/ci/cache/cache_list.go`:
- Line 124: The comment for the function buildCacheTableRows is missing a
terminal period; update the function comment "buildCacheTableRows converts
entries to string rows for the Key/Size/Created table" to end with a period so
it reads "...table." ensuring it follows the project's comment style.
- Line 75: The comment for the function formatCacheOutput is missing a terminal
period; update the comment line "// formatCacheOutput renders cache entries
according to the requested format" to end with a period so it reads "//
formatCacheOutput renders cache entries according to the requested format."
ensuring the function-level comment follows the project's punctuation
convention.
- Line 165: The comment for the function buildCacheCSVTSV is missing a terminal
period; update the comment "// buildCacheCSVTSV builds a delimited string (CSV
or TSV) from entries." to end with a period so it reads "// buildCacheCSVTSV
builds a delimited string (CSV or TSV) from entries." ensuring the function
comment now terminates with a period.
- Line 25: The comment for the variable cacheListCmd (the top-line comment "//
cacheListCmd lists cache entries.") is missing a terminal period; update the var
comment for cacheListCmd so it ends with a period (e.g., "...entries.") to
conform with comment style rules.
- Line 137: The function comment for buildCacheFullRows is missing a terminal
period; update the comment that currently reads "buildCacheFullRows converts
entries to maps that include all four fields" to end with a period so it reads
"...fields." ensuring the function comment follows the project's comment
punctuation convention.
- Line 180: The comment for the helper function formatCreatedAt is missing a
terminal period; update the comment "// formatCreatedAt formats a CreatedAt
timestamp for display" to end with a period so it reads "// formatCreatedAt
formats a CreatedAt timestamp for display."—locate the comment immediately above
the formatCreatedAt function and add the period.
In `@cmd/ci/cache/cache_restore.go`:
- Line 13: The comment for the variable cacheRestoreCmd (the var doc comment "//
cacheRestoreCmd restores the configured cache into the cache root") is missing a
terminal period; update that var comment to end with a period (e.g., "...cache
root.") so it conforms to the project's comment style and godoc expectations.
In `@cmd/ci/cache/cache_save.go`:
- Line 13: The comment for the variable cacheSaveCmd is missing a trailing
period; update the comment string that precedes the cacheSaveCmd declaration to
end with a period so the var comment follows the project's comment style (i.e.,
change "// cacheSaveCmd archives the cache root and uploads it under the
configured key" to include a final period).
In `@cmd/ci/cache/cache.go`:
- Line 24: The var comment for cacheCmd ("cacheCmd is the parent for `atmos ci
cache` subcommands.") needs a trailing period; update the comment associated
with the variable cacheCmd in cmd/ci/cache/cache.go so it ends with a period to
comply with the code-style rule.
- Line 115: Update the method comment for apply so it ends with a period; locate
the comment above the apply function (the line starting "// apply copies any set
overrides onto the schema cache config") and ensure it terminates with a
trailing period to match project comment style.
- Line 108: The comment for the identifier cacheOverrides is missing a trailing
period; update the type comment "// cacheOverrides carries CLI flag overrides
for the resolved cache config." to end with a period so it reads "//
cacheOverrides carries CLI flag overrides for the resolved cache config."
ensuring the comment is properly punctuated for the cacheOverrides declaration.
- Around line 21-22: The comment for the const fieldKey is missing a terminal
period; update the comment that currently reads 'fieldKey is the shared literal
for the "key" flag name and "key" log field' to end with a period so it complies
with the godot linter and project comment style (locate the const named fieldKey
in the file and add the missing period to its comment).
- Around line 54-55: The function comment for buildConfigAndStacksInfo is
missing a terminal period; update the comment above the buildConfigAndStacksInfo
declaration so the sentence ends with a period (e.g., change "//
buildConfigAndStacksInfo creates ConfigAndStacksInfo from global flags so
the\n// cache commands honor --config-path, --base-path, --profile, etc" to
include a trailing period). Ensure the comment text still references the same
function name and flags.
In `@cmd/ci/cache/lifecycle.go`:
- Line 73: The comment for the function registerPendingSave is missing a
terminal period; update the doc comment preceding registerPendingSave to end
with a period (e.g., change "// registerPendingSave stores the manager for
save-on-exit" to include a trailing "."), ensuring the function comment conforms
to the project's comment style.
- Line 60: The comment for the autoRestore function ("autoRestore runs the
restore and logs the outcome") is missing a terminal period; update the comment
above the autoRestore function so it ends with a period (i.e., "autoRestore runs
the restore and logs the outcome."). Ensure you modify the comment associated
with the autoRestore declaration in lifecycle.go.
In `@pkg/ci/cache/config.go`:
- Around line 152-161: Add a brief comment above the renderRestoreKeys function
documenting that it intentionally ignores templates that fail to render or
produce empty strings (it calls renderKey and only appends non-empty, error-free
results), so a single bad template won’t abort processing; reference
renderRestoreKeys and renderKey in the comment and note the silent-skip behavior
is deliberate for defensive robustness.
In `@pkg/ci/cache/github/backend_test.go`:
- Around line 140-169: Add additional unit tests to cover pagination and edge
cases for the GitHub cache backend: extend or add tests alongside
TestBackend_ListAndDelete to simulate multi-page List responses using a Link
header (exercise b.List and listCachesResponse/githubCache across pages), verify
List without a KeyPrefix returns all entries, assert Delete on a non-existent
key is a no-op (call b.Delete for a missing ID and expect no error), and add
tests that simulate upload/download HTTP error responses to ensure error paths
are handled; use the same httptest.Server/mux pattern and the
TestBackend_ListAndDelete handlers as references to implement these scenarios.
In `@pkg/ci/cache/manager.go`:
- Around line 30-35: Remove the unnecessary performance tracking from the
trivial getter Manager.Config by deleting the defer perf.Track(nil,
"cache.Manager.Config")() call so the method simply returns m.cfg; if your
linter mandates perf.Track on all public methods, leave it but add a comment
explaining the lint requirement above Config to justify the tracking usage.
In `@pkg/ci/cache/registry.go`:
- Around line 49-61: GetRegisteredTypes currently iterates over the factories
map which yields non-deterministic order; modify GetRegisteredTypes to sort the
resulting slice before returning (use sort.Strings) so callers always receive a
deterministic list. Locate GetRegisteredTypes and the variables registryMu and
factories, add the "sort" import, and call sort.Strings(types) just before
returning the slice.
In `@pkg/ci/cache/state.go`:
- Around line 86-109: Add brief explanatory comments in the recordRestore and
recordSaved functions clarifying why the error returned by saveState(root, s) is
intentionally ignored: mention this is a best-effort persistence for cache
metadata and should not block or fail cache operations, and note any fallback
behavior (e.g., state will be retried later or is non-critical). Update the
comment near the call to saveState in both recordRestore and recordSaved to
reference the function name saveState and the mutex-protected state update so
future readers understand the tradeoff.
- Around line 55-69: In loadState, the json.Unmarshal error is intentionally
ignored which causes the function to fall back to an empty state on corrupted
JSON; add a short comment above the `_ = json.Unmarshal(data, s)` line (inside
the loadState function) stating this is deliberate (best-effort state tracking,
tolerate corrupted/can't-read state by returning empty `s` rather than failing)
so future readers know this behavior is intentional; reference the `loadState`
function, the `s` variable, and the `json.Unmarshal` call in the comment.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8cf5117f-1f9e-421b-ab88-7bb93694b534
📒 Files selected for processing (39)
cmd/ci/cache/cache.gocmd/ci/cache/cache_delete.gocmd/ci/cache/cache_list.gocmd/ci/cache/cache_restore.gocmd/ci/cache/cache_save.gocmd/ci/cache/lifecycle.gocmd/ci/ci.gocmd/root.godocs/prd/native-ci/framework/ci-cache.mderrors/errors.gopkg/ci/cache/archive.gopkg/ci/cache/archive_test.gopkg/ci/cache/backend.gopkg/ci/cache/config.gopkg/ci/cache/config_test.gopkg/ci/cache/github/backend.gopkg/ci/cache/github/backend_test.gopkg/ci/cache/key.gopkg/ci/cache/key_test.gopkg/ci/cache/manager.gopkg/ci/cache/manager_test.gopkg/ci/cache/registry.gopkg/ci/cache/state.gopkg/ci/cache/util.gopkg/ci/internal/provider/types.gopkg/ci/providers/github/cache.gopkg/ci/registry_provider.gopkg/config/load.gopkg/schema/schema.gopkg/toolchain/setup.gowebsite/blog/2026-06-06-ci-build-cache.mdxwebsite/docs/cli/commands/ci/cache/_category_.jsonwebsite/docs/cli/commands/ci/cache/cache.mdxwebsite/docs/cli/commands/ci/cache/delete.mdxwebsite/docs/cli/commands/ci/cache/list.mdxwebsite/docs/cli/commands/ci/cache/restore.mdxwebsite/docs/cli/commands/ci/cache/save.mdxwebsite/docs/cli/configuration/ci/cache.mdxwebsite/src/data/roadmap.js
safeJoin already rejected traversal, but the `target != root &&` disjunction made the continuing branch `(target == root) || HasPrefix(...)`, which does not imply the strings.HasPrefix predicate. CodeQL's go/zipslip barrier-guard therefore could not treat target as sanitized, flagging all three filesystem sinks (os.MkdirAll x2, os.OpenFile) as Zip Slip. Use the canonical bare HasPrefix guard so the safe branch implies the prefix holds. archiveRoot never emits a root-equal entry (it skips rel == "."), so dropping the disjunction is behavior-preserving. Strengthen TestSafeJoin_RejectsEscape with additional traversal cases and a nested-entry assertion. Co-Authored-By: Claude Opus 4.8 <[email protected]>
- Add perf.Track to AutoRestore and RunPendingSave exported functions - Add pr: 2579 to roadmap milestone - Fix lifecycle hooks path in CI cache PRD (cmd/ci/cache/lifecycle.go) - Clarify Provider.Cache error-contract comment (wraps ErrCacheUnavailable) Co-Authored-By: Claude Opus 4.8 <[email protected]>
The default codecov-action path fetches Codecov's GPG public key from Keybase, which is currently returning 404. Use use_pypi: true to install the CLI from PyPI instead. See codecov/codecov-action#1955. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Important Cloud Posse Engineering Team Review RequiredThis 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 |
Wire `atmos ci cache restore`/`save` around the Helm/Helmfile toolchain
install in test.yml so CI restores ~/.cache/atmos from the GitHub Actions
cache instead of re-downloading. Define the cache key/restore_keys once in
atmos.yaml (ci.cache) so Atmos supplies {{.OS}}/{{.Arch}}. Both steps are
continue-on-error and the workflow always installs exact pinned versions, so
the cache is a pure accelerator and never affects correctness.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
The CI cache feature added Cache to schema.CIConfig, so 'atmos describe
config' now emits "cache": {} under the ci section. Regenerate the two
affected golden snapshots via -regenerate-snapshots.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2579 +/- ##
==========================================
+ Coverage 79.02% 79.09% +0.06%
==========================================
Files 1211 1227 +16
Lines 117294 118408 +1114
==========================================
+ Hits 92693 93652 +959
- Misses 19523 19608 +85
- Partials 5078 5148 +70
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
origin/main already added a tldp.org exclude entry; remove the redundant copy introduced on this branch so the exclude list has no duplicate. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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 @.github/workflows/test.yml:
- Around line 76-77: Pin every workflow action referenced by tag to its
immutable commit SHA instead of tags: replace actions/setup-go@v6,
actions/upload-artifact@v4, actions/download-artifact@v8,
hashicorp/setup-terraform@v4, opentofu/setup-opentofu@v2,
codecov/codecov-action@v7, hadolint/[email protected], and
github/codeql-action/upload-sarif@v4 with their corresponding commit SHAs;
additionally, for the setup-go steps (actions/setup-go@v6) explicitly set
caching policy—if you are not intentionally using action caching add with:
cache: false, otherwise document and validate the cache configuration to avoid
cache-poisoning risks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5862a8ff-aaa3-4060-88f6-4f53d5ce3c5b
📒 Files selected for processing (7)
.github/workflows/test.ymlerrors/errors.golychee.tomlpkg/schema/schema.gotests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_secrets-masking_describe_config.stdout.goldenwebsite/src/data/roadmap.js
✅ Files skipped from review due to trivial changes (3)
- lychee.toml
- tests/snapshots/TestCLICommands_secrets-masking_describe_config.stdout.golden
- website/src/data/roadmap.js
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/schema/schema.go
- errors/errors.go
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
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 @.github/workflows/test.yml:
- Around line 76-77: Pin every workflow action referenced by tag to its
immutable commit SHA instead of tags: replace actions/setup-go@v6,
actions/upload-artifact@v4, actions/download-artifact@v8,
hashicorp/setup-terraform@v4, opentofu/setup-opentofu@v2,
codecov/codecov-action@v7, hadolint/[email protected], and
github/codeql-action/upload-sarif@v4 with their corresponding commit SHAs;
additionally, for the setup-go steps (actions/setup-go@v6) explicitly set
caching policy—if you are not intentionally using action caching add with:
cache: false, otherwise document and validate the cache configuration to avoid
cache-poisoning risks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5862a8ff-aaa3-4060-88f6-4f53d5ce3c5b
📒 Files selected for processing (7)
.github/workflows/test.ymlerrors/errors.golychee.tomlpkg/schema/schema.gotests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_secrets-masking_describe_config.stdout.goldenwebsite/src/data/roadmap.js
✅ Files skipped from review due to trivial changes (3)
- lychee.toml
- tests/snapshots/TestCLICommands_secrets-masking_describe_config.stdout.golden
- website/src/data/roadmap.js
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/schema/schema.go
- errors/errors.go
🛑 Comments failed to post (1)
.github/workflows/test.yml (1)
76-77:
⚠️ Potential issue | 🟠 Major🧩 Analysis chain
🏁 Script executed:
#!/bin/bash # Check if repository has existing pinning policy if [ -f .github/dependabot.yml ]; then echo "=== Dependabot config found ===" cat .github/dependabot.yml fi # Show which actions in this workflow are pinned vs unpinned echo -e "\n=== Actions audit for test.yml ===" rg 'uses:\s+[^@]+@[a-f0-9]{40}' .github/workflows/test.yml -n | head -5 || echo "No SHA-pinned actions found" rg 'uses:\s+[^@]+@v\d+' .github/workflows/test.yml -n | head -10 # Suggest: Document whether unpinned actions are accepted risk or should be pinned echo -e "\nRecommendation: Pin to SHAs or document acceptance of tag-mutation risk"Repository: cloudposse/atmos
Length of output: 2397
Pin GitHub Actions to commit SHAs (starting with
actions/setup-go@v6) and handle cache risk
.github/workflows/test.ymlusesactions/setup-go@v6by tag (lines 77 and 216). Pin to the action’s immutable commit SHA to avoid tag-mutation attacks.- The same workflow also contains other tag-based actions (e.g.,
actions/upload-artifact@v4,actions/download-artifact@v8,hashicorp/setup-terraform@v4,opentofu/setup-opentofu@v2,codecov/codecov-action@v7,hadolint/[email protected],github/codeql-action/upload-sarif@v4); pin those as well.- For the
setup-gosteps, ensure caching is intentionally configured—if not needed, setwith: cache: falseto reduce cache-poisoning exposure.🧰 Tools
🪛 zizmor (1.25.2)
[error] 77-77: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
[error] 77-77: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default
(cache-poisoning)
🤖 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/test.yml around lines 76 - 77, Pin every workflow action referenced by tag to its immutable commit SHA instead of tags: replace actions/setup-go@v6, actions/upload-artifact@v4, actions/download-artifact@v8, hashicorp/setup-terraform@v4, opentofu/setup-opentofu@v2, codecov/codecov-action@v7, hadolint/[email protected], and github/codeql-action/upload-sarif@v4 with their corresponding commit SHAs; additionally, for the setup-go steps (actions/setup-go@v6) explicitly set caching policy—if you are not intentionally using action caching add with: cache: false, otherwise document and validate the cache configuration to avoid cache-poisoning risks.Source: Linters/SAST tools
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Warning Release Documentation RequiredThis PR is labeled
|
|
These changes were released in v1.222.0-rc.0. |
Root cause of the recurring Windows acceptance flake, confirmed by the lookup forensics added in a68e195: the failure dump showed EVERY toolchain directory (terraform, opentofu, helm, helmfile) gone at once -- the whole <cache>/atmos tree had been deleted mid-run. TestPrintTelemetryDisclosureOnlyOnce "cleaned up" by os.RemoveAll on filepath.Dir(cfg.GetCacheFilePath()) -- the real shared <cache>/atmos root -- twice (setup + defer). Ever since the toolchain install root moved underneath that same root (<cache>/atmos/toolchain, #2579), this deleted every CI-provisioned tool out from under the concurrently running package test binaries. Whichever terraform/tofu-dependent test happened to run during the window failed with "executable file not found in %PATH%"; the tests package healed itself via TestMain re-provisioning, which is why only internal/exec kept failing. All four disclosure tests now isolate the cache via a per-test ATMOS_XDG_CACHE_HOME/XDG_CACHE_HOME redirect instead of deleting anything shared. This also fixes the sibling tests that "cleaned" ./.atmos -- a directory the disclosure code never used -- while actually polluting the real user-level cache.yaml.
…#2834) * fix(test): resolve CI toolchain cache binaries * fix(tests): close TOCTOU race in Terraform/OpenTofu binary resolution TestExecuteTerraform_Version and TestYamlFuncTerraformOutput each resolved the tofu/terraform binary via RequireTofu/RequireTerraform, then made a second, independent exec.LookPath call before isolating the binary. On the Windows acceptance job's concurrent packages, another test can mutate the shared toolchain cache directory between those two lookups, turning a binary that just existed into a spurious "not found" failure. RequireTerraformPath/RequireTofuPath now resolve the path once and hand it back directly, removing the redundant lookup at each call site. * fix(tests): fail loudly instead of returning an empty path on lookup miss requireExecutablePath (backing RequireTerraformPath/RequireTofuPath) silently returned "" when ATMOS_TEST_SKIP_PRECONDITION_CHECKS=true (set for every CI acceptance job) and the binary wasn't found, instead of surfacing the miss. Callers that need the resolved path then crashed on the empty string with a confusing "open : file not found" error rather than a clear diagnostic. RequireExecutable is decoupled back to its original full-bypass behavior (a true no-op when checks are disabled) since its callers only need a boolean gate, not a path -- only the path-returning variants now hard-fail on a genuine lookup miss. * fix(test): isolate toolchain install-path from the real shared cache dir Several pkg/toolchain tests (TestRunInstall_WithLatestKeyword, TestRunInstall_WithCanonicalFormat, TestRunInstall_WithValidToolSpec, TestRunInstall_WithSetAsDefault, TestRunInstallWithNoArgs, TestRunInstall_Reinstall, TestRunUninstall, TestRunUninstall_InvalidToolSpecFormat, TestUninstallAllVersionsOfTool) called SetAtmosConfig() without setting Toolchain.InstallPath. NewInstaller()'s GetInstallPath() falls back to the real, shared XDG toolchain cache directory whenever InstallPath is empty -- the exact directory CI's "atmos toolchain install --default" step populates and that the whole acceptance suite depends on for hashicorp/terraform and opentofu/opentofu binaries for the rest of the run. TestRunInstall_WithLatestKeyword and TestRunInstall_WithCanonicalFormat in particular perform real network installs of real "terraform" binaries into that shared path, racing with every other concurrently-running package's test process reading tofu/terraform off PATH -- almost certainly the root cause of the intermittent "'tofu' not found in PATH" hard failures seen on the Windows acceptance job (round 3 of this investigation had already ruled out a stale-PATH-visibility theory for this specific failure instance). Fixed by pointing Toolchain.InstallPath at each test's own t.TempDir(), matching the isolation pattern already used by the rest of the toolchain test suite. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(test): isolate remaining toolchain-path leak, widen resolution retry TestBuildToolRow/TestBuildToolRow_NotInstalled resolved NewInstaller()'s binDir to the real shared toolchain cache dir (no InstallPath override), same class of issue fixed in fdbb83f -- read-only here, but still worth isolating for hygiene and to rule them out as a contributor. The Windows tofu-not-found flake recurred in CI even after that fix, so widen requireExecutablePath's retry window from 2s to 15s as a defensive backstop: some residual contention under the acceptance job's concurrent package load isn't yet fully identified, and a longer bounded poll is safer than risking another silent failure while that's tracked down. * test(ci): add lookup forensics for the Windows toolchain-vanishing flake The Windows acceptance job has a recurring failure where an installed toolchain binary (tofu/terraform) vanishes from PATH mid-suite for the full retry window. Root-cause candidates are all writer-side windows in the shared toolchain cache (uninstall RemoveAll, onedir rename-aside, in-place flat-install extraction) but four rounds of static analysis couldn't pin which one fires in CI. requireExecutablePath now dumps per-PATH-entry forensics on failure: whether each toolchain dir exists, its contents, target presence, and whether the installer's ".lock" sibling is held. The next CI failure becomes direct evidence of the mechanism (dir deleted vs tree renamed aside vs writer mid-flight vs PATH corruption) instead of another guess. * fix(test): stop telemetry test deleting the shared Atmos cache root Root cause of the recurring Windows acceptance flake, confirmed by the lookup forensics added in a68e195: the failure dump showed EVERY toolchain directory (terraform, opentofu, helm, helmfile) gone at once -- the whole <cache>/atmos tree had been deleted mid-run. TestPrintTelemetryDisclosureOnlyOnce "cleaned up" by os.RemoveAll on filepath.Dir(cfg.GetCacheFilePath()) -- the real shared <cache>/atmos root -- twice (setup + defer). Ever since the toolchain install root moved underneath that same root (<cache>/atmos/toolchain, #2579), this deleted every CI-provisioned tool out from under the concurrently running package test binaries. Whichever terraform/tofu-dependent test happened to run during the window failed with "executable file not found in %PATH%"; the tests package healed itself via TestMain re-provisioning, which is why only internal/exec kept failing. All four disclosure tests now isolate the cache via a per-test ATMOS_XDG_CACHE_HOME/XDG_CACHE_HOME redirect instead of deleting anything shared. This also fixes the sibling tests that "cleaned" ./.atmos -- a directory the disclosure code never used -- while actually polluting the real user-level cache.yaml. * docs(fixes): record telemetry-test shared-cache-root fix * docs(fixes): note extraction onto osterman/toolchain-cache-fix-own-pr Update the commit/branch reference now that this self-contained investigation ships as its own PR instead of riding along with #2812's unrelated CI git-clone-bootstrap feature. * test(tests): cover forensics and retry-path branches in requireExecutablePath Codecov flagged tests/preconditions.go at 60.93% patch coverage: the new requireExecutablePath retry loop, executableLookupForensics, describeToolchainPathEntry, RequireTerraformPath, and RequireTofuPath had no direct tests. Add real assertion-based coverage for the resolve-on-first-try, retry-until-resolved, and exhausted-retries-skip paths, plus table-driven tests for the forensics string-building logic (target present/absent, directory contents, writer-lock sibling, unreadable dir). Convert executablePathRetryTimeout/Interval from const to var so tests can shrink the retry window instead of waiting out the real 15s. --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Andriy Knysh <[email protected]>
* fix: skip provenance during component rendering * test: harden provenance rendering coverage * fix: don't process Go templates in Terraform source code (#2145) (#2830) Atmos parses the Terraform/OpenTofu source of a component with `terraform-config-inspect` and stores the result in `component_info.terraform_config`. That section is part of the component section Atmos renders as a `Go` template, so a Terraform `description` containing double curly braces — e.g. the GCP resource name format `projects/{{project}}/locations/{{location}}/services/{{name}}` — aborted every command with `function "project" not defined`. Atmos templating belongs to the abstraction above Terraform modules, so `component_info` is now excluded from template rendering in both the `ProcessStacks` and `describe stacks` pipelines. It remains in the template context, so `{{ .component_info.component_path }}` and friends keep working in stack manifests. Claude-Session: https://claude.ai/code/session_01E9zBYFTZLeu2gBjPjpRN8v Co-authored-by: Claude <[email protected]> Co-authored-by: Erik Osterman (Cloud Posse) <[email protected]> * fix: preserve provenance output order * test: update provenance describe snapshots * perf(terraform-state): cache missing state reads * test: cover raw provenance and missing state cache * fix(test): stop Windows toolchain-vanishing flake in acceptance tests (#2834) * fix(test): resolve CI toolchain cache binaries * fix(tests): close TOCTOU race in Terraform/OpenTofu binary resolution TestExecuteTerraform_Version and TestYamlFuncTerraformOutput each resolved the tofu/terraform binary via RequireTofu/RequireTerraform, then made a second, independent exec.LookPath call before isolating the binary. On the Windows acceptance job's concurrent packages, another test can mutate the shared toolchain cache directory between those two lookups, turning a binary that just existed into a spurious "not found" failure. RequireTerraformPath/RequireTofuPath now resolve the path once and hand it back directly, removing the redundant lookup at each call site. * fix(tests): fail loudly instead of returning an empty path on lookup miss requireExecutablePath (backing RequireTerraformPath/RequireTofuPath) silently returned "" when ATMOS_TEST_SKIP_PRECONDITION_CHECKS=true (set for every CI acceptance job) and the binary wasn't found, instead of surfacing the miss. Callers that need the resolved path then crashed on the empty string with a confusing "open : file not found" error rather than a clear diagnostic. RequireExecutable is decoupled back to its original full-bypass behavior (a true no-op when checks are disabled) since its callers only need a boolean gate, not a path -- only the path-returning variants now hard-fail on a genuine lookup miss. * fix(test): isolate toolchain install-path from the real shared cache dir Several pkg/toolchain tests (TestRunInstall_WithLatestKeyword, TestRunInstall_WithCanonicalFormat, TestRunInstall_WithValidToolSpec, TestRunInstall_WithSetAsDefault, TestRunInstallWithNoArgs, TestRunInstall_Reinstall, TestRunUninstall, TestRunUninstall_InvalidToolSpecFormat, TestUninstallAllVersionsOfTool) called SetAtmosConfig() without setting Toolchain.InstallPath. NewInstaller()'s GetInstallPath() falls back to the real, shared XDG toolchain cache directory whenever InstallPath is empty -- the exact directory CI's "atmos toolchain install --default" step populates and that the whole acceptance suite depends on for hashicorp/terraform and opentofu/opentofu binaries for the rest of the run. TestRunInstall_WithLatestKeyword and TestRunInstall_WithCanonicalFormat in particular perform real network installs of real "terraform" binaries into that shared path, racing with every other concurrently-running package's test process reading tofu/terraform off PATH -- almost certainly the root cause of the intermittent "'tofu' not found in PATH" hard failures seen on the Windows acceptance job (round 3 of this investigation had already ruled out a stale-PATH-visibility theory for this specific failure instance). Fixed by pointing Toolchain.InstallPath at each test's own t.TempDir(), matching the isolation pattern already used by the rest of the toolchain test suite. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(test): isolate remaining toolchain-path leak, widen resolution retry TestBuildToolRow/TestBuildToolRow_NotInstalled resolved NewInstaller()'s binDir to the real shared toolchain cache dir (no InstallPath override), same class of issue fixed in fdbb83f -- read-only here, but still worth isolating for hygiene and to rule them out as a contributor. The Windows tofu-not-found flake recurred in CI even after that fix, so widen requireExecutablePath's retry window from 2s to 15s as a defensive backstop: some residual contention under the acceptance job's concurrent package load isn't yet fully identified, and a longer bounded poll is safer than risking another silent failure while that's tracked down. * test(ci): add lookup forensics for the Windows toolchain-vanishing flake The Windows acceptance job has a recurring failure where an installed toolchain binary (tofu/terraform) vanishes from PATH mid-suite for the full retry window. Root-cause candidates are all writer-side windows in the shared toolchain cache (uninstall RemoveAll, onedir rename-aside, in-place flat-install extraction) but four rounds of static analysis couldn't pin which one fires in CI. requireExecutablePath now dumps per-PATH-entry forensics on failure: whether each toolchain dir exists, its contents, target presence, and whether the installer's ".lock" sibling is held. The next CI failure becomes direct evidence of the mechanism (dir deleted vs tree renamed aside vs writer mid-flight vs PATH corruption) instead of another guess. * fix(test): stop telemetry test deleting the shared Atmos cache root Root cause of the recurring Windows acceptance flake, confirmed by the lookup forensics added in a68e195: the failure dump showed EVERY toolchain directory (terraform, opentofu, helm, helmfile) gone at once -- the whole <cache>/atmos tree had been deleted mid-run. TestPrintTelemetryDisclosureOnlyOnce "cleaned up" by os.RemoveAll on filepath.Dir(cfg.GetCacheFilePath()) -- the real shared <cache>/atmos root -- twice (setup + defer). Ever since the toolchain install root moved underneath that same root (<cache>/atmos/toolchain, #2579), this deleted every CI-provisioned tool out from under the concurrently running package test binaries. Whichever terraform/tofu-dependent test happened to run during the window failed with "executable file not found in %PATH%"; the tests package healed itself via TestMain re-provisioning, which is why only internal/exec kept failing. All four disclosure tests now isolate the cache via a per-test ATMOS_XDG_CACHE_HOME/XDG_CACHE_HOME redirect instead of deleting anything shared. This also fixes the sibling tests that "cleaned" ./.atmos -- a directory the disclosure code never used -- while actually polluting the real user-level cache.yaml. * docs(fixes): record telemetry-test shared-cache-root fix * docs(fixes): note extraction onto osterman/toolchain-cache-fix-own-pr Update the commit/branch reference now that this self-contained investigation ships as its own PR instead of riding along with #2812's unrelated CI git-clone-bootstrap feature. * test(tests): cover forensics and retry-path branches in requireExecutablePath Codecov flagged tests/preconditions.go at 60.93% patch coverage: the new requireExecutablePath retry loop, executableLookupForensics, describeToolchainPathEntry, RequireTerraformPath, and RequireTofuPath had no direct tests. Add real assertion-based coverage for the resolve-on-first-try, retry-until-resolved, and exhausted-retries-skip paths, plus table-driven tests for the forensics string-building logic (target present/absent, directory contents, writer-lock sibling, unreadable dir). Convert executablePathRetryTimeout/Interval from const to var so tests can shrink the retry window instead of waiting out the real 15s. --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Andriy Knysh <[email protected]> --------- Co-authored-by: thejrose1984 <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Erik Osterman (Cloud Posse) <[email protected]> Co-authored-by: Andriy Knysh <[email protected]>
* feat(ci): support explicit git clone checkout * fix(docs): satisfy skill editorconfig * chore(ci): validate editorconfig before commit * fix(ci): install atmos for pre-commit validation * fix(ci): use validate-capable atmos release * test(docker): expect bundled docker cli * fix(ci): mirror Docker Hub pulls through Google * fix(test): resolve CI toolchain cache binaries * fix(pre-commit): remove Go build hook * test(git-clone): cover CI-mode resolution edge cases Patch coverage was 82.71% (below the 85% target) with the gaps concentrated in parseCloneFlags/resolveCICloneMode's flag-parse-error path, the unset-ATMOS_CI-and-unset-flag default path, and root.go's gitCloneBootstrapCIMode explicit --ci=true and invalid-ATMOS_CI branches. * fix(tests): close TOCTOU race in Terraform/OpenTofu binary resolution TestExecuteTerraform_Version and TestYamlFuncTerraformOutput each resolved the tofu/terraform binary via RequireTofu/RequireTerraform, then made a second, independent exec.LookPath call before isolating the binary. On the Windows acceptance job's concurrent packages, another test can mutate the shared toolchain cache directory between those two lookups, turning a binary that just existed into a spurious "not found" failure. RequireTerraformPath/RequireTofuPath now resolve the path once and hand it back directly, removing the redundant lookup at each call site. * fix(tests): fail loudly instead of returning an empty path on lookup miss requireExecutablePath (backing RequireTerraformPath/RequireTofuPath) silently returned "" when ATMOS_TEST_SKIP_PRECONDITION_CHECKS=true (set for every CI acceptance job) and the binary wasn't found, instead of surfacing the miss. Callers that need the resolved path then crashed on the empty string with a confusing "open : file not found" error rather than a clear diagnostic. RequireExecutable is decoupled back to its original full-bypass behavior (a true no-op when checks are disabled) since its callers only need a boolean gate, not a path -- only the path-returning variants now hard-fail on a genuine lookup miss. * fix(test): isolate toolchain install-path from the real shared cache dir Several pkg/toolchain tests (TestRunInstall_WithLatestKeyword, TestRunInstall_WithCanonicalFormat, TestRunInstall_WithValidToolSpec, TestRunInstall_WithSetAsDefault, TestRunInstallWithNoArgs, TestRunInstall_Reinstall, TestRunUninstall, TestRunUninstall_InvalidToolSpecFormat, TestUninstallAllVersionsOfTool) called SetAtmosConfig() without setting Toolchain.InstallPath. NewInstaller()'s GetInstallPath() falls back to the real, shared XDG toolchain cache directory whenever InstallPath is empty -- the exact directory CI's "atmos toolchain install --default" step populates and that the whole acceptance suite depends on for hashicorp/terraform and opentofu/opentofu binaries for the rest of the run. TestRunInstall_WithLatestKeyword and TestRunInstall_WithCanonicalFormat in particular perform real network installs of real "terraform" binaries into that shared path, racing with every other concurrently-running package's test process reading tofu/terraform off PATH -- almost certainly the root cause of the intermittent "'tofu' not found in PATH" hard failures seen on the Windows acceptance job (round 3 of this investigation had already ruled out a stale-PATH-visibility theory for this specific failure instance). Fixed by pointing Toolchain.InstallPath at each test's own t.TempDir(), matching the isolation pattern already used by the rest of the toolchain test suite. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(test): isolate remaining toolchain-path leak, widen resolution retry TestBuildToolRow/TestBuildToolRow_NotInstalled resolved NewInstaller()'s binDir to the real shared toolchain cache dir (no InstallPath override), same class of issue fixed in fdbb83f -- read-only here, but still worth isolating for hygiene and to rule them out as a contributor. The Windows tofu-not-found flake recurred in CI even after that fix, so widen requireExecutablePath's retry window from 2s to 15s as a defensive backstop: some residual contention under the acceptance job's concurrent package load isn't yet fully identified, and a longer bounded poll is safer than risking another silent failure while that's tracked down. * test(ci): add lookup forensics for the Windows toolchain-vanishing flake The Windows acceptance job has a recurring failure where an installed toolchain binary (tofu/terraform) vanishes from PATH mid-suite for the full retry window. Root-cause candidates are all writer-side windows in the shared toolchain cache (uninstall RemoveAll, onedir rename-aside, in-place flat-install extraction) but four rounds of static analysis couldn't pin which one fires in CI. requireExecutablePath now dumps per-PATH-entry forensics on failure: whether each toolchain dir exists, its contents, target presence, and whether the installer's ".lock" sibling is held. The next CI failure becomes direct evidence of the mechanism (dir deleted vs tree renamed aside vs writer mid-flight vs PATH corruption) instead of another guess. * fix(test): stop telemetry test deleting the shared Atmos cache root Root cause of the recurring Windows acceptance flake, confirmed by the lookup forensics added in a68e195: the failure dump showed EVERY toolchain directory (terraform, opentofu, helm, helmfile) gone at once -- the whole <cache>/atmos tree had been deleted mid-run. TestPrintTelemetryDisclosureOnlyOnce "cleaned up" by os.RemoveAll on filepath.Dir(cfg.GetCacheFilePath()) -- the real shared <cache>/atmos root -- twice (setup + defer). Ever since the toolchain install root moved underneath that same root (<cache>/atmos/toolchain, #2579), this deleted every CI-provisioned tool out from under the concurrently running package test binaries. Whichever terraform/tofu-dependent test happened to run during the window failed with "executable file not found in %PATH%"; the tests package healed itself via TestMain re-provisioning, which is why only internal/exec kept failing. All four disclosure tests now isolate the cache via a per-test ATMOS_XDG_CACHE_HOME/XDG_CACHE_HOME redirect instead of deleting anything shared. This also fixes the sibling tests that "cleaned" ./.atmos -- a directory the disclosure code never used -- while actually polluting the real user-level cache.yaml. * docs(fixes): record telemetry-test shared-cache-root fix * refactor(cmd): remove hand-rolled argv parsing for CI git-clone bootstrap cmd/root.go hand-parsed os.Args to decide whether a config-init failure was a no-argument `atmos git clone` bootstrapping in an empty CI workspace, duplicating cmd/git's own --ci/ATMOS_CI resolution (resolveCICloneMode) with real drift: root's literal "--ci=true"/ "--ci=false" string matching missed values pflag's ParseBool accepts (e.g. --ci=TRUE, ATMOS_CI=1). Replace ~120 lines of argv sniffing (isCIGitCloneBootstrapRequested, gitCloneBootstrapCIMode, stripRootFlagsForBootstrapCheck, and friends) with cmd/git.CICloneBootstrapRequested(cmd, args): a Cobra-identity + already-parsed-flag check, callable only from PersistentPreRun onward (where Cobra has parsed the target command's flags), delegating the actual --ci/ATMOS_CI precedence to the single implementation (resolveCICloneMode) cmd/git's own RunE already uses. This also fixes a load-bearing bug uncovered while tracing the old code: the pre-dispatch call site (handleConfigInitErrorWithArgs, run from Execute() before RootCmd.ExecuteC()) was the ONLY place that set CI.Enabled on the config cmd/git actually reads (the package-level `atmosConfig`, aliased into cmd/git via SetAtmosConfig before PersistentPreRun runs) -- PersistentPreRun's own bootstrap branch wrote to a local `tmpConfig` that is discarded at the end of the function, so for the canonical empty-workspace (cfg.NotFound) case it never did anything. The pre-dispatch call site is deleted entirely; the load-bearing write is added directly to PersistentPreRun's NotFound branch instead, which now writes both the package-level atmosConfig (load-bearing) and the local tmpConfig (used by the rest of this invocation). Malformed (as opposed to missing) atmos.yaml encountered during CI bootstrap continues to be tolerated via PersistentPreRun's existing non-NotFound bootstrap branch, now also routed through the shared helper. * fix(ci): exclude docs.docker.com from link check (connection resets) CI's Check Markdown Links job failed on docs/prd/ecr-authentication.md (unrelated to this PR's diff) with "Connection reset by peer" against docs.docker.com. The URL is live (curl: 301 -> 200 outside CI); this matches the repo's existing precedent for CDN-fronted hosts that intermittently reset connections from CI runners (taskfile.dev, geminicli.com, otelic.com, etc.). * fix(test): address CodeRabbit findings on PR #2812 Fix three CodeRabbit-flagged issues: - pkg/toolchain/install_test.go, list_test.go: several tests set Toolchain.InstallPath to a per-test t.TempDir() (needed to keep real installs off the shared XDG toolchain cache) but only partially restored atmosConfig afterward, leaving InstallPath pointed at a directory that TempDir cleanup had already deleted. Save/restore the full prior atmosConfig instead of reconstructing a partial one. - cmd/root_test.go: TestApplyCIGitCloneBootstrap_AllowsBootstrap and TestApplyCIGitCloneBootstrap_NoCIProviderDetected didn't pin ATMOS_CI, so an ambient ATMOS_CI=false in the developer/CI environment could make resolveCICloneMode resolve to "disabled" and fail the test non-deterministically. Pin ATMOS_CI explicitly, mirroring the existing guard in cmd/git/bootstrap_test.go. - .github/workflows/test.yml: the Docker Hub mirror configuration step used jq's `unique` to append mirror.gcr.io to registry-mirrors, which sorts the array and can silently reorder any pre-existing mirrors (Docker tries mirrors in listed order). Only append when absent, preserving existing order. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(git): use CI context branch name, not raw ref, in no-arg checkout Add a real (non-stubbed) native-ci job cloning a local fixture repo to exercise the CI git-clone bootstrap path end-to-end, which immediately surfaced a pre-existing bug: runCICheckout passed the raw ref (e.g. refs/heads/main) as `git clone --branch`, which rejects full ref paths. Use the CI context's already-parsed branch name instead, and document the config-init tolerance mechanism in docs/prd/git-ops.md. Co-Authored-By: Claude Sonnet 5 <[email protected]> * revert(ci): drop the ci-bootstrap-clone native-ci job The synthetic fixture-repo redirection (overriding GITHUB_SERVER_URL/ GITHUB_REPOSITORY at the step level) worked in a local shell but not in a real Actions run: GitHub Actions silently ignores GITHUB_-prefixed env overrides, so the job actually cloned the real cloudposse/atmos repo and failed a later assertion meant for the fixture. That's too curve-fitted to the local repro to be a real test of native CI in CI, and not fixable by adjusting the script further, so drop it rather than keep a job that looks like coverage but silently tests the wrong thing. The runCICheckout branch/ref fix itself is unaffected — it was found and verified via a local (non-CI) reproduction and is covered by the corrected unit test. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(fix-log): fix missing comma per CodeRabbit review Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(test): recognize packer-only manifest error in build tolerance check TestPackerBuildCmdWithDirectoryTemplate failed on Windows CI (job 91001781247) with "Failed loading manifest ... EOF" -- text packer's own manifest post-processor produces, never Atmos. The packerRan heuristic didn't recognize this specific string, so it fell through to a real test failure even though packer clearly ran and failed for environmental (credential) reasons, same as the test already tolerates for other packer error shapes. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Andriy Knysh <[email protected]>
…dependents) + scope --labels/--tags evaluation before filtering (#2807) * fix: scope --labels/--tags and list dependencies evaluation before filtering On a monorepo spanning multiple AWS accounts, atmos terraform ... --all --labels/--tags and atmos list dependencies --stack <stack> fully evaluated (templates, YAML functions, auth) every stack in the repo before consulting the requested selector, failing on an unrelated/inaccessible stack before the command ever got to the user's actual target. Generalizes the existing -s/--stack early-skip (see docs/fixes/2026-06-22-describe-stacks-scope-and-cache-per-component-auth.md) to --labels/--tags, and reworks `list dependencies` to compute a reachable dependency closure and only fully evaluate the stacks that closure touches. * fix(docs): use 2-space list continuation indent for editorconfig atmos validate --affected's editorconfig check requires markdown indentation in multiples of 2 (.editorconfig sets indent_size=2 for *.md). The Symptom section's two numbered-list items used 3-space continuation indent, failing CI. * fix(schema): regenerate atmos.yaml JSON schema for eager_evaluation The Acceptance Tests suite (linux/macos/windows) failed TestEmbeddedSchemaIsCurrent: adding describe.settings.eager_evaluation to schema.DescribeSettings in 62a35aa left the embedded JSON schema stale. Regenerated via `go generate ./pkg/config/schema`. * feat(list): add --tags/--labels filtering across list subcommands, accept ':' in --labels `atmos list stacks` had no way to filter by metadata.tags/metadata.labels even though `list components` already did. Extends the same --tags/--labels filtering to list stacks, instances, metadata, sources, and dependencies, and --tags only to list vendor (manifest-declared tags, not stack metadata; no labels concept in that schema). Also accepts ':' as an alternative to '=' in --labels pairs (e.g. --labels=team:platform) everywhere the shared parser is used (terraform --all, container/kubernetes/helm verbs, list components). Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: address CodeRabbit review findings on PR #2807 - pkg/list/dependencies/closure.go: StackNames now actually sorts (doc claimed "sorted" but graph.Nodes iteration is a non-deterministic map). - Correct the eager-evaluation config path everywhere it's documented/ commented: describe.settings.eager_evaluation, not settings.describe.settings.eager_evaluation (matches schema.DescribeSettings.EagerEvaluation's actual yaml/mapstructure tag). - tests/fixtures/scenarios/dependencies-scoped-evaluation/atmos.yaml: components.terraform.base_path now points at the fixture's own local mock component instead of resolving outside the fixture to a shared, unrelated one. - cmd/list/dependencies.go: list dependencies now parses --labels via LabelsRaw on DependenciesOptions (populated in parseDependenciesOptions, parsed in RunE) instead of reading viper directly, matching every other list subcommand's pattern and making the flag wiring unit-testable. - Strengthen tags/labels filter tests (cmd/list/sources_test.go, cmd/list/vendor_test.go, pkg/list/list_instances_test.go, pkg/list/list_metadata_test.go) to assert exact returned rows and cover multi-tag any-match / multi-label all-match distinctly, so a reversed selector semantics bug would be caught. cmd/list/sources.go's `return nil, err` after ParseLabelsFlag was flagged as bypassing the error-wrapping convention, but left as-is: the error is already wrapped with errUtils.ErrInvalidFlag at its origin in pkg/tags/flags.go, and the same passthrough pattern is the established convention in cmd/list/components.go and cmd/list/dependencies.go (8+ call sites) — wrapping only here would diverge from those siblings without a correctness gain. Co-Authored-By: Claude Sonnet 5 <[email protected]> * test: regenerate --labels help-text golden snapshots The colon-separator fix updated the --labels flag description everywhere it's registered ("key=value or key:value pairs" instead of just "key=value"), which reflows the wrapped --help text captured in these golden snapshots. Regenerated with -regenerate-snapshots per this repo's rule against hand-editing golden files; diff is exactly the reflowed --labels line in each. Fixes the Acceptance Tests (linux/windows/macos) CI failure — same 7 TestCLICommands subtests failed identically on all three OS matrix jobs (tf_plan/terraform_provision/terraform/atmos_terraform help snapshots, config_alias_tr): platform-independent captured CLI text, one fix covers all three. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: treat unresolved YAML functions as undecidable selectors; reject --tags/--labels with --upload Code-review fixes for the --tags/--labels scope-before-evaluate work: - Extract the duplicated templated-selector guard into a shared tags.SelectorUnresolved helper that also detects unprocessed Atmos YAML functions (stored as plain "!env FOO"-style strings until function processing runs), so a component with e.g. metadata.tags: [!env TIER] is conservatively routed through full evaluation instead of being silently skipped by the early gate or the lightweight closure roots. - Reject --tags/--labels combined with --upload in list instances: the Atmos Pro inventory upload is always unfiltered, so a filtered table next to a full upload would mislead. Matches the existing matrix/tree guards. Co-Authored-By: Claude Fable 5 <[email protected]> * feat: dependency-closure selection (--include-dependencies/--include-dependents) for bulk terraform and list commands Every multi-component terraform selection (--all, --components, --query, -s, --tags, --labels, --affected) now accepts two depth-carrying closure flags that expand the selection with its dependency-graph closure, executed in dependency order (reverse for destroy) with cross-stack edges followed: - --include-dependencies[=N]: also run everything the selection depends on (its prerequisites), N levels deep (bare = unlimited). - --include-dependents[=N]: same in the reverse direction. Previously a bool wired only into --affected; now works with every selection and accepts a depth (true/false stay accepted for compatibility). Selectors choose the seed; closure flags expand it - closure members run even when they do not match the selectors that seeded them. The same flags on list components/stacks/instances preview the exact execution set. Implementation: - pkg/dependency: Filter gains per-direction depth bounds (DependencyDepth/DependentDepth, 0 = unlimited) with a best-depth BFS replacing the unbounded DFS walk. - pkg/scheduler/adapters: FilterTerraformGraph restructured to seed-then-expand - tags/labels/query narrow the seed (previously a post-filter), then one graph.Filter applies the closure from info/selection (merged, most-permissive depth). The per-node query skip is suppressed when the query already gated the seed, so closure-added prerequisites are not silently dropped. - pkg/list/dependencies: the three-phase scoped evaluation from the list-dependencies work is generalized into ResolveScopedClosure and shared with the terraform bulk paths, so a closure run fully evaluates only the stacks the closure touches. Root selection is unified behind a Selector (components/stack-glob/tags/labels) used by list previews. - Selector purity (by design): metadata.tags/metadata.labels drive scoping before evaluation, so values requiring auth or execution (!terraform.state, !store, !secret, !aws.*, !exec, atmos.Component, datasources, ...) are rejected with a hard error on any command that processes the manifest; plain strings, simple templates, and local functions (!env, !git.*, !include) remain allowed. Validation parses templates with the configured delimiters (no regex heuristics), and SelectorUnresolved is delimiter-aware as well. - list stacks/components/instances also gain the tags/labels early-skip (scoped describe) so selector filtering no longer evaluates out-of-scope components. Docs: flag docs for terraform plan/apply/deploy/destroy/init + usage and the three list commands, selector-purity section in stack metadata docs, changelog blog post, roadmap entry, and regenerated help-text golden snapshots. Co-Authored-By: Claude Fable 5 <[email protected]> * fix: evaluate only the closure's own components, and resolve templated selectors in the lightweight phase Field testing of the closure flags surfaced two ways evaluation still escaped the selection scope: 1. Stack granularity: Phase C fully evaluated every component in each stack the closure touched, so a component that merely shared a stack file with an in-closure prerequisite had its templates and YAML functions (e.g. a cross-account !terraform.state) evaluated - and could fail auth - despite never being selected. The scoped closure engine now narrows each resolved describe pass to the closure's own components within that stack, and the list closure previews (components/stacks/instances) go through the same engine instead of a full describe followed by row filtering. 2. Templated selectors: metadata.tags/metadata.labels values containing Go templates were undecidable in the lightweight structural pass, so every such component conservatively became a closure seed - inflating the closure toward the whole repo. Since the selector purity contract guarantees selectors are at most simple templates over the stack context, the lightweight matcher now best-effort renders them (sprig functions, configured delimiters, missing keys treated as unresolved) and matches exactly; only genuinely unresolvable values still widen scope conservatively, never wrongly excluding a component. Includes a regression test proving a poison component sharing a stack with closure members is never evaluated, and resolution tests covering templates, custom delimiters, missing keys, and nested values. Co-Authored-By: Claude Fable 5 <[email protected]> * fix: complete scoped dependency closure evaluation (#2816) * fix: complete scoped dependency closure evaluation * fix: scope label template resolution to requested keys * fix: scope dependency label resolution to requested keys * fix: clarify dependency levels output * test: verify dependency levels output * fix: address CodeRabbit review — closure rows, shared describe helper, purity bypass, error wrap, labels test - list stacks closure preview: build rows with extract.Stacks over the resolved closure stacks instead of hand-rolled {"stack": name} rows, so var-derived columns stay populated exactly like the non-closure path. - Extract the duplicated ExecuteDescribeStacksScoped wrapper in the list stacks/components closure paths into one newScopedDescribeFunc constructor. - Selector purity: close the with/range/variable-alias bypass — field and variable accesses naming a forbidden atmos method (.Component, .Store, .GomplateDatasource) are now rejected regardless of what the dot or variable is bound to, since the binding cannot be proven statically and such names have no legitimate selector use. Covers `with atmos`, `$x := atmos`, parenthesized chains, and range bodies, with tests for each. - Wrap the dependency-graph build error in the instances closure filter with the ErrBuildDepGraph sentinel. - Add a labels-filter case to the scoped-dispatch instances test, asserting the labels reach the scoped describe variant. Co-Authored-By: Claude Fable 5 <[email protected]> * fix: address code-review follow-ups on closure selection and selector purity - Add a completeness test guarding the selector purity deny-list: every YAML function registered in utils.AtmosYamlTags must be explicitly classified as forbidden or selector-safe, so a future function cannot silently bypass the contract; stale deny-list entries also fail. - Unify the list instances closure preview with the lightweight closure the other list commands consume: processInstancesScopedClosure now returns the membership of result.Closure and the row filter is a plain membership lookup, removing the divergent resolved-graph rebuild (BuildGraph + Roots + ReachableClosure) and guaranteeing identical membership across list components/instances/dependencies by construction. Add an agreement test covering templated selectors. - Deduplicate requestedSelectorLabels into tags.RequestedLabels (was copied verbatim in internal/exec and pkg/list/dependencies). - Slash-normalize the closure seed stack glob (stackMatches) to match the non-closure instances path on Windows. - Remove the unreachable query-at-seed branch in the terraform scheduler adapter: the only producer of TerraformSelection is the --affected path, and checkTerraformFlags rejects --affected with --query. - Split renderLevels into levelDistances/sortedLevelNodes helpers to satisfy the cyclomatic-complexity gate. - Changelog: state explicitly that the metadata.tags/metadata.labels purity contract is enforced for every component whenever stacks are enumerated, even without selector flags. Co-Authored-By: Claude Fable 5 <[email protected]> * test: reject stale selector-safe entries in the purity completeness test Mirror the deny-list staleness check for the selector-safe allow-list, so a renamed or removed YAML function cannot leave a dangling classification in either direction. Addresses CodeRabbit review on PR #2807. Co-Authored-By: Claude Fable 5 <[email protected]> * chore: allow gh api graphql mutations in Claude Code settings The blanket deny rule on `gh api graphql*mutation*` blocked legitimate PR-review-thread replies/resolutions alongside anything else routed through gh's GraphQL API, overriding the narrower `gh api graphql:*` allow entry above it. Remove it now that this workflow needs mutations (e.g. addPullRequestReviewThreadReply, resolveReviewThread) to work. Co-Authored-By: Claude Fable 5 <[email protected]> * fix: skip provenance during component rendering (#2829) * fix: skip provenance during component rendering * test: harden provenance rendering coverage * fix: don't process Go templates in Terraform source code (#2145) (#2830) Atmos parses the Terraform/OpenTofu source of a component with `terraform-config-inspect` and stores the result in `component_info.terraform_config`. That section is part of the component section Atmos renders as a `Go` template, so a Terraform `description` containing double curly braces — e.g. the GCP resource name format `projects/{{project}}/locations/{{location}}/services/{{name}}` — aborted every command with `function "project" not defined`. Atmos templating belongs to the abstraction above Terraform modules, so `component_info` is now excluded from template rendering in both the `ProcessStacks` and `describe stacks` pipelines. It remains in the template context, so `{{ .component_info.component_path }}` and friends keep working in stack manifests. Claude-Session: https://claude.ai/code/session_01E9zBYFTZLeu2gBjPjpRN8v Co-authored-by: Claude <[email protected]> Co-authored-by: Erik Osterman (Cloud Posse) <[email protected]> * fix: preserve provenance output order * test: update provenance describe snapshots * perf(terraform-state): cache missing state reads * test: cover raw provenance and missing state cache * fix(test): stop Windows toolchain-vanishing flake in acceptance tests (#2834) * fix(test): resolve CI toolchain cache binaries * fix(tests): close TOCTOU race in Terraform/OpenTofu binary resolution TestExecuteTerraform_Version and TestYamlFuncTerraformOutput each resolved the tofu/terraform binary via RequireTofu/RequireTerraform, then made a second, independent exec.LookPath call before isolating the binary. On the Windows acceptance job's concurrent packages, another test can mutate the shared toolchain cache directory between those two lookups, turning a binary that just existed into a spurious "not found" failure. RequireTerraformPath/RequireTofuPath now resolve the path once and hand it back directly, removing the redundant lookup at each call site. * fix(tests): fail loudly instead of returning an empty path on lookup miss requireExecutablePath (backing RequireTerraformPath/RequireTofuPath) silently returned "" when ATMOS_TEST_SKIP_PRECONDITION_CHECKS=true (set for every CI acceptance job) and the binary wasn't found, instead of surfacing the miss. Callers that need the resolved path then crashed on the empty string with a confusing "open : file not found" error rather than a clear diagnostic. RequireExecutable is decoupled back to its original full-bypass behavior (a true no-op when checks are disabled) since its callers only need a boolean gate, not a path -- only the path-returning variants now hard-fail on a genuine lookup miss. * fix(test): isolate toolchain install-path from the real shared cache dir Several pkg/toolchain tests (TestRunInstall_WithLatestKeyword, TestRunInstall_WithCanonicalFormat, TestRunInstall_WithValidToolSpec, TestRunInstall_WithSetAsDefault, TestRunInstallWithNoArgs, TestRunInstall_Reinstall, TestRunUninstall, TestRunUninstall_InvalidToolSpecFormat, TestUninstallAllVersionsOfTool) called SetAtmosConfig() without setting Toolchain.InstallPath. NewInstaller()'s GetInstallPath() falls back to the real, shared XDG toolchain cache directory whenever InstallPath is empty -- the exact directory CI's "atmos toolchain install --default" step populates and that the whole acceptance suite depends on for hashicorp/terraform and opentofu/opentofu binaries for the rest of the run. TestRunInstall_WithLatestKeyword and TestRunInstall_WithCanonicalFormat in particular perform real network installs of real "terraform" binaries into that shared path, racing with every other concurrently-running package's test process reading tofu/terraform off PATH -- almost certainly the root cause of the intermittent "'tofu' not found in PATH" hard failures seen on the Windows acceptance job (round 3 of this investigation had already ruled out a stale-PATH-visibility theory for this specific failure instance). Fixed by pointing Toolchain.InstallPath at each test's own t.TempDir(), matching the isolation pattern already used by the rest of the toolchain test suite. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(test): isolate remaining toolchain-path leak, widen resolution retry TestBuildToolRow/TestBuildToolRow_NotInstalled resolved NewInstaller()'s binDir to the real shared toolchain cache dir (no InstallPath override), same class of issue fixed in fdbb83f -- read-only here, but still worth isolating for hygiene and to rule them out as a contributor. The Windows tofu-not-found flake recurred in CI even after that fix, so widen requireExecutablePath's retry window from 2s to 15s as a defensive backstop: some residual contention under the acceptance job's concurrent package load isn't yet fully identified, and a longer bounded poll is safer than risking another silent failure while that's tracked down. * test(ci): add lookup forensics for the Windows toolchain-vanishing flake The Windows acceptance job has a recurring failure where an installed toolchain binary (tofu/terraform) vanishes from PATH mid-suite for the full retry window. Root-cause candidates are all writer-side windows in the shared toolchain cache (uninstall RemoveAll, onedir rename-aside, in-place flat-install extraction) but four rounds of static analysis couldn't pin which one fires in CI. requireExecutablePath now dumps per-PATH-entry forensics on failure: whether each toolchain dir exists, its contents, target presence, and whether the installer's ".lock" sibling is held. The next CI failure becomes direct evidence of the mechanism (dir deleted vs tree renamed aside vs writer mid-flight vs PATH corruption) instead of another guess. * fix(test): stop telemetry test deleting the shared Atmos cache root Root cause of the recurring Windows acceptance flake, confirmed by the lookup forensics added in a68e195: the failure dump showed EVERY toolchain directory (terraform, opentofu, helm, helmfile) gone at once -- the whole <cache>/atmos tree had been deleted mid-run. TestPrintTelemetryDisclosureOnlyOnce "cleaned up" by os.RemoveAll on filepath.Dir(cfg.GetCacheFilePath()) -- the real shared <cache>/atmos root -- twice (setup + defer). Ever since the toolchain install root moved underneath that same root (<cache>/atmos/toolchain, #2579), this deleted every CI-provisioned tool out from under the concurrently running package test binaries. Whichever terraform/tofu-dependent test happened to run during the window failed with "executable file not found in %PATH%"; the tests package healed itself via TestMain re-provisioning, which is why only internal/exec kept failing. All four disclosure tests now isolate the cache via a per-test ATMOS_XDG_CACHE_HOME/XDG_CACHE_HOME redirect instead of deleting anything shared. This also fixes the sibling tests that "cleaned" ./.atmos -- a directory the disclosure code never used -- while actually polluting the real user-level cache.yaml. * docs(fixes): record telemetry-test shared-cache-root fix * docs(fixes): note extraction onto osterman/toolchain-cache-fix-own-pr Update the commit/branch reference now that this self-contained investigation ships as its own PR instead of riding along with #2812's unrelated CI git-clone-bootstrap feature. * test(tests): cover forensics and retry-path branches in requireExecutablePath Codecov flagged tests/preconditions.go at 60.93% patch coverage: the new requireExecutablePath retry loop, executableLookupForensics, describeToolchainPathEntry, RequireTerraformPath, and RequireTofuPath had no direct tests. Add real assertion-based coverage for the resolve-on-first-try, retry-until-resolved, and exhausted-retries-skip paths, plus table-driven tests for the forensics string-building logic (target present/absent, directory contents, writer-lock sibling, unreadable dir). Convert executablePathRetryTimeout/Interval from const to var so tests can shrink the retry window instead of waiting out the real 15s. --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Andriy Knysh <[email protected]> --------- Co-authored-by: thejrose1984 <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Erik Osterman (Cloud Posse) <[email protected]> Co-authored-by: Andriy Knysh <[email protected]> * test: close patch-scoped coverage gaps on cross-stack-dag-closure Add behavior-asserting tests for previously-uncovered lines this patch introduced: ghost-dependency tolerance in the dependency filter, direct coverage of closure.go's exported helpers, Phase-C describe-error propagation and merge fallback branches in scope.go, levels rendering edge cases (reverse/both direction, diamond convergence, tie-breaking, unresolvable node IDs), templated-tag/unresolvable-label resolution in render.go, selector-purity edge cases (bare template reference, else- branch forbidden call, if-without-else), the tags-filter exclusion branch in the scheduler adapter's selection seeding, and PredicateFilter/ extract-metadata helpers that previously had zero direct coverage. Genuinely unreachable branches (BuildGraph/selectedTerraformNodeIDs error guards with no current failing path, and a few defensive nil/ empty-slice guards in the selector template-parse walk) are left uncovered with the reasoning left in the corresponding review thread rather than padded with tautological tests. Co-Authored-By: Claude Fable 5 <[email protected]> * test: close coverage gaps in cross-stack dependency closure code paths Adds real behavior tests for the closure-preview flows added by this PR (--include-dependencies/--include-dependents on terraform bulk commands and list components/stacks/instances) that had no unit coverage: the closure- requested branches of describeTerraformStacksForExecution, the scoped-closure extraction helpers in cmd/list (components/stacks/instances), the tags/labels early-skip template-resolution layer in describe_stacks_component_processor.go, DefaultStacksProcessor.ExecuteDescribeStacksScoped, ExecuteDescribeStacksWithAuthDisabledAndMocks, includeDependentsFlagValue's dual bool/string flag shapes, and several RunE-level closure-flag error paths across cmd/list. Adds a small dedicated fixture (list-components-closure-tags) with a tagged forward dependency chain plus an unrelated component and an always-failing component, used to assert closure membership is exact (never pulls in unrelated siblings) and that evaluation errors from the closure's own seed propagate instead of being swallowed. Co-Authored-By: Claude Sonnet 5 <[email protected]> * test: close remaining patch-scoped coverage gaps in cmd/list, pkg/list Cover RunE/ParseLabelsFlag/closure-preview error-propagation branches introduced by this patch's --tags/--labels and dependency-closure selection work: components/dependencies/stacks command error paths in cmd/list, and the labels-parse error branch in pkg/list.ExecuteListInstancesCmd's non-tree/non-matrix path. Remaining zero-coverage lines (BuildGraph/selectedTerraformNodeIDs error guards with no failing path, defensive nil/empty-slice guards in the selector template-parse walk, and two nil-map guards on describe results that are always non-nil on the success path) are confirmed genuinely unreachable, consistent with prior cycles' documented reasoning. Co-Authored-By: Claude Fable 5 <[email protected]> * refactor(exec): extract Spacelift/Atlantis and sources-exclusion helpers from ProcessStacks Addresses CodeRabbit feedback that ProcessStacks was growing past the function-size/complexity guidelines. Extracts the Spacelift/Atlantis name computation into computeSpaceliftAndAtlantisNames and the sources capture/delete/restore pair into excludeSourcesFromEvaluation, keeping the orchestrator closer to a linear pipeline. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: address CodeRabbit feedback on PR #2807 - Document the selector purity contract (validateSelectorMetadata runs always, independent of active tags/labels filters or eager_evaluation) in the scope-before-evaluate fix doc, so the always-on rejection of forbidden selector functions isn't a surprise. - Reorder imports in terraform_state_output_coverage_test.go into a single Atmos-package group. - Widen the provisioned_by_user sanitization regex to also preserve double-quoted (not just single-quoted) unresolved provenance templates, with a regression test. - Fix list-vendor.mdx: only vendor manifests lack a labels concept; component manifests already support metadata.labels elsewhere. Co-Authored-By: Claude Sonnet 5 <[email protected]> * [autocommit] formatting fixes * fix(ci): add deterministic URL overrides for flaky gopkg.in NOTICE entries Review Dependency Licenses was failing because 5 gopkg.in vanity-import dependencies (ini.v1, evanphx/json-patch.v4, inf.v0, op/go-logging.v1, warnings.v0) resolve their license URL via go-licenses' network/source metadata lookup, which is flaky: it sometimes emits "URL: Unknown" instead of the real GitHub blob URL, producing a NOTICE diff regardless of which value happened to be committed last (an earlier autocommit on this branch had in fact regenerated NOTICE mid-flake, reverting these five URLs back to "Unknown"). Add these five modules to generate-notice.sh's existing REPO_OVERRIDES mechanism (already used for dario.cat/mergo, inet.af/netaddr, and the cloud.google.com/go split modules for the same reason), so their URLs are rebuilt deterministically from the pinned go.mod version instead of depending on network resolution. Verified byte-identical NOTICE output across three consecutive regenerations. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(ci): convert generate-notice.sh to tab indentation per .editorconfig Run pre-commit hooks and Validation (affected) were both failing with "Wrong indentation type(spaces instead of tabs)" across dozens of lines in scripts/generate-notice.sh: .editorconfig requires indent_style=tab for *.sh, but this file has always used spaces. This was latent — the editorconfig check validates whichever files appear in a commit's diff, and nothing had touched this file until the REPO_OVERRIDES change in 183fb78, which put its pre-existing (unrelated) violation in scope. Convert all shell-code indentation (4/8/12 spaces -> 1/2/3 tabs) to tabs. The one heredoc with genuine indented body content (the footer's " go-licenses report ./..." and " https://github.com/cloudposse/atmos" lines, which become literal NOTICE text, not shell structure) is rewritten as a sequence of top-level `echo` statements instead, so the indentation lives inside a quoted string rather than as leading-line whitespace -- satisfying the tab rule without changing NOTICE's output. Verified byte-identical NOTICE content before/after, and `atmos validate --affected --exclude 'tests/fixtures/**' --exclude '**/*.go' --format rich` (the exact pre-commit hook command) now reports "editorconfig: passed". Co-Authored-By: Claude Fable 5 <[email protected]> * [autocommit] formatting fixes * fix(ci): add gopkg.in/yaml.v2 and v3 to NOTICE URL overrides A second flaky autocommit (10061ca) reverted these two modules' URLs to "Unknown" the same way the five modules fixed in 183fb78 did. Rather than keep patching individual gopkg.in modules as they happen to flake, enumerated every gopkg.in/* module actually present in NOTICE (go list -m all | grep gopkg.in, cross-checked against the generated file) — all 7 are now covered. Verified deterministic output across repeated regenerations. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(test): cross-platform USER env var and Windows backslash-quote sanitization Two independent Windows-only Acceptance Tests failures: 1. TestSanitizeOutput_WithCustomReplacements/Preserve_double-quoted_ provenance_template: sanitizeOutput's filepath.ToSlash(protectedOutput) call converts every backslash to a forward slash on Windows (a no-op on Unix), which corrupted literal `\"` sequences in quoted provenance templates (e.g. `env \"USER\"`) into `/"`. Protect `\"` behind a placeholder before ToSlash and restore it after, mirroring the existing JSON-unicode-escape protection immediately above it in the same function. 2. TestCLICommands/describe_component_with_{current_directory,relative_path, component_name_(backward_compatibility)}: the "complete" fixture's provisioned_by_user used `{{ env "USER" }}`. Windows doesn't set USER (it sets USERNAME), so the template rendered to an empty string, which serializes as a quoted `""` -- and the sanitizer's provisionedByUserRegex deliberately excludes quote-leading values (added in b315ec2, to preserve unresolved quoted templates), so it never got normalized to the expected `user` placeholder. Add the same fallback to the identical pattern in the quick-start-advanced example. Golden snapshots regenerated via -regenerate-snapshots to reflect the new template source text (the rendered/sanitized line is unchanged). Co-Authored-By: Claude Fable 5 <[email protected]> * fix(list): scope `list sources` --tags/--labels before evaluation; nitpick cleanup `atmos list sources` filtered by --tags/--labels only after describe-stacks had already evaluated auth/templates/YAML-functions for every stack. Switch to ExecuteDescribeStacksScoped so out-of-scope components are skipped before evaluation, matching the scope-before-evaluate pattern already used by the other list commands. Also addresses a few CodeRabbit nitpicks: replace a hand-rolled containsString with slices.Contains in pkg/list/dependencies/scope.go, compute componentTypes once per call instead of once per stack in pkg/list/extract/stacks.go, convert the tags/labels row-filtering subtests in list_instances_test.go and list_metadata_test.go to table-driven tests, and drop the dead filterSpec field/case from TestBuildMetadataFilters. Co-Authored-By: Claude Sonnet 5 <[email protected]> * test: cover escaped-quote and JSON-unicode-escape preservation together TestSanitizeOutput had no case exercising the two Windows-only filepath.ToSlash protections (escaped \" and >-style unicode escapes) together, or the > protection at all. Add a regression case with both in one input, per CodeRabbit review on 22a94a4. Only meaningfully exercises the platform-specific path on Windows (ToSlash is a no-op elsewhere), matching how the original bug was only caught by Windows CI. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(closure): review fixes — affected depth bound, selector purity hardening, wrongful-exclusion edges High severity: - --affected --include-dependents=N no longer silently expands unlimited: the selection producer bridged the depth-carrying flag through a bool and left DependentDepth zero (= unlimited in filter encoding), so the most-permissive closure merge erased the user's bound. The new affectedTerraformSelection helper carries the parsed depth from info via the exported FlagDepthToFilterDepth conversion. - Selector purity blast radius: the error now names the offending component and stack manifest; describe.settings.eager_evaluation (the advertised rollback switch) also bypasses purity validation — with full evaluation forced there is no pre-evaluation scoping to protect; docs corrected to state the true enforcement surface (stack-enumerating commands). - Purity gate laundering holes closed: atmos.Resolve (launders any YAML function through a template call), gomplate datasource access beyond ds/datasource (include, datasourceExists, datasourceReachable, defineDatasource), the gomplate aws/gcp/net/random namespaces, and sprig network/nondeterministic functions (getHostByName, uuidv4, randAlpha*, randBytes, now) are now rejected in selectors; map KEYS are validated too. - Wrongful-exclusion edge fixed: RequestedLabels is shape-aware — a non-map labels value (templated scalar) or a templated map key cannot be safely narrowed, so the selector is undecidable and falls through to full evaluation instead of collapsing to a decidable non-match. SelectorUnresolved now also considers map keys. - Reverse-closure blind spot fixed: a dependent whose dependency declaration is templated produces no lightweight-graph edge and was never evaluated, so --include-dependents silently omitted it. Reverse/both directions now conservatively evaluate UnresolvedDependencySources so their edges materialize; membership is still decided by the recomputed closure. Medium severity: - Preview/execution alignment: the final closure re-tests the seed roots against the RESOLVED graph (refineRoots), so a root whose templated selector resolves to a non-matching value is dropped — list previews now match the execution set instead of being a conservative superset. - describe.settings.eager_evaluation documented on the website (cli/configuration/describe) and referenced from the blog post as the migration escape hatch for the purity contract; blog also documents the --affected --include-dependents --tags scope-semantics change and the bare-flag depth syntax sharp edge. Low severity: - list vendor --tags binds ATMOS_VENDOR_TAGS instead of reusing ATMOS_COMPONENT_TAGS for a semantically different filter (vendor manifest tags, not component metadata.tags). - list metadata docs no longer advertise the not-yet-implemented --filter expression; examples use jq over --format json instead. Tests added: - --affected selection depth table (bare/bounded/forced/nil-info) and a closure-spec merge case pinning that same-flag inputs keep the bound. - Purity: ~20 deny-list cases including allowed-direction guards (.vars.aws/.vars.now stay legal), map-key rejection, and the documented .vars.Component conservatism; eager_evaluation bypass; error identity. - Wrongful exclusion: templated-scalar labels and templated label keys fall through to full evaluation at the processor level. - Reverse closure: templated same-stack and cross-stack dependents are discovered; evaluated non-dependents stay out of the closure; forward direction skips the conservative evaluation entirely. - Preview drift: resolved-to-non-matching root is dropped from the closure. - Cross-stack execution ordering through ExecuteTerraform (vpc-core before app-dev; reversed for destroy) and destroy --include-dependencies ordering (seed first, prerequisites last). - Destroy --include-dependencies warning presence/absence via the UI-stream capture seam; not-provisioned state-cache invalidation including mismatched-key negative guards. Co-Authored-By: Claude Fable 5 <[email protected]> * refactor(closure): build the seed selector in one place Extract the Selector construction shared by the lightweight seed pass (ResolveScopedClosure) and the resolved-graph root refinement (refineRoots) into a ScopeRequest.selector() method. The refinement must apply exactly the same filters as the seed pass; constructing them in one place keeps the two passes identical by construction when a selector field is added. Addresses a CodeRabbit review comment on PR #2807. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(lint): extract resolveLabelSelector to reduce nestif complexity internal/exec/describe_stacks_component_processor.go:853 was flagged by nestif (complexity: 4). Extracts the label-narrowing/resolution block from inScopeByTagsAndLabelsWithContext into a named helper, resolveLabelSelector, preserving behavior exactly. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(list): restrict stacks closure preview to final closure; address review comments CodeRabbit review fixes on PR #2807: list stacks closure correctness: - `list stacks --include-*` output is now restricted to the FINAL closure's stacks before extraction. result.Stacks can hold conservatively evaluated stacks that are not closure members (the reverse direction evaluates unresolved dependency sources so their edges materialize, and refineRoots can drop an initially conservative root once its selector resolves) — list components/instances already filtered by closure membership; stacks now does too, so the preview matches the execution set. Regression-tested with a new qa fixture stack whose templated dependency resolves outside the closure (test fails with the filter removed). - With --component, closure-extracted stack rows now carry the component under "component" for stacks that actually contain it, matching extract.StacksForComponent's row shape so `{{ .component }}` columns render identically with and without closure flags. Prerequisite stacks without the component keep no component key rather than claiming one. Help text and docs: - The --include-dependencies/--include-dependents descriptions now state the order is reversed for destroy; 7 terraform help golden snapshots regenerated via -regenerate-snapshots. - list dependencies levels doc: the positional component argument is now listed among the level-0 seeds alongside --stack/--tags/--labels. Test hardening: - USER and USERNAME pinned to "user" in all three component-path-resolution test cases that snapshot provisioned_by_user: the sanitizer regex cannot cover a username containing spaces or both vars being unset, so the snapshots were portable only by accident. Snapshots regenerated (byte-identical — the pinning makes the sanitized value genuine). - Invalid --labels tests (cmd/list sources, pkg/list instances) now assert errUtils.ErrInvalidFlag and the offending value, not just any error. - Added the fail-open scoped-dispatch test: tags/labels filters with a processor lacking the optional scoped interface fall back cleanly. - The instances closure-preview test now captures the data stream and asserts the exact rendered component set instead of only NoError. - GetTagsFromMetadata/GetLabelsFromMetadata tests converted to table-driven with mixed-type cases; render levels selector cases named as subtests with the fixture built inline; ResolveSelectorValue test's name-string branch replaced with a per-case data field. - Removed a //nolint:dupl directive made unused by the strengthened test. Deferred with follow-up issues to be opened: functional-options migration for the ExecuteDescribeStacks* family (heavy refactor, wrong to do mid-review) and honoring --filter in list metadata (feature gap, docs already corrected). Co-Authored-By: Claude Fable 5 <[email protected]> * fix(test): normalize ANSI and wrapping in destroy-warning assertion TestCheckTerraformFlagsDestroyDependenciesWarning asserted plain text on the captured UI stream. Locally (non-TTY) the warning renders unstyled and the test passed; on CI (all three OSes) the formatter renders the stream with ANSI colors and width-dependent style segmentation — the sentence is split across styled segments (`...the selected\x1b[0m\x1b[97m components`) — so the Contains assertion failed. Strip ANSI escape sequences and collapse all whitespace (including wrap-inserted newlines) before asserting, in both the positive and negative directions. Verified against the exact CI-captured byte sequence and under ATMOS_FORCE_COLOR=true ATMOS_FORCE_TTY=true COLUMNS=80. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Andriy Knysh <[email protected]> Co-authored-by: zack-is-cool <[email protected]> Co-authored-by: thejrose1984 <[email protected]> Co-authored-by: atmos-pro[bot] <173522224+atmos-pro[bot]@users.noreply.github.com> Co-authored-by: aknysh <[email protected]>
what
~/.cache/atmos— toolchain binaries, vendored components, remote import clones, provider/plugin caches) at startup and saves it at exit, using the same storeactions/cacheuses (GitHub Actions Cache Service v2).atmos ci cachesubcommands:restore,save,list,delete— so the lifecycle can run in one invocation or be spread across CI steps.ci.cacheconfiguration block (enabled,auto: off|restore|save|both,root,paths,key,restore_keys,compression) withATMOS_CI_CACHE_*env overrides.provider.CacheProvider+ci.DetectCache()) with a backend registry (pkg/ci/cache) and a GitHub Actions implementation (pkg/ci/cache/github), mirroring the existing artifact subsystem; outside a runner it's a clean no-op.~/.cache/atmos/toolchain) so a single cache captures it; add a PRD, command/config docs, blog post, and roadmap entry.why
actions/cachestep and own thekey/pathlogic themselves; Atmos already knows its cache root and can derive a stable key fromtoolchain.lock.yaml+ OS/arch, so it's two settings to enable.references
docs/prd/native-ci/framework/ci-cache.md/cli/commands/ci/cacheand/cli/configuration/ci/cacheactions/cacheuses)