Skip to content

feat: tags and labels standard for auth, components, and bulk selection - #2738

Merged
Andriy Knysh (aknysh) merged 12 commits into
mainfrom
osterman/tags-and-labels-standard
Jul 14, 2026
Merged

Andriy Knysh (aknysh) merged 12 commits into
mainfrom
osterman/tags-and-labels-standard

Conversation

@osterman

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

Copy link
Copy Markdown
Member

what

  • Adds tags to auth identities/providers, filterable via --tags on atmos auth list/login/logout (composes with --providers/--identities).
  • Adds metadata.tags (list, any-match) and metadata.labels (map, all-match) to components, filterable via atmos list components --tags/--labels.
  • Adds four new no-arg YAML functions — !tags, !labels, !labels.keys, !labels.values — that return the current component's own metadata.tags/metadata.labels, typed, for bridging into vars (e.g. vars.tags: !labels for terraform-null-label-style modules).
  • Adds --tags/--labels bulk-selection filtering to terraform, kubernetes, helm, and container commands, composing with (not replacing) --all/--affected, via a new shared pkg/tags package.
  • Updates the examples/demo-auth and examples/quick-start-advanced examples and their casts to demonstrate the new tags/labels filtering.

why

  • Implements the docs/prd/tags-and-labels-standard.md design (previously merged docs-only) so users can categorize and bulk-select components and identities without maintaining static name lists per stack/region/environment.
  • Tags (any-match) and labels (all-match, Kubernetes-selector semantics) give two matching semantics suited to different selection needs — "any of these categories" vs. "all of these key=value constraints" — consistent with existing conventions like atmos vendor pull --tags.

references

  • Implements docs/prd/tags-and-labels-standard.md.
  • Relates to feature: implement label-based filtering to all list and describe commands #1323 (mcalhoun's open PR adding metadata.labels + a --selector flag to list/describe commands) — this PR is broader in scope (adds tags, auth tags, YAML functions, and --tags/--labels on terraform/kubernetes/helm/container) but shares the metadata.labels foundation.

@atmos-pro

atmos-pro Bot commented Jul 12, 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.

@osterman Erik Osterman (Cloud Posse) (osterman) added the minor New features that do not break anything label Jul 12, 2026
@github-actions github-actions Bot added the size/l Large size PR label Jul 12, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 02edd454-c0f4-4423-a6bf-ca66237e1710

📥 Commits

Reviewing files that changed from the base of the PR and between 65b16ec and 3e97724.

📒 Files selected for processing (4)
  • errors/errors.go
  • pkg/scheduler/adapters/terraform.go
  • pkg/utils/yaml_utils.go
  • website/src/data/roadmap.js
🚧 Files skipped from review as they are similar to previous changes (4)
  • pkg/utils/yaml_utils.go
  • website/src/data/roadmap.js
  • errors/errors.go
  • pkg/scheduler/adapters/terraform.go

📝 Walkthrough

Walkthrough

Introduces "tags" and "labels" as first-class metadata for components, auth providers, and identities. Adds a shared pkg/tags package for parsing, matching, and converting metadata; extends Go and JSON schemas; wires --tags/--labels filtering into auth list/login/logout, container, helm, kubernetes, terraform, and list commands; implements YAML !tags/!labels functions; and updates comprehensive documentation, examples, and tests across the codebase.

Changes

Tags and labels support

Layer / File(s) Summary
Core tags/labels package and schemas
pkg/tags/*.go, pkg/tags/*_test.go, pkg/schema/schema.go, pkg/schema/schema_auth.go, pkg/datafetcher/schema/atmos/manifest/1.0.json, pkg/datafetcher/schema/stacks/stack-config/1.0.json, pkg/function/tag/tag.go, pkg/function/tags.go, pkg/utils/yaml_utils.go
Adds MatchesTags, MatchesLabels, ParseTagsFlag/ParseLabelsFlag, conversion helpers, Tags/Labels fields on ConfigAndStacksInfo/Provider/Identity, JSON schema properties for components/providers/identities, and new tag constants/YAML identifiers for !tags, !labels, !labels.keys, !labels.values.
Auth list --tags
cmd/auth/list.go, cmd/auth/list_test.go
Adds --tags flag with shell completion, tag-based applyFilters for providers and identities using any-match semantics, and full test coverage including composition with existing filters.
Auth login --tags
cmd/auth/login.go, cmd/auth/login_test.go
Adds tag-based identity selection with auto-select for single match, interactive TUI picker for multiple matches, error hints listing available tags, and unit tests for each selection scenario.
Auth logout --tags
cmd/auth/logout.go, cmd/auth/logout_test.go, errors/errors.go
Adds mutually exclusive --tags flag with batch tag-based provider logout, dry-run support, batch keychain confirmation, and new sentinel errors for tag mismatches.
Container bulk filtering
cmd/container/container.go, cmd/container/verbs.go, cmd/container/dispatch_test.go, pkg/component/container/bulk.go, pkg/component/container/bulk_tags_test.go, pkg/component/container/list.go, pkg/component/container/list_test.go, pkg/component/container/bulk_test.go
Adds --tags/--labels flags to bulk verbs with validation, filters bulk execution targets by component metadata using any-match tags and all-match labels, extracts tags/labels during container instance collection, and provides comprehensive tag/label filtering tests.
Component graph and terraform filtering
pkg/component/graph.go, pkg/component/graph_tags_test.go, pkg/scheduler/adapters/terraform.go, pkg/scheduler/adapters/terraform_tags_test.go
Filters component graphs and routes terraform bulk execution using tag/label metadata matching, applies secondary post-filter stage to any initial selection, and includes deterministic test fixtures validating cross-stack tag/label narrowing.
Helm and Kubernetes bulk routing
pkg/component/helm/executor.go, pkg/component/kubernetes/executor.go
Routes bulk execution for helm and kubernetes when --tags or --labels are present, in addition to existing --all/--affected triggers.
Terraform/Helm/Kubernetes/List CLI flags
cmd/terraform/flags.go, cmd/terraform/options.go, cmd/terraform/utils.go, cmd/terraform/utils_test.go, cmd/helm/helm.go, cmd/helm/helm_test.go, cmd/kubernetes/kubernetes.go, cmd/kubernetes/kubernetes_test.go, cmd/list/flag_wrappers.go, cmd/list/components.go, cmd/list/components_test.go, pkg/list/filter/filter.go, pkg/list/filter/filter_test.go, pkg/list/extract/components.go, pkg/list/extract/components_test.go
Registers --tags/--labels for terraform, helm, kubernetes, and list; validates mutual exclusivity with component arguments; adds TagFilter and LabelFilter implementations; extracts component tags/labels into top-level fields during metadata extraction; and provides comprehensive flag registration, validation, and filter tests.
YAML functions
internal/exec/yaml_func_tags.go, internal/exec/yaml_func_tags_test.go, internal/exec/yaml_func_utils.go, website/docs/functions/yaml/tags.mdx, website/docs/functions/yaml/labels.mdx, website/docs/functions/yaml/labels.keys.mdx, website/docs/functions/yaml/labels.values.mdx
Implements !tags, !labels, !labels.keys, !labels.values YAML exec functions to read component metadata, wires them into processSimpleTags dispatch with exact-tag matching, includes deterministic key/value ordering, and documents each function with usage examples.
Command documentation
website/docs/cli/commands/auth/*.mdx, website/docs/cli/commands/terraform/*.mdx, website/docs/cli/commands/helm/*.mdx, website/docs/cli/commands/kubernetes/*.mdx, website/docs/cli/commands/container/usage.mdx, website/docs/cli/commands/list/list-components.mdx, website/docs/stacks/components/metadata.mdx, website/docs/functions/yaml/index.mdx
Documents --tags/--labels usage across terraform, helm, kubernetes, container, and auth commands; explains any-match vs all-match semantics; clarifies composition with --all/--affected; and documents new YAML functions and metadata fields.
Examples, blog, and roadmap
examples/demo-auth/atmos.yaml, examples/demo-auth/README.md, examples/quick-start-advanced/README.md, examples/quick-start-advanced/stacks/catalog/*/defaults.yaml, demo/casts/atmos.d/examples/quick-start-advanced/list-instances.yaml, website/blog/2026-07-11-tags-and-labels.mdx, website/src/data/roadmap.js
Adds tags arrays to demo-auth providers/identities; adds example metadata tags and labels to quick-start-advanced components; extends demo cast with tag/label listing commands; publishes blog post explaining the feature; and adds roadmap milestones.
Regenerated snapshots and cast
tests/snapshots/TestCLICommands_*.golden, website/static/casts/examples/quick-start-advanced/list-instances.cast
Regenerates CLI help golden snapshots to include --tags/--labels flags and regenerates the quick-start-advanced demo cast recording output with new provisioning timings and resource IDs.

Estimated code review effort: 4 (Complex) | ~75 minutes

Suggested reviewers: aknysh

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.97% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 main change: adding standardized tags and labels support across auth, component, and bulk selection flows.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch osterman/tags-and-labels-standard

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 (9)
pkg/tags/tags_test.go (1)

1-33: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

LGTM! Good table-driven coverage of the core matching semantics.

💡 Optional: add edge-case tests for ALL-mode duplicates and unknown mode
 		{"any: duplicate filter tags", []string{"a"}, []string{"a", "a"}, TagModeAny, true},
+		{"all: duplicate filter tags", []string{"a"}, []string{"a", "a"}, TagModeAll, true},
+		{"unknown mode defaults to any", []string{"a", "b"}, []string{"b"}, TagMode("unknown"), true},
 	}
🤖 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/tags_test.go` around lines 1 - 33, Add optional table-driven cases
to TestMatchesTags covering duplicate filter tags in TagModeAll and an
unsupported or unknown TagMode, with expected results matching the intended
MatchesTags behavior; keep the existing core matching cases unchanged.
cmd/helm/helm.go (1)

98-99: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using flags.NewStandardParser() for flag registration.

The coding guidelines require cmd/**/*.go files to use flags.NewStandardParser() for command-specific flags. The new --tags and --labels flags are registered via cmd.Flags() directly, while cmd/kubernetes/kubernetes.go registers the same flags through the standard parser. This is a pre-existing pattern in helm.go (all flags at lines 87-99 use cmd.Flags()), so a focused fix would create intra-file inconsistency — a broader refactor of this file's flag registration would be needed.

As per coding guidelines: "Commands must use flags.NewStandardParser() for command-specific flags and must never call viper.BindEnv() or viper.BindPFlag() directly."

🤖 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/helm/helm.go` around lines 98 - 99, Refactor command-specific flag
registration in the Helm command to use flags.NewStandardParser(), including the
existing flags and the new tags and labels flags, instead of cmd.Flags().
Preserve all current flag names, defaults, descriptions, and parsing behavior
while keeping registration consistent throughout helm.go.

Source: Coding guidelines

internal/exec/yaml_func_utils.go (1)

369-394: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Dispatch order comment is misleading but harmless.

The comment says to check .keys/.values suffixes before the bare !labels match to avoid ambiguity, but every check here uses exact equality (input == u.AtmosYamlFuncLabels), not a prefix match — so order genuinely doesn't matter for correctness. Consider rewording the comment to avoid implying an ordering dependency that doesn't exist, since it could confuse future maintainers into thinking reordering is unsafe.

🤖 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/yaml_func_utils.go` around lines 369 - 394, The dispatch-order
comment above the tag checks incorrectly implies that `.keys` and `.values` must
precede the bare `!labels` match. Reword it to state that these tags are handled
as distinct exact matches, without claiming ordering is required; leave the
dispatch logic unchanged.
cmd/container/container.go (1)

120-122: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Avoid the slice→string→slice round-trip for --tags. GetStringSlice("tags") already returns the parsed values, and rejoining them before tags.ParseTagsFlag drops pflag’s CSV quoting behavior. Assign the slice directly, or add a slice-based helper if you still need normalization.

🤖 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/container/container.go` around lines 120 - 122, Update the --tags
handling in the command flag parsing block to pass the slice returned by
GetStringSlice directly into info.Tags, avoiding strings.Join and the
tags.ParseTagsFlag round-trip. If normalization is required, use or add a helper
that accepts []string while preserving pflag’s CSV quoting behavior.
cmd/container/dispatch_test.go (1)

59-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Comment is missing a trailing period.

Per coding guidelines, all comments must end with periods. The comment on line 59 also reads slightly awkwardly — "A verb without withAllFlag" should likely be "A verb without the withAllFlag".

✏️ Suggested fix
-	// A verb without withAllFlag (e.g. exec) never registers --tags/--labels;
-	// buildConfigAndStacksInfo must be nil-safe.
+	// A verb without the withAllFlag (e.g., exec) never registers --tags/--labels;
+	// buildConfigAndStacksInfo must be nil-safe.
🤖 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/container/dispatch_test.go` around lines 59 - 60, Update the comment
above the nil-safety assertion in the dispatch tests to say “A verb without the
withAllFlag” and ensure the comment ends with a period.

Source: Coding guidelines

cmd/auth/logout.go (1)

676-679: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add browser and external credential warnings for consistency with performLogoutAll.

performLogoutAll calls displayBrowserWarning() and displayExternalCredentialWarnings() after logout (lines 606–611). performTagsLogout omits both, so users who log out via --tags miss the reminder that their IdP browser session may still be active.

♻️ Proposed addition
 	ui.Success(fmt.Sprintf("Logged out from %d provider(s) matching tags %v", successCount, filterTags))
 	ui.Writeln("")
+
+	// Display browser session warning.
+	displayBrowserWarning()
+
+	// Display external credential warnings.
+	displayExternalCredentialWarnings()

 	return nil
🤖 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/auth/logout.go` around lines 676 - 679, Update performTagsLogout to call
displayBrowserWarning() and displayExternalCredentialWarnings() after reporting
the logout result, matching the post-logout behavior in performLogoutAll. Keep
the existing success message, blank line, and return flow intact.
pkg/component/graph_tags_test.go (1)

53-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test case for both Tags and Labels set simultaneously.

No subtest exercises ConfigAndStacksInfo with both Tags and Labels populated at once. The matchesGraphTagsAndLabels function ANDs the two checks, but this composition isn't directly verified.

♻️ Suggested additional subtest
 	t.Run("no matches returns empty graph, not an error", func(t *testing.T) {
 		filtered := FilterGraph(graph, &schema.ConfigAndStacksInfo{Tags: []string{"nonexistent"}}, nil)
 		require.Equal(t, 0, filtered.Size())
 	})
+
+	t.Run("tags and labels compose (both must match)", func(t *testing.T) {
+		filtered := FilterGraph(graph, &schema.ConfigAndStacksInfo{
+			Tags:   []string{"production"},
+			Labels: map[string]string{"compliance": "sox"},
+		}, nil)
+		require.Equal(t, 1, filtered.Size())
+		require.Contains(t, filtered.Nodes, GraphNodeID("api", "prod"))
+	})
 }
🤖 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/component/graph_tags_test.go` around lines 53 - 100, Add a subtest to
TestFilterGraphByTagsAndLabels that populates both Tags and Labels in
ConfigAndStacksInfo, then verify FilterGraph applies both criteria with AND
semantics by asserting only the node matching the tag and every label remains.
pkg/tags/convert_test.go (1)

60-78: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

TestSortedKeysAndValues could panic on unexpected length.

The test indexes into keys and values without first checking len(keys) != len(wantKeys). If SortedKeys returns fewer elements, this panics rather than failing gracefully. Add a length check before the loop, consistent with the pattern in TestToStringSlice.

♻️ Proposed fix to add length guards
 	keys := SortedKeys(m)
 	wantKeys := []string{"a", "b", "c"}
+	if len(keys) != len(wantKeys) {
+		t.Fatalf("SortedKeys() = %v, want %v", keys, wantKeys)
+	}
 	for i := range wantKeys {
 		if keys[i] != wantKeys[i] {
 			t.Fatalf("SortedKeys() = %v, want %v", keys, wantKeys)
 		}
 	}

 	values := SortedValues(m)
 	wantValues := []string{"1", "2", "3"}
+	if len(values) != len(wantValues) {
+		t.Fatalf("SortedValues() = %v, want %v", values, wantValues)
+	}
 	for i := range wantValues {
 		if values[i] != wantValues[i] {
 			t.Fatalf("SortedValues() = %v, want %v", values, wantValues)
 		}
 	}
🤖 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/convert_test.go` around lines 60 - 78, Update
TestSortedKeysAndValues to compare the lengths of keys and wantKeys before
indexing, and likewise values and wantValues, failing with a test error on
mismatch; preserve the existing element-by-element comparisons after these
guards.
internal/exec/yaml_func_tags.go (1)

13-19: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

componentMetadata silently returns nil on type assertion failure.

The metadata, _ := stackInfo.ComponentSection[cfg.MetadataSectionName].(map[string]any) discards the ok flag. If ComponentSection returns a non-map[string]any value (e.g., a typed struct), this silently produces a nil map. Consider logging or handling the assertion failure explicitly, especially during debugging when metadata is expected but not found.

However, since all callers already handle nil returns gracefully, this is a minor robustness concern.

🤖 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/yaml_func_tags.go` around lines 13 - 19, Update
componentMetadata to handle a failed assertion of
ComponentSection[cfg.MetadataSectionName] explicitly instead of discarding the
ok flag; preserve the existing nil result for absent or invalid metadata while
adding appropriate diagnostic logging when the value is present but not a
map[string]any.
🤖 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/auth/logout.go`:
- Around line 668-674: Update performTagsLogout so that after reporting
collected provider errors, it returns a non-nil aggregated error when errs is
non-empty, using the existing errors.Join pattern if available; retain nil for
fully successful logout. Keep performLogoutAll’s existing non-partial failure
behavior consistent with this change.

In `@cmd/helm/helm_test.go`:
- Around line 236-248: Update the expected selection error wording in
validateSelectionFlags to mention --all, --affected, --tags, and --labels. Add a
table-driven test alongside the existing component cannot combine with tags case
covering a component combined with --labels and asserting the broadened error
message.

In `@cmd/kubernetes/kubernetes_test.go`:
- Around line 155-173: Update the validation error expected by the “component
cannot be combined with tags” case in the Kubernetes command tests so it
includes --tags/--labels alongside --all and --affected. Ensure the
corresponding validation behavior and related Helm test expectation remain
consistent.

---

Nitpick comments:
In `@cmd/auth/logout.go`:
- Around line 676-679: Update performTagsLogout to call displayBrowserWarning()
and displayExternalCredentialWarnings() after reporting the logout result,
matching the post-logout behavior in performLogoutAll. Keep the existing success
message, blank line, and return flow intact.

In `@cmd/container/container.go`:
- Around line 120-122: Update the --tags handling in the command flag parsing
block to pass the slice returned by GetStringSlice directly into info.Tags,
avoiding strings.Join and the tags.ParseTagsFlag round-trip. If normalization is
required, use or add a helper that accepts []string while preserving pflag’s CSV
quoting behavior.

In `@cmd/container/dispatch_test.go`:
- Around line 59-60: Update the comment above the nil-safety assertion in the
dispatch tests to say “A verb without the withAllFlag” and ensure the comment
ends with a period.

In `@cmd/helm/helm.go`:
- Around line 98-99: Refactor command-specific flag registration in the Helm
command to use flags.NewStandardParser(), including the existing flags and the
new tags and labels flags, instead of cmd.Flags(). Preserve all current flag
names, defaults, descriptions, and parsing behavior while keeping registration
consistent throughout helm.go.

In `@internal/exec/yaml_func_tags.go`:
- Around line 13-19: Update componentMetadata to handle a failed assertion of
ComponentSection[cfg.MetadataSectionName] explicitly instead of discarding the
ok flag; preserve the existing nil result for absent or invalid metadata while
adding appropriate diagnostic logging when the value is present but not a
map[string]any.

In `@internal/exec/yaml_func_utils.go`:
- Around line 369-394: The dispatch-order comment above the tag checks
incorrectly implies that `.keys` and `.values` must precede the bare `!labels`
match. Reword it to state that these tags are handled as distinct exact matches,
without claiming ordering is required; leave the dispatch logic unchanged.

In `@pkg/component/graph_tags_test.go`:
- Around line 53-100: Add a subtest to TestFilterGraphByTagsAndLabels that
populates both Tags and Labels in ConfigAndStacksInfo, then verify FilterGraph
applies both criteria with AND semantics by asserting only the node matching the
tag and every label remains.

In `@pkg/tags/convert_test.go`:
- Around line 60-78: Update TestSortedKeysAndValues to compare the lengths of
keys and wantKeys before indexing, and likewise values and wantValues, failing
with a test error on mismatch; preserve the existing element-by-element
comparisons after these guards.

In `@pkg/tags/tags_test.go`:
- Around line 1-33: Add optional table-driven cases to TestMatchesTags covering
duplicate filter tags in TagModeAll and an unsupported or unknown TagMode, with
expected results matching the intended MatchesTags behavior; keep the existing
core matching cases unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ebb6bfce-c624-4baa-90c8-4587a925aca3

📥 Commits

Reviewing files that changed from the base of the PR and between b8688aa and 7d6ea7a.

📒 Files selected for processing (107)
  • cmd/auth/list.go
  • cmd/auth/list_test.go
  • cmd/auth/login.go
  • cmd/auth/login_test.go
  • cmd/auth/logout.go
  • cmd/auth/logout_test.go
  • cmd/container/container.go
  • cmd/container/dispatch_test.go
  • cmd/container/verbs.go
  • cmd/helm/helm.go
  • cmd/helm/helm_test.go
  • cmd/kubernetes/kubernetes.go
  • cmd/kubernetes/kubernetes_test.go
  • cmd/list/components.go
  • cmd/list/components_test.go
  • cmd/list/flag_wrappers.go
  • cmd/terraform/flags.go
  • cmd/terraform/options.go
  • cmd/terraform/utils.go
  • cmd/terraform/utils_test.go
  • demo/casts/atmos.d/examples/quick-start-advanced/list-instances.yaml
  • errors/errors.go
  • examples/demo-auth/README.md
  • examples/demo-auth/atmos.yaml
  • examples/quick-start-advanced/README.md
  • examples/quick-start-advanced/stacks/catalog/app-config/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/dynamodb-table/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/kms-key/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/s3-bucket/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/sns-topic/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/sqs-queue/defaults.yaml
  • internal/exec/yaml_func_tags.go
  • internal/exec/yaml_func_tags_test.go
  • internal/exec/yaml_func_utils.go
  • pkg/component/container/bulk.go
  • pkg/component/container/bulk_tags_test.go
  • pkg/component/container/list.go
  • pkg/component/graph.go
  • pkg/component/graph_tags_test.go
  • pkg/component/helm/executor.go
  • pkg/component/kubernetes/executor.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/datafetcher/schema/stacks/stack-config/1.0.json
  • pkg/function/tag/tag.go
  • pkg/function/tag/tag_test.go
  • pkg/function/tags.go
  • pkg/function/tags_test.go
  • pkg/list/extract/components.go
  • pkg/list/extract/components_test.go
  • pkg/list/filter/filter.go
  • pkg/list/filter/filter_test.go
  • pkg/scheduler/adapters/terraform.go
  • pkg/scheduler/adapters/terraform_tags_test.go
  • pkg/schema/schema.go
  • pkg/schema/schema_auth.go
  • pkg/tags/convert.go
  • pkg/tags/convert_test.go
  • pkg/tags/flags.go
  • pkg/tags/flags_test.go
  • pkg/tags/labels.go
  • pkg/tags/labels_test.go
  • pkg/tags/tags.go
  • pkg/tags/tags_test.go
  • pkg/utils/yaml_utils.go
  • pkg/utils/yaml_utils_test.go
  • pkg/utils/yaml_utils_unsupported_test.go
  • tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden
  • 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_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
  • website/blog/2026-07-11-tags-and-labels.mdx
  • website/docs/cli/commands/auth/auth-list.mdx
  • website/docs/cli/commands/auth/auth-login.mdx
  • website/docs/cli/commands/auth/logout.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/helm/usage.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/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
  • website/docs/functions/yaml/index.mdx
  • website/docs/functions/yaml/labels.keys.mdx
  • website/docs/functions/yaml/labels.mdx
  • website/docs/functions/yaml/labels.values.mdx
  • website/docs/functions/yaml/tags.mdx
  • website/docs/stacks/components/metadata.mdx
  • website/src/data/roadmap.js
  • website/static/casts/examples/quick-start-advanced/list-instances.cast

Comment thread cmd/auth/logout.go Resolved
Comment thread cmd/helm/helm_test.go Resolved
Comment thread cmd/kubernetes/kubernetes_test.go Resolved
@codecov

codecov Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.75220% with 64 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.67%. Comparing base (c0facc6) to head (3e97724).

Files with missing lines Patch % Lines
cmd/auth/login.go 59.64% 22 Missing and 1 partial ⚠️
internal/exec/yaml_func_utils.go 0.00% 8 Missing and 8 partials ⚠️
cmd/auth/logout.go 87.27% 6 Missing and 1 partial ⚠️
cmd/auth/list.go 92.00% 2 Missing and 2 partials ⚠️
cmd/container/verbs.go 77.77% 1 Missing and 1 partial ⚠️
cmd/list/components.go 87.50% 1 Missing and 1 partial ⚠️
cmd/terraform/options.go 60.00% 1 Missing and 1 partial ⚠️
internal/exec/yaml_func_tags.go 90.47% 1 Missing and 1 partial ⚠️
pkg/component/container/list.go 81.81% 1 Missing and 1 partial ⚠️
pkg/scheduler/adapters/terraform.go 94.44% 1 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2738      +/-   ##
==========================================
+ Coverage   81.64%   81.67%   +0.02%     
==========================================
  Files        1648     1653       +5     
  Lines      155530   156045     +515     
==========================================
+ Hits       126988   127450     +462     
- Misses      21583    21622      +39     
- Partials     6959     6973      +14     
Flag Coverage Δ
unittests 81.67% <88.75%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
cmd/container/container.go 83.95% <100.00%> (+0.83%) ⬆️
cmd/helm/helm.go 94.87% <100.00%> (+0.93%) ⬆️
cmd/kubernetes/kubernetes.go 93.71% <100.00%> (+0.46%) ⬆️
cmd/list/flag_wrappers.go 100.00% <100.00%> (ø)
cmd/terraform/flags.go 100.00% <100.00%> (ø)
cmd/terraform/utils.go 66.02% <100.00%> (+0.33%) ⬆️
errors/errors.go 100.00% <ø> (ø)
pkg/component/container/bulk.go 95.41% <100.00%> (+0.41%) ⬆️
pkg/component/graph.go 89.40% <100.00%> (+1.31%) ⬆️
pkg/component/helm/executor.go 82.35% <100.00%> (ø)
... and 22 more

... and 8 files with indirect coverage changes

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

Implements the tags-and-labels-standard PRD: `tags` on auth identities/providers
(filterable via `--tags` on auth list/login/logout); `metadata.tags`/`metadata.labels`
on components (filterable via `atmos list components --tags/--labels`); new
`!tags`/`!labels`/`!labels.keys`/`!labels.values` YAML functions for bridging
metadata into vars; and `--tags`/`--labels` bulk selection on terraform,
kubernetes, helm, and container operations, composing with `--all`/`--affected`.

Adds a shared pkg/tags package for the ANY-match tag/AND-match label predicates
used across all of the above, plus docs, a blog post, and roadmap updates.
…tion error

performTagsLogout previously returned nil even when some per-provider logouts
failed, masking failures in CI (exit code 0) despite printing an error summary.
Now joins and returns the accumulated errors, matching performLogoutAll's
existing behavior.

Also broadens the helm/kubernetes "component argument cannot be used with
--all or --affected" error to mention --tags/--labels, since those flags now
trigger the same validation path.

Addresses CodeRabbit review on #2738.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/auth/list_test.go`:
- Around line 252-266: Update the applyFilters tag test to request multiple
tags, such as “production” and “development,” and assert that providers and
identities matching either tag are retained while unrelated entries are
excluded. Preserve the existing assertions that verify the expected filtered
results and any-match semantics.

In `@pkg/component/container/bulk_tags_test.go`:
- Around line 142-163: The TestFilterByTagsAndLabels test lacks coverage for
combining tag and label filters. Add a subtest using the existing rows with Tags
set to production and Labels set to cost-center=data, then assert that
filterByTagsAndLabels returns no rows, verifying both criteria must match rather
than being combined with OR logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9d135861-6071-4cbe-acdf-2526cd22347d

📥 Commits

Reviewing files that changed from the base of the PR and between 7d6ea7a and 31aa95d.

📒 Files selected for processing (107)
  • cmd/auth/list.go
  • cmd/auth/list_test.go
  • cmd/auth/login.go
  • cmd/auth/login_test.go
  • cmd/auth/logout.go
  • cmd/auth/logout_test.go
  • cmd/container/container.go
  • cmd/container/dispatch_test.go
  • cmd/container/verbs.go
  • cmd/helm/helm.go
  • cmd/helm/helm_test.go
  • cmd/kubernetes/kubernetes.go
  • cmd/kubernetes/kubernetes_test.go
  • cmd/list/components.go
  • cmd/list/components_test.go
  • cmd/list/flag_wrappers.go
  • cmd/terraform/flags.go
  • cmd/terraform/options.go
  • cmd/terraform/utils.go
  • cmd/terraform/utils_test.go
  • demo/casts/atmos.d/examples/quick-start-advanced/list-instances.yaml
  • errors/errors.go
  • examples/demo-auth/README.md
  • examples/demo-auth/atmos.yaml
  • examples/quick-start-advanced/README.md
  • examples/quick-start-advanced/stacks/catalog/app-config/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/dynamodb-table/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/kms-key/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/s3-bucket/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/sns-topic/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/sqs-queue/defaults.yaml
  • internal/exec/yaml_func_tags.go
  • internal/exec/yaml_func_tags_test.go
  • internal/exec/yaml_func_utils.go
  • pkg/component/container/bulk.go
  • pkg/component/container/bulk_tags_test.go
  • pkg/component/container/list.go
  • pkg/component/graph.go
  • pkg/component/graph_tags_test.go
  • pkg/component/helm/executor.go
  • pkg/component/kubernetes/executor.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/datafetcher/schema/stacks/stack-config/1.0.json
  • pkg/function/tag/tag.go
  • pkg/function/tag/tag_test.go
  • pkg/function/tags.go
  • pkg/function/tags_test.go
  • pkg/list/extract/components.go
  • pkg/list/extract/components_test.go
  • pkg/list/filter/filter.go
  • pkg/list/filter/filter_test.go
  • pkg/scheduler/adapters/terraform.go
  • pkg/scheduler/adapters/terraform_tags_test.go
  • pkg/schema/schema.go
  • pkg/schema/schema_auth.go
  • pkg/tags/convert.go
  • pkg/tags/convert_test.go
  • pkg/tags/flags.go
  • pkg/tags/flags_test.go
  • pkg/tags/labels.go
  • pkg/tags/labels_test.go
  • pkg/tags/tags.go
  • pkg/tags/tags_test.go
  • pkg/utils/yaml_utils.go
  • pkg/utils/yaml_utils_test.go
  • pkg/utils/yaml_utils_unsupported_test.go
  • tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden
  • 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_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
  • website/blog/2026-07-11-tags-and-labels.mdx
  • website/docs/cli/commands/auth/auth-list.mdx
  • website/docs/cli/commands/auth/auth-login.mdx
  • website/docs/cli/commands/auth/logout.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/helm/usage.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/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
  • website/docs/functions/yaml/index.mdx
  • website/docs/functions/yaml/labels.keys.mdx
  • website/docs/functions/yaml/labels.mdx
  • website/docs/functions/yaml/labels.values.mdx
  • website/docs/functions/yaml/tags.mdx
  • website/docs/stacks/components/metadata.mdx
  • website/src/data/roadmap.js
  • website/static/casts/examples/quick-start-advanced/list-instances.cast
🚧 Files skipped from review as they are similar to previous changes (87)
  • tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden
  • examples/quick-start-advanced/stacks/catalog/kms-key/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/dynamodb-table/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/sns-topic/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/s3-bucket/defaults.yaml
  • demo/casts/atmos.d/examples/quick-start-advanced/list-instances.yaml
  • website/docs/cli/commands/list/list-components.mdx
  • examples/quick-start-advanced/stacks/catalog/sqs-queue/defaults.yaml
  • tests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
  • pkg/tags/tags.go
  • website/docs/cli/commands/helm/helm-template.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-apply.mdx
  • tests/snapshots/TestCLICommands_terraform_help_shows_stack_flag.stdout.golden
  • pkg/component/kubernetes/executor.go
  • cmd/list/flag_wrappers.go
  • website/docs/cli/commands/helm/helm-deploy.mdx
  • website/docs/cli/commands/helm/helm-delete.mdx
  • pkg/tags/flags_test.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • website/docs/cli/commands/auth/logout.mdx
  • website/docs/cli/commands/helm/usage.mdx
  • cmd/terraform/flags.go
  • pkg/tags/labels.go
  • tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
  • website/docs/cli/commands/helm/helm-diff.mdx
  • website/docs/cli/commands/auth/auth-list.mdx
  • website/docs/stacks/components/metadata.mdx
  • pkg/schema/schema.go
  • pkg/function/tags.go
  • pkg/tags/flags.go
  • pkg/tags/convert.go
  • website/docs/cli/commands/kubernetes/kubernetes-plan.mdx
  • website/docs/cli/commands/kubernetes/usage.mdx
  • pkg/schema/schema_auth.go
  • pkg/datafetcher/schema/stacks/stack-config/1.0.json
  • website/src/data/roadmap.js
  • website/docs/cli/commands/kubernetes/kubernetes-deploy.mdx
  • internal/exec/yaml_func_tags.go
  • tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden
  • pkg/tags/convert_test.go
  • tests/snapshots/TestCLICommands_terraform_provision_help_shows_inherited_stack_flag.stdout.golden
  • website/docs/cli/commands/kubernetes/kubernetes-validate.mdx
  • examples/quick-start-advanced/README.md
  • website/docs/cli/commands/kubernetes/kubernetes-delete.mdx
  • website/docs/cli/commands/kubernetes/kubernetes-diff.mdx
  • tests/snapshots/TestCLICommands_tf_plan_help_shows_inherited_stack_flag.stdout.golden
  • website/docs/cli/commands/terraform/terraform-apply.mdx
  • pkg/utils/yaml_utils_unsupported_test.go
  • website/docs/cli/commands/helm/helm-apply.mdx
  • pkg/function/tag/tag_test.go
  • pkg/component/graph_tags_test.go
  • pkg/list/extract/components_test.go
  • pkg/utils/yaml_utils.go
  • internal/exec/yaml_func_tags_test.go
  • pkg/tags/labels_test.go
  • pkg/utils/yaml_utils_test.go
  • pkg/list/filter/filter_test.go
  • cmd/auth/login_test.go
  • examples/demo-auth/atmos.yaml
  • internal/exec/yaml_func_utils.go
  • pkg/function/tag/tag.go
  • website/docs/cli/commands/terraform/terraform-plan.mdx
  • pkg/scheduler/adapters/terraform_tags_test.go
  • cmd/container/dispatch_test.go
  • tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden
  • cmd/kubernetes/kubernetes.go
  • pkg/component/helm/executor.go
  • cmd/auth/logout_test.go
  • pkg/function/tags_test.go
  • website/docs/cli/commands/terraform/terraform-deploy.mdx
  • cmd/kubernetes/kubernetes_test.go
  • cmd/helm/helm.go
  • cmd/container/verbs.go
  • pkg/list/filter/filter.go
  • pkg/component/container/bulk.go
  • pkg/component/container/list.go
  • pkg/list/extract/components.go
  • pkg/scheduler/adapters/terraform.go
  • cmd/list/components_test.go
  • website/docs/cli/commands/kubernetes/kubernetes-render.mdx
  • cmd/auth/logout.go
  • cmd/terraform/options.go
  • cmd/helm/helm_test.go
  • cmd/terraform/utils_test.go
  • cmd/container/container.go
  • cmd/terraform/utils.go
  • website/static/casts/examples/quick-start-advanced/list-instances.cast

Comment thread cmd/auth/list_test.go Resolved
Adds targeted tests for the previously-undertested lines this PR introduced:
listTagsFlagCompletion, the --tags dispatch branch in authenticateIdentity,
the tags-mutually-exclusive and --tags dispatch paths in
executeAuthLogoutCommand, the errors.Join partial-failure path in
performTagsLogout, the --tags filter path in executeAuthListCommand, and
parseLabelsFlag in cmd/terraform/options.go (previously untested).
@github-actions github-actions Bot added size/xl Extra large size PR and removed size/l Large size PR labels Jul 12, 2026
Addresses CodeRabbit review on #2738: the applyFilters tags test only used a
single tag, so it couldn't distinguish any-match from all-match; and
TestFilterByTagsAndLabels never combined tags with labels, so an accidental
OR between the two dimensions would have gone undetected.
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026
Reframe the intro and section ordering around the everyday case
(filtering components/stacks by tag) instead of opening with an
auth-identity scenario most readers won't relate to. Auth is now
presented as an extension of the same standard, not the headline.

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.

🧹 Nitpick comments (2)
website/blog/2026-07-11-tags-and-labels.mdx (2)

86-100: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Clarify the count of new YAML functions.

Line 86 says "two new YAML functions" but the post goes on to introduce !tags, !labels, !labels.keys, and !labels.values — four functions total. The "two" framing likely refers to !tags and !labels as the primary forms with .keys/.values as helpers, but this can confuse readers counting the functions.

✏️ Suggested rewording
-**Bridging into your modules** — two new YAML functions read a component's own `metadata.tags`/`metadata.labels` without the usual `!template`/`toJson` boilerplate. The most common use is feeding `metadata.labels` into the `var.tags` a `terraform-null-label`-style module expects (Terraform and AWS call a map "tags"; Atmos calls it a "label" — same data, different name):
+**Bridging into your modules** — new YAML functions read a component's own `metadata.tags`/`metadata.labels` without the usual `!template`/`toJson` boilerplate. The most common use is feeding `metadata.labels` into the `var.tags` a `terraform-null-label`-style module expects (Terraform and AWS call a map "tags"; Atmos calls it a "label" — same data, different name):
🤖 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/blog/2026-07-11-tags-and-labels.mdx` around lines 86 - 100, Update
the opening description around the YAML tag/label helpers to clarify that there
are four functions total: primary !tags and !labels forms plus the !labels.keys
and !labels.values helpers. Keep the existing examples and behavior unchanged.

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

Capitalize "Terraform" in prose for consistency.

Line 104 uses lowercase "terraform" while line 18 capitalizes it as "Terraform" in the same prose context. CLI commands correctly use lowercase, but prose should be consistent.

✏️ Suggested fix
-Tags and labels are supported today on components across terraform, Kubernetes, Helm, and container components, and on auth identities and providers.
+Tags and labels are supported today on components across Terraform, Kubernetes, Helm, and container components, and on auth identities and providers.
🤖 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/blog/2026-07-11-tags-and-labels.mdx` at line 104, Update the prose in
the tags-and-labels blog content to capitalize “terraform” as “Terraform” in the
sentence listing supported components, matching the existing capitalization used
elsewhere while leaving CLI command names unchanged.
🤖 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.

Nitpick comments:
In `@website/blog/2026-07-11-tags-and-labels.mdx`:
- Around line 86-100: Update the opening description around the YAML tag/label
helpers to clarify that there are four functions total: primary !tags and
!labels forms plus the !labels.keys and !labels.values helpers. Keep the
existing examples and behavior unchanged.
- Line 104: Update the prose in the tags-and-labels blog content to capitalize
“terraform” as “Terraform” in the sentence listing supported components,
matching the existing capitalization used elsewhere while leaving CLI command
names unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7a671bbc-087a-4cd6-8a70-d775fba39d74

📥 Commits

Reviewing files that changed from the base of the PR and between 519fc5f and 444147e.

📒 Files selected for processing (1)
  • website/blog/2026-07-11-tags-and-labels.mdx

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026
…o types

Drop []string/map[string]string syntax in favor of plain English, and
reframe The Problem around the actual use case (annotating infra to
target slices of it, the same reason cloud tags and Kubernetes labels
exist) instead of framing gaps in Atmos's own CLI flags as the problem.

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: 2

🤖 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/blog/2026-07-11-tags-and-labels.mdx`:
- Around line 8-10: Update the introductory paragraph around the sentence
beginning “Tags and labels give components” to remove unsupported claims about
stacks and accounts. Limit the stated tagging and labeling support to components
and auth identities/providers, while preserving the point that organizational
context enables selection by what infrastructure is rather than where it is
filed.
- Line 105: Update the supported-resource sentence in the blog content to
distinguish terminology accurately: refer to tags for auth identities and
providers, while retaining labels only for component types that expose labels.
Keep the surrounding cloud-provider metadata example and wording unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 98ef5785-5746-490c-9f1b-a50f182e616e

📥 Commits

Reviewing files that changed from the base of the PR and between 519fc5f and 4c0b85c.

📒 Files selected for processing (1)
  • website/blog/2026-07-11-tags-and-labels.mdx

Verified against internal/exec/yaml_func_tags.go: there are four YAML
functions (!tags, !labels, !labels.keys, !labels.values), not two.
Also fix inconsistent lowercase "terraform" in the Get Involved
paragraph to match "Terraform" used elsewhere in prose.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 13, 2026
Verified against pkg/schema/schema_auth.go: Provider and Identity
structs only define Tags []string, no Labels field, and no auth
code path calls tags.MatchesLabels. Component metadata (terraform/
kubernetes/helm/container) supports both tags and labels via the
generic metadata map. Corrected the Get Involved sentence to stop
implying labels apply to auth.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@osterman

Copy link
Copy Markdown
Member Author

CodeRabbit (@coderabbitai) full review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

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

⚠️ Outside diff range comments (1)
pkg/datafetcher/schema/atmos/manifest/1.0.json (1)

1365-1446: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Mirror metadata.tags and metadata.labels in pkg/datafetcher/schema/atmos/manifest/1.0.json.
This metadata object is still additionalProperties: false and doesn’t list the new fields, so component manifests using tags or labels will be rejected here even though pkg/datafetcher/schema/stacks/stack-config/1.0.json already allows them.

🤖 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/datafetcher/schema/atmos/manifest/1.0.json` around lines 1365 - 1446,
Update the metadata.properties schema in the manifest definition to add tags and
labels, matching the corresponding definitions in the stack-config schema. Keep
metadata.additionalProperties set to false and preserve the existing field types
and validation behavior.
♻️ Duplicate comments (1)
website/blog/2026-07-11-tags-and-labels.mdx (1)

10-10: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Line 10 still overclaims scope: stacks, accounts, and labels for auth.

This sentence implies tags and labels are supported on stacks, accounts, and auth identities. Per line 103 and the PR scope, only components support both tags and labels; auth identities and providers support tags only; stacks and accounts are not supported at all. This was flagged in a previous review and marked addressed, but the current text still contains the overclaim.

Suggested fix:

-Tags and labels give components — and stacks, accounts, and auth identities — that organizational context directly, so you can select and act on infrastructure by what it is instead of by where you filed it.
+Tags and labels give components — and auth identities and providers — that organizational context directly, so you can select and act on infrastructure by what it is instead of by where you filed 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 `@website/blog/2026-07-11-tags-and-labels.mdx` at line 10, Update the
introductory sentence near the opening of the article to accurately state that
components support both tags and labels, auth identities and providers support
tags only, and stacks and accounts are outside the supported scope; remove the
implication that labels apply to all listed resource types.
🧹 Nitpick comments (9)
cmd/auth/login.go (1)

260-282: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

DRY: buildNoIdentitiesMatchTagsError and buildNoProvidersMatchTagsError are structural clones. Both functions aggregate tags from a map of items, sort them, and build a "no match" error with the same hint format — only the map type, sentinel, and entity name differ. Extract a generic CollectAvailableTags helper into pkg/tags to eliminate the duplication.

  • cmd/auth/login.go#L260-L282: Replace inline tag aggregation with tags.CollectAvailableTags(identities, func(id schema.Identity) []string { return id.Tags }).
  • cmd/auth/logout.go#L683-L705: Replace inline tag aggregation with tags.CollectAvailableTags(providers, func(p schema.Provider) []string { return p.Tags }).
♻️ Proposed shared helper
// pkg/tags/tags.go
import "sort"

// CollectAvailableTags gathers all unique tags from a map of items and returns them sorted.
func CollectAvailableTags[T any](items map[string]T, getTags func(T) []string) []string {
	tagSet := make(map[string]struct{})
	for name := range items {
		for _, tag := range getTags(items[name]) {
			tagSet[tag] = struct{}{}
		}
	}
	availableTags := make([]string, 0, len(tagSet))
	for tag := range tagSet {
		availableTags = append(availableTags, tag)
	}
	sort.Strings(availableTags)
	return availableTags
}
🤖 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/auth/login.go` around lines 260 - 282, Extract the shared sorted tag
aggregation into pkg/tags as CollectAvailableTags[T any](items map[string]T,
getTags func(T) []string), then update cmd/auth/login.go lines 260-282 in
buildNoIdentitiesMatchTagsError to call tags.CollectAvailableTags with
schema.Identity tags, and cmd/auth/logout.go lines 683-705 in
buildNoProvidersMatchTagsError to call it with schema.Provider tags; preserve
each function’s existing error sentinel and hint formatting.
pkg/component/graph_tags_test.go (1)

102-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding a combined tags+labels test case.

TestMatchesGraphTagsAndLabels covers tags-only and labels-only paths, but matchesGraphTagsAndLabels also handles both set simultaneously (graph.go lines 228-239). A combined case would close that gap.

🧪 Suggested additional sub-test
 	t.Run("labels all-match", func(t *testing.T) {
 		require.True(t, matchesGraphTagsAndLabels(node, &schema.ConfigAndStacksInfo{Labels: map[string]string{"compliance": "sox"}}))
 		require.False(t, matchesGraphTagsAndLabels(node, &schema.ConfigAndStacksInfo{Labels: map[string]string{"compliance": "wrong"}}))
 	})
+
+	t.Run("tags and labels combined", func(t *testing.T) {
+		require.True(t, matchesGraphTagsAndLabels(node, &schema.ConfigAndStacksInfo{
+			Tags:   []string{"production"},
+			Labels: map[string]string{"cost-center": "platform"},
+		}))
+		require.False(t, matchesGraphTagsAndLabels(node, &schema.ConfigAndStacksInfo{
+			Tags:   []string{"nonexistent"},
+			Labels: map[string]string{"cost-center": "platform"},
+		}))
+		require.False(t, matchesGraphTagsAndLabels(node, &schema.ConfigAndStacksInfo{
+			Tags:   []string{"production"},
+			Labels: map[string]string{"cost-center": "wrong"},
+		}))
+	})
 }
🤖 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/component/graph_tags_test.go` around lines 102 - 120, The
TestMatchesGraphTagsAndLabels coverage lacks a case where tags and labels are
provided together. Add a sub-test invoking matchesGraphTagsAndLabels with both
matching tags and labels, asserting it succeeds, and another with one mismatched
criterion asserting it fails.
pkg/tags/flags_test.go (1)

32-67: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add test for values containing =.

ParseLabelsFlag uses strings.Cut which splits on the first =, so "key=val=ue" produces {"key": "val=ue"}. This is an important edge case worth a test to lock in the behavior.

🧪 Suggested additional test case
+	t.Run("value containing equals sign", func(t *testing.T) {
+		got, err := ParseLabelsFlag("key=val=ue")
+		if err != nil {
+			t.Fatalf("unexpected error: %v", err)
+		}
+		if got["key"] != "val=ue" {
+			t.Fatalf("ParseLabelsFlag() = %v, want key=val=ue", got)
+		}
+	})
+
 	t.Run("missing equals sign errors", func(t *testing.T) {
🤖 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/flags_test.go` around lines 32 - 67, Add a subtest to
TestParseLabelsFlag covering a value containing an additional equals sign, such
as key=val=ue; assert parsing succeeds and returns the key mapped to the
complete value val=ue, preserving the first-equals-sign split behavior.
cmd/helm/helm.go (1)

98-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use flags.NewStandardParser() instead of cmd.Flags() for command-specific flags.

The new --tags and --labels flags are registered via cmd.Flags().StringSlice() and cmd.Flags().String() directly, while the equivalent flags in cmd/kubernetes/kubernetes.go and cmd/container/verbs.go use flags.NewStandardParser(). The coding guidelines require flags.NewStandardParser() for command-specific flags. Consider migrating all flags in newOperationCommand to the standard parser pattern (as operationFlagOptions does in the kubernetes file) for both guideline compliance and cross-file consistency.

♻️ Suggested refactor: migrate to standard parser
 func newOperationCommand(name, short string) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:   name + " [component]",
 		Args:  validateOperationArgs,
 		Short: short,
 		RunE: func(cmd *cobra.Command, args []string) error {
 			return runOperation(cmd, name, args)
 		},
 	}

-	cmd.Flags().Bool("all", false, "Process all Helm components in dependency order.")
-	cmd.Flags().Bool("affected", false, "Process affected Helm components in dependency order.")
-	cmd.Flags().Bool("ci", false, "Enable CI mode for automated pipelines (writes job summary).")
-	cmd.Flags().Bool("include-dependents", false, "Include dependent components when processing affected Helm components.")
-	cmd.Flags().String("repo-path", "", "Path to the already cloned target repository to use as the affected baseline.")
-	cmd.Flags().String("base", "", "Git base ref or SHA to compare against for affected detection.")
-	cmd.Flags().String("ref", "", "Git ref to compare against for affected detection.")
-	cmd.Flags().String("sha", "", "Git SHA to compare against for affected detection.")
-	cmd.Flags().String("ssh-key", "", "Path to the SSH private key used to clone the target ref for affected detection.")
-	cmd.Flags().String("ssh-key-password", "", "Password for the SSH private key used to clone the target ref for affected detection.")
-	cmd.Flags().Bool("clone-target-ref", false, "Clone the target ref instead of checking it out in the current repository for affected detection.")
-	cmd.Flags().StringSlice("tags", nil, "Filter by tags (comma-separated, matches any): --tags=production,tier-1")
-	cmd.Flags().String("labels", "", "Filter by labels (comma-separated key=value pairs, matches all): --labels=cost-center=platform,compliance=sox")
+	options := []flags.Option{
+		flags.WithBoolFlag("all", "", false, "Process all Helm components in dependency order."),
+		flags.WithBoolFlag("affected", "", false, "Process affected Helm components in dependency order."),
+		flags.WithBoolFlag("ci", "", false, "Enable CI mode for automated pipelines (writes job summary)."),
+		flags.WithBoolFlag("include-dependents", "", false, "Include dependent components when processing affected Helm components."),
+		flags.WithStringFlag("repo-path", "", "", "Path to the already cloned target repository to use as the affected baseline."),
+		flags.WithStringFlag("base", "", "", "Git base ref or SHA to compare against for affected detection."),
+		flags.WithStringFlag("ref", "", "", "Git ref to compare against for affected detection."),
+		flags.WithStringFlag("sha", "", "", "Git SHA to compare against for affected detection."),
+		flags.WithStringFlag("ssh-key", "", "", "Path to the SSH private key used to clone the target ref for affected detection."),
+		flags.WithStringFlag("ssh-key-password", "", "", "Password for the SSH private key used to clone the target ref for affected detection."),
+		flags.WithBoolFlag("clone-target-ref", "", false, "Clone the target ref instead of checking it out in the current repository for affected detection."),
+		flags.WithStringSliceFlag("tags", "", nil, "Filter by tags (comma-separated, matches any): --tags=production,tier-1"),
+		flags.WithStringFlag("labels", "", "", "Filter by labels (comma-separated key=value pairs, matches all): --labels=cost-center=platform,compliance=sox"),
+	}
+
 	if name == "template" {
-		cmd.Flags().String("output", "", "Write rendered manifests to a single multi-document YAML file.")
-		cmd.Flags().String("output-dir", "", "Write rendered manifests to a directory.")
-		cmd.Flags().Bool("split", false, "Write one rendered manifest file per object. Requires --output-dir.")
+		options = append(options,
+			flags.WithStringFlag("output", "", "", "Write rendered manifests to a single multi-document YAML file."),
+			flags.WithStringFlag("output-dir", "", "", "Write rendered manifests to a directory."),
+			flags.WithBoolFlag("split", "", false, "Write one rendered manifest file per object. Requires --output-dir."),
+		)
 	}

 	if name == "apply" || name == "deploy" {
-		cmd.Flags().String("target", "", "Provision target to deliver to (e.g. a git deployment repository). Defaults to provision.default, otherwise the cluster.")
+		options = append(options,
+			flags.WithStringFlag("target", "", "", "Provision target to deliver to (e.g. a git deployment repository). Defaults to provision.default, otherwise the cluster."),
+		)
 	}

 	if name == "diff" || name == "plan" {
-		cmd.Flags().String("against", "", "Baseline to diff against: 'release' (the deployed release, default), or 'target[:<name>]' for the git deployment-repo provision target (offline).")
-		cmd.Flags().String("from-manifest", "", "Diff against a local baseline manifest file instead of the cluster (offline).")
-		cmd.Flags().Int("context", 3, "Number of unchanged context lines to show around each change.")
+		options = append(options,
+			flags.WithStringFlag("against", "", "", "Baseline to diff against: 'release' (the deployed release, default), or 'target[:<name>]' for the git deployment-repo provision target (offline)."),
+			flags.WithStringFlag("from-manifest", "", "", "Diff against a local baseline manifest file instead of the cluster (offline)."),
+			flags.WithIntFlag("context", "", 3, "Number of unchanged context lines to show around each change."),
+		)
 	}

+	parser := flags.NewStandardParser(options...)
+	parser.RegisterFlags(cmd)
+
 	return cmd
 }
🤖 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/helm/helm.go` around lines 98 - 99, Update newOperationCommand to
register the command-specific tags and labels options through
flags.NewStandardParser(), following the operationFlagOptions pattern in the
Kubernetes command, and migrate its other command-specific flags to the same
parser where applicable. Remove direct cmd.Flags() registration while preserving
the existing flag names, types, defaults, and descriptions.

Source: Coding guidelines

cmd/list/components.go (1)

106-148: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

parseTagsFlag/parseLabelsFlag and their tests are duplicated from pkg/tags. The root cause is that these parsing functions were copied into cmd/list instead of being exported from pkg/tags and imported, violating the guideline to extend existing code rather than duplicate it.

  • cmd/list/components.go#L106-L148: Export ParseTagsFlag and ParseLabelsFlag from pkg/tags and import them here instead of defining local copies. Remove the local parseTagsFlag and parseLabelsFlag functions.
  • cmd/list/components_test.go#L342-L391: Remove TestParseTagsFlag and TestParseLabelsFlag — the identical tests in pkg/tags/flags_test.go already cover the exported functions.
🤖 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/components.go` around lines 106 - 148, The tag and label parsers are
duplicated in cmd/list instead of being reused from pkg/tags. In
cmd/list/components.go lines 106-148, export the existing pkg/tags parser
functions as ParseTagsFlag and ParseLabelsFlag, import and use them in place of
the local parseTagsFlag and parseLabelsFlag definitions, and remove those local
functions. In cmd/list/components_test.go lines 342-391, remove
TestParseTagsFlag and TestParseLabelsFlag because pkg/tags/flags_test.go already
covers the exported implementations.

Source: Coding guidelines

cmd/terraform/options.go (1)

97-129: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the shared label parser. pkg/tags.ParseLabelsFlag already covers this comma-separated key=value format and is used by the other command families, so keeping a second implementation here just risks drift in trimming and error text.

🤖 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/terraform/options.go` around lines 97 - 129, The local parseLabelsFlag
implementation duplicates shared behavior; replace its use and remove the
duplicate helper by importing and calling pkg/tags.ParseLabelsFlag when parsing
the labels option. Preserve the existing error propagation and opts.Labels
assignment, relying on the shared parser’s trimming and validation behavior.

Source: Coding guidelines

pkg/tags/convert_test.go (1)

60-78: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider adding nil and empty-map edge cases to TestSortedKeysAndValues.

SortedKeys and SortedValues handle nil and empty maps correctly (Go's len(nil) returns 0 and range over a nil map is a no-op), but these paths aren't exercised by the current test. Adding them would guard against future regressions.

♻️ Proposed additional test cases
 func TestSortedKeysAndValues(t *testing.T) {
 	m := map[string]string{"b": "2", "a": "1", "c": "3"}
 
 	keys := SortedKeys(m)
 	wantKeys := []string{"a", "b", "c"}
 	for i := range wantKeys {
 		if keys[i] != wantKeys[i] {
 			t.Fatalf("SortedKeys() = %v, want %v", keys, wantKeys)
 		}
 	}
 
 	values := SortedValues(m)
 	wantValues := []string{"1", "2", "3"}
 	for i := range wantValues {
 		if values[i] != wantValues[i] {
 			t.Fatalf("SortedValues() = %v, want %v", values, wantValues)
 		}
 	}
+
+	t.Run("nil map returns empty slices", func(t *testing.T) {
+		assert.Empty(t, SortedKeys(nil))
+		assert.Empty(t, SortedValues(nil))
+	})
+
+	t.Run("empty map returns empty slices", func(t *testing.T) {
+		assert.Empty(t, SortedKeys(map[string]string{}))
+		assert.Empty(t, SortedValues(map[string]string{}))
+	})
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/tags/convert_test.go` around lines 60 - 78, Extend
TestSortedKeysAndValues with nil-map and empty-map cases, asserting that both
SortedKeys and SortedValues return empty results without errors. Keep the
existing non-empty ordering assertions unchanged.
pkg/component/container/list.go (1)

149-161: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider returning empty slices/maps instead of nil for consistency.

tagsAndLabelsFromComponent returns nil, nil when metadata is missing, but tags.ToStringSlice/tags.ToStringMap return empty non-nil values when metadata exists but tags/labels don't. This means instanceRow.tags can be either nil or []string{} depending on whether the component has a metadata block. While functionally equivalent for filtering, the inconsistency could surface in JSON output (null vs []) or equality assertions.

♻️ Proposed refactor for consistent empty values
 func tagsAndLabelsFromComponent(compData any) ([]string, map[string]string) {
 	compMap, ok := compData.(map[string]any)
 	if !ok {
-		return nil, nil
+		return []string{}, map[string]string{}
 	}
 	metadata, ok := compMap["metadata"].(map[string]any)
 	if !ok {
-		return nil, nil
+		return []string{}, map[string]string{}
 	}
 	return tags.ToStringSlice(metadata["tags"]), tags.ToStringMap(metadata["labels"])
 }
🤖 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/component/container/list.go` around lines 149 - 161, Update
tagsAndLabelsFromComponent to return empty non-nil slices and maps whenever
compData is not a map or metadata is absent, matching the values produced by
tags.ToStringSlice and tags.ToStringMap for missing fields. Preserve the
existing extraction behavior when metadata is present.
pkg/tags/tags_test.go (1)

13-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding edge cases for TagModeAll with empty filter and duplicate tags.

The table covers TagModeAny with empty filter and duplicate filter tags, but the equivalent TagModeAll cases are missing. Since MatchesTags returns true for empty filterTags regardless of mode, an TagModeAll empty-filter case would lock that contract.

♻️ Suggested additional test cases
 		{"any: duplicate filter tags", []string{"a"}, []string{"a", "a"}, TagModeAny, true},
+		{"all: empty filter matches all", []string{"a"}, nil, TagModeAll, true},
+		{"all: empty filter matches entity with no tags", nil, nil, TagModeAll, true},
+		{"all: duplicate filter tags", []string{"a", "b"}, []string{"a", "a"}, TagModeAll, true},
 	}
🤖 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/tags_test.go` around lines 13 - 23, The MatchesTags table-driven
tests should also cover TagModeAll edge cases. Add cases for an empty filter
matching both tagged and untagged entities, plus duplicate filter tags under
TagModeAll, preserving the expected true/false results consistent with
MatchesTags behavior.
🤖 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/auth/logout.go`:
- Around line 615-681: Reduce the funlen violation in performTagsLogout by
either adding a targeted //nolint:funlen annotation or extracting the dry-run
and keychain-confirmation branches into focused helpers. Preserve the existing
provider matching, confirmation, logout, error aggregation, and success
behavior.

In `@internal/exec/yaml_func_tags.go`:
- Around line 10-12: Update the multi-line comment for componentMetadata so its
final line ends with a period, without changing the surrounding description or
implementation.

In `@website/docs/stacks/components/metadata.mdx`:
- Line 246: Add a route slug for the list-components documentation page
identified by its frontmatter `id: components`, using
`/cli/commands/list/components` so the existing link resolves; preserve the
current document content and metadata.

---

Outside diff comments:
In `@pkg/datafetcher/schema/atmos/manifest/1.0.json`:
- Around line 1365-1446: Update the metadata.properties schema in the manifest
definition to add tags and labels, matching the corresponding definitions in the
stack-config schema. Keep metadata.additionalProperties set to false and
preserve the existing field types and validation behavior.

---

Duplicate comments:
In `@website/blog/2026-07-11-tags-and-labels.mdx`:
- Line 10: Update the introductory sentence near the opening of the article to
accurately state that components support both tags and labels, auth identities
and providers support tags only, and stacks and accounts are outside the
supported scope; remove the implication that labels apply to all listed resource
types.

---

Nitpick comments:
In `@cmd/auth/login.go`:
- Around line 260-282: Extract the shared sorted tag aggregation into pkg/tags
as CollectAvailableTags[T any](items map[string]T, getTags func(T) []string),
then update cmd/auth/login.go lines 260-282 in buildNoIdentitiesMatchTagsError
to call tags.CollectAvailableTags with schema.Identity tags, and
cmd/auth/logout.go lines 683-705 in buildNoProvidersMatchTagsError to call it
with schema.Provider tags; preserve each function’s existing error sentinel and
hint formatting.

In `@cmd/helm/helm.go`:
- Around line 98-99: Update newOperationCommand to register the command-specific
tags and labels options through flags.NewStandardParser(), following the
operationFlagOptions pattern in the Kubernetes command, and migrate its other
command-specific flags to the same parser where applicable. Remove direct
cmd.Flags() registration while preserving the existing flag names, types,
defaults, and descriptions.

In `@cmd/list/components.go`:
- Around line 106-148: The tag and label parsers are duplicated in cmd/list
instead of being reused from pkg/tags. In cmd/list/components.go lines 106-148,
export the existing pkg/tags parser functions as ParseTagsFlag and
ParseLabelsFlag, import and use them in place of the local parseTagsFlag and
parseLabelsFlag definitions, and remove those local functions. In
cmd/list/components_test.go lines 342-391, remove TestParseTagsFlag and
TestParseLabelsFlag because pkg/tags/flags_test.go already covers the exported
implementations.

In `@cmd/terraform/options.go`:
- Around line 97-129: The local parseLabelsFlag implementation duplicates shared
behavior; replace its use and remove the duplicate helper by importing and
calling pkg/tags.ParseLabelsFlag when parsing the labels option. Preserve the
existing error propagation and opts.Labels assignment, relying on the shared
parser’s trimming and validation behavior.

In `@pkg/component/container/list.go`:
- Around line 149-161: Update tagsAndLabelsFromComponent to return empty non-nil
slices and maps whenever compData is not a map or metadata is absent, matching
the values produced by tags.ToStringSlice and tags.ToStringMap for missing
fields. Preserve the existing extraction behavior when metadata is present.

In `@pkg/component/graph_tags_test.go`:
- Around line 102-120: The TestMatchesGraphTagsAndLabels coverage lacks a case
where tags and labels are provided together. Add a sub-test invoking
matchesGraphTagsAndLabels with both matching tags and labels, asserting it
succeeds, and another with one mismatched criterion asserting it fails.

In `@pkg/tags/convert_test.go`:
- Around line 60-78: Extend TestSortedKeysAndValues with nil-map and empty-map
cases, asserting that both SortedKeys and SortedValues return empty results
without errors. Keep the existing non-empty ordering assertions unchanged.

In `@pkg/tags/flags_test.go`:
- Around line 32-67: Add a subtest to TestParseLabelsFlag covering a value
containing an additional equals sign, such as key=val=ue; assert parsing
succeeds and returns the key mapped to the complete value val=ue, preserving the
first-equals-sign split behavior.

In `@pkg/tags/tags_test.go`:
- Around line 13-23: The MatchesTags table-driven tests should also cover
TagModeAll edge cases. Add cases for an empty filter matching both tagged and
untagged entities, plus duplicate filter tags under TagModeAll, preserving the
expected true/false results consistent with MatchesTags behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 29f9f94f-c7e1-45aa-859f-8562fe478679

📥 Commits

Reviewing files that changed from the base of the PR and between 86edc83 and d7cbe8f.

📒 Files selected for processing (108)
  • cmd/auth/list.go
  • cmd/auth/list_test.go
  • cmd/auth/login.go
  • cmd/auth/login_test.go
  • cmd/auth/logout.go
  • cmd/auth/logout_test.go
  • cmd/container/container.go
  • cmd/container/dispatch_test.go
  • cmd/container/verbs.go
  • cmd/helm/helm.go
  • cmd/helm/helm_test.go
  • cmd/kubernetes/kubernetes.go
  • cmd/kubernetes/kubernetes_test.go
  • cmd/list/components.go
  • cmd/list/components_test.go
  • cmd/list/flag_wrappers.go
  • cmd/terraform/flags.go
  • cmd/terraform/options.go
  • cmd/terraform/options_test.go
  • cmd/terraform/utils.go
  • cmd/terraform/utils_test.go
  • demo/casts/atmos.d/examples/quick-start-advanced/list-instances.yaml
  • errors/errors.go
  • examples/demo-auth/README.md
  • examples/demo-auth/atmos.yaml
  • examples/quick-start-advanced/README.md
  • examples/quick-start-advanced/stacks/catalog/app-config/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/dynamodb-table/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/kms-key/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/s3-bucket/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/sns-topic/defaults.yaml
  • examples/quick-start-advanced/stacks/catalog/sqs-queue/defaults.yaml
  • internal/exec/yaml_func_tags.go
  • internal/exec/yaml_func_tags_test.go
  • internal/exec/yaml_func_utils.go
  • pkg/component/container/bulk.go
  • pkg/component/container/bulk_tags_test.go
  • pkg/component/container/list.go
  • pkg/component/graph.go
  • pkg/component/graph_tags_test.go
  • pkg/component/helm/executor.go
  • pkg/component/kubernetes/executor.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/datafetcher/schema/stacks/stack-config/1.0.json
  • pkg/function/tag/tag.go
  • pkg/function/tag/tag_test.go
  • pkg/function/tags.go
  • pkg/function/tags_test.go
  • pkg/list/extract/components.go
  • pkg/list/extract/components_test.go
  • pkg/list/filter/filter.go
  • pkg/list/filter/filter_test.go
  • pkg/scheduler/adapters/terraform.go
  • pkg/scheduler/adapters/terraform_tags_test.go
  • pkg/schema/schema.go
  • pkg/schema/schema_auth.go
  • pkg/tags/convert.go
  • pkg/tags/convert_test.go
  • pkg/tags/flags.go
  • pkg/tags/flags_test.go
  • pkg/tags/labels.go
  • pkg/tags/labels_test.go
  • pkg/tags/tags.go
  • pkg/tags/tags_test.go
  • pkg/utils/yaml_utils.go
  • pkg/utils/yaml_utils_test.go
  • pkg/utils/yaml_utils_unsupported_test.go
  • tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden
  • 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_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
  • website/blog/2026-07-11-tags-and-labels.mdx
  • website/docs/cli/commands/auth/auth-list.mdx
  • website/docs/cli/commands/auth/auth-login.mdx
  • website/docs/cli/commands/auth/logout.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/helm/usage.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/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
  • website/docs/functions/yaml/index.mdx
  • website/docs/functions/yaml/labels.keys.mdx
  • website/docs/functions/yaml/labels.mdx
  • website/docs/functions/yaml/labels.values.mdx
  • website/docs/functions/yaml/tags.mdx
  • website/docs/stacks/components/metadata.mdx
  • website/src/data/roadmap.js
  • website/static/casts/examples/quick-start-advanced/list-instances.cast

Comment thread cmd/auth/logout.go Resolved
Comment thread internal/exec/yaml_func_tags.go Resolved
Verified against current code; only still-valid CodeRabbit findings applied
(funlen and comment-period findings from the earlier review were already
resolved, and the docs-slug finding was a false positive — build with
onBrokenLinks: 'throw' already succeeds).

- pkg/datafetcher/schema/atmos/manifest/1.0.json: add tags/labels to the
  metadata definition, matching stacks/stack-config/1.0.json (was rejecting
  metadata.tags/labels under additionalProperties: false).
- website/blog/2026-07-11-tags-and-labels.mdx: fix intro sentence that
  implied labels apply to stacks/accounts/auth (only components support
  both; auth identities/providers support tags only).
- cmd/helm/helm.go: migrate newOperationCommand to flags.NewStandardParser()
  via an operationFlagOptions helper, matching the kubernetes command's
  established pattern instead of direct cmd.Flags() registration.
- cmd/list/components.go, cmd/terraform/options.go: replace local
  parseTagsFlag/parseLabelsFlag duplicates with the shared, already-exported
  pkg/tags.ParseTagsFlag/ParseLabelsFlag; drop now-redundant local tests
  (coverage already exists in pkg/tags), adding the one edge case
  (blank segments) that wasn't already covered there.
- pkg/tags/tags.go: add CollectAvailableTags[T] to dedup the identical
  sorted-tag-aggregation logic in cmd/auth/login.go and cmd/auth/logout.go's
  no-match error builders.
- pkg/component/container/list.go: tagsAndLabelsFromComponent now returns
  non-nil empty slice/map consistently across all no-metadata branches
  (previously nil in the early-return paths, empty in the fallthrough path);
  updated the two tests whose expected values encoded the old inconsistency.
- Added missing test coverage: combined tags+labels graph filtering,
  nil/empty map SortedKeys/SortedValues, extra-equals-sign label parsing,
  and TagModeAll edge cases (empty filter, duplicate filter tags).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@aknysh
Andriy Knysh (aknysh) merged commit 965e5f3 into main Jul 14, 2026
78 checks passed
@atmos-pro

atmos-pro Bot commented Jul 14, 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.

@aknysh
Andriy Knysh (aknysh) deleted the osterman/tags-and-labels-standard branch July 14, 2026 13:17
@github-actions

Copy link
Copy Markdown

These changes were released in v1.223.0-rc.11.

This branch was successfully deployed

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

Labels

minor New features that do not break anything size/xl Extra large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants