Skip to content

feat: dependency-closure selection (--include-dependencies/--include-dependents) + scope --labels/--tags evaluation before filtering - #2807

Merged
Andriy Knysh (aknysh) merged 50 commits into
mainfrom
osterman/cross-stack-dag-closure
Aug 1, 2026
Merged

Andriy Knysh (aknysh) merged 50 commits into
mainfrom
osterman/cross-stack-dag-closure

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

what

Dependency-closure selection (new)

  • Every multi-component terraform selection (--all, --components, --query, -s, --tags, --labels, --affected) accepts two new depth-carrying flags on plan/apply/deploy/destroy/init:
    • --include-dependencies[=N] — also process everything the selection depends on (its prerequisites), N levels deep (bare flag = unlimited).
    • --include-dependents[=N] — the reverse direction. Previously a bool wired only into --affected; now works with every selection and accepts a depth (true/false remain accepted for compatibility).
  • Selectors choose the seed; closure flags expand it: closure members execute even when they don't match the selectors that seeded them, in dependency order (reversed for destroy), with cross-stack edges followed. destroy --include-dependencies warns that it also destroys shared prerequisites.
  • The same flags on atmos list components/stacks/instances preview the exact execution set a bulk run would touch.
  • Depth support in the graph engine: pkg/dependency.Filter gains per-direction depth bounds with a best-depth BFS; the scheduler adapter is restructured to seed-then-expand (tags/labels/query moved from post-filter to seed narrowing, per-node query skip suppressed when the seed already applied it).
  • The three-phase scoped evaluation built for list dependencies is generalized into dependencies.ResolveScopedClosure and shared with the terraform bulk paths, so closure runs fully evaluate only the stacks the closure touches.

Selector purity (new, by design)

  • metadata.tags/metadata.labels are selectors evaluated before auth/templating/YAML functions, so their values must be resolvable without authentication or process execution. Values using !terraform.state, !terraform.output, !store, !store.get, !secret, !aws.*, !emulator, !exec, !random, or template calls to atmos.Component/atmos.Store/atmos.GomplateDatasource/datasources are rejected with a by-design error and migration hint on any command that processes the manifest. Plain strings, simple templates, and local functions (!env, !git.*, !include) remain allowed.
  • Validation parses template actions with the configured delimiters (templates.settings.delimiters) via Go's template parser — no regex heuristics — and tags.SelectorUnresolved is now delimiter-aware too.

Scope-before-evaluate for --labels/--tags (original scope)

  • Early-skip scope check in the shared describe-stacks processor: a component excluded by --tags/--labels skips auth/template/YAML-function evaluation entirely, generalizing the existing -s/--stack early-skip. Now also threaded into list stacks/components/instances (previously they row-filtered after full evaluation).
  • atmos list dependencies computes a lightweight dependency graph, derives the reachable closure, and only fully evaluates the stacks that closure touches — re-converging against the resolved graph so templated same-stack dependency targets still resolve.
  • describe.settings.eager_evaluation remains the rollback switch forcing the old full-evaluation behavior.

Tests and docs

  • Unit tests across pkg/tags (purity + delimiter cases), pkg/dependency (depth/cycles/diamonds), pkg/scheduler/adapters (closure retains non-matching prereqs, destroy ordering, query suppression, depth merging), pkg/list/dependencies (scoped-evaluation convergence with a poisoned unrelated stack), and the list/cmd layers; regenerated help-text golden snapshots.
  • Docusaurus docs for all new flags (terraform + list commands), a Selector Purity section in the stack metadata docs, a changelog blog post (website/blog/2026-07-27-include-dependencies-closure.mdx), and a roadmap entry.

why

  • On a monorepo spanning multiple AWS accounts, atmos terraform ... --all --labels=.../--tags=... and atmos list dependencies --stack <stack> fully evaluated every stack in the repo (templates, YAML functions, auth/backend) before consulting the selector, so an unrelated account's unreachable backend failed the command.
  • Deploying "a stack and everything it needs" (or tearing down "a component and everything that depends on it") required hand-maintained bash wrappers around Atmos, even though the dependency graph and topological scheduler already existed — the selection just never followed the edges.
  • Making tags/labels drive scoping decisions before evaluation requires them to be cheaply resolvable; the purity contract makes that explicit design rather than a silent perf cliff.

