Skip to content

feat(list): --process-templates and --process-functions flags; fix list instances --upload auth - #2363

Merged
Andriy Knysh (aknysh) merged 18 commits into
mainfrom
aknysh/update-upload-instances
Apr 27, 2026
Merged

Andriy Knysh (aknysh) merged 18 commits into
mainfrom
aknysh/update-upload-instances

Conversation

@aknysh

@aknysh Andriy Knysh (aknysh) commented Apr 24, 2026 •

Copy link
Copy Markdown
Member

what

  • Added --process-templates and --process-functions CLI flags (and ATMOS_PROCESS_TEMPLATES / ATMOS_PROCESS_FUNCTIONS env vars) to every atmos list subcommand that processes stack manifests: list instances, list components, list metadata, list sources, list stacks. Defaults are true, matching atmos describe affected / atmos describe stacks / atmos describe component.
  • Clarified the flag descriptions that used to conflate YAML functions with Go template functions. --process-templates toggles Go templates (including atmos.Component(...)); --process-functions toggles YAML functions (!terraform.state, !terraform.output, !store, !aws.*, …).
  • Fixed the underlying atmos list instances --upload hang in CI: per-component auth resolution in internal/exec/describe_stacks_component_processor.go was gated on processYamlFunctions only, so the template-only path (atmos.Component(...) inside Go templates) ran terraform init with an empty AuthContext against remote backends and failed with No valid credential sources found. Guard now fires when either templates or YAML functions will run.
  • Refactored the per-component auth resolver for testability: extracted shouldResolvePerComponentAuth(...) predicate, resolveComponentAuthManager(...) method, and an injectable componentAuthManagerResolver field on describeStacksProcessor so the decision can be exercised without running real OIDC/STS.
  • Threaded the two flags through InstancesCommandOptions / MetadataOptions in pkg/list/ and through both the matrix-format and tree-format branches of list_instances.go, so every output path of the same invocation honors the same flag values.
  • Added three layers of regression coverage for each command that just got the flags (parser wiring, options struct, flag propagation to ExecuteDescribeStacks) plus a dedicated auth-guard regression suite (TestShouldResolvePerComponentAuth, TestResolveComponentAuthManager 6-row table, TestResolveComponentAuthManager_ResolverErrorFallsBackToParent).
  • Documented the two flags on every affected atmos list command page, added a blog post announcing the feature, and added a shipped milestone to the Discoverability & List Commands roadmap initiative.
  • Bumped Go modules to latest where compatible (aws-sdk-go-v2/service/s3 → 1.100.0, smithy-go → 1.25.1, anthropic-sdk-go → 1.38.0, hashicorp/terraform-exec → 0.25.1, posthog-go → 1.12.1, k8s.io/client-go → 0.36.0, plus many transitive indirects). Three transitive pins remain, now documented inline in go.mod: sentry-go v0.45.1 (cockroachdb/errors v1.12.0 still references the removed Extra field), gocloud.dev v0.41.0 (gomplate/v3 s3blob uses removed ConfigProvider), hairyhenderson/go-fsimpl v0.3.1 (transitive via the gocloud.dev pin).

why

  • atmos list instances --upload was broken in CI for any repo whose component sections call atmos.Component(...) inside Go templates with a stack-level default identity — the exact shape used by the Atmos Pro release workflow. Users reported the command failing with No valid credential sources found while atmos describe affected --upload in the same workflow succeeded.
  • Root cause: atmos.Component(...) is a Go template function, not a YAML function. The processor's per-component auth resolver assumed YAML functions were the only consumer of info.AuthContext and gated itself on processYamlFunctions. The template path reads the same AuthContext and shells out to terraform init + terraform output, so disabling per-component auth broke template-only invocations.
  • Users expected atmos list flags to line up with atmos describe flags. They didn't: only list affected, list settings, and list values had the two knobs. A user workflow actually relied on --process-functions on list instances (where it didn't exist), which produced an unknown flag error and a confusing escape hatch. Adding the two flags everywhere the command processes stacks closes that gap.
  • The flag rollout intentionally defaults both flags to true for parity. Users who run atmos list locally without tofu / terraform on $PATH can opt out with --process-functions=false or ATMOS_PROCESS_FUNCTIONS=false; the auth-guard fix above ensures the true, true default works end-to-end in CI.
  • Module update was due. The three remaining pins are annotated so the next go get -u ./... pass doesn't trip over them blindly.

references

  • Fix design doc: `docs/fixes/2026-04-24-list-instances-per-component-auth.md`
  • Blog post: `website/blog/2026-04-24-list-process-flags.mdx`
  • Roadmap milestone: `website/src/data/roadmap.js` (Discoverability & List Commands initiative)
  • Previous related fix: `docs/fixes/2026-04-08-atmos-auth-identity-resolution-fixes.md` (Category A vs B caller split that this change builds on)

Summary by CodeRabbit

  • New Features

    • Added --process-templates and --process-functions flags to list subcommands to control Go template vs YAML function processing (both default to enabled).
  • Bug Fixes

    • Restored per-component authentication resolution when templates are processed, fixing upload failures in CI.
  • Documentation

    • Updated CLI docs, added a blog post and roadmap entry describing the new flags and examples.
  • Tests

    • Extensive new and updated unit/integration tests covering flag parsing, behavior permutations, and regressions.
  • Chores

    • Updated NOTICE/license references, added missing license entries, bumped dependencies and example default version to 1.217.0.

Andriy Knysh (aknysh) and others added 7 commits April 24, 2026 14:06
…omponent

`atmos list instances --upload` was failing in CI with "No valid
credential sources found" when component sections contain
`atmos.Component(...)` Go-template calls. The processor gated
per-component auth on `processYamlFunctions`, but
`atmos.Component(...)` is a Go template function, not a YAML
function; it runs during the template branch and also consumes
`info.AuthContext` to authenticate terraform subprocesses against
remote backends.

Widen the guard to `processYamlFunctions || processTemplates` so
list instances (and any future caller with the same shape) gets
credentials for the per-component auth path. Refactor the inline
block into `resolveComponentAuthManager` with an injectable
resolver for testability; add `shouldResolvePerComponentAuth` as a
named predicate so the fix is self-documenting.

Category A callers (terraform/helmfile/describe-component) pass
`processYamlFunctions=true` and take the unchanged branch. The only
observable behavior change is for callers with
`processTemplates=true, processYamlFunctions=false` — today that is
`list instances` and its provenance-tree branch, which were broken.

See docs/fixes/2026-04-24-list-instances-per-component-auth.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ommands

Add `--process-templates` / `--process-functions` flags (and their
ATMOS_PROCESS_TEMPLATES / ATMOS_PROCESS_FUNCTIONS env var bindings) to
every `atmos list` subcommand that processes stack configurations, for
parity with `atmos describe affected` / `atmos describe stacks` /
`atmos describe component`. Both flags default to true.

Commands updated:
- `atmos list instances` (new)
- `atmos list components` (new)
- `atmos list metadata` (new)
- `atmos list sources` (new)
- `atmos list stacks` (new)

Already had the flags: `list affected`, `list settings`, `list values`
(and its `list vars` alias). Skipped: `list aliases`, `list themes`,
`list vendor`, `list workflows` — these do not process stacks or use
them only internally for enumeration where the flags would be no-ops.

Also:
- Clarify `WithProcessFunctionsFlag` / `WithProcessTemplatesFlag`
  wrapper descriptions to distinguish YAML functions
  (`!terraform.state`, `!terraform.output`, `!store`, `!aws.*`) from
  Go template functions (`atmos.Component(...)`) — they are controlled
  by separate flags.
- Thread the two flags through `InstancesCommandOptions` /
  `MetadataOptions` in `pkg/list/` and through both the matrix-format
  and tree-format branches of `list_instances.go` so output is
  consistent with the non-matrix, non-tree path for the same
  invocation.
- Clarify the misleading comment in `processInstancesWithDeps` that
  conflated the YAML-function flag with `atmos.Component(...)` (which
  is a Go template function).
- Update the `list instances` docs page with the two new flags.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extend the fix doc to cover:
- The refactor that extracted the guard into the named helper
  `shouldResolvePerComponentAuth` and the inline block into
  `resolveComponentAuthManager` with an injectable
  `componentAuthManagerResolver` for test doubles.
- The three-layer regression-test suite
  (`TestShouldResolvePerComponentAuth`,
  `TestResolveComponentAuthManager` six-row table,
  `TestResolveComponentAuthManager_ResolverErrorFallsBackToParent`).
- The companion `--process-templates` / `--process-functions` flag
  rollout across the `atmos list` surface (instances, components,
  metadata, sources, stacks), the matrix-/tree-format plumbing, and
  the reworded flag help that disambiguates YAML functions from
  Go template functions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Docs: add the two flags to every `atmos list` subcommand page that now
exposes them but was missing the entry: list-components, list-metadata,
list-settings, list-sources, list-stacks, list-values, list-vars. Each
entry names the default (true), disambiguates Go template functions
(`atmos.Component(...)`) from YAML functions (`!terraform.state`,
`!terraform.output`, `!store`, `!aws.*`), and links the matching
`ATMOS_PROCESS_TEMPLATES` / `ATMOS_PROCESS_FUNCTIONS` env var.

Tests: three layers of regression coverage for each command that just
got the flags (instances, components, metadata, sources, stacks):

- Parser wiring — `Test*ProcessTemplatesAndFunctionsFlags` queries the
  real `<command>Cmd.Flags()` and asserts both flags are registered
  with default "true". Guards against future removal of
  `WithProcessTemplatesFlag` / `WithProcessFunctionsFlag` from the
  command's `NewListParser(...)` call.
- Options struct — `Test*Options_ProcessTemplatesAndFunctions` over
  all four (templates, functions) combinations; guards against field
  rename/removal from the cmd- and pkg-level option structs.
- Flag propagation — `TestProcessInstancesWithDeps_PropagatesTemplate
  AndFunctionFlags` uses a gomock mock of `e.StacksProcessor` and
  asserts the `(processTemplates, processYamlFunctions)` pair reaches
  `ExecuteDescribeStacks` unchanged across all four quadrants. Regression
  guard for the original hardcoded-`(true, false)` shape the
  `list instances --upload` hang was about.

Also backfills a `cmd/list/metadata_test.go` for the
previously-untested metadata command and extends the existing
`TestMetadataOptionsStruct` to cover the two new fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New blog post covers the two flags added to every `atmos list`
subcommand that processes stack manifests (instances, components,
metadata, sources, stacks), the YAML-function vs. Go-template-function
distinction the flag help used to conflate, and the escape-hatch
patterns for environments without `tofu` / `terraform` on $PATH.
Briefly references the underlying per-component auth fix that made
defaulting both flags to `true` safe for the `list instances --upload`
path.

Also adds the matching milestone to the `discoverability` initiative
in the roadmap data file. Progress stays at 100% (9/9 shipped).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ran `go get -u ./... && go mod tidy`. Updates land on everything
that's compatible; three transitive pins remain in place and are
documented inline in go.mod so the next `-u` pass does not re-bump
them blindly:

- `getsentry/sentry-go` — held at v0.45.1 because
  `cockroachdb/errors v1.12.0` (the latest) still references
  `sentry.Event.Extra`, which was removed in sentry-go v0.46.0.
- `gocloud.dev` (indirect) — held at v0.41.0 because
  `hairyhenderson/gomplate/v3`'s s3blob code uses
  `s3blob.URLOpener.ConfigProvider`, which was removed in
  gocloud.dev v0.42+.
- `hairyhenderson/go-fsimpl` (indirect) — held at v0.3.1 because
  newer go-fsimpl versions require the gocloud.dev bump above.

Notable direct-dep bumps: aws-sdk-go-v2/service/s3 1.99.1→1.100.0,
smithy-go 1.25.0→1.25.1, anthropic-sdk-go 1.37.0→1.38.0,
hashicorp/terraform-exec 0.25.0→0.25.1, posthog-go 1.11.3→1.12.1,
k8s.io/client-go 0.35.4→0.36.0.

`go build ./...` and `go vet ./...` are clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Audit fixes on the list-flag rollout:

- `pkg/list/list_instances.go` — tree-format branch now honors the
  caller-supplied `ProcessTemplates` / `ProcessFunctions` flags,
  matching the behavior of `cmd/list/stacks.go` tree format and
  what the fix doc claims. Previously the tree path still had
  hardcoded `(false, false)` after the flag rollout.
- `website/docs/cli/commands/list/list-instances.mdx` — normalize
  the env-var note to `<br/>Environment variable: ATMOS_*`, matching
  the seven other list-*.mdx files.

Unrelated housekeeping:

- Bump `ATMOS_VERSION` references from 1.216.0 to 1.217.0 in the
  quick-start-advanced Dockerfile and in two tests that assert
  against the version string.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aknysh
Andriy Knysh (aknysh) requested a review from a team as a code owner April 24, 2026 20:37
@aknysh Andriy Knysh (aknysh) added the minor New features that do not break anything label Apr 24, 2026
@atmos-pro

atmos-pro Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

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

View pull request changes on Atmos Pro

@github-actions github-actions Bot added the size/l Large size PR label Apr 24, 2026
@github-actions

github-actions Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

🚀 Go Version Change Detected

This PR changes the Go version:

  • Base branch (main): 1.26
  • This PR: 1.26.2
  • Change: ⬆️ Upgrade

Tip

Upgrade Checklist

  • Verify all CI workflows pass with new Go version
  • Check for new language features that could be leveraged
  • Review release notes: https://go.dev/doc/go1.26
  • Update .tool-versions if using asdf
  • Update Dockerfile Go version if applicable

This is an automated comment from the Go Version Check action.

@github-actions

github-actions Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

Dependency Review

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

License Issues

go.mod

PackageVersionLicenseIssue Type
github.com/Azure/go-ntlmssp0.1.1NullUnknown License
github.com/aws/aws-sdk-go-v2/service/s31.100.0NullUnknown License
github.com/bahlo/generic-list-go0.2.0NullUnknown License
github.com/buger/jsonparser1.1.2NullUnknown License
github.com/dlclark/regexp21.12.0NullUnknown License
github.com/docker/cli29.4.1+incompatibleNullUnknown License
github.com/hashicorp/consul/api1.34.2NullUnknown License
github.com/invopop/jsonschema0.13.0NullUnknown License
github.com/mailru/easyjson0.9.2NullUnknown License
github.com/posthog/posthog-go1.12.1NullUnknown License
github.com/rs/zerolog1.35.1NullUnknown License
google.golang.org/protobuf1.36.12-0.20260120151049-f2248ac996afNullUnknown License
k8s.io/apimachinery0.36.0NullUnknown License
k8s.io/client-go0.36.0NullUnknown License
github.com/deckarep/golang-set/v22.9.0NullUnknown License
Allowed Licenses: MIT, MIT-0, Apache-2.0, BSD-2-Clause, BSD-2-Clause-Views, BSD-3-Clause, ISC, MPL-2.0, 0BSD, Unlicense, CC0-1.0, CC-BY-3.0, CC-BY-4.0, CC-BY-SA-3.0, Python-2.0, OFL-1.1, LicenseRef-scancode-generic-cla, LicenseRef-scancode-unknown-license-reference, LicenseRef-scancode-unicode, LicenseRef-scancode-google-patent-license-golang
Excluded from license check: pkg:golang/modernc.org/libc

Scanned Files

  • go.mod

@mergify

mergify Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

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

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

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label Apr 24, 2026
@aknysh Andriy Knysh (aknysh) self-assigned this Apr 24, 2026
Andriy Knysh (aknysh) and others added 2 commits April 24, 2026 16:41
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f115873c-d675-4d78-9973-be9305380baf

📥 Commits

Reviewing files that changed from the base of the PR and between e95e691 and 96ca7dc.

📒 Files selected for processing (2)
  • internal/exec/terraform_test.go
  • pkg/list/list_metadata_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/exec/terraform_test.go
  • pkg/list/list_metadata_test.go

📝 Walkthrough

Walkthrough

Adds two flags—--process-templates and --process-functions—to list subcommands, threads them through list/describe execution paths, refactors per-component auth resolution to run when either mode is enabled with an injectable resolver, and updates tests, docs, and dependency/version metadata.

Changes

Cohort / File(s) Summary
CLI Flag Helpers
cmd/list/flag_wrappers.go, cmd/list/flag_wrappers_test.go
Clarified help text for --process-templates (Go templates incl. atmos.Component) and --process-functions (YAML functions like !terraform.*, !store); adjusted test expectation.
Commands — components/instances/metadata/sources/stacks
cmd/list/components.go, cmd/list/instances.go, cmd/list/metadata.go, cmd/list/sources.go, cmd/list/stacks.go, cmd/list/*_test.go
Added ProcessTemplates/ProcessFunctions fields to command option structs; introduced parse*Options helpers; registered flags; forwarded flags into execution paths; added unit tests asserting flag presence/defaults.
Core list package
pkg/list/list_instances.go, pkg/list/list_metadata.go, pkg/list/list_instances_*_test.go
Exposed new option fields and updated processInstances/processInstancesWithDeps signatures and callers so ExecuteDescribeStacks receives the flags across tree/matrix/non-tree flows; tests updated.
Per-component auth
internal/exec/describe_stacks_component_processor.go, internal/exec/describe_stacks_component_processor_auth_test.go
Refactored per-component auth resolution into resolveComponentAuthManager with an injectable componentAuthResolver; shouldResolvePerComponentAuth now true when templates OR YAML-functions are enabled; added comprehensive tests (truth table, spy, error fallback).
CLI parsing & integration tests
cmd/list/parse_options_test.go, cmd/list/cmd_executor_integration_test.go
Added viper→options parsing tests for new flags and cmd-layer integration tests exercising list executors across combinations of template/function flags and output formats.
Docs / Blog / Roadmap / Fixes
website/docs/cli/.../list-*.mdx, website/blog/2026-04-24-list-process-flags.mdx, website/src/data/roadmap.js, docs/fixes/2026-04-24-list-instances-per-component-auth.md
Documented the two new flags, env vars, behavioral distinctions, CI fix for per-component auth, and added blog/roadmap entries and a fixes doc.
Deps / Version bumps
go.mod, NOTICE, examples/quick-start-advanced/Dockerfile, pkg/ai/analyze/analyze_test.go, pkg/devcontainer/lifecycle_rebuild_test.go
Bumped Go toolchain and multiple dependencies, added indirect modules, updated NOTICE entries, and bumped default ATMOS_VERSION from 1.216.0 → 1.217.0 (Dockerfile/tests).
Test cleanup
pkg/list/list_instances_coverage_test.go
Removed a coverage-only test that directly invoked processInstances; replaced with integration-style tests.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI (atmos list ...)
    participant Cmd as List Command
    participant ListPkg as pkg/list.ExecuteList*
    participant Describe as ExecuteDescribeStacks
    participant CompProc as ComponentProcessor
    participant AuthRes as componentAuthResolver
    participant AuthMgr as AuthManager

    CLI->>Cmd: parse --process-templates / --process-functions
    Cmd->>ListPkg: call ExecuteList* with flags
    ListPkg->>Describe: ExecuteDescribeStacks(processTemplates, processFunctions)
    Describe->>CompProc: process component entries
    CompProc->>AuthRes: shouldResolvePerComponentAuth?(templates || functions)
    AuthRes-->>CompProc: return component-level or parent AuthManager
    CompProc->>AuthMgr: use returned AuthManager for per-component ops
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Possibly related PRs

Suggested reviewers

  • osterman
  • milldr
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the two main changes: adding --process-templates and --process-functions flags to list commands, and fixing the list instances --upload auth issue.
Docstring Coverage ✅ Passed Docstring coverage is 82.22% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aknysh/update-upload-instances

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
NOTICE (1)

1-1830: ⚠️ Potential issue | 🟠 Major

Regenerate NOTICE from source-of-truth to unblock CI.

The dependency-review job already reports this file is out of date; since NOTICE is generated, please rerun ./scripts/generate-notice.sh and commit the result instead of manually curating entries.

Based on learnings: In cloudposse/atmos, the NOTICE file is programmatically generated and should not be manually edited.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@NOTICE` around lines 1 - 1830, The NOTICE file was manually edited and is
out-of-date; regenerate it from the source-of-truth by running the provided
generator and commit the generated output: run ./scripts/generate-notice.sh,
replace the current NOTICE with the script's output, verify CI passes, and
commit the regenerated NOTICE (do not hand-edit the NOTICE file).
🧹 Nitpick comments (7)
pkg/list/list_metadata_test.go (1)

359-406: These combo tests should target behavior, not field assignment.

Both tests currently re-check values assigned in the test itself. Consider replacing with assertions that these options actually affect metadata/instances execution behavior.

As per coding guidelines, "Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/list/list_metadata_test.go` around lines 359 - 406, The tests
TestMetadataOptions_ProcessTemplatesAndFunctionsAllCombinations and
TestInstancesCommandOptions_ProcessTemplatesAndFunctions are tautological
because they only re-assert fields set in the test; change them to assert
behavior: construct a MetadataOptions or InstancesCommandOptions with each flag
combo, call the real processing function(s) that use those structs (e.g., the
metadata/instance processing pipeline functions that accept MetadataOptions or
InstancesCommandOptions), and assert side-effects for each flag (for example,
when ProcessTemplates is true templates are expanded/replaced and when false
they remain intact; when ProcessFunctions is true function calls are executed
and when false they are not). If needed, inject test doubles or hooks into the
processing functions to observe whether template or function handlers ran (use
DI or a small fake processor), and replace the current field-only assertions
with checks against the processed output or observed handler invocations for
each combo.
pkg/list/list_instances_coverage_test.go (1)

44-59: Strengthen this wrapper test to validate behavior, not just execution.

With the new processTemplates/processFunctions arguments, this test currently won’t catch forwarding/behavior regressions because results are ignored. Consider asserting a deterministic outcome (or removing this wrapper-only test if covered meaningfully elsewhere).

As per coding guidelines, "Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/list/list_instances_coverage_test.go` around lines 44 - 59, The wrapper
test currently only executes processInstances and ignores outputs; update it to
assert deterministic behavior for the new processTemplates/processFunctions
flags: call processInstances with controlled inputs (e.g., a minimal
AtmosConfiguration and explicit processTemplates/processFunctions boolean
values), then assert the returned instances slice and/or error using errors.Is()
or exact value comparisons, or replace the test with table-driven cases that
cover the meaningful combinations of processTemplates/processFunctions and
validate expected outputs; if this wrapper truly adds no behavior beyond
processInstancesWithDeps, remove the tautological test and rely on the
underlying processInstancesWithDeps tests instead.
cmd/list/sources_test.go (1)

871-892: This options test is mostly tautological right now.

It validates direct field assignment rather than command behavior. Prefer a regression test that proves these booleans influence the downstream describe/list path.

As per coding guidelines, "Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/sources_test.go` around lines 871 - 892,
TestSourcesOptions_ProcessTemplatesAndFunctions currently only checks that
struct fields hold assigned values; change it to exercise the downstream
describe/list path by invoking the command behavior that uses SourcesOptions.
Create a small test double (mock/stub) for the component that performs
listing/describing (e.g., a SourcesLister/Describer interface used by the
command) and inject it into the code path invoked by the test, then call the
real entrypoint (the function that consumes SourcesOptions and triggers the
describe/list flow) and assert the mock observed whether templates and functions
were processed according to ProcessTemplates and ProcessFunctions; keep the
table-driven cases (both_on, templates_on_functions_off, etc.) and replace the
tautological assert.Equal checks on the struct fields with assertions against
the mock's recorded calls/flags to prove behavior rather than implementation.
cmd/list/stacks_test.go (1)

444-465: Consider replacing this with a behavior-driven wiring test.

This currently validates only direct struct assignment. A higher-signal test would assert these values affect downstream execution behavior.

As per coding guidelines, "Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/stacks_test.go` around lines 444 - 465, The test
TestStacksOptions_ProcessTemplatesAndFunctions currently only asserts direct
struct field assignment on StacksOptions (ProcessTemplates, ProcessFunctions)
which is tautological; replace it with a behavior-driven test that wires
StacksOptions into the actual code path that consumes those flags (e.g., the
command handler or function that executes stack processing), use dependency
injection or test doubles to observe whether template and function processing
ran (e.g., by injecting a mock processor and asserting its
ProcessTemplates/ProcessFunctions call behavior), and assert observable side
effects or interactions rather than field values; also ensure you use
errors.Is() for any error comparisons in the new test.
cmd/list/components_test.go (1)

1148-1169: Prefer behavior-level coverage over struct self-assignment checks.

This test only reasserts values set in the same literal, so it won’t catch actual wiring regressions. Consider asserting end-to-end option propagation from flags/env into execution paths instead.

As per coding guidelines, "Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/components_test.go` around lines 1148 - 1169, The test
TestComponentsOptions_ProcessTemplatesAndFunctions only reasserts fields on the
ComponentsOptions struct (ProcessTemplates/ProcessFunctions) and is
tautological; replace it with a behavior-level test that exercises the code path
which builds and consumes ComponentsOptions (e.g., invoke the CLI flag/env
parsing or the component execution function that accepts ComponentsOptions) so
you assert real option propagation: set flags or env to enable/disable
templates/functions, call the function that constructs or uses
ComponentsOptions, and then verify the resulting behavior (templates processed
vs skipped, functions processed vs skipped) for each case instead of comparing
struct fields directly.
cmd/list/metadata_test.go (1)

41-62: Consider strengthening the options test beyond struct round-trip.

TestMetadataOptions_ProcessTemplatesAndFunctions just sets two bool fields and reads them back — that's testing Go's struct semantics, not the feature. The parallel test in pkg/list/list_instances_process_test.go (new TestProcessInstancesWithDeps_PropagatesTemplateAndFunctionFlags) is the right pattern: drive the options through the actual execution path and assert the flags reach ExecuteDescribeStacks. Consider either dropping this table or replacing it with an end-to-end check that MetadataOptions.ProcessTemplates/ProcessFunctions actually flow into the downstream call.

As per coding guidelines: "Test behavior, not implementation; never test stub functions; avoid tautological tests".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/metadata_test.go` around lines 41 - 62, The current
TestMetadataOptions_ProcessTemplatesAndFunctions only verifies struct field
assignment; update it to exercise the real execution path so flags propagate:
create a test that constructs MetadataOptions with
ProcessTemplates/ProcessFunctions set, invokes the same higher-level flow used
in production (the command handler or runner that ultimately calls
ExecuteDescribeStacks), and assert that ExecuteDescribeStacks receives the
corresponding flags (use a test double/mocked ExecuteDescribeStacks to capture
its input). Specifically, replace the tautological assertions on MetadataOptions
with a call that routes options through the code path that calls
ExecuteDescribeStacks and verify the flags are observed there (refer to
MetadataOptions, ProcessTemplates, ProcessFunctions, and ExecuteDescribeStacks
to locate and wire the test).
cmd/list/instances_test.go (1)

328-353: Same tautology flag as in metadata_test.go.

TestInstancesOptions_ProcessTemplatesAndFunctions only exercises struct-field assignment. The real value-add is the companion test in pkg/list/list_instances_process_test.go (TestProcessInstancesWithDeps_PropagatesTemplateAndFunctionFlags) which actually proves the flags flow into ExecuteDescribeStacks. Consider removing this table or replacing it with an end-to-end check that InstancesOptions.ProcessTemplates/ProcessFunctions reach the downstream call site.

As per coding guidelines: "Test behavior, not implementation; never test stub functions; avoid tautological tests".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/instances_test.go` around lines 328 - 353, The test
TestInstancesOptions_ProcessTemplatesAndFunctions is tautological (only checks
struct field assignments); remove it or replace it with an end-to-end assertion
that the flag values actually propagate to the downstream call site (e.g.,
ExecuteDescribeStacks). Concretely: delete
TestInstancesOptions_ProcessTemplatesAndFunctions or rewrite it to invoke the
command path (or the function that calls ExecuteDescribeStacks), set
InstancesOptions.ProcessTemplates and ProcessFunctions, and assert the called
ExecuteDescribeStacks (or the command RunE) receives/uses those flags—use a
spy/mocked ExecuteDescribeStacks or inspect behavior in the same style as
pkg/list/list_instances_process_test.go
TestProcessInstancesWithDeps_PropagatesTemplateAndFunctionFlags to verify
propagation rather than field assignment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/fixes/2026-04-24-list-instances-per-component-auth.md`:
- Around line 145-150: Update the wording around the --process-functions flag to
reflect scope drift: find the paragraph that begins "Adding a
`--process-functions` flag to `list instances`" and change the text to state
that the flag was an "initial-fix non-goal" and that a later companion commit
added the flag, e.g., reword to "initial-fix non-goal; later companion commit
added `--process-functions` to `list instances`" so both the earlier non-goal
statement and the delivered change (documented later) are reconciled; ensure the
same clarified phrasing is applied where the flag is described again in the
later section that currently documents it as delivered.

In `@pkg/list/list_instances.go`:
- Around line 389-391: Update the stale comment that describes the default
behavior for the "list instances" implementation: change the wording to reflect
that both processTemplates and processYamlFunctions default to true, and note
that users can opt out of YAML function processing via the CLI flag
--process-functions=false; update any mention of "default shape" near the list
instances implementation (symbols: processTemplates, processYamlFunctions, the
list instances handler/function) to clearly state the current defaults and the
opt-out flag.

In `@website/docs/cli/commands/list/list-values.mdx`:
- Around line 52-56: The docs add `--process-templates` and
`--process-functions` to the list values page but the `list values` command
likely doesn't register those flags; either remove the two `<dt>/<dd>` blocks
from the docs or wire the flags into the values command by adding the same flag
registration calls used by the other list subcommands (e.g. add
WithProcessTemplatesFlag and WithProcessFunctionsFlag to the values
command/parser initialization, update cmd/list/values.go and add a unit test to
assert the flags are accepted), ensuring flag names
ProcessTemplates/ProcessFunctions appear in the values parser.

---

Outside diff comments:
In `@NOTICE`:
- Around line 1-1830: The NOTICE file was manually edited and is out-of-date;
regenerate it from the source-of-truth by running the provided generator and
commit the generated output: run ./scripts/generate-notice.sh, replace the
current NOTICE with the script's output, verify CI passes, and commit the
regenerated NOTICE (do not hand-edit the NOTICE file).

---

Nitpick comments:
In `@cmd/list/components_test.go`:
- Around line 1148-1169: The test
TestComponentsOptions_ProcessTemplatesAndFunctions only reasserts fields on the
ComponentsOptions struct (ProcessTemplates/ProcessFunctions) and is
tautological; replace it with a behavior-level test that exercises the code path
which builds and consumes ComponentsOptions (e.g., invoke the CLI flag/env
parsing or the component execution function that accepts ComponentsOptions) so
you assert real option propagation: set flags or env to enable/disable
templates/functions, call the function that constructs or uses
ComponentsOptions, and then verify the resulting behavior (templates processed
vs skipped, functions processed vs skipped) for each case instead of comparing
struct fields directly.

In `@cmd/list/instances_test.go`:
- Around line 328-353: The test
TestInstancesOptions_ProcessTemplatesAndFunctions is tautological (only checks
struct field assignments); remove it or replace it with an end-to-end assertion
that the flag values actually propagate to the downstream call site (e.g.,
ExecuteDescribeStacks). Concretely: delete
TestInstancesOptions_ProcessTemplatesAndFunctions or rewrite it to invoke the
command path (or the function that calls ExecuteDescribeStacks), set
InstancesOptions.ProcessTemplates and ProcessFunctions, and assert the called
ExecuteDescribeStacks (or the command RunE) receives/uses those flags—use a
spy/mocked ExecuteDescribeStacks or inspect behavior in the same style as
pkg/list/list_instances_process_test.go
TestProcessInstancesWithDeps_PropagatesTemplateAndFunctionFlags to verify
propagation rather than field assignment.

In `@cmd/list/metadata_test.go`:
- Around line 41-62: The current
TestMetadataOptions_ProcessTemplatesAndFunctions only verifies struct field
assignment; update it to exercise the real execution path so flags propagate:
create a test that constructs MetadataOptions with
ProcessTemplates/ProcessFunctions set, invokes the same higher-level flow used
in production (the command handler or runner that ultimately calls
ExecuteDescribeStacks), and assert that ExecuteDescribeStacks receives the
corresponding flags (use a test double/mocked ExecuteDescribeStacks to capture
its input). Specifically, replace the tautological assertions on MetadataOptions
with a call that routes options through the code path that calls
ExecuteDescribeStacks and verify the flags are observed there (refer to
MetadataOptions, ProcessTemplates, ProcessFunctions, and ExecuteDescribeStacks
to locate and wire the test).

In `@cmd/list/sources_test.go`:
- Around line 871-892: TestSourcesOptions_ProcessTemplatesAndFunctions currently
only checks that struct fields hold assigned values; change it to exercise the
downstream describe/list path by invoking the command behavior that uses
SourcesOptions. Create a small test double (mock/stub) for the component that
performs listing/describing (e.g., a SourcesLister/Describer interface used by
the command) and inject it into the code path invoked by the test, then call the
real entrypoint (the function that consumes SourcesOptions and triggers the
describe/list flow) and assert the mock observed whether templates and functions
were processed according to ProcessTemplates and ProcessFunctions; keep the
table-driven cases (both_on, templates_on_functions_off, etc.) and replace the
tautological assert.Equal checks on the struct fields with assertions against
the mock's recorded calls/flags to prove behavior rather than implementation.

In `@cmd/list/stacks_test.go`:
- Around line 444-465: The test TestStacksOptions_ProcessTemplatesAndFunctions
currently only asserts direct struct field assignment on StacksOptions
(ProcessTemplates, ProcessFunctions) which is tautological; replace it with a
behavior-driven test that wires StacksOptions into the actual code path that
consumes those flags (e.g., the command handler or function that executes stack
processing), use dependency injection or test doubles to observe whether
template and function processing ran (e.g., by injecting a mock processor and
asserting its ProcessTemplates/ProcessFunctions call behavior), and assert
observable side effects or interactions rather than field values; also ensure
you use errors.Is() for any error comparisons in the new test.

In `@pkg/list/list_instances_coverage_test.go`:
- Around line 44-59: The wrapper test currently only executes processInstances
and ignores outputs; update it to assert deterministic behavior for the new
processTemplates/processFunctions flags: call processInstances with controlled
inputs (e.g., a minimal AtmosConfiguration and explicit
processTemplates/processFunctions boolean values), then assert the returned
instances slice and/or error using errors.Is() or exact value comparisons, or
replace the test with table-driven cases that cover the meaningful combinations
of processTemplates/processFunctions and validate expected outputs; if this
wrapper truly adds no behavior beyond processInstancesWithDeps, remove the
tautological test and rely on the underlying processInstancesWithDeps tests
instead.

In `@pkg/list/list_metadata_test.go`:
- Around line 359-406: The tests
TestMetadataOptions_ProcessTemplatesAndFunctionsAllCombinations and
TestInstancesCommandOptions_ProcessTemplatesAndFunctions are tautological
because they only re-assert fields set in the test; change them to assert
behavior: construct a MetadataOptions or InstancesCommandOptions with each flag
combo, call the real processing function(s) that use those structs (e.g., the
metadata/instance processing pipeline functions that accept MetadataOptions or
InstancesCommandOptions), and assert side-effects for each flag (for example,
when ProcessTemplates is true templates are expanded/replaced and when false
they remain intact; when ProcessFunctions is true function calls are executed
and when false they are not). If needed, inject test doubles or hooks into the
processing functions to observe whether template or function handlers ran (use
DI or a small fake processor), and replace the current field-only assertions
with checks against the processed output or observed handler invocations for
each combo.
🪄 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: 1c7f95f4-6b0f-4e8e-81e0-5a2f2d2b598b

📥 Commits

Reviewing files that changed from the base of the PR and between 2013914 and adb36ba.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (35)
  • NOTICE
  • cmd/list/components.go
  • cmd/list/components_test.go
  • cmd/list/flag_wrappers.go
  • cmd/list/flag_wrappers_test.go
  • cmd/list/instances.go
  • cmd/list/instances_test.go
  • cmd/list/metadata.go
  • cmd/list/metadata_test.go
  • cmd/list/sources.go
  • cmd/list/sources_test.go
  • cmd/list/stacks.go
  • cmd/list/stacks_test.go
  • docs/fixes/2026-04-24-list-instances-per-component-auth.md
  • examples/quick-start-advanced/Dockerfile
  • go.mod
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/describe_stacks_component_processor_auth_test.go
  • pkg/ai/analyze/analyze_test.go
  • pkg/devcontainer/lifecycle_rebuild_test.go
  • pkg/list/list_instances.go
  • pkg/list/list_instances_coverage_test.go
  • pkg/list/list_instances_process_test.go
  • pkg/list/list_metadata.go
  • pkg/list/list_metadata_test.go
  • website/blog/2026-04-24-list-process-flags.mdx
  • website/docs/cli/commands/list/list-components.mdx
  • website/docs/cli/commands/list/list-instances.mdx
  • website/docs/cli/commands/list/list-metadata.mdx
  • website/docs/cli/commands/list/list-settings.mdx
  • website/docs/cli/commands/list/list-sources.mdx
  • website/docs/cli/commands/list/list-stacks.mdx
  • website/docs/cli/commands/list/list-values.mdx
  • website/docs/cli/commands/list/list-vars.mdx
  • website/src/data/roadmap.js

Comment thread docs/fixes/2026-04-24-list-instances-per-component-auth.md Outdated
Comment thread pkg/list/list_instances.go Outdated
Comment thread website/docs/cli/commands/list/list-values.mdx
@codecov

codecov Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.96%. Comparing base (012c87a) to head (96ca7dc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ternal/exec/describe_stacks_component_processor.go 93.10% 1 Missing and 1 partial ⚠️
cmd/list/components.go 96.96% 1 Missing ⚠️
cmd/list/instances.go 96.87% 1 Missing ⚠️
cmd/list/metadata.go 95.23% 1 Missing ⚠️
cmd/list/stacks.go 96.96% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2363      +/-   ##
==========================================
+ Coverage   77.64%   77.96%   +0.31%     
==========================================
  Files        1090     1090              
  Lines      102974   103072      +98     
==========================================
+ Hits        79955    80358     +403     
+ Misses      18660    18308     -352     
- Partials     4359     4406      +47     
Flag Coverage Δ
unittests 77.96% <97.00%> (+0.31%) ⬆️

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

Files with missing lines Coverage Δ
cmd/list/flag_wrappers.go 100.00% <100.00%> (ø)
cmd/list/sources.go 80.23% <100.00%> (+18.66%) ⬆️
pkg/list/list_instances.go 85.88% <100.00%> (+4.43%) ⬆️
pkg/list/list_metadata.go 82.08% <100.00%> (+17.91%) ⬆️
cmd/list/components.go 79.19% <96.96%> (+20.07%) ⬆️
cmd/list/instances.go 60.86% <96.87%> (+43.01%) ⬆️
cmd/list/metadata.go 60.29% <95.23%> (+38.62%) ⬆️
cmd/list/stacks.go 70.31% <96.96%> (+40.90%) ⬆️
...ternal/exec/describe_stacks_component_processor.go 95.93% <93.10%> (+0.60%) ⬆️

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Addresses CodeRabbit review feedback and Codecov patch coverage for
the list-flag rollout PR.

CodeRabbit feedback:
- Drop 7 tautological `*Options_ProcessTemplatesAndFunctions` tests that
  only validated struct field round-tripping (not behavior). Covered by
  the existing `TestProcessInstancesWithDeps_PropagatesTemplate…` mock
  test and the new parser-wiring tests.
- Drop the explicit coverage-theater `TestProcessInstances` wrapper
  test. Its own comment labeled it "just executing to achieve coverage"
  — exactly the pattern the guidelines forbid.
- Fix stale comment on `processInstancesWithDeps` that claimed the
  `(templates=true, functions=false)` combination was the "default
  shape" for list instances. Reworded to describe the actual CLI
  defaults (both `true`) and name `--process-functions=false` as the
  opt-out path.
- Rewrite the fix doc: drop the Non-goals section (all three items
  were intermediary ideas that either shipped later or were never the
  shape of the final fix) and fold "Companion flag work (later
  commit)" into a plain "Flag surface" section describing what
  shipped, without the temporal framing.

Codecov patch coverage:
- Extract `parseInstancesOptions` / `parseComponentsOptions` /
  `parseMetadataOptions` / `parseSourcesOptions` / `parseStacksOptions`
  from their respective RunE closures in cmd/list/*.go. Each is a pure
  `(cmd, v [, args]) → *Options` function that can be unit-tested
  without driving cobra.
- Add `cmd/list/parse_options_test.go` — 5 tests covering defaults and
  explicit flags for each parser, plus the positional-arg path for
  `parseSourcesOptions` and the tri-state `*bool` enabled/locked path
  for `parseComponentsOptions`.
- Add `cmd/list/cmd_executor_integration_test.go` — 6 integration
  tests that exercise each cmd-layer executor
  (`executeListInstancesCmd`, `listComponentsWithOptions`,
  `executeListMetadataCmd`, `executeListSources`,
  `listStacksWithOptions`) against the existing
  `tests/fixtures/scenarios/complete` fixture. Covers the full
  ProcessCommandLineArgs → InitCliConfig → createAuthManagerForList →
  list.Execute* glue path including the new
  ProcessTemplates/ProcessFunctions pass-through lines.

cmd/list package coverage: 56.6% (from a baseline where most executor
functions were 0%). Executors now range from 21% to 76%, and all five
parseOptions helpers are at 100%.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
cmd/list/cmd_executor_integration_test.go (2)

14-18: Nit: build the fixture path with filepath.Join.

The literal "../../tests/fixtures/scenarios/complete" works because go test runs from the package directory and Go stdlib accepts forward slashes on Windows for most ops, but the repo rules ask for filepath.Join over forward-slash concatenation for consistency.

♻️ Suggested change
-const completeFixturePath = "../../tests/fixtures/scenarios/complete"
+var completeFixturePath = filepath.Join("..", "..", "tests", "fixtures", "scenarios", "complete")

As per coding guidelines: "Never use forward slash concatenation … always use filepath.Join() with separate arguments."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/cmd_executor_integration_test.go` around lines 14 - 18, Replace the
hard-coded forward-slash path in the constant completeFixturePath with a
filepath.Join-based construction; update the file to import "path/filepath" and
define completeFixturePath using filepath.Join("..", "..", "tests", "fixtures",
"scenarios", "complete") (reference: completeFixturePath constant in
cmd_executor_integration_test.go).

23-30: Prefer require over manual t.Fatalf here.

Tiny style nit to match the rest of the new test code in this PR:

♻️ Suggested change
 func initExecutorTestIO(t *testing.T) {
 	t.Helper()
 	ioCtx, err := iolib.NewContext()
-	if err != nil {
-		t.Fatalf("failed to initialize I/O context: %v", err)
-	}
+	require.NoError(t, err, "failed to initialize I/O context")
 	ui.InitFormatter(ioCtx)
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/cmd_executor_integration_test.go` around lines 23 - 30, The test
helper initExecutorTestIO uses manual t.Fatalf for error handling; replace that
with the require style used elsewhere: call iolib.NewContext(), then assert no
error via require.NoError(t, err) (importing
github.com/stretchr/testify/require) and remove the t.Fatalf branch, then
continue to call ui.InitFormatter(ioCtx); this updates initExecutorTestIO,
keeping iolib.NewContext and ui.InitFormatter usage but using require.NoError
for cleaner, consistent test assertions.
cmd/list/parse_options_test.go (1)

19-29: Use the parser's own BindFlagsToViper instead of re-implementing the loop.

The hand-rolled loop here duplicates what production code (stacksParser.BindFlagsToViper(cmd, v) in cmd/list/stacks.go, same for sibling parsers) already does. If BindFlagsToViper changes semantics, these tests won't notice. Also aligns with the repo rule that commands should not touch viper.BindPFlag directly.

♻️ Suggested change
-// bindFlagsToViper mirrors the production BindPFlag loop so the parse*
-// helpers see viper values that match the cobra flag values. Returns a
-// fresh viper.Viper each call to isolate tests from global viper state.
-func bindFlagsToViper(t *testing.T, cmd *cobra.Command) *viper.Viper {
-	t.Helper()
-	v := viper.New()
-	cmd.Flags().VisitAll(func(f *pflag.Flag) {
-		require.NoError(t, v.BindPFlag(f.Name, cmd.Flags().Lookup(f.Name)))
-	})
-	return v
-}
+// bindFlagsToViper returns a fresh viper.Viper bound to `cmd`'s flags via
+// the same parser helper production uses, so the parse* helpers see the
+// real binding semantics and tests are isolated from global viper state.
+func bindFlagsToViper(t *testing.T, cmd *cobra.Command, parser *flags.StandardParser) *viper.Viper {
+	t.Helper()
+	v := viper.New()
+	require.NoError(t, parser.BindFlagsToViper(cmd, v))
+	return v
+}

Call sites would then pass the matching parser (e.g. bindFlagsToViper(t, cmd, componentsParser)), which also drops the pflag import.

As per coding guidelines: "Never use viper.BindEnv() or viper.BindPFlag() directly; commands MUST use flags.NewStandardParser() for command-specific flags."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/parse_options_test.go` around lines 19 - 29, The test helper
re-implements flag binding; change bindFlagsToViper to accept the parser
instance (e.g. componentsParser/stacksParser) and call that parser's
BindFlagsToViper(cmd, v) instead of iterating flags and calling v.BindPFlag;
keep creating a fresh v := viper.New() and return it, remove the pflag import
and update all test call sites to pass the appropriate parser to
bindFlagsToViper so tests use the parser's binding logic.
cmd/list/stacks.go (1)

160-173: Consider: early-empty-stacks short-circuit also skips tree output.

Minor behavioral note (pre-existing in this file, just highlighting since the tree path now depends on these inputs): when the initial executeAndExtractStacks returns zero stacks, we print No stacks found and return before the tree re-processing branch at Line 166–167. That's likely fine in practice because the same filters are applied again, but if a future change makes the tree path produce different selection semantics, this early return would mask it. Nothing to fix here — just flagging so the next person touching tree rendering knows.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/list/stacks.go` around lines 160 - 173, The early-return when len(stacks)
== 0 prevents the tree-specific path (opts.Format == string(format.FormatTree))
from executing, which can mask differences in tree rendering semantics; modify
the logic in the function that calls executeAndExtractStacks so that the
tree-format branch (check of opts.Format and call to renderStacksTreeFormat) is
evaluated before short-circuiting on empty stacks (or handle the empty-stacks
case inside renderStacksTreeFormat), ensuring renderStacksTreeFormat and its use
of stacksMap still run for FormatTree even when stacks is empty; refer to
opts.Format, format.FormatTree, renderStacksTreeFormat, and the len(stacks)
check to locate and adjust the code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/list/cmd_executor_integration_test.go`:
- Around line 51-75: The test TestExecuteListInstancesCmd_CoverageIntegration is
ignoring the executor result by doing `_ = err`, producing "coverage-theater";
update the test(s) that call executeListInstancesCmd (and similar
_CoverageIntegration tests) to either (A) treat the fixture as a well-formed
scenario: assert require.NoError(t, err) and capture/assert stdout (e.g., decode
the JSON output and assert a non-empty slice) while keeping InstancesOptions
(Format, ProcessTemplates, ProcessFunctions) as in the test, or (B) if the
fixture may legitimately error, mark the test with t.Skip(reason) or replace it
with a focused unit test using DI/mocks; apply the same change pattern to the
other listed tests to ensure they validate behavior instead of merely increasing
coverage.

In `@docs/fixes/2026-04-24-list-instances-per-component-auth.md`:
- Around line 329-330: Update the wording that states "hang in CI" to "fail in
CI" to match earlier descriptions of a deterministic credentials failure;
specifically edit the sentence containing "defaulting both to `true` safe;
without it, the `list instances` path would hang in CI as described in the Issue
section" so it instead reads that the `list instances` path would "fail in CI",
preserving the rest of the sentence and terminology consistency.

---

Nitpick comments:
In `@cmd/list/cmd_executor_integration_test.go`:
- Around line 14-18: Replace the hard-coded forward-slash path in the constant
completeFixturePath with a filepath.Join-based construction; update the file to
import "path/filepath" and define completeFixturePath using filepath.Join("..",
"..", "tests", "fixtures", "scenarios", "complete") (reference:
completeFixturePath constant in cmd_executor_integration_test.go).
- Around line 23-30: The test helper initExecutorTestIO uses manual t.Fatalf for
error handling; replace that with the require style used elsewhere: call
iolib.NewContext(), then assert no error via require.NoError(t, err) (importing
github.com/stretchr/testify/require) and remove the t.Fatalf branch, then
continue to call ui.InitFormatter(ioCtx); this updates initExecutorTestIO,
keeping iolib.NewContext and ui.InitFormatter usage but using require.NoError
for cleaner, consistent test assertions.

In `@cmd/list/parse_options_test.go`:
- Around line 19-29: The test helper re-implements flag binding; change
bindFlagsToViper to accept the parser instance (e.g.
componentsParser/stacksParser) and call that parser's BindFlagsToViper(cmd, v)
instead of iterating flags and calling v.BindPFlag; keep creating a fresh v :=
viper.New() and return it, remove the pflag import and update all test call
sites to pass the appropriate parser to bindFlagsToViper so tests use the
parser's binding logic.

In `@cmd/list/stacks.go`:
- Around line 160-173: The early-return when len(stacks) == 0 prevents the
tree-specific path (opts.Format == string(format.FormatTree)) from executing,
which can mask differences in tree rendering semantics; modify the logic in the
function that calls executeAndExtractStacks so that the tree-format branch
(check of opts.Format and call to renderStacksTreeFormat) is evaluated before
short-circuiting on empty stacks (or handle the empty-stacks case inside
renderStacksTreeFormat), ensuring renderStacksTreeFormat and its use of
stacksMap still run for FormatTree even when stacks is empty; refer to
opts.Format, format.FormatTree, renderStacksTreeFormat, and the len(stacks)
check to locate and adjust the code.
🪄 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: 2f4fa119-c831-4345-80c0-0dd1228cd3a6

📥 Commits

Reviewing files that changed from the base of the PR and between b2a8720 and 2d1a2d6.

📒 Files selected for processing (16)
  • cmd/list/cmd_executor_integration_test.go
  • cmd/list/components.go
  • cmd/list/components_test.go
  • cmd/list/instances.go
  • cmd/list/instances_test.go
  • cmd/list/metadata.go
  • cmd/list/metadata_test.go
  • cmd/list/parse_options_test.go
  • cmd/list/sources.go
  • cmd/list/sources_test.go
  • cmd/list/stacks.go
  • cmd/list/stacks_test.go
  • docs/fixes/2026-04-24-list-instances-per-component-auth.md
  • pkg/list/list_instances.go
  • pkg/list/list_instances_coverage_test.go
  • pkg/list/list_metadata_test.go
💤 Files with no reviewable changes (1)
  • pkg/list/list_instances_coverage_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/list/list_instances.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • cmd/list/sources_test.go
  • cmd/list/metadata_test.go
  • pkg/list/list_metadata_test.go
  • cmd/list/components_test.go
  • cmd/list/instances.go

Comment thread cmd/list/cmd_executor_integration_test.go
Comment thread docs/fixes/2026-04-24-list-instances-per-component-auth.md Outdated
Addresses the latest round of CodeRabbit feedback plus Codecov patch
coverage:

CodeRabbit feedback:
- Integration tests in cmd/list/cmd_executor_integration_test.go used
  `_ = err` which was coverage theater — they passed regardless of
  what the executor returned. Tightened all 5 to `require.NoError`
  with messages describing the expected behavior. Wiring had to
  change to match: register the global flags builder on the test cmd
  (so ProcessCommandLineArgs can read `base-path`/`config`/etc.) and
  init `data.InitWriter` in the test I/O setup.
- `parse_options_test.go`: replaced the hand-rolled `v.BindPFlag`
  loop with `parser.BindFlagsToViper(cmd, v)` — the same helper
  production RunE closures use. Tests now exercise the real binding
  semantics and don't touch `viper.BindPFlag` directly (CLAUDE.md
  forbids that outside pkg/flags).
- Fix doc + blog: reworded "hang in CI" / "hang on missing AWS
  credentials" to the actual failure mode users see
  (`No valid credential sources found`), consistent with the Issue
  section.

Codecov patch coverage — new tests to hit previously-0% branches:
- `cmd/list/cmd_executor_integration_test.go`:
  `TestListStacksWithOptions_TreeFormat`,
  `TestListStacksWithOptions_TreeFormatWithProvenance`,
  `TestExecuteListInstancesCmd_TreeFormat`,
  `TestExecuteListInstancesCmd_MatrixFormat`.
- `pkg/list/list_metadata_test.go`:
  `TestExecuteListMetadataCmd` (happy path with the `complete`
  fixture) and `TestExecuteListMetadataCmd_InvalidConfig` (error
  path). Mirrors the existing `TestExecuteListInstancesCmd` pattern.
- `pkg/list/list_instances_coverage_test.go`:
  `TestExecuteListInstancesCmd_TreeFormat` and
  `TestExecuteListInstancesCmd_TreeFormatRejectsUpload`.

Coverage jumps (per function):
  renderStacksTreeFormat       0%   → 86.7%
  resolveAndFilterImportTrees  0%   → 84.6%
  pkg ExecuteListMetadataCmd   0%   → 73.9%
  pkg ExecuteListInstancesCmd  51.6% → 68.8%
  cmd executeListInstancesCmd  35.7% → 78.6%
  cmd executeListMetadataCmd   23.1% → 76.9%
  cmd listStacksWithOptions    37.5% → 75.0%
  cmd/list package total       56.6% → 63.9%

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
pkg/list/list_metadata_test.go (2)

372-372: Use filepath.Join for cross-platform fixture paths.

Coding guidelines prohibit forward-slash-concatenated path literals in tests (tempDir + "/components/...") and hardcoded Unix paths in favor of filepath.Join. Both the fixture path and the sentinel "invalid" path are better expressed portably.

♻️ Proposed diff
-	fixturePath := "../../tests/fixtures/scenarios/complete"
+	fixturePath := filepath.Join("..", "..", "tests", "fixtures", "scenarios", "complete")
 	tests.RequireFilePath(t, fixturePath, "test fixture directory")
-	info := &schema.ConfigAndStacksInfo{
-		BasePath: "/nonexistent/path",
-	}
+	info := &schema.ConfigAndStacksInfo{
+		BasePath: filepath.Join(t.TempDir(), "does-not-exist"),
+	}

(requires adding "path/filepath" to the import block.)

As per coding guidelines: "Never use forward slash concatenation ...; always use filepath.Join()" and "Never hardcode Unix paths ... in tests".

Also applies to: 397-397

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/list/list_metadata_test.go` at line 372, Replace hardcoded forward-slash
fixture paths with filepath.Join for portability: import "path/filepath" in the
test file and change the fixturePath variable (currently set to
"../../tests/fixtures/scenarios/complete") to use filepath.Join(...) and
likewise replace the sentinel "invalid" path literal referenced nearby (line
with "invalid") to use filepath.Join segments; update any other test path
literals in the same test (e.g., the one at the later mention) to use
filepath.Join to satisfy the coding guideline.

400-403: Assert the specific error with errors.Is.

The current require.Error only proves some error bubbled up — a future regression that swallows the config-init error and surfaces a render-time error instead would still pass. Pin it to the init-config sentinel (e.g., errUtils.ErrInvalidConfig or whatever InitCliConfig returns on invalid BasePath) so the test fails loudly on behavior drift.

As per coding guidelines: "Test behavior, not implementation; ... use errors.Is() for error checking".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/list/list_metadata_test.go` around lines 400 - 403, Replace the loose
require.Error check with an assertion that the returned error matches the
specific sentinel from InitCliConfig using errors.Is; locate the call to
ExecuteListMetadataCmd and change the expectation to assert errors.Is(err,
errUtils.ErrInvalidConfig) (or the exact sentinel value returned by
InitCliConfig), importing the standard errors package and referencing errUtils
(or the package that defines the sentinel) so the test fails only when the
init-config sentinel is returned rather than any render-time error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/list/list_metadata_test.go`:
- Line 372: Replace hardcoded forward-slash fixture paths with filepath.Join for
portability: import "path/filepath" in the test file and change the fixturePath
variable (currently set to "../../tests/fixtures/scenarios/complete") to use
filepath.Join(...) and likewise replace the sentinel "invalid" path literal
referenced nearby (line with "invalid") to use filepath.Join segments; update
any other test path literals in the same test (e.g., the one at the later
mention) to use filepath.Join to satisfy the coding guideline.
- Around line 400-403: Replace the loose require.Error check with an assertion
that the returned error matches the specific sentinel from InitCliConfig using
errors.Is; locate the call to ExecuteListMetadataCmd and change the expectation
to assert errors.Is(err, errUtils.ErrInvalidConfig) (or the exact sentinel value
returned by InitCliConfig), importing the standard errors package and
referencing errUtils (or the package that defines the sentinel) so the test
fails only when the init-config sentinel is returned rather than any render-time
error.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 11eaf63e-1620-4f82-9681-09d1098a0e6b

📥 Commits

Reviewing files that changed from the base of the PR and between 2d1a2d6 and e95e691.

📒 Files selected for processing (7)
  • cmd/list/cmd_executor_integration_test.go
  • cmd/list/instances_test.go
  • cmd/list/parse_options_test.go
  • docs/fixes/2026-04-24-list-instances-per-component-auth.md
  • pkg/list/list_instances_coverage_test.go
  • pkg/list/list_metadata_test.go
  • website/blog/2026-04-24-list-process-flags.mdx
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/list/list_instances_coverage_test.go
  • cmd/list/cmd_executor_integration_test.go

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 24, 2026
…s order-independent

The test was failing on macOS CI while passing on Linux/Windows. Root
cause: the `tests/fixtures/scenarios/invalid-stacks/` fixture contains
several invalid YAML files with different error shapes (invalid
template syntax in import paths, missing imports, malformed schemas,
…). Filesystem walk order differs across OSes — on Linux/Windows the
test happened to hit a file whose error contained "invalid", on macOS
it hit `invalid-template-import-path.yaml` first and got
`function "unclosed" not defined`, no "invalid" substring.

The fixture file `invalid-template-import-path.yaml` was added in
PR #2173 (now in main); my branch's test was relying on file walk
order that no longer holds.

Replace the brittle `assert.ErrorContains(t, err, "invalid")` with a
multi-pattern check that accepts any of the documented error messages
the fixture's invalid files can surface. Test still asserts an error
is returned (`require.Error`); the substring check now tolerates the
full set of error shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal/exec/terraform_test.go (1)

360-377: Nice de-flake — sensible multi-pattern fallback.

The require.Error plus lowercased OR-of-substrings approach is a clean way to absorb OS-dependent walk order without dropping the assertion entirely. The inline comment explaining why the brittleness existed is also a helpful breadcrumb for the next person who touches this.

One small thought you can take or leave: "function" and "template" are pretty broad fragments and would match a lot of unrelated future errors, so this assertion is closer to "we got some error" than "we got an invalid-stacks error." If you want a touch more signal without re-introducing brittleness, narrowing to the more specific phrases (e.g. "invalid template", "unclosed", "no matches found", "function \"") would still tolerate the documented variants while catching accidental error-shape drift. Totally optional given require.Error already guards the main contract.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/exec/terraform_test.go` around lines 360 - 377, The current test
accepts very broad substrings ("function" and "template") in the errMsg check,
which weakens the assertion; update the assertion in terraform_test.go (the
require.Error/err, errMsg := strings.ToLower(err.Error()) block and the
assert.True call) to look for narrower phrases that still cover documented
variants — e.g. check for "invalid template" instead of "template" and for
'function "' (function followed by a quote) instead of bare "function", while
keeping the existing "unclosed" and "no matches found" alternatives so the
assertion remains tolerant of OS-dependent walk order.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@internal/exec/terraform_test.go`:
- Around line 360-377: The current test accepts very broad substrings
("function" and "template") in the errMsg check, which weakens the assertion;
update the assertion in terraform_test.go (the require.Error/err, errMsg :=
strings.ToLower(err.Error()) block and the assert.True call) to look for
narrower phrases that still cover documented variants — e.g. check for "invalid
template" instead of "template" and for 'function "' (function followed by a
quote) instead of bare "function", while keeping the existing "unclosed" and "no
matches found" alternatives so the assertion remains tolerant of OS-dependent
walk order.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8e7c60fa-c50e-4da6-a939-7e177d48feea

📥 Commits

Reviewing files that changed from the base of the PR and between e95e691 and 98c8429.

📒 Files selected for processing (1)
  • internal/exec/terraform_test.go

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 25, 2026
Addresses two CodeRabbit comments on the new pkg-level metadata
executor tests:

1. Replace forward-slash literal fixture path
   `"../../tests/fixtures/scenarios/complete"` with
   `filepath.Join(...)`, and replace the hardcoded Unix path
   `"/nonexistent/path"` with `filepath.Join(t.TempDir(),
   "does-not-exist")` for cross-platform portability and to avoid
   collisions with any real path. Per CLAUDE.md: "Never use forward
   slash concatenation; always use filepath.Join()" and "Never
   hardcode Unix paths in tests".
2. Tighten `TestExecuteListMetadataCmd_InvalidConfig` to assert
   `errors.Is(err, errUtils.ErrFailedToInitConfig)` instead of
   `require.Error` only, so a future regression that swallows the
   init-config error and surfaces a render-time error instead would
   fail loudly. Per CLAUDE.md: "use errors.Is() for error checking".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aknysh
Andriy Knysh (aknysh) merged commit 9536254 into main Apr 27, 2026
61 checks passed
@atmos-pro

atmos-pro Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@aknysh
Andriy Knysh (aknysh) deleted the aknysh/update-upload-instances branch April 27, 2026 17:16
@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Apr 27, 2026
@atmos-pro

atmos-pro Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@github-actions

Copy link
Copy Markdown

Warning

Release Documentation Required

This PR is labeled minor or major and requires documentation updates:

  • Changelog entry - Add a blog post in website/blog/YYYY-MM-DD-feature-name.mdx
  • Roadmap update - Update website/src/data/roadmap.js with the new milestone

Alternatively: If this change doesn't require release documentation, remove the minor or major label.

@github-actions

Copy link
Copy Markdown

These changes were released in v1.217.0-rc.2.

This branch was successfully deployed

1 active deployment
preview — 96ca7dc9 Deployed Apr 25, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New features that do not break anything size/l Large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants