Repository navigation
feat(describe affected): add --tags/--labels selectors and --flatten - #3297
Conversation
Native CI had no per-instance opt-out and the affected matrix could not be filtered, so privileged components (iam, aws-teams, tfstate-backend) always reached the plan/apply matrix. `atmos describe affected` and `atmos list affected` now accept `--tags` (match any) and `--labels` (match all) with the same semantics as `atmos terraform --tags/--labels`, applied to every output format including `--format=matrix`. Combining them with `--upload` is rejected because the upload is always unfiltered. The positional `excludeLocked` parameter is replaced by an `AffectedFilter` struct. Docs cover the default-label-plus-override pattern and an OPA backstop, with a changelog post, roadmap entry, migration-guide note and atmos-ci skill update. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned Files
|
Bump the patched versions through pnpm.overrides in website/ (all within the current major, so the dependabot.yml ignore policy is respected): - shell-quote 1.10.0 -> 1.11.0 (#321) - source-map-js 1.2.1 -> 1.2.2 (#318) - proxy-addr 2.0.7 -> 2.0.8 (#317) - joi 17.13.7 -> 17.13.8 (#316) - compression 1.8.1 -> 1.8.2 (#315) - postcss-selector-parser 7.1.5 -> 7.1.6 (#314) The remaining open alerts are not auto-fixable (no patch, major bump blocked by policy, or an unfamiliar CodeQL/Semgrep rule). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (12)
🚧 Files skipped from review as they are similar to previous changes (4)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughAdds tag and label selectors to affected-component commands and Terraform graph selection. Selectors filter live and deleted components and can prune or promote dependents. The change also adds namespaced environment handling, count-based CI matrix guards, and CI guidance. ChangesAffected Component Selectors
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CLI as describe affected CLI
participant Resolver as Affected component resolver
participant Dependents as Dependent finalizer
participant Output as Matrix output
CLI->>Resolver: parse selectors and find affected components
Resolver->>Dependents: resolve dependents with metadata
Dependents->>Dependents: prune unmatched entries and promote matching descendants
Dependents->>Output: return filtered affected entries
Merge Risk: ⚪ Minimal · up to This change updates documentation for the new affected-component selectors. No merge-blocking risk is apparent from the supplied material. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
CI timing summaryLatest completed GitHub Actions runs for
Wall-clock time spans the earliest included workflow creation through the latest completion. Aggregate runner time adds each job's execution time, so concurrent jobs are counted separately.
Longest jobs (top 10)
Updated automatically when a PR workflow finishes. |
TestGetAffectedComponents patches the public ExecuteDescribeAffectedWithTarget*
wrappers, which keep their `excludeLocked bool` parameter (only the *WithOptions
variants take an AffectedFilter). The doubles had been switched to
`filter AffectedFilter`, so gomonkey's ApplyFunc type check panicked on Linux and
Windows ("target type ... and double type ... are different") and aborted the
whole internal/exec package. The test is skipped on darwin/arm64, so it was not
caught locally.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3297 +/- ##
==========================================
+ Coverage 84.73% 84.74% +0.01%
==========================================
Files 2122 2124 +2
Lines 207244 207934 +690
==========================================
+ Hits 175602 176211 +609
- Misses 23375 23428 +53
- Partials 8267 8295 +28
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…nd dependents A field test of the new selectors found two paths that bypassed them. A component deleted in HEAD, including every component of a deleted stack, was always reported, so a privileged `ci: manual` component still reached the `--labels=ci=auto` matrix. With --include-dependents, non-matching components were still nested under their parents. Deleted components are now matched against their metadata from the base ref. Nested dependents are pruned recursively, promoting matching descendants of a removed dependent to the nearest remaining ancestor. `terraform --affected` is unchanged. `atmos list affected` picks up the deleted-component fix. Docs, the changelog post and the atmos-ci skill now cover the schemas.opa.base_path prerequisite for the OPA backstop, the empty-value behavior, deleted and dependents handling, and the list affected flags. A fix record is added under docs/fixes. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… no schemas Setting ATMOS_SCHEMAS_OPA_BASE_PATH (or the jsonschema, cue and atmos-manifest variants, or the matching --schemas-* flags) panicked with "assignment to entry in nil map" when the loaded atmos.yaml had no `schemas:` section, because the Schemas map is left nil in that case. AtmosConfiguration already had a nil-safe SetSchemaRegistry, but eight write sites in pkg/config/utils.go still assigned into the map directly. Add the matching SetResourcePath setter and use the nil-safe setters at all eight sites. Regression tests cover the environment variable path, the flag path and the setter, and they fail with the original panic without the change. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Regenerate only the describe affected and list affected --help casts so they show the new --tags and --labels flags, using the casts generator's --filter option. Update the fix record: both pass-through follow-ups were resolved in this pull request. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏 |
… are set The nested-dependents pruning attached each dependent's metadata inside addDependentsToAffected unconditionally. That added a populated field to every dependent, so the whole-struct comparisons in TestDescribeAffectedWithDependents, ...WithoutTemplates and ...FilteredByStack failed on Linux, macOS and Windows CI. Those tests skip inside a git worktree (go-git rejects the worktreeconfig extension), which is why they were not caught locally. addDependentsToAffected keeps its signature and original behavior and now delegates to addDependentsToAffectedWithFilter. Execute uses the filtered variant only when --tags or --labels is set, and the transient metadata is cleared after pruning. The shared settings move into a dependentsOptions struct, which also brings the touched functions within the argument and length limits. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
CodeRabbit (@coderabbitai) review |
✅ Action performedReview finished.
|
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.231.0. |
what
Add
--tags(match any) and--labels(match all) selectors toatmos describe affectedandatmos list affected, with the same semantics asatmos terraform --tags/--labels. They filter every output format, including--format=matrix.Replace the positional
excludeLockedparameter threaded through the affected code with anAffectedFilterstruct.Apply the selectors to components deleted in
HEAD(matched against their metadata in the base ref, including whole deleted stacks) and to nested--include-dependentslists. With--include-dependents, selectors are applied after dependents are resolved: a non-matching dependent is removed and its matching dependents move up, and a non-matching top-level affected component is removed with its matching dependents promoted to top-level entries reported asaffected: dependent. So a change to a privileged (ci: manual) component still surfaces the automated components that depend on it.Add
--flatten(ATMOS_DESCRIBE_AFFECTED_FLATTEN) todescribe affected, which lifts every remaining dependent into the top-level list for every format. Without it,--format=matrixonly ever contained top-level entries, so dependents never reached the CI matrix. Requires--include-dependents; rejected with--upload.list affected --include-dependentsnow resolves dependents and emitsaffected: dependentrows through the same code path.atmos terraform --affected|--all --include-dependents --tags/--labelsnow prunes closure-added dependents that do not match the selectors (prerequisites still run regardless), with dropped intermediates contracted so execution and destroy order survive. This is a behavior change for--include-dependentswith selectors and is called out in the terraform docs and the changelog.Apply
--exclude-lockedto deleted components using their base-ref metadata, and to dependents that promotion or--flattenwould lift into the top-level list, so a locked component never reaches the matrix through either path. Nested dependents of kept components are unchanged.Reject
--tags/--labelscombined with--uploadwith hints when passed on the command line; selectors that arrive throughATMOS_TAGS/ATMOS_LABELSare ignored with a warning instead, so a job-level export does not break the unfiltered upload step.Stop
ATMOS_TAGS/ATMOS_LABELSleaking into other commands. The global Viper's automatic env lookup resolved the baretags/labelskeys before any explicitly bound env var, so a job-level export silently narrowedlist components,list stacks,list affected,vendor update/diff/verify, and changed which identityauth loginpicked. A new per-flagflags.WithViperKeyoption moves those flags to namespaced keys (list.*,list.vendor.tags,vendor.*,auth.*) with their documented env vars (ATMOS_COMPONENT_*,ATMOS_VENDOR_*,ATMOS_AUTH_TAGS), so no two commands share a key.terraformkeepsATMOS_TAGS/ATMOS_LABELSbut ignores env-only selectors when a component argument is given, and normalizesATMOS_TAGS=a,binto two tags.--labelsparse errors now name the flag and env var and carry a hint.Document the pattern: a default
ci: autolabel on every component, aci: manualoverride on privileged components,--labels=ci=autowhere CI builds its matrix, and an OPA policy as a backstop. Updates thedescribe affectedandlist affectedreferences (including the previously undocumented--output-file), the native CI guide, the legacy-actions migration guide, the GitHub Actions matrix examples (guard on thecountoutput, since an empty matrix is{"include":[]}), component metadata docs, and theatmos-ciagent skill. Adds a changelog post and a roadmap entry.Add a real-stack regression fixture (
tests/fixtures/scenarios/atmos-describe-affected-with-selectors) and test covering promotion, flatten, deleted and locked components, label flips, templated labels, and terraform parity. Fix records:docs/fixes/2026-10-07-affected-selectors-deleted-and-dependents.mdanddocs/fixes/2026-10-07-affected-selectors-field-test-fixes.md.Fix a pre-existing panic (
assignment to entry in nil map) whenATMOS_SCHEMAS_*environment variables or--schemas-*flags are used with anatmos.yamlthat has noschemas:section, by using nil-safe setters at all eight write sites. Regenerate thedescribe affectedandlist affectedhelp screengrabs.Bump six website dependencies through
pnpm.overridesto patched versions within their current major (shell-quote, source-map-js, proxy-addr, joi, compression, postcss-selector-parser), closing the matching Dependabot alerts.why
settings.github.actions_enabled, so foundation components (aws-teams, iam, tfstate-backend) always landed in the plan/apply matrix, and--format=matrixignores--query.terraformruns. Reusing them keeps the opt-out in the stack configuration instead of in ajqfilter in workflow YAML.references
--tags/--labels/--flattento the surface described inwebsite/docs/stacks/components/component-metadata.website/blog/2026-10-07-ci-component-selectors.mdx.🤖 Generated with Claude Code
Summary by CodeRabbit
describe affected.