references

  • Builds on docs/fixes/2026-06-22-describe-stacks-scope-and-cache-per-component-auth.md.
  • See docs/fixes/2026-07-25-scope-before-evaluate-labels-tags-list-dependencies.md for root-cause and verification detail of the scope-before-evaluate work (its Recommendations section is implemented by this PR's closure flags).

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added dependency and dependent expansion with optional depth limits and cross-stack relationships.
    • Added dependency-closure previews for component, stack, and instance selections.
    • Added tag and label filtering across list commands, including vendor tags.
    • Added levels output for shortest dependency distances.
    • Label filters now support key=value and key:value formats.
  • Improvements

    • Scoped evaluation skips unrelated components for filtered selections.
    • Added eager-evaluation controls for bulk selections.
    • Added clearer validation and warnings for unsupported flag combinations and dependency expansion during destroy operations.
    • Expanded CLI documentation and help text for new filtering and dependency options.

…ltering

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.
@atmos-pro

atmos-pro Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

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

@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds tag and label filters, depth-limited dependency closure, scoped evaluation, selector validation, and levels dependency rendering. It integrates these features with list and Terraform commands, extraction APIs, graph traversal, tests, fixtures, and documentation.

Changes

Scoped selection and dependency closure

Layer / File(s) Summary
Selector validation and closure engine
pkg/tags/*, pkg/dependency/*, pkg/list/dependencies/*, pkg/schema/schema.go
Selectors support safe template resolution, purity validation, custom delimiters, eager evaluation, and directional closure traversal with depth limits.
List and Terraform integration
cmd/list/*, pkg/list/list_*.go, cmd/terraform/*, internal/exec/*, pkg/scheduler/adapters/terraform.go
List and Terraform commands accept tag, label, and closure options. Scoped evaluation and closure membership control selection and execution.
Rendering, extraction, and validation
pkg/list/dependencies/render.go, pkg/list/extract/*, pkg/list/filter/*, tests
Dependency output adds levels. Extraction exposes metadata tags and labels. Tests cover filtering, closure boundaries, parsing, and error propagation.
Supporting behavior and documentation
website/docs/..., website/blog/..., docs/fixes/..., fixtures, snapshots
Documentation and CLI output describe label syntax, selector purity, closure depth, scoped evaluation, cross-stack expansion, and destroy warnings.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested reviewers: aknysh

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes do not implement custom Helmfile component support requested by issue #39. Add or link implementation and tests for custom Helmfile component support, or update the linked issue to match the PR objectives.
Out of Scope Changes check ⚠️ Warning Most changes address dependency closure and selector evaluation rather than custom Helmfile component support in issue #39. Remove unrelated dependency-closure and selector changes, or link issues that explicitly cover those objectives.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.97% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the PR's primary dependency-closure and scope-before-evaluation changes.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch osterman/cross-stack-dag-closure

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

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

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

346-384: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Parameter list keeps growing on executeDescribeStacks.

This internal function is now up to ~17 positional parameters, with several adjacent bools (authDisabled, useMocks, resolveSecrets) plus the two new filters. A transposition at any call site (e.g. swapping authDisabled/useMocks) would compile silently and misbehave at runtime.

As per coding guidelines, **/*.go: "Use the functional options pattern for configuration instead of functions with many parameters." Consider introducing an options struct (or functional options) for executeDescribeStacks before more flags accumulate here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/exec/describe_stacks.go` around lines 346 - 384, Refactor
executeDescribeStacks to accept a dedicated options struct or functional options
instead of its growing positional argument list, especially the adjacent
authDisabled, useMocks, and resolveSecrets flags and the filters. Update every
call site to use named configuration fields/options while preserving all
existing behavior and values.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@docs/fixes/2026-07-25-scope-before-evaluate-labels-tags-list-dependencies.md`:
- Around line 84-85: The documented eager-evaluation setting path is incorrect.
Replace settings.describe.settings.eager_evaluation with
describe.settings.eager_evaluation in
docs/fixes/2026-07-25-scope-before-evaluate-labels-tags-list-dependencies.md at
lines 84-85 and 146-150, and update the corresponding helper comment in
internal/exec/describe_stacks_component_processor.go lines 724-727 and test
comment in internal/exec/describe_stacks_component_processor_scope_test.go lines
318-322; no behavioral code changes are needed.

In `@pkg/list/dependencies/closure.go`:
- Around line 48-69: Update StackNames to sort the deduplicated names slice
before returning it, preserving the existing nil handling and deduplication
behavior so results are deterministic as documented.

In `@tests/fixtures/scenarios/dependencies-scoped-evaluation/atmos.yaml`:
- Around line 12-17: Update the terraform base_path in the scenario fixture to
point to the local component root under components/terraform when directory
validation is part of the scenario; otherwise preserve the existing path and
document that it intentionally scopes dependency evaluation outside this
fixture.

---

Nitpick comments:
In `@internal/exec/describe_stacks.go`:
- Around line 346-384: Refactor executeDescribeStacks to accept a dedicated
options struct or functional options instead of its growing positional argument
list, especially the adjacent authDisabled, useMocks, and resolveSecrets flags
and the filters. Update every call site to use named configuration
fields/options while preserving all existing behavior and values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ddbfc95-a5fb-43bd-a474-29f69de3540c

📥 Commits

Reviewing files that changed from the base of the PR and between 1b965ac and 62a35aa.

📒 Files selected for processing (17)
  • cmd/list/dependencies.go
  • cmd/list/dependencies_scoped_test.go
  • docs/fixes/2026-07-25-scope-before-evaluate-labels-tags-list-dependencies.md
  • internal/exec/describe_stacks.go
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/describe_stacks_component_processor_scope_test.go
  • internal/exec/filter_utils.go
  • internal/exec/terraform_all.go
  • internal/exec/terraform_query.go
  • internal/exec/terraform_utils_test.go
  • pkg/list/dependencies/closure.go
  • pkg/list/dependencies/closure_test.go
  • pkg/schema/schema.go
  • tests/fixtures/scenarios/dependencies-scoped-evaluation/atmos.yaml
  • tests/fixtures/scenarios/dependencies-scoped-evaluation/components/terraform/mock/main.tf
  • tests/fixtures/scenarios/dependencies-scoped-evaluation/stacks/deploy/app-a.yaml
  • tests/fixtures/scenarios/dependencies-scoped-evaluation/stacks/deploy/app-b.yaml

Comment thread pkg/list/dependencies/closure.go Resolved
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.
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`.
@codecov

codecov Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.10393% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.11%. Comparing base (00784e4) to head (daf97c1).

Files with missing lines Patch % Lines
pkg/list/dependencies/scope.go 95.77% 3 Missing and 3 partials ⚠️
pkg/tags/selector.go 97.36% 3 Missing and 3 partials ⚠️
pkg/list/list_instances.go 96.58% 2 Missing and 2 partials ⚠️
pkg/scheduler/adapters/terraform.go 94.73% 2 Missing and 2 partials ⚠️
cmd/list/stacks.go 96.38% 2 Missing and 1 partial ⚠️
cmd/list/components.go 96.29% 1 Missing and 1 partial ⚠️
pkg/list/dependencies/render.go 97.43% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2807      +/-   ##
==========================================
+ Coverage   81.95%   82.11%   +0.15%     
==========================================
  Files        1798     1802       +4     
  Lines      173942   175133    +1191     
==========================================
+ Hits       142555   143803    +1248     
+ Misses      23624    23566      -58     
- Partials     7763     7764       +1     
Flag Coverage Δ
unittests 82.11% <98.10%> (+0.15%) ⬆️

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

Files with missing lines Coverage Δ
cmd/container/verbs.go 88.40% <100.00%> (ø)
cmd/helm/helm.go 94.41% <100.00%> (ø)
cmd/kubernetes/kubernetes.go 93.50% <100.00%> (ø)
cmd/list/dependencies.go 91.11% <100.00%> (+24.03%) ⬆️
cmd/list/flag_wrappers.go 100.00% <100.00%> (ø)
cmd/list/instances.go 71.42% <100.00%> (+7.07%) ⬆️
cmd/list/metadata.go 64.93% <100.00%> (+2.96%) ⬆️
cmd/list/sources.go 83.75% <100.00%> (+1.97%) ⬆️
cmd/list/vendor.go 49.27% <100.00%> (+7.48%) ⬆️
cmd/terraform/flags.go 100.00% <100.00%> (ø)
... and 32 more

... and 10 files with indirect coverage changes

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

…cept ':' 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]>
@mergify

mergify Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label Jul 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

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

⚠️ Outside diff range comments (1)
cmd/list/sources.go (1)

196-228: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Apply selectors before describe-stack evaluation.

This calls executeDescribeStacksForSources with nil selectors, then filters at line 228. Sources excluded by --tags/--labels still run template/YAML-function evaluation and can trigger unnecessary authentication or failures, which defeats this PR’s scoped-evaluation goal. Propagate these selectors into the describe path before evaluation.

🤖 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/list/sources.go` around lines 196 - 228, Update fetchAndFilterSources to
pass the requested component, tags, and parsed labels into
executeDescribeStacksForSources instead of supplying nil selectors. Ensure these
selectors are applied during describe-stack evaluation, while retaining the
final source filtering for the returned results.
🧹 Nitpick comments (3)
cmd/list/stacks.go (1)

262-286: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Validate --labels before, not after, the expensive evaluation pass. Both sites parse the raw --labels string only after running the full (potentially template/YAML-function-heavy) evaluation, so bad input pays the full cost before failing — at odds with this PR's own goal of scoping work before evaluation.

  • cmd/list/stacks.go#L262-L286: move the tags.ParseLabelsFlag(opts.LabelsRaw) call (and its error return) above the e.ExecuteDescribeStacksWithOptions(...) call in executeAndExtractStacks.
  • pkg/list/list_instances.go#L802-L836: validate opts.LabelsRaw via tags.ParseLabelsFlag before calling processInstances, instead of only inside buildInstanceFilters after the fact.
🤖 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/list/stacks.go` around lines 262 - 286, Validate opts.LabelsRaw before
expensive evaluation in executeAndExtractStacks by moving tags.ParseLabelsFlag
and its error return ahead of ExecuteDescribeStacksWithOptions. Also update
pkg/list/list_instances.go lines 802-836 to parse and validate opts.LabelsRaw
before processInstances; reuse the validated labels in buildInstanceFilters
rather than deferring validation there.
cmd/list/vendor_test.go (2)

106-112: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Exercise actual flag parsing.

The test only checks the command’s local flag set; it does not prove that executing the vendor parser rejects --labels. Assert the real parsing path returns an unknown-flag error, while retaining the positive --tags registration check.

As per coding guidelines, tests should verify behavior rather than implementation details.

🤖 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/list/vendor_test.go` around lines 106 - 112, Update
TestVendorCmd_LabelsFlagNotRegistered to execute the vendor command’s actual
argument-parsing path with --labels and assert it returns an unknown-flag error.
Retain the positive assertion that --tags is accepted or registered, but remove
the direct vendorCmd.Flags().Lookup("labels") implementation-detail check.

Source: Coding guidelines


67-104: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover filter behavior with table-driven cases.

These hand-written subtests do not verify multi-tag “matches any” behavior or the actual intersection of stack and tag filters; the stack-plus-tags case only checks the filter count. Refactor into table-driven cases and include multiple requested tags plus matching/nonmatching stack rows.

As per coding guidelines, Go tests should use table-driven scenarios and verify behavior rather than only construction.

🤖 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/list/vendor_test.go` around lines 67 - 104, The
TestBuildVendorFilters_Tags tests should be refactored into table-driven
scenarios that exercise behavior rather than only filter construction. Add cases
covering no filters, multiple requested tags with “matches any” semantics,
tags-only matching and nonmatching rows, and combined stack glob plus tags using
rows that both match and fail the intersection; assert the resulting components
or row counts for each case.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/list/parse_options_test.go`:
- Around line 256-264: Extend the existing “tags_flag” test or add a nearby case
to set the dependencies command’s “labels” flag to “team:platform” and assert
that parseDependenciesOptions populates opts.LabelsRaw with the expected value,
while preserving the current tags assertion.

In `@cmd/list/sources_test.go`:
- Around line 781-806: The filterSourcesByTagsLabels tests should verify exact
returned entries and distinguish matching semantics. Strengthen “no filters is
passthrough” by asserting all expected sources, add multi-tag coverage for
any-match behavior, and add multi-label coverage requiring all labels to match;
retain assertions that returned components identify the correct rows.

In `@cmd/list/sources.go`:
- Around line 215-218: Update the error branch after tags.ParseLabelsFlag in the
list command to wrap the parsing error with the existing
invalid-flag/list-command static error while retaining err as the cause. Reuse
the repository’s established error-wrapping convention and leave successful
label parsing unchanged.

In `@cmd/list/vendor_test.go`:
- Around line 99-102: Replace the non-fatal assert.True and assert.Len checks
for filtered in the vendor test with require.True and require.Len, ensuring both
preconditions complete before indexing filtered[0]. Keep the existing validation
of the component value unchanged.

In `@pkg/list/list_instances_test.go`:
- Around line 76-101: Extend TestBuildInstanceFilters_FiltersRows in
pkg/list/list_instances_test.go (lines 76-101) with multi-tag and multi-label
rows and selectors that verify tag any-match, label all-match, and their
same-row intersection; retain only rows satisfying both combined filters. Add
equivalent multi-value selector coverage to the metadata row tests in
pkg/list/list_metadata_test.go (lines 353-375), targeting the relevant metadata
filter test and asserting behavior rather than implementation details.

---

Outside diff comments:
In `@cmd/list/sources.go`:
- Around line 196-228: Update fetchAndFilterSources to pass the requested
component, tags, and parsed labels into executeDescribeStacksForSources instead
of supplying nil selectors. Ensure these selectors are applied during
describe-stack evaluation, while retaining the final source filtering for the
returned results.

---

Nitpick comments:
In `@cmd/list/stacks.go`:
- Around line 262-286: Validate opts.LabelsRaw before expensive evaluation in
executeAndExtractStacks by moving tags.ParseLabelsFlag and its error return
ahead of ExecuteDescribeStacksWithOptions. Also update
pkg/list/list_instances.go lines 802-836 to parse and validate opts.LabelsRaw
before processInstances; reuse the validated labels in buildInstanceFilters
rather than deferring validation there.

In `@cmd/list/vendor_test.go`:
- Around line 106-112: Update TestVendorCmd_LabelsFlagNotRegistered to execute
the vendor command’s actual argument-parsing path with --labels and assert it
returns an unknown-flag error. Retain the positive assertion that --tags is
accepted or registered, but remove the direct vendorCmd.Flags().Lookup("labels")
implementation-detail check.
- Around line 67-104: The TestBuildVendorFilters_Tags tests should be refactored
into table-driven scenarios that exercise behavior rather than only filter
construction. Add cases covering no filters, multiple requested tags with
“matches any” semantics, tags-only matching and nonmatching rows, and combined
stack glob plus tags using rows that both match and fail the intersection;
assert the resulting components or row counts for each case.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 20c38a68-c611-42d6-8c82-341031ba7942

📥 Commits

Reviewing files that changed from the base of the PR and between 7ff2e26 and 669fd64.

📒 Files selected for processing (59)
  • cmd/container/verbs.go
  • cmd/helm/helm.go
  • cmd/kubernetes/kubernetes.go
  • cmd/list/dependencies.go
  • cmd/list/flag_wrappers.go
  • cmd/list/instances.go
  • cmd/list/instances_test.go
  • cmd/list/metadata.go
  • cmd/list/parse_options_test.go
  • cmd/list/sources.go
  • cmd/list/sources_test.go
  • cmd/list/stacks.go
  • cmd/list/vendor.go
  • cmd/list/vendor_test.go
  • cmd/terraform/flags.go
  • pkg/list/dependencies/closure.go
  • pkg/list/dependencies/closure_test.go
  • pkg/list/dependencies/render.go
  • pkg/list/dependencies/render_test.go
  • pkg/list/extract/components.go
  • pkg/list/extract/metadata.go
  • pkg/list/extract/metadata_test.go
  • pkg/list/extract/stacks.go
  • pkg/list/extract/stacks_test.go
  • pkg/list/extract/vendor.go
  • pkg/list/extract/vendor_test.go
  • pkg/list/list_instances.go
  • pkg/list/list_instances_coverage_test.go
  • pkg/list/list_instances_test.go
  • pkg/list/list_metadata.go
  • pkg/list/list_metadata_test.go
  • pkg/tags/flags.go
  • pkg/tags/flags_test.go
  • website/docs/cli/commands/container/usage.mdx
  • website/docs/cli/commands/helm/helm-apply.mdx
  • website/docs/cli/commands/helm/helm-delete.mdx
  • website/docs/cli/commands/helm/helm-deploy.mdx
  • website/docs/cli/commands/helm/helm-diff.mdx
  • website/docs/cli/commands/helm/helm-plan.mdx
  • website/docs/cli/commands/helm/helm-template.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-apply.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-delete.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-deploy.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-diff.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-plan.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-render.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-validate.mdx
  • website/docs/cli/commands/kubernetes/usage.mdx
  • website/docs/cli/commands/list/list-components.mdx
  • website/docs/cli/commands/list/list-dependencies.mdx
  • website/docs/cli/commands/list/list-instances.mdx
  • website/docs/cli/commands/list/list-metadata.mdx
  • website/docs/cli/commands/list/list-sources.mdx
  • website/docs/cli/commands/list/list-stacks.mdx
  • website/docs/cli/commands/list/list-vendor.mdx
  • website/docs/cli/commands/terraform/terraform-apply.mdx
  • website/docs/cli/commands/terraform/terraform-deploy.mdx
  • website/docs/cli/commands/terraform/terraform-plan.mdx
  • website/docs/cli/commands/terraform/usage.mdx
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/list/dependencies/closure_test.go
  • cmd/list/dependencies.go

Comment thread cmd/list/parse_options_test.go Resolved
Comment thread cmd/list/sources_test.go Resolved
Comment thread cmd/list/sources.go Resolved
Comment thread cmd/list/vendor_test.go Resolved
Comment thread pkg/list/list_instances_test.go Resolved
- 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]>
…dag-closure

# Conflicts:
#	cmd/list/dependencies.go
#	cmd/list/instances.go
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]>
atmos-pro Bot and others added 4 commits July 31, 2026 14:36
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]>
…nitization

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]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@tests/cli_test.go`:
- Around line 395-410: Add a regression entry to the TestSanitizeOutput table
using output that contains both escaped quotes (\") and a Unicode escape
(\uXXXX), asserting both sequences remain unchanged after sanitization. Mark or
configure this case to run on Windows so it exercises filepath.ToSlash’s
platform-specific behavior, before relying on the protection logic in the diff.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c9d5613-1bf7-48a2-aabf-c9d96c8fccf9

📥 Commits

Reviewing files that changed from the base of the PR and between 183fb78 and 22a94a4.

📒 Files selected for processing (7)
  • examples/quick-start-advanced/stacks/orgs/acme/_defaults.yaml
  • scripts/generate-notice.sh
  • tests/cli_test.go
  • tests/fixtures/scenarios/complete/stacks/orgs/cp/_defaults.yaml
  • tests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.golden
  • tests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.golden
  • tests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.golden
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.golden
  • tests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.golden
  • tests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.golden

Comment thread tests/cli_test.go Resolved
…tpick 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]>
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]>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 31, 2026
…dag-closure

Resolved a conflict in scripts/generate-notice.sh: both branches
independently fixed the same editorconfig tab-indentation violation in
the footer heredoc. Kept this branch's echo-based rewrite (preserves
NOTICE's original 2-space visual indent, verified byte-identical
across regenerations) over main's simpler tab-substitution (which,
while also editorconfig-compliant, would leave those two lines with a
much wider indent than the rest of NOTICE). Deduplicated four
REPO_OVERRIDES entries (yaml.v2, yaml.v3, op/go-logging.v1,
warnings.v0) that both branches had added independently.
…rdening, 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]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
website/docs/stacks/components/metadata.mdx (1)

324-333: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clarify the selector evaluation boundary.

Line 326 says selectors are evaluated before all template processing and YAML function execution, but Lines 331-332 allow simple Go templates and local YAML functions. State that selectors use a restricted pre-authentication phase before full template/YAML evaluation.

Proposed wording
-Labels and tags are selectors: Atmos evaluates them **before** authentication, template processing, and YAML function execution to decide which components a command operates on.
+Labels and tags are selectors: Atmos resolves them in a restricted pre-authentication phase, before authentication and full template/YAML evaluation, to decide which components a command operates on.
🤖 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 `@website/docs/stacks/components/metadata.mdx` around lines 324 - 333, Clarify
the “Selector Purity” description to distinguish restricted pre-authentication
evaluation from full template and YAML processing. Update the paragraph near
“metadata.tags” and “metadata.labels” to state that only the supported simple
templates and local YAML functions are resolved in this restricted phase, while
authentication, external processes, and full evaluation remain deferred.
🧹 Nitpick comments (1)
pkg/list/dependencies/scope.go (1)

260-271: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the Selector construction into a ScopeRequest method.

This literal duplicates the one in ResolveScopedClosure. If a future selector field is added to ScopeRequest, one of the two sites will be missed and the refined roots will use a weaker selector than the seed pass. A small helper keeps both passes identical by construction.

♻️ Proposed refactor
+// selector builds the seed selector for this request. Both the lightweight
+// seed pass and the resolved-graph refinement must use the same filters.
+func (r *ScopeRequest) selector() *Selector {
+	return &Selector{
+		Components: r.Components,
+		Stack:      r.Stack,
+		Tags:       r.Tags,
+		Labels:     r.Labels,
+		LeftDelim:  r.LeftDelim,
+		RightDelim: r.RightDelim,
+	}
+}
-	sel := &Selector{
-		Components: req.Components,
-		Stack:      req.Stack,
-		Tags:       req.Tags,
-		Labels:     req.Labels,
-		LeftDelim:  req.LeftDelim,
-		RightDelim: req.RightDelim,
-	}
+	sel := req.selector()
🤖 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/list/dependencies/scope.go` around lines 260 - 271, Extract the
duplicated Selector construction from refineRoots into a method on ScopeRequest,
then reuse that method in both refineRoots and ResolveScopedClosure. Ensure the
helper maps all selector-related ScopeRequest fields so root refinement and seed
resolution remain identical as fields evolve.
🤖 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 `@website/docs/cli/configuration/describe.mdx`:
- Around line 49-59: Update the selector purity link in the
settings.eager_evaluation documentation to use the current
/stacks/components/metadata#selector-purity destination instead of the outdated
component-metadata path.

---

Outside diff comments:
In `@website/docs/stacks/components/metadata.mdx`:
- Around line 324-333: Clarify the “Selector Purity” description to distinguish
restricted pre-authentication evaluation from full template and YAML processing.
Update the paragraph near “metadata.tags” and “metadata.labels” to state that
only the supported simple templates and local YAML functions are resolved in
this restricted phase, while authentication, external processes, and full
evaluation remain deferred.

---

Nitpick comments:
In `@pkg/list/dependencies/scope.go`:
- Around line 260-271: Extract the duplicated Selector construction from
refineRoots into a method on ScopeRequest, then reuse that method in both
refineRoots and ResolveScopedClosure. Ensure the helper maps all
selector-related ScopeRequest fields so root refinement and seed resolution
remain identical as fields evolve.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b04bf176-a9a9-41d5-80d4-2e55d30b4722

📥 Commits

Reviewing files that changed from the base of the PR and between 9c31eb7 and 1ff5c48.

📒 Files selected for processing (22)
  • cmd/list/flag_wrappers.go
  • cmd/list/vendor.go
  • cmd/terraform/utils_test.go
  • errors/errors.go
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/describe_stacks_component_processor_scope_test.go
  • internal/exec/terraform_affected.go
  • internal/exec/terraform_affected_test.go
  • internal/exec/terraform_state_output_coverage_test.go
  • pkg/list/dependencies/build.go
  • pkg/list/dependencies/render.go
  • pkg/list/dependencies/scope.go
  • pkg/list/dependencies/scope_test.go
  • pkg/scheduler/adapters/terraform.go
  • pkg/scheduler/adapters/terraform_closure_test.go
  • pkg/tags/selector.go
  • pkg/tags/selector_test.go
  • website/blog/2026-07-27-include-dependencies-closure.mdx
  • website/docs/cli/commands/list/list-metadata.mdx
  • website/docs/cli/commands/list/list-vendor.mdx
  • website/docs/cli/configuration/describe.mdx
  • website/docs/stacks/components/metadata.mdx
🚧 Files skipped from review as they are similar to previous changes (6)
  • errors/errors.go
  • pkg/tags/selector_test.go
  • cmd/list/vendor.go
  • pkg/list/dependencies/render.go
  • internal/exec/describe_stacks_component_processor.go
  • cmd/list/flag_wrappers.go

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 1, 2026
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]>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 1, 2026
@aknysh

Copy link
Copy Markdown
Member

CodeRabbit (@coderabbitai) full review please, and analyze in more details the last two commits (from Andriy Knysh (@aknysh)) for correctness

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== PR commits, newest first =="
gh api repos/cloudposse/atmos/pulls/2807/commits --paginate \
  --jq '.[] | [.sha[0:12], .commit.author.name, .commit.author.email, .commit.message | split("\n")[0]] | `@tsv`' \
  | tac

echo
echo "== Last two commits authored by aknysh =="
mapfile -t shas < <(
  gh api repos/cloudposse/atmos/pulls/2807/commits --paginate \
    --jq '.[] | select((.author.login? // "") == "aknysh" or (.commit.author.name | ascii_downcase | contains("aknysh"))) | .sha' \
    | tail -n 2
)
printf '%s\n' "${shas[@]}"

for sha in "${shas[@]}"; do
  echo
  echo "== Commit ${sha} =="
  git show --no-ext-diff --format=fuller --stat "$sha"
  echo "-- Changed files --"
  git diff-tree --no-commit-id --name-status -r "$sha"
  echo "-- Diff --"
  git show --no-ext-diff --format= --find-renames --find-copies "$sha"
done

Length of output: 7140


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for sha in b32eb87b1915 bf5cb33871b7; do
  echo
  echo "== ${sha}: commit metadata and changed files =="
  git show --no-ext-diff --format=fuller --stat --summary "$sha"
  echo
  echo "== ${sha}: patch =="
  git show --no-ext-diff --format= --find-renames --find-copies "$sha"
done

echo
echo "== Changed Go-file outlines =="
for sha in b32eb87b1915 bf5cb33871b7; do
  git diff-tree --no-commit-id --name-only -r "$sha" -- '*.go' \
    | while IFS= read -r file; do
        [ -n "$file" ] || continue
        echo "-- ${sha} :: ${file} --"
        ast-grep outline "$file" --items all --type function,method,struct,interface 2>/dev/null || true
      done
done

Length of output: 111681


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Scoped closure implementation =="
sed -n '80,390p' pkg/list/dependencies/scope.go

echo
echo "== Scoped closure callers and result consumption =="
rg -n -C 6 'ResolveScopedClosure\s*\(|ScopeResult|\.Closure\b|\.Stacks\b' \
  cmd internal pkg \
  -g '*.go'

echo
echo "== Dependency graph closure semantics =="
sed -n '1,230p' pkg/list/dependencies/closure.go
sed -n '280,470p' pkg/scheduler/adapters/terraform.go

echo
echo "== Selector matching and current purity parsing =="
sed -n '100,540p' pkg/tags/selector.go
sed -n '750,875p' internal/exec/describe_stacks_component_processor.go

echo
echo "== Relevant current tests =="
sed -n '150,380p' pkg/list/dependencies/scope_test.go
sed -n '430,640p' pkg/list/dependencies/scope_test.go
sed -n '210,290p' pkg/scheduler/adapters/terraform_closure_test.go

Length of output: 127434


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Direct scoped-closure call sites =="
rg -n -C 18 'ResolveScopedClosure\s*\(' cmd internal pkg -g '*.go'

echo
echo "== Components closure path =="
ast-grep outline cmd/list/components.go --items all --type function,method --match 'Closure|Extract|Components'
rg -n -C 20 'ResolveScopedClosure|ComponentNames|IncludeDependencies|IncludeDependents|filterRowsByComponentNames' \
  cmd/list/components.go

echo
echo "== Stacks closure path =="
ast-grep outline cmd/list/stacks.go --items all --type function,method --match 'Closure|Stacks|Extract'
rg -n -C 20 'ResolveScopedClosure|ComponentNames|IncludeDependencies|IncludeDependents|extract\.Stacks' \
  cmd/list/stacks.go

echo
echo "== Dependencies closure path =="
ast-grep outline cmd/list/dependencies.go --items all --type function,method --match 'Closure|Dependency|Graph'
rg -n -C 20 'ResolveScopedClosure|result\.Stacks|result\.Closure|BuildGraph' \
  cmd/list/dependencies.go

echo
echo "== Terraform scoped-closure execution path =="
rg -n -C 20 'ResolveScopedClosure|result\.Stacks|result\.Closure|describeTerraformStacksForExecution' \
  internal/exec/terraform_all.go internal/exec/terraform_query.go

Length of output: 86258


@aknysh, I found one correctness issue in bf5cb33871b7.

cmd/list/stacks.go passes result.Stacks directly to extract.Stacks at Line 390. This is not equivalent to the final closure.

In reverse or both-direction closure resolution, ResolveScopedClosure evaluates unresolved dependency sources conservatively. Those stacks can remain in result.Stacks even when they are absent from result.Closure. refineRoots can also remove an initially conservative root while its evaluated stack remains in result.Stacks.

As a result, atmos list stacks --include-dependents can show stacks that are not part of the final dependency closure. list components and list instances apply final closure membership. list stacks must similarly restrict output to dependencies.StackNames(result.Closure) before it calls extract.Stacks.

The selector refactor in b32eb87b1915 is correct. It keeps the seed and refinement selectors aligned.

I will now run the requested full review.

✅ Action performed

Full review finished.

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]>

@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: 6

🧹 Nitpick comments (7)
pkg/list/list_instances_authdisabled_test.go (1)

164-182: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider one more case: filters set, but the processor has no scoped method.

executeDescribeStacksForInstances now has three dispatch branches, and the new scoped branch is the first one. These tests always pass nil for both filters, so the scoped branch never runs. The documented fail-open contract ("A processor without the optional scoped interface simply describes unscoped") is therefore untested. authDisabledFakeProcessor does not implement ExecuteDescribeStacksScoped, so adding a case with non-nil filters covers the fallback cheaply.

♻️ Suggested additional test
// TestExecuteDescribeStacksForInstances_ScopedFiltersFallBackWhenUnsupported asserts
// that tags/labels filters do not break dispatch for a processor without the
// optional scoped interface: the run must fall through to the auth-disabled path.
func TestExecuteDescribeStacksForInstances_ScopedFiltersFallBackWhenUnsupported(t *testing.T) {
	fake := &authDisabledFakeProcessor{}
	atmosConfig := &schema.AtmosConfiguration{}

	_, err := executeDescribeStacksForInstances(
		atmosConfig,
		fake,
		nil,  // authManager
		true, // processTemplates
		true, // processYamlFunctions
		nil,  // skip
		true, // authDisabled
		[]string{"production"},              // tagsFilter
		map[string]string{"env": "prod"},    // labelsFilter
	)
	require.NoError(t, err)
	assert.True(t, fake.executeDescribeStacksAuthDisabled,
		"a processor without the scoped interface must fall back to the auth-disabled path")
}
🤖 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/list/list_instances_authdisabled_test.go` around lines 164 - 182, Add a
test covering non-nil tags and labels filters when using
authDisabledFakeProcessor, which lacks ExecuteDescribeStacksScoped. Invoke
executeDescribeStacksForInstances with authDisabled enabled and assert no error
plus executeDescribeStacksAuthDisabled is called, verifying fallback to the
auth-disabled path.
pkg/list/list_instances_coverage_test.go (1)

609-621: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Assert the rendered closure set, not only the absence of an error.

The doc comment states the test must render the istio chain plus its forward prerequisites and never eks/karpenter. The only assertion is require.NoError, so a closure regression that returns every component in the stack still passes. Capture the JSON output through the data writer and assert the component set.

The same gap applies to nothing else in this file; the error-propagation test below does assert its specific message.

🤖 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/list/list_instances_coverage_test.go` around lines 609 - 621, Strengthen
the test around ExecuteListInstancesCmd by capturing its JSON output via the
data writer and decoding the rendered component set. Assert that it contains the
istio chain and forward prerequisites while excluding eks/karpenter, in addition
to retaining the existing require.NoError check.
pkg/list/extract/components_test.go (1)

716-737: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use table-driven tests for the metadata cases.

Each new test function contains multiple scenarios as separate subtests. Convert both groups to table-driven tests. Include mixed invalid entries and values to verify the filtering behavior.

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

Also applies to: 739-760

🤖 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/list/extract/components_test.go` around lines 716 - 737, Refactor the
metadata accessor tests around TestGetTagsFromMetadata into table-driven cases
instead of separate scenario subtests. Include valid tags, absent and wrong-type
metadata, plus mixed valid and invalid entries/values to verify filtering, while
preserving assertions that invalid or missing input returns an empty non-nil
slice.

Source: Coding guidelines

internal/exec/describe_stacks.go (1)

256-272: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Replace the expanded positional API with functional options.

The selector filters add more positional arguments to an already large call chain. This makes caller mistakes hard to detect and violates the Go command guidelines.

  • internal/exec/describe_stacks.go#L256-L272: replace tagsFilter and labelsFilter parameters with scope options.
  • internal/exec/describe_stacks.go#L353-L372: expose the scoped operation through the same options-based API.
  • internal/exec/describe_stacks.go#L376-L414: pass a single options value to the internal processor setup.

As per coding guidelines, “Use the functional options pattern for configuration instead of functions with many parameters.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/exec/describe_stacks.go` around lines 256 - 272, Replace the
positional tagsFilter and labelsFilter parameters with functional scope options
across internal/exec/describe_stacks.go:256-272, including
ExecuteDescribeStacksWithMocks; expose the same options-based API in the
operation around lines 353-372; and pass one options value into the internal
processor setup around lines 376-414 instead of separate selector arguments.
Preserve existing selector behavior while consolidating configuration through
the functional-options pattern.

Source: Coding guidelines

pkg/list/list_metadata.go (1)

175-178: 📐 Maintainability & Code Quality | 🔵 Trivial

TODO: --filter spec not yet honored for metadata.

The comment marks --filter support for list metadata as unimplemented. Do you want me to draft a solution that extends buildMetadataFilters to also honor --filter once its format is defined, or open a new issue to track this?

🤖 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/list/list_metadata.go` around lines 175 - 178, The metadata filter
builder currently ignores the `--filter` specification. Once the filter format
is defined, update `buildMetadataFilters` to parse and apply `--filter`
alongside the existing `--tags` and `--labels` filters, preserving their current
matching semantics.
pkg/list/dependencies/render_test.go (1)

138-169: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider naming the two selector cases and building app metadata in the fixture.

Two small readability points here. The loop runs two different selectors without subtests, so a failure does not say whether tags or labels failed. Also, app metadata is injected through a chain of type assertions on the fixture map, which duplicates knowledge of the fixture shape.

♻️ Suggested shape
-	app := stacks["dev"].(map[string]any)["components"].(map[string]any)["terraform"].(map[string]any)["app"].(map[string]any)
-	app["metadata"] = map[string]any{
-		"tags":   []any{"application"},
-		"labels": map[string]any{"team": "platform", "environment": "test"},
-	}
 	graph, err := BuildGraph(stacks)
 	require.NoError(t, err)
 
-	for _, opts := range []Options{
-		{Format: FormatLevels, Direction: DirectionForward, Tags: []string{"application", "tier-1"}},
-		{Format: FormatLevels, Direction: DirectionForward, Labels: map[string]string{"team": "platform", "environment": "test"}},
-	} {
-		out, err := Render(graph, opts)
-		require.NoError(t, err)
-		assertLevel(t, out, "app", 0)
-		assertLevel(t, out, "vpc", 1)
-		assert.NotContains(t, out, "ignored")
-	}
+	for _, tc := range []struct {
+		name string
+		opts Options
+	}{
+		{"tags_root", Options{Format: FormatLevels, Direction: DirectionForward, Tags: []string{"application", "tier-1"}}},
+		{"labels_root", Options{Format: FormatLevels, Direction: DirectionForward, Labels: map[string]string{"team": "platform", "environment": "test"}}},
+	} {
+		t.Run(tc.name, func(t *testing.T) {
+			out, err := Render(graph, tc.opts)
+			require.NoError(t, err)
+			assertLevel(t, out, "app", 0)
+			assertLevel(t, out, "vpc", 1)
+			assert.NotContains(t, out, "ignored")
+		})
+	}

Set the app metadata (tags plus labels) in the fixture map next to its dependencies, so the test reads top to bottom.

🤖 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/list/dependencies/render_test.go` around lines 138 - 169, Improve
TestRender_LevelsHonorsTagsAndAllLabelsForRoots by defining the app metadata
directly in the terraformStacks fixture alongside its dependencies, removing the
subsequent chained type assertions and mutation. Name the two Options cases and
run them as subtests so failures identify whether tag or label selection failed.
pkg/tags/selector_test.go (1)

436-478: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move the alternate fixture into the table instead of branching on the case name.

The tc.name == "nested_template_output_unresolved" check ties behavior to a string. If someone renames that case, the test silently exercises the wrong data and still passes.

♻️ Proposed refactor
 	tests := []struct {
 		name     string
 		v        any
+		data     map[string]any
 		want     any
 		resolved bool
 	}{
@@
-		{name: "nested_template_output_unresolved", v: "{{ .vars.templated }}", resolved: false},
+		{name: "nested_template_output_unresolved", v: "{{ .vars.templated }}", data: dataWithTemplated, resolved: false},
@@
-			input := data
-			if tc.name == "nested_template_output_unresolved" {
-				input = dataWithTemplated
-			}
+			input := data
+			if tc.data != nil {
+				input = tc.data
+			}
 			got, resolved := ResolveSelectorValue(tc.v, input, "", "")

Declare dataWithTemplated above the table so the literal can reference 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/tags/selector_test.go` around lines 436 - 478, Update the table-driven
test around the tests slice so each case carries its own input data, using the
existing dataWithTemplated fixture for nested_template_output_unresolved and the
default fixture for other cases. Remove the tc.name comparison and input
reassignment inside the subtest.
🤖 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/list/sources_test.go`:
- Around line 82-83: Update the fetchAndFilterSources error assertion to verify
errors.Is against errUtils.ErrInvalidFlag, preserving the wrapped-error behavior
from tags.ParseLabelsFlag instead of only checking that an error occurred. Add
the errUtils import if needed and use the existing test assertion style to
validate the specific error identity.

In `@cmd/list/stacks.go`:
- Around line 356-395: Update extractStacksViaScopedClosure so each
closure-extracted row includes the selected component value under the
"component" key, matching the non-closure --component path. Add opts.Component
to the row data before returning stacks, while preserving existing stack and
vars values and behavior when no component is selected.

In `@pkg/list/list_instances_coverage_test.go`:
- Around line 103-112: Update the test around ExecuteListInstancesCmd to assert
the specific malformed-label parse error returned by tags.ParseLabelsFlag,
rather than accepting any error. Use errors.Is() to verify the appropriate
sentinel and assert the expected error message, adjusting the sentinel to the
parser’s actual malformed-pair error.

In
`@tests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.golden`:
- Line 1039: Update the golden snapshot test setup for
TestCLICommands_describe_component_with_relative_path so both USER and USERNAME
are explicitly set to the fixed value “user” before rendering the snapshot,
ensuring provisioned_by_user remains portable across platforms and environments.

In
`@tests/snapshots/TestCLICommands_terraform_help_shows_stack_flag.stdout.golden`:
- Around line 86-90: Update the source help text for the Terraform closure flags
near the include-dependencies/include-dependents descriptions to document that
destroy operations reverse dependency order, with dependents destroyed before
prerequisites. Regenerate the
TestCLICommands_terraform_help_shows_stack_flag.stdout.golden snapshot so it
matches the updated help output.

In `@website/docs/cli/commands/list/list-dependencies.mdx`:
- Around line 124-125: Update the level-0 seed description near the `Level`
definition to include the positional `component` argument alongside `--stack`,
`--tags`, and `--labels`, accurately documenting that all these selectors seed
level 0.

---

Nitpick comments:
In `@internal/exec/describe_stacks.go`:
- Around line 256-272: Replace the positional tagsFilter and labelsFilter
parameters with functional scope options across
internal/exec/describe_stacks.go:256-272, including
ExecuteDescribeStacksWithMocks; expose the same options-based API in the
operation around lines 353-372; and pass one options value into the internal
processor setup around lines 376-414 instead of separate selector arguments.
Preserve existing selector behavior while consolidating configuration through
the functional-options pattern.

In `@pkg/list/dependencies/render_test.go`:
- Around line 138-169: Improve TestRender_LevelsHonorsTagsAndAllLabelsForRoots
by defining the app metadata directly in the terraformStacks fixture alongside
its dependencies, removing the subsequent chained type assertions and mutation.
Name the two Options cases and run them as subtests so failures identify whether
tag or label selection failed.

In `@pkg/list/extract/components_test.go`:
- Around line 716-737: Refactor the metadata accessor tests around
TestGetTagsFromMetadata into table-driven cases instead of separate scenario
subtests. Include valid tags, absent and wrong-type metadata, plus mixed valid
and invalid entries/values to verify filtering, while preserving assertions that
invalid or missing input returns an empty non-nil slice.

In `@pkg/list/list_instances_authdisabled_test.go`:
- Around line 164-182: Add a test covering non-nil tags and labels filters when
using authDisabledFakeProcessor, which lacks ExecuteDescribeStacksScoped. Invoke
executeDescribeStacksForInstances with authDisabled enabled and assert no error
plus executeDescribeStacksAuthDisabled is called, verifying fallback to the
auth-disabled path.

In `@pkg/list/list_instances_coverage_test.go`:
- Around line 609-621: Strengthen the test around ExecuteListInstancesCmd by
capturing its JSON output via the data writer and decoding the rendered
component set. Assert that it contains the istio chain and forward prerequisites
while excluding eks/karpenter, in addition to retaining the existing
require.NoError check.

In `@pkg/list/list_metadata.go`:
- Around line 175-178: The metadata filter builder currently ignores the
`--filter` specification. Once the filter format is defined, update
`buildMetadataFilters` to parse and apply `--filter` alongside the existing
`--tags` and `--labels` filters, preserving their current matching semantics.

In `@pkg/tags/selector_test.go`:
- Around line 436-478: Update the table-driven test around the tests slice so
each case carries its own input data, using the existing dataWithTemplated
fixture for nested_template_output_unresolved and the default fixture for other
cases. Remove the tc.name comparison and input reassignment inside the subtest.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c15319e7-0187-4480-95b0-33ec147c4d8e

📥 Commits

Reviewing files that changed from the base of the PR and between 00784e4 and b32eb87.

📒 Files selected for processing (148)
  • .claude/settings.json
  • NOTICE
  • cmd/container/verbs.go
  • cmd/helm/helm.go
  • cmd/kubernetes/kubernetes.go
  • cmd/list/closure_test.go
  • cmd/list/cmd_executor_integration_test.go
  • cmd/list/components.go
  • cmd/list/components_closure_test.go
  • cmd/list/components_test.go
  • cmd/list/dependencies.go
  • cmd/list/dependencies_scoped_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/parse_options_test.go
  • cmd/list/sources.go
  • cmd/list/sources_test.go
  • cmd/list/stacks.go
  • cmd/list/stacks_closure_test.go
  • cmd/list/vendor.go
  • cmd/list/vendor_test.go
  • cmd/terraform/flags.go
  • cmd/terraform/flags_test.go
  • cmd/terraform/options.go
  • cmd/terraform/options_test.go
  • cmd/terraform/utils.go
  • cmd/terraform/utils_test.go
  • docs/fixes/2026-07-25-scope-before-evaluate-labels-tags-list-dependencies.md
  • errors/errors.go
  • examples/quick-start-advanced/stacks/orgs/acme/_defaults.yaml
  • internal/exec/describe_affected.go
  • internal/exec/describe_affected_test.go
  • internal/exec/describe_stacks.go
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/describe_stacks_component_processor_scope_test.go
  • internal/exec/describe_stacks_component_processor_test.go
  • internal/exec/describe_stacks_test.go
  • internal/exec/filter_utils.go
  • internal/exec/stacks_processor.go
  • internal/exec/stacks_processor_test.go
  • internal/exec/terraform_affected.go
  • internal/exec/terraform_affected_test.go
  • internal/exec/terraform_all.go
  • internal/exec/terraform_all_closure_scope_test.go
  • internal/exec/terraform_query.go
  • internal/exec/terraform_state_output_coverage_test.go
  • internal/exec/terraform_state_utils.go
  • internal/exec/terraform_utils_test.go
  • internal/exec/utils.go
  • internal/exec/utils_test.go
  • pkg/datafetcher/schema/atmos/config/1.0.json
  • pkg/dependency/filter.go
  • pkg/dependency/filter_test.go
  • pkg/dependency/types.go
  • pkg/flags/depth.go
  • pkg/flags/depth_test.go
  • pkg/list/dependencies/build.go
  • pkg/list/dependencies/closure.go
  • pkg/list/dependencies/closure_test.go
  • pkg/list/dependencies/render.go
  • pkg/list/dependencies/render_test.go
  • pkg/list/dependencies/scope.go
  • pkg/list/dependencies/scope_test.go
  • pkg/list/extract/components.go
  • pkg/list/extract/components_test.go
  • pkg/list/extract/metadata.go
  • pkg/list/extract/metadata_test.go
  • pkg/list/extract/stacks.go
  • pkg/list/extract/stacks_test.go
  • pkg/list/extract/vendor.go
  • pkg/list/extract/vendor_test.go
  • pkg/list/filter/filter.go
  • pkg/list/filter/filter_test.go
  • pkg/list/list_instances.go
  • pkg/list/list_instances_authdisabled_test.go
  • pkg/list/list_instances_closure_test.go
  • pkg/list/list_instances_coverage_test.go
  • pkg/list/list_instances_process_test.go
  • pkg/list/list_instances_test.go
  • pkg/list/list_metadata.go
  • pkg/list/list_metadata_test.go
  • pkg/scheduler/adapters/terraform.go
  • pkg/scheduler/adapters/terraform_closure_test.go
  • pkg/scheduler/adapters/terraform_test.go
  • pkg/schema/schema.go
  • pkg/schema/schema_test.go
  • pkg/tags/flags.go
  • pkg/tags/flags_test.go
  • pkg/tags/selector.go
  • pkg/tags/selector_test.go
  • scripts/generate-notice.sh
  • tests/cli_sanitize_test.go
  • tests/cli_test.go
  • tests/fixtures/scenarios/complete/stacks/orgs/cp/_defaults.yaml
  • tests/fixtures/scenarios/dependencies-scoped-evaluation/atmos.yaml
  • tests/fixtures/scenarios/dependencies-scoped-evaluation/components/terraform/mock/main.tf
  • tests/fixtures/scenarios/dependencies-scoped-evaluation/stacks/deploy/app-a.yaml
  • tests/fixtures/scenarios/dependencies-scoped-evaluation/stacks/deploy/app-b.yaml
  • tests/fixtures/scenarios/list-components-closure-tags/atmos.yaml
  • tests/fixtures/scenarios/list-components-closure-tags/stacks/deploy/broken.yaml
  • tests/fixtures/scenarios/list-components-closure-tags/stacks/deploy/prod.yaml
  • tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden
  • tests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
  • tests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.golden
  • tests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.golden
  • tests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.golden
  • tests/snapshots/TestCLICommands_terraform_help_shows_stack_flag.stdout.golden
  • tests/snapshots/TestCLICommands_terraform_provision_help_shows_inherited_stack_flag.stdout.golden
  • tests/snapshots/TestCLICommands_tf_plan_help_shows_inherited_stack_flag.stdout.golden
  • tests/test-cases/component-path-resolution.yaml
  • website/blog/2026-07-27-include-dependencies-closure.mdx
  • website/docs/cli/commands/container/usage.mdx
  • website/docs/cli/commands/helm/helm-apply.mdx
  • website/docs/cli/commands/helm/helm-delete.mdx
  • website/docs/cli/commands/helm/helm-deploy.mdx
  • website/docs/cli/commands/helm/helm-diff.mdx
  • website/docs/cli/commands/helm/helm-plan.mdx
  • website/docs/cli/commands/helm/helm-template.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-apply.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-delete.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-deploy.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-diff.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-plan.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-render.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-validate.mdx
  • website/docs/cli/commands/kubernetes/usage.mdx
  • website/docs/cli/commands/list/list-components.mdx
  • website/docs/cli/commands/list/list-dependencies.mdx
  • website/docs/cli/commands/list/list-instances.mdx
  • website/docs/cli/commands/list/list-metadata.mdx
  • website/docs/cli/commands/list/list-sources.mdx
  • website/docs/cli/commands/list/list-stacks.mdx
  • website/docs/cli/commands/list/list-vendor.mdx
  • website/docs/cli/commands/terraform/terraform-apply.mdx
  • website/docs/cli/commands/terraform/terraform-deploy.mdx
  • website/docs/cli/commands/terraform/terraform-destroy.mdx
  • website/docs/cli/commands/terraform/terraform-init.mdx
  • website/docs/cli/commands/terraform/terraform-plan.mdx
  • website/docs/cli/commands/terraform/usage.mdx
  • website/docs/cli/configuration/describe.mdx
  • website/docs/stacks/components/metadata.mdx
  • website/src/data/roadmap.js
  • website/static/casts/screengrabs/atmos-list-dependencies--help.cast
💤 Files with no reviewable changes (2)
  • tests/test-cases/component-path-resolution.yaml
  • .claude/settings.json

Comment thread cmd/list/sources_test.go Resolved
Comment thread cmd/list/stacks.go Resolved
…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]>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 1, 2026
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]>
@atmos-pro

atmos-pro Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

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

@github-actions

github-actions Bot commented Aug 1, 2026

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

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

These changes were released in v1.225.0-rc.5.

This branch was successfully deployed

1 active and 1 inactive deployments
preview — daf97c12 Deployed Aug 1, 2026 by github-actions[bot]
screengrabs — daf97c12 Deployed Aug 1, 2026 by aknysh via build #959
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/xxl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants