Skip to content

Conversation

@osterman
Copy link
Member

@osterman osterman commented Oct 20, 2025

what

  • Replaced the usage of the archived github.com/golang/mock with go.uber.org/mock.
  • Updated all import paths from github.com/golang/mock/gomock to go.uber.org/mock/gomock.
  • Updated all //go:generate mockgen directives to use go run go.uber.org/mock/mockgen@v0.6.0 (pinned version for reproducible builds).
  • Regenerated all mock files with the pinned version.
  • Added a lint rule in .golangci.yml to disallow usage of github.com/golang/mock.
  • Configured .golangci.yml to exclude generated mock files (mock_*.go) from godot linter checks.

why

  • github.com/golang/mock is an archived repository and should no longer be used.
  • go.uber.org/mock is the maintained successor.
  • Pinning to @v0.6.0 ensures reproducible builds across different environments.
  • This change ensures the project uses actively maintained dependencies and prevents accidental use of the deprecated library through a new lint rule.

references

@osterman osterman requested review from a team as code owners October 20, 2025 18:50
@github-actions github-actions bot added the size/m Medium size PR label Oct 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

📝 Walkthrough

Walkthrough

Replace usages of the archived github.com/golang/mock with go.uber.org/mock across the repo: update .golangci.yml forbidigo rule, swap gomock import paths, change //go:generate directives to run Uber's mockgen, update go.mod, and regenerate many mock files (adding unexported isgomock fields and replacing recorder parameter types from interface{} to any).

Changes

Cohort / File(s) Summary
Linting config
\.golangci\.yml
Add forbidigo rule forbidding github.com/golang/mock with message pointing to go.uber.org/mock; add godot exclusion for mock_.*\.go.
Dependency manifest
go.mod
Remove github.com/golang/mock v1.6.0 and add go.uber.org/mock v0.6.0; bump cloud.google.com/go/secretmanager.
Documentation & examples
CLAUDE.md, tests/testhelpers/README.md
Replace golang/mock references and examples with go.uber.org/mock/mockgen and go.uber.org/mock/gomock.
go:generate directives
internal/..., pkg/config/interface.go, pkg/datafetcher/fetch_schema.go, pkg/downloader/*, pkg/filematch/interface.go, pkg/filesystem/*, pkg/git/interface.go, pkg/pager/pager.go, pkg/pro/interface.go, pkg/validator/schema_validator.go, internal/tui/...
Replace direct mockgen invocations with go run go.uber.org/mock/mockgen@v0.6.0 (or @latest) in //go:generate comments.
Test & non-generated imports
cmd/*.go, internal/exec/*_test.go, pkg/*/*_test.go, tests/testhelpers/*
Update gomock import path from github.com/golang/mock/gomock to go.uber.org/mock/gomock and adjust related imports/order.
Regenerated mocks (wide)
internal/exec/mock_*.go, internal/tui/templates/term/mock_term_writer.go, pkg/config/mock_interface.go, pkg/datafetcher/mock_fetch_schema.go, pkg/downloader/mock_file_downloader_interface.go, pkg/filematch/mock_interface.go, pkg/filesystem/mock_*.go, pkg/git/mock_interface.go, pkg/pager/mock_pager.go, pkg/pro/mock_interface.go, pkg/telemetry/mock/*.go, pkg/validator/mock_schema_validator.go, ...
Regenerated mock files: change gomock import, add unexported isgomock struct{} fields to mock structs, change recorder parameter types from interface{} to any, update generated headers and some method signatures/return types (e.g., git repo type changes).
Mock API refactors / public mock surface
pkg/filematch/mock_interface.go, pkg/filesystem/mock_interface.go, pkg/git/mock_interface.go, pkg/validator/mock_schema_validator.go, internal/exec/mock_*.go, pkg/filesystem/mock_homedir.go, ...
Rename/refactor some mocks (e.g., MockFileMatcherInterfaceMockFileMatcher), remove MockfileSystem, add isgomock fields, and update several recorder/public mock method signatures (notably interface{}any, and some concrete type changes).
Tests & minor code changes
assorted test files
Mostly import path swaps, test mock type adjustments, occasional added test deps and minor assertion tweaks.
Generated headers
assorted mock files
Update/add generated header comments showing new mockgen invocation/version.

Sequence Diagram(s)

(omitted — changes are build/config and generated mocks; no runtime control-flow alterations)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

patch

Suggested reviewers

  • osterman
  • mcalhoun

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning There is a critical mismatch between the PR's actual changes and the linked issue #123. The PR updates mockgen from github.com/golang/mock to go.uber.org/mock across the codebase, but issue #123 requires implementing configurable analytics settings in atmos.yaml with options like components_enabled, auto_crash_log_send_enabled, and commands_enabled. The PR contains zero changes related to analytics configuration, telemetry options, or the atmos.yaml schema needed to satisfy issue #123's requirements. The PR should either be unlinked from issue #123 and linked to the appropriate mockgen migration issue (if one exists), or the PR needs to include the analytics configuration implementation required by #123. Confirm the correct issue number for this mockgen migration work or add the missing analytics feature implementation before merging.
Out of Scope Changes Check ⚠️ Warning Relative to issue #123's stated objectives, all changes in this PR are out of scope. Issue #123 requires implementing user-facing analytics configuration options in atmos.yaml, but the PR exclusively modifies the mock testing infrastructure by migrating from golang/mock to go.uber.org/mock. While the mockgen migration changes are internally consistent and well-executed, they do not advance any of the analytics feature requirements that issue #123 specifies. Determine whether this PR should close issue #123 or if it's linked to the wrong issue. If this is a separate mockgen infrastructure upgrade, it should be tracked under a distinct issue. If the analytics feature must be implemented, those changes are currently missing from this PR.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "Update mockgen to go.uber.org/mock" clearly and concisely summarizes the primary change throughout the codebase. The changeset demonstrates a consistent migration from the archived github.com/golang/mock package to the maintained go.uber.org/mock successor, including import path updates, go:generate directive changes, mock file regeneration, and new linting rules. The title is specific enough that teammates scanning history would immediately understand the core objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch osterman/migrate-uber-mock

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

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 (2)
pkg/validator/schema_validator_test.go (1)

76-81: Test scenario not exercising schema fetch error.

Case "Schema fetch error" sets fetcherErr but never configures the mock to return it; defaults return (nil, nil). Configure an expectation to return the error so the test matches its name.

       {
         name:         "Schema fetch error",
         schemaSource: "schema.json",
         yamlSource:   "data.yaml",
-        fetcherErr:   ErrFailedToFetchSchema,
-        wantErr:      true,
+        fetcherErr:   ErrFailedToFetchSchema,
+        wantErr:      true,
+        setMockExpect: func(mockFetcher *datafetcher.MockDataFetcher) {
+          // YAML fetch succeeds (minimal input), schema fetch fails.
+          mockFetcher.EXPECT().GetData("data.yaml").Return([]byte("name: test"), nil)
+          mockFetcher.EXPECT().GetData("schema.json").Return(nil, ErrFailedToFetchSchema)
+        },
       },
pkg/filematch/mock_interface.go (1)

95-132: Update mock type references in test file; rename incomplete.

The old mock type name MockFileMatcherInterface is still referenced in internal/exec/validate_schema_test.go (lines 105, 112, 122). Rename these to MockFileMatcher to match the changes in pkg/filematch/mock_interface.go.

🧹 Nitpick comments (12)
pkg/list/list_instances_upload_test.go (1)

7-9: Migration to go.uber.org/mock looks good.

The import path change correctly migrates from the archived golang/mock to the maintained uber fork. The gomock API remains compatible throughout the file.

Minor: The third-party imports could be alphabetically sorted (go.uber.org should come after github.com/stretchr). As per coding guidelines, imports should be sorted alphabetically within each group.

 	git "github.com/go-git/go-git/v5"
-	"go.uber.org/mock/gomock"
 	"github.com/stretchr/testify/assert"
+	"go.uber.org/mock/gomock"
pkg/config/interface.go (1)

10-10: Pin mockgen version for reproducible codegen.

Using @latest can churn diffs and break CI when mockgen output changes. Recommend pinning to a known good tag (e.g., v0.6.0) and updating intentionally.

Based on learnings.

-//go:generate go run go.uber.org/mock/mockgen@latest -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE
+//go:generate go run go.uber.org/mock/mockgen@v0.6.0 -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE
pkg/filesystem/homedir.go (1)

9-9: Pin mockgen version for reproducible mocks.

Using @latest can cause diff churn across machines/CI. Pin to a known version (e.g., v0.6.0).

Based on learnings.

-//go:generate go run go.uber.org/mock/mockgen@latest -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE
+//go:generate go run go.uber.org/mock/mockgen@v0.6.0 -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE
CLAUDE.md (1)

321-332: Doc examples: prefer pinning mockgen version.

Use a fixed version in examples to avoid churn and flaky diffs in CI.

Based on learnings.

-//go:generate go run go.uber.org/mock/mockgen@latest -package=yourpkg -destination=mock_interface_test.go github.com/external/package InterfaceName
+//go:generate go run go.uber.org/mock/mockgen@v0.6.0 -package=yourpkg -destination=mock_interface_test.go github.com/external/package InterfaceName
-//go:generate go run go.uber.org/mock/mockgen@latest -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE
+//go:generate go run go.uber.org/mock/mockgen@v0.6.0 -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE
internal/exec/mock_describe_dependents.go (1)

3-7: Generated mock updated for Uber gomock; suggest pinning generator for reproducibility.

  • Import switched to go.uber.org/mock/gomock and recorder uses any — expected with Uber mockgen. LGTM.
  • Recommend pinning the generator instead of @latest in go:generate to avoid CI churn from upstream releases.
-// mockgen -source=describe_dependents.go -destination=mock_describe_dependents.go -package=exec
+// go run go.uber.org/mock/mockgen@v0.6.0 -source=describe_dependents.go -destination=mock_describe_dependents.go -package=exec

Also applies to: 15-16, 22-22, 51-54

pkg/filesystem/mock_homedir.go (1)

3-7: Uber gomock migration looks correct; consider pinning mockgen.

Changes align with regenerated output (isgomock marker, any in recorder). Recommend pinning generator for stable diffs.

-// mockgen -source=homedir.go -destination=mock_homedir.go -package=filesystem
+// go run go.uber.org/mock/mockgen@v0.6.0 -source=homedir.go -destination=mock_homedir.go -package=filesystem

Also applies to: 15-16, 22-22, 67-70

pkg/pro/mock_interface.go (1)

3-7: Uber gomock regeneration is consistent; consider pinning generator.

All updates align with Uber mockgen. Recommend pinning mockgen for reproducibility.

Also applies to: 17-18, 24-24, 53-56, 62-62, 92-95

pkg/filesystem/mock_interface.go (1)

3-7: Large mock regen diff is expected; minor suggestion.

Migration to go.uber.org/mock and any-typed recorders look good. Consider pinning mockgen for stable outputs.

Also applies to: 18-19, 25-25, 55-57, 69-72, 84-87, 113-116, 128-131, 143-146, 158-161, 172-175, 186-189, 201-204, 215-218, 229-232, 239-239, 268-271, 283-286, 292-292, 322-325

pkg/datafetcher/fetch_schema.go (1)

19-19: Pin mockgen version for deterministic builds.

Using @latest causes mock output to drift between runs. Pin to a specific version (e.g., v0.6.0) to ensure reproducible builds.

-//go:generate go run go.uber.org/mock/mockgen@latest -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE
+//go:generate go run go.uber.org/mock/mockgen@v0.6.0 -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE

Note: golangci-lint is already configured with generated: lax, so generated mock files are properly exempted from strict linting rules like godot.

pkg/git/mock_interface.go (1)

3-7: Pin mockgen and exclude generated mocks from godot lints.

The codebase currently uses mockgen@latest (unpinned) in pkg/git/interface.go:10. Recommend pinning to a specific version (e.g., @v0.6.0) per coding guidelines.

Additionally, .golangci.yml enforces godot period termination but has no exclusions for mock files. Generated code from mockgen may not pass godot checks. Add mock_*.go exclusion patterns to the godot linter config to prevent false positives on generated files.

pkg/filematch/interface.go (2)

16-16: Pin mockgen version for reproducible builds.

Using @latest can cause churn across machines/CI. Pin to a known version (e.g., v0.6.0) or your repo’s chosen pin.

-//go:generate go run go.uber.org/mock/mockgen@latest -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE
+//go:generate go run go.uber.org/mock/mockgen@v0.6.0 -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE

Based on learnings.


16-16: Optional: move go:generate to tests/tools.

Consider placing //go:generate in a test file (or tools.go) to keep prod sources minimal and follow the project’s mockgen placement convention.

Based on learnings.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e73828e and deb68e9.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (65)
  • .golangci.yml (1 hunks)
  • CLAUDE.md (2 hunks)
  • cmd/describe_affected_test.go (1 hunks)
  • cmd/describe_dependents_test.go (1 hunks)
  • cmd/describe_stacks_test.go (1 hunks)
  • cmd/describe_workflows_test.go (1 hunks)
  • go.mod (1 hunks)
  • internal/exec/copy_glob_error_paths_test.go (1 hunks)
  • internal/exec/describe_affected.go (1 hunks)
  • internal/exec/describe_affected_test.go (1 hunks)
  • internal/exec/describe_affected_utils_test.go (1 hunks)
  • internal/exec/describe_component_test.go (1 hunks)
  • internal/exec/describe_config_test.go (1 hunks)
  • internal/exec/describe_dependents.go (1 hunks)
  • internal/exec/describe_dependents_test.go (1 hunks)
  • internal/exec/describe_stacks.go (1 hunks)
  • internal/exec/describe_stacks_test.go (1 hunks)
  • internal/exec/describe_workflows.go (1 hunks)
  • internal/exec/mock_describe_affected.go (2 hunks)
  • internal/exec/mock_describe_dependents.go (2 hunks)
  • internal/exec/mock_describe_stacks.go (3 hunks)
  • internal/exec/mock_describe_workflows.go (3 hunks)
  • internal/exec/mock_stacks_processor.go (3 hunks)
  • internal/exec/mock_storer_test.go (15 hunks)
  • internal/exec/mock_version_test.go (4 hunks)
  • internal/exec/oci_utils_test.go (1 hunks)
  • internal/exec/stacks_processor.go (1 hunks)
  • internal/exec/validate_schema_test.go (1 hunks)
  • internal/exec/version_test.go (1 hunks)
  • internal/tui/templates/term/mock_term_writer.go (1 hunks)
  • internal/tui/templates/term/term_writer.go (1 hunks)
  • pkg/config/imports_error_paths_test.go (1 hunks)
  • pkg/config/interface.go (1 hunks)
  • pkg/config/load_error_paths_test.go (1 hunks)
  • pkg/config/mock_interface.go (3 hunks)
  • pkg/datafetcher/fetch_schema.go (1 hunks)
  • pkg/datafetcher/mock_fetch_schema.go (4 hunks)
  • pkg/downloader/file_downloader_interface.go (2 hunks)
  • pkg/downloader/file_downloader_test.go (1 hunks)
  • pkg/downloader/mock_file_downloader_interface.go (10 hunks)
  • pkg/filematch/interface.go (1 hunks)
  • pkg/filematch/mock_interface.go (5 hunks)
  • pkg/filesystem/homedir.go (1 hunks)
  • pkg/filesystem/interface.go (3 hunks)
  • pkg/filesystem/mock_homedir.go (2 hunks)
  • pkg/filesystem/mock_interface.go (19 hunks)
  • pkg/git/interface.go (1 hunks)
  • pkg/git/mock_interface.go (4 hunks)
  • pkg/list/list_instances_process_test.go (1 hunks)
  • pkg/list/list_instances_upload_test.go (1 hunks)
  • pkg/pager/mock_pager.go (2 hunks)
  • pkg/pager/pager.go (1 hunks)
  • pkg/pro/interface.go (1 hunks)
  • pkg/pro/mock_interface.go (5 hunks)
  • pkg/telemetry/mock/mock_posthog_client.go (1 hunks)
  • pkg/telemetry/mock/mock_telemetry_provider.go (1 hunks)
  • pkg/telemetry/telemetry_logger_selection_test.go (1 hunks)
  • pkg/telemetry/telemetry_test.go (1 hunks)
  • pkg/telemetry/utils_test.go (1 hunks)
  • pkg/validator/mock_schema_validator.go (2 hunks)
  • pkg/validator/schema_validator.go (1 hunks)
  • pkg/validator/schema_validator_test.go (1 hunks)
  • tests/testhelpers/README.md (1 hunks)
  • tests/testhelpers/filesystem.go (1 hunks)
  • tests/testhelpers/filesystem_test.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

**/*.go: All comments must end with periods; enforced by golangci-lint godot across all Go comments.
Organize imports into three groups (stdlib, third-party, Atmos) separated by blank lines and sorted alphabetically within each group; keep existing aliases.
All errors must be wrapped using static errors defined in errors/errors.go; prefer errors.Join for multiple, fmt.Errorf with %w for context, and errors.Is for checks; never rely on string comparisons.
Prefer cross-platform implementations: use SDKs over external binaries; use filepath/os facilities; gate OS-specific logic with runtime.GOOS or build tags.

Files:

  • internal/tui/templates/term/mock_term_writer.go
  • internal/exec/describe_dependents_test.go
  • internal/exec/describe_stacks.go
  • pkg/config/imports_error_paths_test.go
  • internal/tui/templates/term/term_writer.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • internal/exec/version_test.go
  • cmd/describe_dependents_test.go
  • internal/exec/describe_workflows.go
  • internal/exec/stacks_processor.go
  • cmd/describe_stacks_test.go
  • internal/exec/describe_config_test.go
  • pkg/filesystem/interface.go
  • internal/exec/oci_utils_test.go
  • tests/testhelpers/filesystem_test.go
  • pkg/telemetry/telemetry_logger_selection_test.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • cmd/describe_affected_test.go
  • pkg/downloader/file_downloader_interface.go
  • internal/exec/mock_describe_affected.go
  • internal/exec/copy_glob_error_paths_test.go
  • internal/exec/mock_describe_dependents.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/downloader/file_downloader_test.go
  • internal/exec/validate_schema_test.go
  • internal/exec/mock_stacks_processor.go
  • internal/exec/mock_describe_stacks.go
  • internal/exec/mock_describe_workflows.go
  • pkg/telemetry/telemetry_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/describe_affected_test.go
  • internal/exec/describe_stacks_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • tests/testhelpers/filesystem.go
  • cmd/describe_workflows_test.go
  • internal/exec/mock_version_test.go
  • pkg/telemetry/utils_test.go
  • pkg/config/mock_interface.go
  • pkg/validator/mock_schema_validator.go
  • pkg/datafetcher/fetch_schema.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/exec/describe_component_test.go
  • pkg/pager/pager.go
  • pkg/list/list_instances_process_test.go
  • internal/exec/describe_dependents.go
  • pkg/config/load_error_paths_test.go
  • pkg/validator/schema_validator_test.go
  • internal/exec/describe_affected.go
  • pkg/list/list_instances_upload_test.go
  • pkg/pro/interface.go
  • pkg/pro/mock_interface.go
  • pkg/filesystem/mock_homedir.go
  • pkg/pager/mock_pager.go
  • pkg/datafetcher/mock_fetch_schema.go
  • pkg/downloader/mock_file_downloader_interface.go
  • pkg/git/mock_interface.go
  • pkg/filesystem/mock_interface.go
  • pkg/filematch/mock_interface.go
  • internal/exec/mock_storer_test.go
**/!(*_test).go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Document all exported functions, types, and methods with Go doc comments

Files:

  • internal/tui/templates/term/mock_term_writer.go
  • internal/exec/describe_stacks.go
  • internal/tui/templates/term/term_writer.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • internal/exec/describe_workflows.go
  • internal/exec/stacks_processor.go
  • pkg/filesystem/interface.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • pkg/downloader/file_downloader_interface.go
  • internal/exec/mock_describe_affected.go
  • internal/exec/mock_describe_dependents.go
  • internal/exec/mock_stacks_processor.go
  • internal/exec/mock_describe_stacks.go
  • internal/exec/mock_describe_workflows.go
  • pkg/validator/schema_validator.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • tests/testhelpers/filesystem.go
  • pkg/config/mock_interface.go
  • pkg/validator/mock_schema_validator.go
  • pkg/datafetcher/fetch_schema.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • pkg/pager/pager.go
  • internal/exec/describe_dependents.go
  • internal/exec/describe_affected.go
  • pkg/pro/interface.go
  • pkg/pro/mock_interface.go
  • pkg/filesystem/mock_homedir.go
  • pkg/pager/mock_pager.go
  • pkg/datafetcher/mock_fetch_schema.go
  • pkg/downloader/mock_file_downloader_interface.go
  • pkg/git/mock_interface.go
  • pkg/filesystem/mock_interface.go
  • pkg/filematch/mock_interface.go
{cmd,internal,pkg}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

{cmd,internal,pkg}/**/*.go: Add defer perf.Track() to all public functions and critical private ones, include a blank line after it, and use package-qualified names (e.g., "exec.ProcessComponent"). Use atmosConfig if available, else nil.
Always bind environment variables with viper.BindEnv; every var must have an ATMOS_ alternative and prefer ATMOS_ over external names.
Distinguish structured logging from UI output: UI prompts/errors/status to stderr; data/results to stdout; logging for system/debug only; no UI via logging.
Most text UI must go to stderr (via utils.PrintfMessageToTUI or fmt.Fprintf(os.Stderr,...)); only data/results to stdout.

Files:

  • internal/tui/templates/term/mock_term_writer.go
  • internal/exec/describe_dependents_test.go
  • internal/exec/describe_stacks.go
  • pkg/config/imports_error_paths_test.go
  • internal/tui/templates/term/term_writer.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • internal/exec/version_test.go
  • cmd/describe_dependents_test.go
  • internal/exec/describe_workflows.go
  • internal/exec/stacks_processor.go
  • cmd/describe_stacks_test.go
  • internal/exec/describe_config_test.go
  • pkg/filesystem/interface.go
  • internal/exec/oci_utils_test.go
  • pkg/telemetry/telemetry_logger_selection_test.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • cmd/describe_affected_test.go
  • pkg/downloader/file_downloader_interface.go
  • internal/exec/mock_describe_affected.go
  • internal/exec/copy_glob_error_paths_test.go
  • internal/exec/mock_describe_dependents.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/downloader/file_downloader_test.go
  • internal/exec/validate_schema_test.go
  • internal/exec/mock_stacks_processor.go
  • internal/exec/mock_describe_stacks.go
  • internal/exec/mock_describe_workflows.go
  • pkg/telemetry/telemetry_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/describe_affected_test.go
  • internal/exec/describe_stacks_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • cmd/describe_workflows_test.go
  • internal/exec/mock_version_test.go
  • pkg/telemetry/utils_test.go
  • pkg/config/mock_interface.go
  • pkg/validator/mock_schema_validator.go
  • pkg/datafetcher/fetch_schema.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/exec/describe_component_test.go
  • pkg/pager/pager.go
  • pkg/list/list_instances_process_test.go
  • internal/exec/describe_dependents.go
  • pkg/config/load_error_paths_test.go
  • pkg/validator/schema_validator_test.go
  • internal/exec/describe_affected.go
  • pkg/list/list_instances_upload_test.go
  • pkg/pro/interface.go
  • pkg/pro/mock_interface.go
  • pkg/filesystem/mock_homedir.go
  • pkg/pager/mock_pager.go
  • pkg/datafetcher/mock_fetch_schema.go
  • pkg/downloader/mock_file_downloader_interface.go
  • pkg/git/mock_interface.go
  • pkg/filesystem/mock_interface.go
  • pkg/filematch/mock_interface.go
  • internal/exec/mock_storer_test.go
{pkg,internal,cmd}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Always use mockgen for interface mocks; never write manual mocks with many stub methods.

Files:

  • internal/tui/templates/term/mock_term_writer.go
  • internal/exec/describe_dependents_test.go
  • internal/exec/describe_stacks.go
  • pkg/config/imports_error_paths_test.go
  • internal/tui/templates/term/term_writer.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • internal/exec/version_test.go
  • cmd/describe_dependents_test.go
  • internal/exec/describe_workflows.go
  • internal/exec/stacks_processor.go
  • cmd/describe_stacks_test.go
  • internal/exec/describe_config_test.go
  • pkg/filesystem/interface.go
  • internal/exec/oci_utils_test.go
  • pkg/telemetry/telemetry_logger_selection_test.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • cmd/describe_affected_test.go
  • pkg/downloader/file_downloader_interface.go
  • internal/exec/mock_describe_affected.go
  • internal/exec/copy_glob_error_paths_test.go
  • internal/exec/mock_describe_dependents.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/downloader/file_downloader_test.go
  • internal/exec/validate_schema_test.go
  • internal/exec/mock_stacks_processor.go
  • internal/exec/mock_describe_stacks.go
  • internal/exec/mock_describe_workflows.go
  • pkg/telemetry/telemetry_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/describe_affected_test.go
  • internal/exec/describe_stacks_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • cmd/describe_workflows_test.go
  • internal/exec/mock_version_test.go
  • pkg/telemetry/utils_test.go
  • pkg/config/mock_interface.go
  • pkg/validator/mock_schema_validator.go
  • pkg/datafetcher/fetch_schema.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/exec/describe_component_test.go
  • pkg/pager/pager.go
  • pkg/list/list_instances_process_test.go
  • internal/exec/describe_dependents.go
  • pkg/config/load_error_paths_test.go
  • pkg/validator/schema_validator_test.go
  • internal/exec/describe_affected.go
  • pkg/list/list_instances_upload_test.go
  • pkg/pro/interface.go
  • pkg/pro/mock_interface.go
  • pkg/filesystem/mock_homedir.go
  • pkg/pager/mock_pager.go
  • pkg/datafetcher/mock_fetch_schema.go
  • pkg/downloader/mock_file_downloader_interface.go
  • pkg/git/mock_interface.go
  • pkg/filesystem/mock_interface.go
  • pkg/filematch/mock_interface.go
  • internal/exec/mock_storer_test.go
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_.go, mock_.go, **/mock/*.go.

Files:

  • internal/tui/templates/term/mock_term_writer.go
  • internal/exec/describe_dependents_test.go
  • internal/exec/describe_stacks.go
  • pkg/config/imports_error_paths_test.go
  • internal/tui/templates/term/term_writer.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • internal/exec/version_test.go
  • cmd/describe_dependents_test.go
  • internal/exec/describe_workflows.go
  • internal/exec/stacks_processor.go
  • cmd/describe_stacks_test.go
  • internal/exec/describe_config_test.go
  • pkg/filesystem/interface.go
  • internal/exec/oci_utils_test.go
  • tests/testhelpers/filesystem_test.go
  • pkg/telemetry/telemetry_logger_selection_test.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • cmd/describe_affected_test.go
  • pkg/downloader/file_downloader_interface.go
  • internal/exec/mock_describe_affected.go
  • internal/exec/copy_glob_error_paths_test.go
  • internal/exec/mock_describe_dependents.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/downloader/file_downloader_test.go
  • internal/exec/validate_schema_test.go
  • internal/exec/mock_stacks_processor.go
  • internal/exec/mock_describe_stacks.go
  • internal/exec/mock_describe_workflows.go
  • pkg/telemetry/telemetry_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/describe_affected_test.go
  • internal/exec/describe_stacks_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • tests/testhelpers/filesystem.go
  • cmd/describe_workflows_test.go
  • internal/exec/mock_version_test.go
  • pkg/telemetry/utils_test.go
  • pkg/config/mock_interface.go
  • pkg/validator/mock_schema_validator.go
  • pkg/datafetcher/fetch_schema.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/exec/describe_component_test.go
  • pkg/pager/pager.go
  • pkg/list/list_instances_process_test.go
  • internal/exec/describe_dependents.go
  • go.mod
  • CLAUDE.md
  • pkg/config/load_error_paths_test.go
  • pkg/validator/schema_validator_test.go
  • internal/exec/describe_affected.go
  • pkg/list/list_instances_upload_test.go
  • pkg/pro/interface.go
  • pkg/pro/mock_interface.go
  • pkg/filesystem/mock_homedir.go
  • pkg/pager/mock_pager.go
  • pkg/datafetcher/mock_fetch_schema.go
  • tests/testhelpers/README.md
  • pkg/downloader/mock_file_downloader_interface.go
  • pkg/git/mock_interface.go
  • pkg/filesystem/mock_interface.go
  • pkg/filematch/mock_interface.go
  • internal/exec/mock_storer_test.go
**/*_test.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios

**/*_test.go: Unit tests should be table-driven where appropriate and focus on pure functions; target >80% coverage with emphasis on pkg/ and internal/exec/.
Test behavior, not implementation; avoid tautological or stub-only tests; use dependency injection to make code testable; remove always-skipped tests; table-driven tests must use realistic scenarios.
Place //go:generate mockgen directives for mocks at the top of test files; for internal interfaces use -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE.
Tests must call production code paths (do not duplicate production logic within tests).
Always use t.Skipf with a reason (never t.Skip or Skipf without context).
Test files should mirror implementation structure and be co-located with source files (foo.go ↔ foo_test.go).
Use precondition-based test skipping helpers from tests/test_preconditions.go (e.g., RequireAWSProfile, RequireGitHubAccess).

Files:

  • internal/exec/describe_dependents_test.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/version_test.go
  • cmd/describe_dependents_test.go
  • cmd/describe_stacks_test.go
  • internal/exec/describe_config_test.go
  • internal/exec/oci_utils_test.go
  • tests/testhelpers/filesystem_test.go
  • pkg/telemetry/telemetry_logger_selection_test.go
  • cmd/describe_affected_test.go
  • internal/exec/copy_glob_error_paths_test.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/downloader/file_downloader_test.go
  • internal/exec/validate_schema_test.go
  • pkg/telemetry/telemetry_test.go
  • internal/exec/describe_affected_test.go
  • internal/exec/describe_stacks_test.go
  • cmd/describe_workflows_test.go
  • internal/exec/mock_version_test.go
  • pkg/telemetry/utils_test.go
  • internal/exec/describe_component_test.go
  • pkg/list/list_instances_process_test.go
  • pkg/config/load_error_paths_test.go
  • pkg/validator/schema_validator_test.go
  • pkg/list/list_instances_upload_test.go
  • internal/exec/mock_storer_test.go
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/config/imports_error_paths_test.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • pkg/filesystem/interface.go
  • pkg/telemetry/telemetry_logger_selection_test.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • pkg/downloader/file_downloader_interface.go
  • pkg/downloader/file_downloader_test.go
  • pkg/telemetry/telemetry_test.go
  • pkg/validator/schema_validator.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • pkg/telemetry/utils_test.go
  • pkg/config/mock_interface.go
  • pkg/validator/mock_schema_validator.go
  • pkg/datafetcher/fetch_schema.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • pkg/pager/pager.go
  • pkg/list/list_instances_process_test.go
  • pkg/config/load_error_paths_test.go
  • pkg/validator/schema_validator_test.go
  • pkg/list/list_instances_upload_test.go
  • pkg/pro/interface.go
  • pkg/pro/mock_interface.go
  • pkg/filesystem/mock_homedir.go
  • pkg/pager/mock_pager.go
  • pkg/datafetcher/mock_fetch_schema.go
  • pkg/downloader/mock_file_downloader_interface.go
  • pkg/git/mock_interface.go
  • pkg/filesystem/mock_interface.go
  • pkg/filematch/mock_interface.go
pkg/config/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Use Viper for configuration loading with precedence (CLI→ENV→files→defaults) and the shown setup snippet (SetConfigName, AddConfigPath, AutomaticEnv, SetEnvPrefix).

Files:

  • pkg/config/imports_error_paths_test.go
  • pkg/config/interface.go
  • pkg/config/mock_interface.go
  • pkg/config/load_error_paths_test.go
pkg/{,**/}**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests should primarily cover pkg/ code; ensure meaningful coverage with real scenarios (not coverage theater).

Files:

  • pkg/config/imports_error_paths_test.go
  • pkg/telemetry/telemetry_logger_selection_test.go
  • pkg/downloader/file_downloader_test.go
  • pkg/telemetry/telemetry_test.go
  • pkg/telemetry/utils_test.go
  • pkg/list/list_instances_process_test.go
  • pkg/config/load_error_paths_test.go
  • pkg/validator/schema_validator_test.go
  • pkg/list/list_instances_upload_test.go
cmd/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

cmd/**/*.go: Use Cobra's recommended command structure with a root command and subcommands
Implement each CLI command in a separate file under cmd/
Use Viper for managing configuration, environment variables, and flags in the CLI
Keep separation of concerns between CLI interface (cmd) and business logic
Use kebab-case for command-line flags
Provide comprehensive help text for all commands and flags
Include examples in Cobra command help
Use Viper for configuration management; support files, env vars, and flags with precedence flags > env > config > defaults
Follow single responsibility; separate command interface from business logic
Provide meaningful user feedback and include progress indicators for long-running operations
Provide clear error messages to users and troubleshooting hints where appropriate

cmd/**/*.go: Follow Cobra command pattern: one command per file; load examples via //go:embed and render via utils.PrintfMarkdown in RunE.
Telemetry for new commands is automatic via RootCmd.ExecuteC(); for non-standard paths use telemetry.CaptureCmd or telemetry.CaptureCmdString.

Files:

  • cmd/describe_dependents_test.go
  • cmd/describe_stacks_test.go
  • cmd/describe_affected_test.go
  • cmd/describe_workflows_test.go
cmd/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

cmd/**/*_test.go: Always use cmd.NewTestKit(t) in ALL cmd package tests, including subtests, to snapshot and restore RootCmd state.
Command tests live under cmd/ and must use temporary binaries when needed; TestMain must call os.Exit(m.Run()) to propagate exit code.

Files:

  • cmd/describe_dependents_test.go
  • cmd/describe_stacks_test.go
  • cmd/describe_affected_test.go
  • cmd/describe_workflows_test.go
tests/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Integration tests live under tests/ with fixtures in tests/test-cases/.

Files:

  • tests/testhelpers/filesystem_test.go
.golangci.yml

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Configure golangci-lint with gofmt, goimports, govet, staticcheck, errcheck, ineffassign, misspell, unused, revive, gocritic enabled

Files:

  • .golangci.yml
go.{mod,sum}

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

go.{mod,sum}: Manage dependencies with Go modules
Keep dependencies up to date

Files:

  • go.mod
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to pkg/store/**/mock_*.go : Generate mocks for all store interfaces using mockgen (via //go:generate) rather than manual implementations.
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to {pkg,internal,cmd}/**/*.go : Always use mockgen for interface mocks; never write manual mocks with many stub methods.
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Place `//go:generate mockgen` directives for mocks at the top of test files; for internal interfaces use `-source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE`.
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to pkg/store/**/mock_*.go : Generate mocks for all store interfaces using mockgen (via //go:generate) rather than manual implementations.

Applied to files:

  • internal/exec/describe_stacks.go
  • internal/tui/templates/term/term_writer.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • internal/exec/version_test.go
  • internal/exec/describe_workflows.go
  • internal/exec/stacks_processor.go
  • pkg/filesystem/interface.go
  • tests/testhelpers/filesystem_test.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • pkg/downloader/file_downloader_interface.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/downloader/file_downloader_test.go
  • pkg/validator/schema_validator.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • tests/testhelpers/filesystem.go
  • internal/exec/mock_version_test.go
  • pkg/telemetry/utils_test.go
  • pkg/config/mock_interface.go
  • pkg/datafetcher/fetch_schema.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • pkg/pager/pager.go
  • internal/exec/describe_dependents.go
  • CLAUDE.md
  • pkg/validator/schema_validator_test.go
  • pkg/list/list_instances_upload_test.go
  • pkg/pro/interface.go
  • pkg/pro/mock_interface.go
  • pkg/filesystem/mock_homedir.go
  • pkg/pager/mock_pager.go
  • pkg/datafetcher/mock_fetch_schema.go
  • pkg/downloader/mock_file_downloader_interface.go
  • pkg/git/mock_interface.go
  • pkg/filesystem/mock_interface.go
  • pkg/filematch/mock_interface.go
  • internal/exec/mock_storer_test.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Place `//go:generate mockgen` directives for mocks at the top of test files; for internal interfaces use `-source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE`.

Applied to files:

  • internal/exec/describe_stacks.go
  • internal/tui/templates/term/term_writer.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • internal/exec/version_test.go
  • internal/exec/stacks_processor.go
  • pkg/filesystem/interface.go
  • tests/testhelpers/filesystem_test.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • pkg/downloader/file_downloader_interface.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/validator/schema_validator.go
  • tests/testhelpers/filesystem.go
  • pkg/telemetry/utils_test.go
  • pkg/config/mock_interface.go
  • pkg/datafetcher/fetch_schema.go
  • pkg/pager/pager.go
  • internal/exec/describe_dependents.go
  • CLAUDE.md
  • pkg/validator/schema_validator_test.go
  • pkg/pro/interface.go
  • pkg/filematch/mock_interface.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to {pkg,internal,cmd}/**/*.go : Always use mockgen for interface mocks; never write manual mocks with many stub methods.

Applied to files:

  • internal/exec/describe_stacks.go
  • internal/tui/templates/term/term_writer.go
  • pkg/config/interface.go
  • pkg/git/interface.go
  • internal/exec/version_test.go
  • internal/exec/stacks_processor.go
  • pkg/filesystem/interface.go
  • pkg/filematch/interface.go
  • pkg/filesystem/homedir.go
  • cmd/describe_affected_test.go
  • pkg/downloader/file_downloader_interface.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/validator/schema_validator.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • tests/testhelpers/filesystem.go
  • internal/exec/mock_version_test.go
  • pkg/config/mock_interface.go
  • pkg/datafetcher/fetch_schema.go
  • .golangci.yml
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • pkg/pager/pager.go
  • internal/exec/describe_dependents.go
  • CLAUDE.md
  • pkg/validator/schema_validator_test.go
  • pkg/list/list_instances_upload_test.go
  • pkg/pro/interface.go
  • pkg/pro/mock_interface.go
📚 Learning: 2024-11-13T21:37:07.852Z
Learnt from: Cerebrovinny
PR: cloudposse/atmos#764
File: internal/exec/describe_stacks.go:289-295
Timestamp: 2024-11-13T21:37:07.852Z
Learning: In the `internal/exec/describe_stacks.go` file of the `atmos` project written in Go, avoid extracting the stack name handling logic into a helper function within the `ExecuteDescribeStacks` method, even if the logic appears duplicated.

Applied to files:

  • internal/exec/describe_stacks.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Consider using testify/mock for creating mock implementations

Applied to files:

  • internal/exec/copy_glob_error_paths_test.go
  • CLAUDE.md
  • tests/testhelpers/README.md
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
PR: cloudposse/atmos#1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.

Applied to files:

  • internal/exec/validate_schema_test.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Tests must call production code paths (do not duplicate production logic within tests).

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Test behavior, not implementation; avoid tautological or stub-only tests; use dependency injection to make code testable; remove always-skipped tests; table-driven tests must use realistic scenarios.

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Unit tests should be table-driven where appropriate and focus on pure functions; target >80% coverage with emphasis on pkg/ and internal/exec/.

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to pkg/{,**/}**/*_test.go : Unit tests should primarily cover pkg/ code; ensure meaningful coverage with real scenarios (not coverage theater).

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*_test.go : Test both happy paths and error conditions

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*_test.go : Every new feature must include comprehensive unit tests

Applied to files:

  • CLAUDE.md
🧬 Code graph analysis (7)
internal/exec/mock_version_test.go (3)
pkg/utils/log_utils.go (1)
  • PrintMessage (21-23)
pkg/utils/version_utils.go (1)
  • PrintMessageToUpgradeToAtmosLatestRelease (15-44)
internal/tui/utils/utils.go (1)
  • PrintStyledText (32-38)
pkg/config/mock_interface.go (1)
pkg/config/config.go (1)
  • InitCliConfig (25-62)
pkg/pro/mock_interface.go (1)
pkg/downloader/mock_file_downloader_interface.go (1)
  • MockClientFactoryMockRecorder (126-128)
pkg/filesystem/mock_homedir.go (1)
pkg/config/homedir/homedir.go (1)
  • Expand (68-87)
pkg/downloader/mock_file_downloader_interface.go (1)
pkg/pro/mock_interface.go (1)
  • MockClientFactoryMockRecorder (66-68)
pkg/git/mock_interface.go (1)
pkg/git/git.go (3)
  • GetLocalRepo (14-26)
  • GetRepoInfo (60-110)
  • RepoInfo (50-58)
pkg/filesystem/mock_interface.go (1)
pkg/utils/glob_utils.go (2)
  • GetGlobMatches (36-65)
  • PathMatch (74-106)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build (linux)
  • GitHub Check: Build (windows)
  • GitHub Check: Analyze (go)
  • GitHub Check: autofix
  • GitHub Check: Summary
🔇 Additional comments (69)
pkg/pager/pager.go (1)

11-11: Migration verified—mock regenerated correctly.

The go:generate directive successfully migrated to go.uber.org/mock/mockgen, and mock_pager.go was properly regenerated with the correct uber import at line 15.

Optionally consider pinning a specific version (e.g., @v0.6.0) instead of @latest for reproducible builds across environments—this would be a codebase-wide decision affecting all go:generate directives.

pkg/config/imports_error_paths_test.go (1)

9-9: Import migration complete and verified.

The update from archived golang/mock to maintained go.uber.org/mock is correct. Mock files have been regenerated with the new tool, and go:generate directives are properly configured. No issues.

internal/exec/describe_config_test.go (1)

8-8: Migration looks good.

The import path update from github.com/golang/mock/gomock to go.uber.org/mock/gomock is correct, and all gomock API usage remains compatible.

tests/testhelpers/README.md (1)

38-38: Documentation updated correctly.

The example code now reflects the migration to go.uber.org/mock/gomock, keeping documentation in sync with the codebase.

internal/exec/copy_glob_error_paths_test.go (1)

10-10: Import migration complete.

The gomock import path has been correctly updated to go.uber.org/mock/gomock with no impact on test functionality.

pkg/git/interface.go (1)

10-10: Code generation directive updated correctly.

The go:generate directive now uses go run go.uber.org/mock/mockgen@latest, which ensures version pinning and aligns with the migration to Uber's maintained mock framework. Based on learnings.

internal/exec/oci_utils_test.go (1)

11-11: Import path migrated successfully.

The gomock import has been updated to go.uber.org/mock/gomock, maintaining full compatibility with existing test code.

internal/exec/validate_schema_test.go (1)

10-10: Mock import updated correctly.

The migration to go.uber.org/mock/gomock is complete for this test file with no functional impact.

tests/testhelpers/filesystem_test.go (1)

8-8: Test helpers updated for new mock framework.

The gomock import path has been correctly updated to go.uber.org/mock/gomock, ensuring test helpers work with the migrated mock framework.

pkg/list/list_instances_process_test.go (1)

7-7: Migration complete for this test file.

The gomock import has been successfully updated to go.uber.org/mock/gomock, maintaining compatibility with all existing test logic.

pkg/telemetry/mock/mock_posthog_client.go (1)

15-17: Migration to Uber gomock looks good.

Generated file; import switch is correct and matches project-wide migration. No manual edits needed here.

internal/exec/describe_component_test.go (1)

9-9: Good swap to go.uber.org/mock/gomock.

No behavior change; aligns with the new dependency.

pkg/telemetry/telemetry_test.go (1)

12-12: Uber gomock import looks correct.

No test behavior changes; consistent with the migration.

pkg/config/load_error_paths_test.go (1)

11-11: Import migration complete and verified repo-wide.

Script confirms all go:generate directives use go run go.uber.org/mock/mockgen@, go.mod has the correct dependency, and .golangci.yml enforces the rule. No active stragglers—references in CLAUDE.md and go.sum are documentation and historical respectively. The change is solid.

pkg/telemetry/telemetry_logger_selection_test.go (3)

7-7: Import migration looks good.

The gomock import path has been correctly updated to the maintained Uber fork.


67-68: Linter rule prevents regression.

Excellent addition to prevent accidental use of the archived library going forward.


67-68: Remove review comment—no misalignment exists.

The test file legitimately tests telemetry logger selection (a real feature), and the mock library migration to go.uber.org/mock is the technical update mechanism for that test. The codebase already supports telemetry opt-in/opt-out via settings.telemetry.enabled. The PR objectives and actual changes are aligned; there's no contradiction. Lines 67-68 are routine test closure syntax.

Likely an incorrect or invalid review comment.

go.mod (1)

92-92: Dependency migration complete.

Updated to go.uber.org/mock v0.6.0, the maintained successor to the archived golang/mock library.

pkg/telemetry/mock/mock_telemetry_provider.go (1)

15-15: Generated mock updated correctly.

Import path successfully migrated in the generated mock file. The presence of the isgomock marker field at line 23 confirms this mock was regenerated with Uber's mockgen.

pkg/filesystem/interface.go (1)

12-12: Mock generation directives migrated.

All three go:generate directives now correctly invoke Uber's mockgen via go run go.uber.org/mock/mockgen@latest, ensuring future mock regeneration uses the maintained tooling.

Based on learnings

Also applies to: 58-58, 69-69

tests/testhelpers/filesystem.go (1)

6-6: Test helper import updated.

The gomock import path has been successfully migrated. The MockFSBuilder continues to work seamlessly with Uber's gomock API.

pkg/validator/schema_validator.go (1)

16-16: Mock generation directive updated.

The go:generate directive now uses Uber's mockgen, ensuring the Validator interface mock will be generated with the maintained tooling.

Based on learnings

pkg/pro/interface.go (1)

11-11: Mock generation directive migrated.

The go:generate directive now correctly references Uber's mockgen for future mock regeneration.

Based on learnings

pkg/pager/mock_pager.go (1)

15-16: Generated mocks migrated to Uber gomock — looks good.

Import swap, isgomock marker, and any-typed recorder params match Uber mockgen output.

Also applies to: 22-22, 51-51

CLAUDE.md (1)

321-332: Quick PR hygiene check: confirm linked issue.

PR text says “closes #123” (analytics opt-in/out). This PR migrates mocks; no analytics config surfaced here. Please verify the issue linkage before merge.

pkg/validator/mock_schema_validator.go (1)

16-16: Validator mock migration looks correct.

Changes align with Uber mockgen output; no action needed.

Also applies to: 24-24, 53-53

pkg/telemetry/utils_test.go (1)

20-20: Uber gomock import verified—no issues.

The codebase is fully migrated: all //go:generate directives use go.uber.org/mock/mockgen, no deprecated github.com/golang/mock imports remain in active code, and go.mod correctly references go.uber.org/mock v0.6.0. The change is good to merge.

pkg/datafetcher/mock_fetch_schema.go (1)

3-7: Mock regeneration matches Uber gomock expectations.

Import path, isgomock markers, and any-typed recorder params look good. No functional concerns.

Also applies to: 15-16, 22-22, 52-55, 61-62, 91-94

pkg/downloader/mock_file_downloader_interface.go (1)

3-7: Mock updates look correct with Uber gomock.

Recorder parameters generalized to any are expected; no issues spotted.

Also applies to: 17-18, 24-24, 53-56, 68-71, 83-86, 98-101, 113-116, 122-122, 152-155, 161-161

pkg/validator/schema_validator_test.go (1)

7-13: Import migration verified—all checks pass.

The verification confirms the migration to go.uber.org/mock is complete and consistent across the codebase:

  • No deprecated github.com/golang/mock imports in actual code
  • All 21 go:generate directives use the correct go run go.uber.org/mock/mockgen@latest pattern
  • Dependency properly declared in go.mod (v0.6.0)
  • No bare mockgen invocations found

Code changes look good.

internal/exec/mock_storer_test.go (1)

1-350: LGTM! Generated mock successfully migrated.

This generated mock file has been correctly updated to use go.uber.org/mock. The new format includes the isgomock marker field and updated recorder signatures using any, which aligns with the v0.6.0 API.

cmd/describe_workflows_test.go (1)

6-6: LGTM! Import path cleanly updated.

The gomock import has been correctly updated to the maintained fork without affecting test logic.

internal/exec/stacks_processor.go (1)

7-7: LGTM! Code generation directive properly updated.

The go:generate directive now invokes mockgen via go run with version pinning, ensuring reproducible mock generation.

Based on learnings.

pkg/downloader/file_downloader_test.go (1)

9-9: LGTM! Import migration complete.

The gomock import path has been correctly updated while preserving all test functionality.

cmd/describe_affected_test.go (1)

7-7: LGTM! Import updated consistently.

The import migration follows the same pattern as other test files, maintaining test behavior.

internal/exec/describe_stacks_test.go (1)

9-9: LGTM! Import path correctly updated.

Clean migration to the maintained mock framework without impacting test logic.

internal/exec/mock_describe_affected.go (1)

1-54: LGTM! Generated mock properly updated.

The mock has been regenerated with the new tooling, including the isgomock marker and any-typed recorder parameters that match the updated API.

internal/exec/describe_stacks.go (1)

34-34: LGTM! Code generation updated correctly.

The go:generate directive now uses the maintained mockgen with version pinning and appropriate source-mode parameters.

Based on learnings.

pkg/downloader/file_downloader_interface.go (1)

11-11: LGTM! Clean migration to maintained mock tooling.

The go:generate directives have been correctly updated to use go run go.uber.org/mock/mockgen@latest, ensuring mocks are generated with the actively maintained fork.

Also applies to: 31-31

internal/exec/version_test.go (1)

9-9: LGTM! Import and mock generation updated correctly.

The migration to go.uber.org/mock/gomock is complete with no impact on test logic.

Also applies to: 17-17

cmd/describe_dependents_test.go (1)

6-6: LGTM! Import path updated correctly.

The switch to go.uber.org/mock/gomock maintains full compatibility with existing test logic.

internal/exec/describe_affected_test.go (1)

10-10: LGTM! Import migration complete.

The update to go.uber.org/mock/gomock is correct and preserves all test functionality.

cmd/describe_stacks_test.go (1)

7-7: LGTM! Import path correctly updated.

Migration to go.uber.org/mock/gomock completed without affecting test behavior.

internal/tui/templates/term/term_writer.go (1)

11-11: LGTM! Mock generation directive updated correctly.

The switch to go run go.uber.org/mock/mockgen@latest aligns with the maintained mock tooling.

internal/exec/describe_affected.go (1)

51-51: LGTM! Mock generation updated to maintained tooling.

The directive change ensures mocks are generated using go.uber.org/mock/mockgen@latest.

internal/exec/describe_dependents.go (1)

32-32: LGTM! Mock generation directive correctly migrated.

The update to go run go.uber.org/mock/mockgen@latest completes the migration to actively maintained mock tooling.

internal/exec/describe_workflows.go (1)

17-17: LGTM! Updated go:generate directive aligns with Uber's mock framework.

The change to go run go.uber.org/mock/mockgen@latest ensures version consistency and follows the modern approach for running mockgen.

internal/exec/describe_dependents_test.go (1)

9-9: LGTM! Import path successfully migrated to Uber's mock framework.

The gomock API remains compatible, so no test logic changes are needed.

internal/exec/describe_affected_utils_test.go (2)

3-3: LGTM! Mock generation directive properly migrated.

Using go run go.uber.org/mock/mockgen@latest ensures reproducible mock generation for the external go-git Storer interface.


11-11: LGTM! Import path correctly updated.

The migration to go.uber.org/mock/gomock is consistent with the repository-wide migration.

internal/tui/templates/term/mock_term_writer.go (2)

15-15: LGTM! Generated mock uses correct import path.

The migration to go.uber.org/mock/gomock is properly reflected in the generated mock.


22-22: LGTM! New isgomock marker field added by Uber's mockgen.

This is a standard marker field that the new mockgen adds to identify mock types.

pkg/config/mock_interface.go (3)

16-16: LGTM! Import path correctly migrated.

The generated mock now uses go.uber.org/mock/gomock as expected.


23-23: LGTM! Marker field added by new mockgen.

The isgomock struct{} field is a standard addition by Uber's mockgen.


53-53: LGTM! Modern type alias used in recorder method.

The change from interface{} to any reflects modern Go conventions (Go 1.18+) and is automatically generated by the new mockgen.

internal/exec/mock_describe_stacks.go (1)

16-16: LGTM! Generated mock properly migrated to Uber's framework.

All changes (import path, isgomock marker field, and any type usage) are consistent with the new mockgen output.

Also applies to: 23-23, 52-52

internal/exec/mock_describe_workflows.go (1)

16-16: LGTM! Generated mock correctly reflects Uber's mockgen output.

Import path, marker field, and modern type usage are all properly updated.

Also applies to: 23-23, 52-52

internal/exec/mock_stacks_processor.go (1)

16-16: LGTM! Generated mock successfully migrated.

All structural changes (import, marker field, and type aliases) align with Uber's mockgen conventions.

Also applies to: 23-23, 53-53

internal/exec/mock_version_test.go (3)

15-15: Good: migrated to go.uber.org/mock/gomock.

Correct import path for the maintained fork.


22-22: isgomock marker is expected with Uber mockgen.

No action needed.


64-67: Verified: Go version and recorder signatures are compatible.

Go 1.24.8 (from go.mod) exceeds the 1.18 minimum, confirming the any parameter change is appropriate. Test usage shows the recorder methods work as expected with the updated signatures (PrintMessage with gomock.Any(), PrintMessageToUpgradeToAtmosLatestRelease with gomock.Eq()). No compatibility concerns.

pkg/git/mock_interface.go (4)

15-17: Imports look correct and ordered.

go-git v5 and Uber gomock are properly grouped; aliases are consistent.


23-23: isgomock marker acknowledged.

Expected with Uber mockgen; no changes needed.


44-49: *Return type updated to git.Repository matches implementation.

Aligns with pkg/git/git.go:GetLocalRepo returning *git.Repository. Looks good.


59-65: No action required—types and callers are already aligned.

The mock implementation correctly uses *git.Repository while the recorder uses any (standard gomock pattern for flexible test expectations). All callsites—test mocks and production code—properly pass *git.Repository. No lingering v5 aliases or import issues found. The type migration is complete and consistent.

pkg/filematch/mock_interface.go (3)

15-15: Import migration LGTM.

Runtime import updated to go.uber.org/mock/gomock as intended.


22-23: Uber mock sentinel fields expected.

The isgomock markers are part of go.uber.org/mock. No action.

Also applies to: 61-62, 99-100


51-55: No issues found.

The Go version is confirmed at 1.24.8, which exceeds the 1.18 minimum requirement for any type support. The mock file is properly generated by mockgen (per coding guidelines), and any usage is correct.

.golangci.yml (1)

67-68: Linter rule correctly prevents use of archived mock library.

The forbidigo pattern is syntactically valid and properly integrated into the configuration. The rule will catch imports and references to github.com/golang/mock across the codebase, enforcing the migration to go.uber.org/mock and preventing accidental regressions.

To confirm the pattern functions as intended, you may want to verify it catches both standard imports (github.com/golang/mock/gomock) and package-level references during a local lint run.

Reorder imports to comply with Atmos import organization conventions:
1. Go native imports
2. 3rd-party imports (alphabetically sorted)
3. Atmos imports

Moved go.uber.org/mock/gomock to correct alphabetical position in
3rd-party section (after github.com/stretchr/testify).

Also fixed MockFileMatcherInterface → MockFileMatcher to match
regenerated mock interface names.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added size/l Large size PR and removed size/m Medium size PR labels Oct 20, 2025
Run gofumpt to correctly order imports in all files using uber/mock.
Ensures go.uber.org/mock/gomock comes after other 3rd-party imports
alphabetically (after github.com/stretchr/testify).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.04%. Comparing base (9e4489c) to head (8658ef1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1681      +/-   ##
==========================================
+ Coverage   66.01%   66.04%   +0.02%     
==========================================
  Files         351      351              
  Lines       40032    40032              
==========================================
+ Hits        26429    26441      +12     
+ Misses      11586    11575      -11     
+ Partials     2017     2016       -1     
Flag Coverage Δ
unittests 66.04% <ø> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
internal/exec/describe_affected.go 62.71% <ø> (ø)
internal/exec/describe_dependents.go 76.85% <ø> (ø)
internal/exec/describe_stacks.go 68.61% <ø> (ø)
internal/exec/describe_workflows.go 18.75% <ø> (ø)
internal/exec/stacks_processor.go 100.00% <ø> (ø)
internal/tui/templates/term/term_writer.go 37.73% <ø> (ø)
pkg/config/interface.go 100.00% <ø> (ø)
pkg/datafetcher/fetch_schema.go 100.00% <ø> (ø)
pkg/filesystem/homedir.go 66.66% <ø> (ø)
pkg/git/interface.go 100.00% <ø> (ø)
... and 3 more

... and 3 files with indirect coverage changes

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

@osterman osterman added the no-release Do not create a new release (wait for additional code changes) label Oct 20, 2025
- Pin go:generate directives to mockgen@v0.6.0 for reproducible builds
- Add godoc comment to FileMatcher interface
- Exclude mock_*.go files from godot linter checks
- Regenerate all mocks with pinned version

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
internal/tui/templates/term/term_writer.go (1)

79-79: Add periods to inline comments.

Per coding guidelines, all comments must end with periods (enforced by golangci-lint godot). Lines 79, 104, and 111 are missing them.

Apply this diff:

-	// Use optimal width based on terminal size
+	// Use optimal width based on terminal size.
-	// Preserving the original length for correct return value
+	// Preserving the original length for correct return value.
-	// return the original length as per io.Writer contract
+	// Return the original length as per io.Writer contract.

Also applies to: 104-104, 111-111

🧹 Nitpick comments (3)
internal/tui/templates/term/term_writer.go (1)

28-31: Consider adding performance tracking to public functions.

Per coding guidelines, public functions should include defer perf.Track(). While these TUI methods are lightweight, tracking would provide visibility into terminal operations during debugging.

Example for NewResponsiveWriter:

 func NewResponsiveWriter(w io.Writer) io.Writer {
+	defer perf.Track()
+
 	file, ok := w.(*os.File)

Apply similar pattern to other public functions and methods as appropriate.

Based on coding guidelines.

Also applies to: 34-37, 40-43, 64-97, 99-113, 115-117, 121-123, 127-129, 133-135

pkg/config/imports_error_paths_test.go (1)

260-262: Consider asserting expected behavior.

The test calls processLocalImport but doesn't verify whether it should succeed or fail. Either assert NoError if nested imports should be processed successfully, or Error if they should fail at max depth.

Apply this diff to clarify the expected behavior:

-	// Process with depth that will hit max
 	_, err = processLocalImport(tempDir, "config.yaml", tempDir, MaximumImportLvL, MaximumImportLvL)
-	// Should complete but nested import will fail at max depth
-	_ = err
+	// The first-level import succeeds, but nested import processing should fail at max depth
+	assert.NoError(t, err)

Or if nested processing should bubble up an error:

 	_, err = processLocalImport(tempDir, "config.yaml", tempDir, MaximumImportLvL, MaximumImportLvL)
-	// Should complete but nested import will fail at max depth
-	_ = err
+	assert.Error(t, err)
+	assert.ErrorIs(t, err, errUtils.ErrMaxImportDepth)
internal/exec/version_test.go (1)

6-6: Consider using stdlib errors instead of pkg/errors.

The file only uses errors.New() to create simple test mock errors (lines 61, 230). The standard library errors package would suffice here; pkg/errors is typically reserved for production code that needs stack traces or error wrapping.

-	"github.com/pkg/errors"
+	"errors"
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between deb68e9 and 27d4519.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (44)
  • .golangci.yml (2 hunks)
  • cmd/describe_affected_test.go (1 hunks)
  • cmd/describe_dependents_test.go (1 hunks)
  • cmd/describe_stacks_test.go (1 hunks)
  • cmd/describe_workflows_test.go (1 hunks)
  • go.mod (1 hunks)
  • internal/exec/copy_glob_error_paths_test.go (1 hunks)
  • internal/exec/describe_affected.go (1 hunks)
  • internal/exec/describe_affected_test.go (1 hunks)
  • internal/exec/describe_affected_utils_test.go (1 hunks)
  • internal/exec/describe_component_test.go (1 hunks)
  • internal/exec/describe_config_test.go (1 hunks)
  • internal/exec/describe_dependents.go (1 hunks)
  • internal/exec/describe_dependents_test.go (1 hunks)
  • internal/exec/describe_stacks.go (1 hunks)
  • internal/exec/describe_stacks_test.go (1 hunks)
  • internal/exec/describe_workflows.go (1 hunks)
  • internal/exec/oci_utils_test.go (1 hunks)
  • internal/exec/stacks_processor.go (1 hunks)
  • internal/exec/validate_schema_test.go (4 hunks)
  • internal/exec/version_test.go (1 hunks)
  • internal/tui/templates/term/term_writer.go (1 hunks)
  • pkg/config/imports_error_paths_test.go (1 hunks)
  • pkg/config/interface.go (1 hunks)
  • pkg/config/load_error_paths_test.go (1 hunks)
  • pkg/datafetcher/fetch_schema.go (1 hunks)
  • pkg/downloader/file_downloader_interface.go (2 hunks)
  • pkg/downloader/file_downloader_test.go (1 hunks)
  • pkg/filematch/interface.go (1 hunks)
  • pkg/filesystem/homedir.go (1 hunks)
  • pkg/filesystem/interface.go (3 hunks)
  • pkg/git/interface.go (1 hunks)
  • pkg/list/list_instances_process_test.go (1 hunks)
  • pkg/list/list_instances_upload_test.go (1 hunks)
  • pkg/pager/pager.go (1 hunks)
  • pkg/pro/interface.go (1 hunks)
  • pkg/telemetry/mock/mock_posthog_client.go (1 hunks)
  • pkg/telemetry/mock/mock_telemetry_provider.go (1 hunks)
  • pkg/telemetry/telemetry_logger_selection_test.go (1 hunks)
  • pkg/telemetry/telemetry_test.go (1 hunks)
  • pkg/telemetry/utils_test.go (1 hunks)
  • pkg/validator/schema_validator.go (1 hunks)
  • pkg/validator/schema_validator_test.go (1 hunks)
  • tests/testhelpers/filesystem_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • cmd/describe_stacks_test.go
  • internal/exec/stacks_processor.go
🚧 Files skipped from review as they are similar to previous changes (21)
  • pkg/validator/schema_validator_test.go
  • pkg/config/load_error_paths_test.go
  • cmd/describe_workflows_test.go
  • internal/exec/oci_utils_test.go
  • pkg/downloader/file_downloader_test.go
  • pkg/list/list_instances_process_test.go
  • internal/exec/copy_glob_error_paths_test.go
  • pkg/pro/interface.go
  • pkg/git/interface.go
  • cmd/describe_dependents_test.go
  • internal/exec/describe_dependents_test.go
  • internal/exec/describe_workflows.go
  • pkg/downloader/file_downloader_interface.go
  • pkg/config/interface.go
  • pkg/datafetcher/fetch_schema.go
  • go.mod
  • internal/exec/describe_config_test.go
  • pkg/telemetry/telemetry_test.go
  • internal/exec/describe_dependents.go
  • pkg/telemetry/telemetry_logger_selection_test.go
  • pkg/list/list_instances_upload_test.go
🧰 Additional context used
📓 Path-based instructions (13)
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/telemetry/utils_test.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • pkg/filesystem/homedir.go
  • pkg/config/imports_error_paths_test.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • pkg/validator/schema_validator.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • pkg/filesystem/interface.go
**/*_test.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios

**/*_test.go: Unit tests should be table-driven where appropriate and focus on pure functions; target >80% coverage with emphasis on pkg/ and internal/exec/.
Test behavior, not implementation; avoid tautological or stub-only tests; use dependency injection to make code testable; remove always-skipped tests; table-driven tests must use realistic scenarios.
Place //go:generate mockgen directives for mocks at the top of test files; for internal interfaces use -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE.
Tests must call production code paths (do not duplicate production logic within tests).
Always use t.Skipf with a reason (never t.Skip or Skipf without context).
Test files should mirror implementation structure and be co-located with source files (foo.go ↔ foo_test.go).
Use precondition-based test skipping helpers from tests/test_preconditions.go (e.g., RequireAWSProfile, RequireGitHubAccess).

Files:

  • pkg/telemetry/utils_test.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/describe_affected_utils_test.go
  • internal/exec/describe_component_test.go
  • internal/exec/version_test.go
  • internal/exec/describe_stacks_test.go
  • internal/exec/describe_affected_test.go
  • cmd/describe_affected_test.go
  • tests/testhelpers/filesystem_test.go
  • internal/exec/validate_schema_test.go
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

**/*.go: All comments must end with periods; enforced by golangci-lint godot across all Go comments.
Organize imports into three groups (stdlib, third-party, Atmos) separated by blank lines and sorted alphabetically within each group; keep existing aliases.
All errors must be wrapped using static errors defined in errors/errors.go; prefer errors.Join for multiple, fmt.Errorf with %w for context, and errors.Is for checks; never rely on string comparisons.
Prefer cross-platform implementations: use SDKs over external binaries; use filepath/os facilities; gate OS-specific logic with runtime.GOOS or build tags.

Files:

  • pkg/telemetry/utils_test.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/tui/templates/term/term_writer.go
  • internal/exec/describe_affected.go
  • pkg/filesystem/homedir.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/describe_stacks.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • internal/exec/describe_affected_utils_test.go
  • internal/exec/describe_component_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/version_test.go
  • internal/exec/describe_stacks_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • internal/exec/describe_affected_test.go
  • pkg/filesystem/interface.go
  • cmd/describe_affected_test.go
  • tests/testhelpers/filesystem_test.go
  • internal/exec/validate_schema_test.go
{cmd,internal,pkg}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

{cmd,internal,pkg}/**/*.go: Add defer perf.Track() to all public functions and critical private ones, include a blank line after it, and use package-qualified names (e.g., "exec.ProcessComponent"). Use atmosConfig if available, else nil.
Always bind environment variables with viper.BindEnv; every var must have an ATMOS_ alternative and prefer ATMOS_ over external names.
Distinguish structured logging from UI output: UI prompts/errors/status to stderr; data/results to stdout; logging for system/debug only; no UI via logging.
Most text UI must go to stderr (via utils.PrintfMessageToTUI or fmt.Fprintf(os.Stderr,...)); only data/results to stdout.

Files:

  • pkg/telemetry/utils_test.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/tui/templates/term/term_writer.go
  • internal/exec/describe_affected.go
  • pkg/filesystem/homedir.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/describe_stacks.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • internal/exec/describe_affected_utils_test.go
  • internal/exec/describe_component_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/version_test.go
  • internal/exec/describe_stacks_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • internal/exec/describe_affected_test.go
  • pkg/filesystem/interface.go
  • cmd/describe_affected_test.go
  • internal/exec/validate_schema_test.go
{pkg,internal,cmd}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Always use mockgen for interface mocks; never write manual mocks with many stub methods.

Files:

  • pkg/telemetry/utils_test.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/tui/templates/term/term_writer.go
  • internal/exec/describe_affected.go
  • pkg/filesystem/homedir.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/describe_stacks.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • internal/exec/describe_affected_utils_test.go
  • internal/exec/describe_component_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/version_test.go
  • internal/exec/describe_stacks_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • internal/exec/describe_affected_test.go
  • pkg/filesystem/interface.go
  • cmd/describe_affected_test.go
  • internal/exec/validate_schema_test.go
pkg/{,**/}**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests should primarily cover pkg/ code; ensure meaningful coverage with real scenarios (not coverage theater).

Files:

  • pkg/telemetry/utils_test.go
  • pkg/config/imports_error_paths_test.go
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_.go, mock_.go, **/mock/*.go.

Files:

  • pkg/telemetry/utils_test.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/tui/templates/term/term_writer.go
  • internal/exec/describe_affected.go
  • pkg/filesystem/homedir.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/describe_stacks.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • internal/exec/describe_affected_utils_test.go
  • internal/exec/describe_component_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/version_test.go
  • internal/exec/describe_stacks_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • internal/exec/describe_affected_test.go
  • pkg/filesystem/interface.go
  • cmd/describe_affected_test.go
  • tests/testhelpers/filesystem_test.go
  • internal/exec/validate_schema_test.go
**/!(*_test).go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Document all exported functions, types, and methods with Go doc comments

Files:

  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/tui/templates/term/term_writer.go
  • internal/exec/describe_affected.go
  • pkg/filesystem/homedir.go
  • internal/exec/describe_stacks.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • pkg/validator/schema_validator.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • pkg/filesystem/interface.go
pkg/config/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Use Viper for configuration loading with precedence (CLI→ENV→files→defaults) and the shown setup snippet (SetConfigName, AddConfigPath, AutomaticEnv, SetEnvPrefix).

Files:

  • pkg/config/imports_error_paths_test.go
.golangci.yml

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Configure golangci-lint with gofmt, goimports, govet, staticcheck, errcheck, ineffassign, misspell, unused, revive, gocritic enabled

Files:

  • .golangci.yml
cmd/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

cmd/**/*.go: Use Cobra's recommended command structure with a root command and subcommands
Implement each CLI command in a separate file under cmd/
Use Viper for managing configuration, environment variables, and flags in the CLI
Keep separation of concerns between CLI interface (cmd) and business logic
Use kebab-case for command-line flags
Provide comprehensive help text for all commands and flags
Include examples in Cobra command help
Use Viper for configuration management; support files, env vars, and flags with precedence flags > env > config > defaults
Follow single responsibility; separate command interface from business logic
Provide meaningful user feedback and include progress indicators for long-running operations
Provide clear error messages to users and troubleshooting hints where appropriate

cmd/**/*.go: Follow Cobra command pattern: one command per file; load examples via //go:embed and render via utils.PrintfMarkdown in RunE.
Telemetry for new commands is automatic via RootCmd.ExecuteC(); for non-standard paths use telemetry.CaptureCmd or telemetry.CaptureCmdString.

Files:

  • cmd/describe_affected_test.go
cmd/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

cmd/**/*_test.go: Always use cmd.NewTestKit(t) in ALL cmd package tests, including subtests, to snapshot and restore RootCmd state.
Command tests live under cmd/ and must use temporary binaries when needed; TestMain must call os.Exit(m.Run()) to propagate exit code.

Files:

  • cmd/describe_affected_test.go
tests/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Integration tests live under tests/ with fixtures in tests/test-cases/.

Files:

  • tests/testhelpers/filesystem_test.go
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to pkg/store/**/mock_*.go : Generate mocks for all store interfaces using mockgen (via //go:generate) rather than manual implementations.
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to {pkg,internal,cmd}/**/*.go : Always use mockgen for interface mocks; never write manual mocks with many stub methods.
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Place `//go:generate mockgen` directives for mocks at the top of test files; for internal interfaces use `-source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE`.
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to pkg/store/**/mock_*.go : Generate mocks for all store interfaces using mockgen (via //go:generate) rather than manual implementations.

Applied to files:

  • pkg/telemetry/utils_test.go
  • pkg/telemetry/mock/mock_telemetry_provider.go
  • internal/tui/templates/term/term_writer.go
  • pkg/filesystem/homedir.go
  • internal/exec/describe_stacks.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/version_test.go
  • pkg/telemetry/mock/mock_posthog_client.go
  • pkg/filesystem/interface.go
  • tests/testhelpers/filesystem_test.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Place `//go:generate mockgen` directives for mocks at the top of test files; for internal interfaces use `-source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE`.

Applied to files:

  • pkg/telemetry/utils_test.go
  • internal/tui/templates/term/term_writer.go
  • pkg/filesystem/homedir.go
  • internal/exec/describe_stacks.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • internal/exec/describe_affected_utils_test.go
  • pkg/validator/schema_validator.go
  • internal/exec/version_test.go
  • pkg/filesystem/interface.go
  • tests/testhelpers/filesystem_test.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to {pkg,internal,cmd}/**/*.go : Always use mockgen for interface mocks; never write manual mocks with many stub methods.

Applied to files:

  • pkg/telemetry/utils_test.go
  • internal/tui/templates/term/term_writer.go
  • pkg/filesystem/homedir.go
  • internal/exec/describe_stacks.go
  • pkg/pager/pager.go
  • pkg/filematch/interface.go
  • internal/exec/describe_affected_utils_test.go
  • .golangci.yml
  • pkg/validator/schema_validator.go
  • internal/exec/version_test.go
  • pkg/filesystem/interface.go
  • cmd/describe_affected_test.go
📚 Learning: 2024-11-13T21:37:07.852Z
Learnt from: Cerebrovinny
PR: cloudposse/atmos#764
File: internal/exec/describe_stacks.go:289-295
Timestamp: 2024-11-13T21:37:07.852Z
Learning: In the `internal/exec/describe_stacks.go` file of the `atmos` project written in Go, avoid extracting the stack name handling logic into a helper function within the `ExecuteDescribeStacks` method, even if the logic appears duplicated.

Applied to files:

  • internal/exec/describe_stacks.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/!(*_test).go : Document all exported functions, types, and methods with Go doc comments

Applied to files:

  • pkg/filematch/interface.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/* : Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_*.go, mock_*.go, **/mock/*.go.

Applied to files:

  • .golangci.yml
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*.go : All code must pass golangci-lint checks

Applied to files:

  • .golangci.yml
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
PR: cloudposse/atmos#1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.

Applied to files:

  • internal/exec/describe_stacks_test.go
🧬 Code graph analysis (1)
internal/exec/validate_schema_test.go (3)
pkg/validator/mock_schema_validator.go (1)
  • MockValidator (20-24)
pkg/downloader/mock_file_downloader_interface.go (1)
  • MockFileDownloader (21-25)
pkg/filematch/mock_interface.go (2)
  • MockFileMatcher (96-100)
  • NewMockFileMatcher (108-112)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Build (linux)
  • GitHub Check: Build (windows)
  • GitHub Check: Build (macos)
  • GitHub Check: Run pre-commit hooks
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary
🔇 Additional comments (28)
pkg/telemetry/utils_test.go (1)

24-24: LGTM! Clean migration to the maintained mock library.

The import path update to go.uber.org/mock/gomock is correct. All test logic remains intact since the APIs are compatible.

pkg/validator/schema_validator.go (1)

16-16: Migration to go.uber.org/mock looks good.

The directive correctly migrates to the maintained mock library. Pinning to @v0.6.0 rather than using @latest is actually solid practice—ensures reproducible builds across environments.

internal/exec/describe_component_test.go (1)

10-10: LGTM! Import path correctly updated.

The migration from the archived github.com/golang/mock to the maintained go.uber.org/mock is correct. The API remains compatible, so no changes to the gomock usage elsewhere in the file are needed.

tests/testhelpers/filesystem_test.go (1)

9-9: Import path updated correctly.

The migration from github.com/golang/mock/gomock to go.uber.org/mock/gomock is clean and aligns with the PR's goal to use the maintained fork. All gomock API usage remains unchanged.

pkg/filematch/interface.go (2)

18-21: Doc comment properly added.

Addresses previous feedback. The comment follows Go conventions and satisfies the coding guidelines.


16-16: No issues found; version pinning is consistent and intentional.

All go:generate mockgen directives across the codebase consistently use @v0.6.0. This is a deliberate choice for reproducibility and stability—pinned versions are preferred over @latest. The directive in pkg/filematch/interface.go:16 aligns with the codebase-wide pattern.

pkg/telemetry/mock/mock_posthog_client.go (1)

1-187: Migration looks good for this generated mock.

The import path update to go.uber.org/mock/gomock is correct, and the generated code includes expected changes from the Uber fork (the isgomock field at line 23 and any type usage in recorder methods). Since this is generated code, no manual edits are needed.

Note: Per the coding guidelines, ensure a //go:generate mockgen ... directive exists in the appropriate location (likely in the interface definition or test file) to regenerate this mock when needed. Based on learnings.

internal/tui/templates/term/term_writer.go (1)

11-11: Migration to go.uber.org/mock looks good.

The go:generate directive correctly invokes the Uber mock generator with proper flags and version pinning.

cmd/describe_affected_test.go (1)

9-9: LGTM!

The gomock import path has been correctly updated to use Uber's maintained fork. The test logic and mock usage remain unchanged.

.golangci.yml (2)

67-68: LGTM!

The new forbidigo rule correctly prevents future use of the archived github.com/golang/mock library and directs developers to use go.uber.org/mock. This proactive lint rule helps maintain consistency after the migration.


200-202: LGTM!

Excluding generated mock files from the godot linter is appropriate. Generated code may not follow comment style conventions, and this exclusion prevents noisy linting errors.

internal/exec/validate_schema_test.go (2)

6-8: LGTM!

Import paths correctly updated to use Uber's mock library. The test dependencies are now aligned with the migrated mock framework.


106-136: LGTM!

The mock type has been correctly updated from MockFileMatcherInterface to MockFileMatcher, reflecting the naming conventions of Uber's mockgen. The test logic and assertions remain unchanged.

internal/exec/describe_affected_test.go (1)

13-13: LGTM!

The gomock import path has been correctly updated. All test logic and mock expectations remain functionally identical.

internal/exec/describe_stacks.go (1)

34-34: LGTM!

The go:generate directive has been updated to use go run with explicit version pinning (@v0.6.0). This approach is more reproducible than relying on a globally installed mockgen binary.

internal/exec/describe_affected_utils_test.go (2)

3-3: LGTM!

The go:generate directive has been updated to use the versioned go run approach, consistent with other files in this PR. This ensures reproducible mock generation.


12-12: LGTM!

The gomock import path has been correctly updated. Test logic remains unchanged.

internal/exec/describe_affected.go (1)

51-51: LGTM!

The go:generate directive has been updated to use the versioned go run approach, ensuring reproducible and consistent mock generation across the codebase.

internal/exec/describe_stacks_test.go (1)

9-12: LGTM!

The gomock import path has been correctly updated to Uber's maintained fork. Import ordering follows the project's conventions (stdlib, third-party, Atmos packages).

pkg/config/imports_error_paths_test.go (2)

11-11: LGTM! Import path correctly updated.

The migration from the archived github.com/golang/mock to the maintained go.uber.org/mock is correct. The API is fully compatible, so no other changes are needed in this file.


62-80: LGTM! Proper gomock usage for testing hard-to-trigger error path.

The mock-based test correctly verifies the MkdirTemp error handling. Good use of dependency injection with the processConfigImportsWithFS function to make this testable.

pkg/filesystem/interface.go (1)

12-12: Verify the version pinning choice.

The PR description states directives should use @latest, but the implementation pins to @v0.6.0. While pinning to a specific version is generally better for reproducibility, confirm this deviation from the PR description is intentional.

Also applies to: 58-58, 69-69

pkg/filesystem/homedir.go (1)

9-9: Rewrite unnecessary—no code issues found.

All 21 go:generate mockgen directives in the codebase consistently use @v0.6.0, not @latest. The change to pkg/filesystem/homedir.go:9 follows the established pattern and is correct as-is. The original concern about version inconsistency was based on incorrect assumptions about PR objectives.

Likely an incorrect or invalid review comment.

internal/exec/version_test.go (2)

18-18: Migration to uber/mock looks good.

The go:generate directive correctly migrates to go.uber.org/mock/mockgen and follows the learned pattern for test file mock generation. Using @v0.6.0 instead of @latest is solid for reproducible builds.

Based on learnings.


3-13: Add blank line between import groups.

Import organization should follow the three-group pattern (stdlib, third-party, Atmos) with blank lines separating each group. A blank line is needed between line 4 (stdlib) and line 6 (third-party).

As per coding guidelines.

 import (
 	"testing"
+
 	"github.com/pkg/errors"
 	"github.com/stretchr/testify/assert"
 	"go.uber.org/mock/gomock"
⛔ Skipped due to learnings
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Unit tests should be table-driven where appropriate and focus on pure functions; target >80% coverage with emphasis on pkg/ and internal/exec/.
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Place `//go:generate mockgen` directives for mocks at the top of test files; for internal interfaces use `-source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE`.
pkg/telemetry/mock/mock_telemetry_provider.go (3)

16-16: Import migration looks good.

The import path correctly points to the maintained go.uber.org/mock library.


23-23: Expected addition from uber's mockgen.

The isgomock marker field is a zero-sized sentinel added by the new mockgen version—no impact on behavior or memory.


53-53: Stylistic update to modern Go.

The parameter type switch from interface{} to any is a cosmetic change—they're aliases. The new mockgen favors the shorter form.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
internal/exec/version_test.go (1)

15-15: Comment period issue addressed.

The missing period on the comment has been fixed as flagged in the previous review.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 584bb09 and 8658ef1.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • go.mod (2 hunks)
  • internal/exec/version_test.go (1 hunks)
  • internal/tui/templates/term/term_writer.go (3 hunks)
  • pkg/config/imports_error_paths_test.go (2 hunks)
  • pkg/downloader/file_downloader_interface.go (2 hunks)
  • pkg/filesystem/interface.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • pkg/downloader/file_downloader_interface.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/filesystem/interface.go
🧰 Additional context used
📓 Path-based instructions (10)
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

**/*.go: All comments must end with periods; enforced by golangci-lint godot across all Go comments.
Organize imports into three groups (stdlib, third-party, Atmos) separated by blank lines and sorted alphabetically within each group; keep existing aliases.
All errors must be wrapped using static errors defined in errors/errors.go; prefer errors.Join for multiple, fmt.Errorf with %w for context, and errors.Is for checks; never rely on string comparisons.
Prefer cross-platform implementations: use SDKs over external binaries; use filepath/os facilities; gate OS-specific logic with runtime.GOOS or build tags.

Files:

  • internal/tui/templates/term/term_writer.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/version_test.go
**/!(*_test).go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Document all exported functions, types, and methods with Go doc comments

Files:

  • internal/tui/templates/term/term_writer.go
{cmd,internal,pkg}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

{cmd,internal,pkg}/**/*.go: Add defer perf.Track() to all public functions and critical private ones, include a blank line after it, and use package-qualified names (e.g., "exec.ProcessComponent"). Use atmosConfig if available, else nil.
Always bind environment variables with viper.BindEnv; every var must have an ATMOS_ alternative and prefer ATMOS_ over external names.
Distinguish structured logging from UI output: UI prompts/errors/status to stderr; data/results to stdout; logging for system/debug only; no UI via logging.
Most text UI must go to stderr (via utils.PrintfMessageToTUI or fmt.Fprintf(os.Stderr,...)); only data/results to stdout.

Files:

  • internal/tui/templates/term/term_writer.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/version_test.go
{pkg,internal,cmd}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Always use mockgen for interface mocks; never write manual mocks with many stub methods.

Files:

  • internal/tui/templates/term/term_writer.go
  • pkg/config/imports_error_paths_test.go
  • internal/exec/version_test.go
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_.go, mock_.go, **/mock/*.go.

Files:

  • internal/tui/templates/term/term_writer.go
  • go.mod
  • pkg/config/imports_error_paths_test.go
  • internal/exec/version_test.go
go.{mod,sum}

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

go.{mod,sum}: Manage dependencies with Go modules
Keep dependencies up to date

Files:

  • go.mod
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/config/imports_error_paths_test.go
**/*_test.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios

**/*_test.go: Unit tests should be table-driven where appropriate and focus on pure functions; target >80% coverage with emphasis on pkg/ and internal/exec/.
Test behavior, not implementation; avoid tautological or stub-only tests; use dependency injection to make code testable; remove always-skipped tests; table-driven tests must use realistic scenarios.
Place //go:generate mockgen directives for mocks at the top of test files; for internal interfaces use -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE.
Tests must call production code paths (do not duplicate production logic within tests).
Always use t.Skipf with a reason (never t.Skip or Skipf without context).
Test files should mirror implementation structure and be co-located with source files (foo.go ↔ foo_test.go).
Use precondition-based test skipping helpers from tests/test_preconditions.go (e.g., RequireAWSProfile, RequireGitHubAccess).

Files:

  • pkg/config/imports_error_paths_test.go
  • internal/exec/version_test.go
pkg/config/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Use Viper for configuration loading with precedence (CLI→ENV→files→defaults) and the shown setup snippet (SetConfigName, AddConfigPath, AutomaticEnv, SetEnvPrefix).

Files:

  • pkg/config/imports_error_paths_test.go
pkg/{,**/}**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests should primarily cover pkg/ code; ensure meaningful coverage with real scenarios (not coverage theater).

Files:

  • pkg/config/imports_error_paths_test.go
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to pkg/store/**/mock_*.go : Generate mocks for all store interfaces using mockgen (via //go:generate) rather than manual implementations.
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to {pkg,internal,cmd}/**/*.go : Always use mockgen for interface mocks; never write manual mocks with many stub methods.
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Place `//go:generate mockgen` directives for mocks at the top of test files; for internal interfaces use `-source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE`.
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to pkg/store/**/mock_*.go : Generate mocks for all store interfaces using mockgen (via //go:generate) rather than manual implementations.

Applied to files:

  • internal/tui/templates/term/term_writer.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*_test.go : Place `//go:generate mockgen` directives for mocks at the top of test files; for internal interfaces use `-source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE`.

Applied to files:

  • internal/tui/templates/term/term_writer.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to {pkg,internal,cmd}/**/*.go : Always use mockgen for interface mocks; never write manual mocks with many stub methods.

Applied to files:

  • internal/tui/templates/term/term_writer.go
📚 Learning: 2025-10-19T22:59:32.333Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.333Z
Learning: Applies to **/*.go : All comments must end with periods; enforced by golangci-lint godot across all Go comments.

Applied to files:

  • internal/exec/version_test.go
🧬 Code graph analysis (1)
pkg/config/imports_error_paths_test.go (1)
pkg/config/load.go (1)
  • MaximumImportLvL (28-28)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Build (linux)
  • GitHub Check: Build (macos)
  • GitHub Check: Build (windows)
  • GitHub Check: Run pre-commit hooks
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary
🔇 Additional comments (7)
go.mod (1)

6-6: LGTM - dependency migration looks good.

The switch from archived golang/mock to maintained go.uber.org/mock v0.6.0 aligns perfectly with the PR objectives. The version is consistent with the @v0.6.0 used in go:generate directives throughout the codebase.

Also applies to: 90-90

internal/tui/templates/term/term_writer.go (2)

11-11: Good migration to Uber's mock framework.

The directive now uses go run with version pinning (@v0.6.0), ensuring reproducible mock generation across environments without requiring a globally installed mockgen binary.


79-79: Comments now properly punctuated.

The period additions ensure compliance with the godot linter requirement that all Go comments must end with periods.

Also applies to: 104-104, 111-111

pkg/config/imports_error_paths_test.go (2)

11-11: Import updated correctly.

The switch to go.uber.org/mock/gomock completes the migration from the archived golang/mock package.


259-264: Test correctly verifies graceful depth-limit handling.

The implementation confirms the test's expected behavior: processLocalImport at max depth succeeds and gracefully skips nested imports that exceed the limit (lines 259–261 log and continue rather than propagate errors). The assertion NoError is correct—the function doesn't fail the operation when nested imports hit the depth ceiling, it just processes what fits.

internal/exec/version_test.go (2)

3-13: Migration to go.uber.org/mock looks good.

The import path has been correctly updated from github.com/golang/mock/gomock to go.uber.org/mock/gomock, and the import organization follows the coding guidelines with proper grouping.


26-306: Test implementation is solid.

The table-driven tests are well-structured, cover both happy paths and error conditions, and properly utilize gomock for mocking. The migration to go.uber.org/mock hasn't affected the test logic.

@aknysh aknysh merged commit 5754c18 into main Oct 21, 2025
53 checks passed
@aknysh aknysh deleted the osterman/migrate-uber-mock branch October 21, 2025 13:51
@coderabbitai coderabbitai bot mentioned this pull request Oct 21, 2025
@github-actions
Copy link

These changes were released in v1.196.0-rc.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/l Large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opt in or opt out analytics for how atmos is used

3 participants