Skip to content

Conversation

osterman
Copy link
Member

@osterman osterman commented Sep 3, 2025

what

  • Changed -coverpkg=./... to -coverpkg=github.com/cloudposse/atmos/... in the Makefile's testacc-cover target
  • This change makes coverage instrumentation selective, only instrumenting Atmos packages rather than all dependencies

why

  • The Linux builds in GitHub Actions were failing due to cache restoration timeouts
  • The Go build cache was exceeding 4GB when using -coverpkg=./... because it was instrumenting all 853 dependencies
  • Major dependencies like google.golang.org/api (336MB), aws-sdk-go (322MB), and wasmtime-go (297MB) were all being instrumented for coverage
  • This massive cache caused downloads to timeout with the default 10-minute segment timeout
  • Only Linux builds were affected because they're the only ones running make testacc-cover with full coverage instrumentation (for Codecov upload)

references

  • The issue started after adding Packer support which brought in many large dependencies (AWS SDK v2, Azure SDK, Google APIs, JFrog client)
  • Using selective coverage (github.com/cloudposse/atmos/...) still provides accurate coverage for our code while excluding external dependencies
  • This reduces the cache size from 4GB+ to under 1GB, fixing the timeout issues

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Adjusted test coverage configuration for acceptance tests to instrument only relevant module packages, improving the accuracy of coverage metrics.
    • Output artifacts and post-processing remain unchanged, ensuring consistent CI reporting.
    • No impact on runtime behavior or user-facing features.
    • No changes to public APIs.

…tation

- Change -coverpkg=./... to -coverpkg=github.com/cloudposse/atmos/...
- This prevents instrumentation of all 853 external dependencies
- Reduces cache size from 4GB+ to under 1GB
- Fixes timeout issues in GitHub Actions for Linux builds
- Coverage still tracks all Atmos code, just not external deps

The issue was that -coverpkg=./... was instrumenting ALL dependencies
(including google.golang.org/api at 336MB, aws-sdk-go at 322MB, etc.)
for coverage tracking, causing the Go build cache to exceed 4GB and
timeout during restoration in GitHub Actions.

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

Co-Authored-By: Claude <[email protected]>
@osterman osterman requested a review from a team as a code owner September 3, 2025 03:23
@github-actions github-actions bot added the size/xs Extra small size PR label Sep 3, 2025
Copy link

mergify bot commented Sep 3, 2025

Important

Cloud Posse Engineering Team Review Required

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

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

@mergify mergify bot added the needs-cloudposse Needs Cloud Posse assistance label Sep 3, 2025
@osterman osterman added the no-release Do not create a new release (wait for additional code changes) label Sep 3, 2025
Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

📝 Walkthrough

Walkthrough

Updated the Makefile’s testacc-cover target by changing the Go test coverage flag -coverpkg from ./... to github.com/cloudposse/atmos/.... No other targets or flags were modified.

Changes

Cohort / File(s) Summary
Build/Test tooling
Makefile
Adjusted test coverage scope in testacc-cover: -coverpkg changed from ./... to github.com/cloudposse/atmos/...; output and filtering behavior unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

no-release

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-go-deps-cache-size

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (1)
Makefile (1)

62-66: Use module-derived coverpkg, atomic coverage mode, and tighten mock filter.

  • Avoid hardcoding the module path; derive it to keep forks/renames working.
  • Prefer -covermode=atomic for accurate concurrent coverage (and Codecov friendliness).
  • Narrow the grep to exclude only _mock.go files and drop the needless cat.

Add near the top (outside this hunk):

MODULE ?= $(shell go list -m)

Apply this diff in this target:

-	go test $(TEST) -v -coverpkg=github.com/cloudposse/atmos/... $(TESTARGS) -timeout 40m -coverprofile=coverage.out.tmp
-	cat coverage.out.tmp | grep -v "mock_" > coverage.out
+	go test $(TEST) -v -covermode=atomic -coverpkg=$(MODULE)/... $(TESTARGS) -timeout 40m -coverprofile=coverage.out.tmp
+	grep -vE '/mock_.*\.go:' coverage.out.tmp > coverage.out
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 5e2f1c3 and a1e0259.

📒 Files selected for processing (1)
  • Makefile (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: aknysh
PR: cloudposse/atmos#768
File: internal/exec/vendor_model_component.go:3-20
Timestamp: 2024-11-18T13:59:10.824Z
Learning: When replacing significant dependencies like `go-getter` that require extensive changes, prefer to address them in separate PRs.
Learnt from: CR
PR: cloudposse/atmos#0
File: AGENTS.md:0-0
Timestamp: 2025-09-02T14:44:18.329Z
Learning: Run `make testacc-cover` before committing
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T19:59:52.081Z
Learning: Applies to **/*.go : Target >80% coverage on new/changed lines and include comprehensive unit tests for new features.
📚 Learning: 2025-09-02T14:44:18.329Z
Learnt from: CR
PR: cloudposse/atmos#0
File: AGENTS.md:0-0
Timestamp: 2025-09-02T14:44:18.329Z
Learning: Run `make testacc-cover` before committing

Applied to files:

  • Makefile
📚 Learning: 2025-07-01T02:22:25.901Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: CI should run unit tests, integration tests, golangci-lint, and coverage reporting

Applied to files:

  • Makefile
📚 Learning: 2025-07-01T02:22:25.901Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*_test.go : Include integration tests for command flows

Applied to files:

  • Makefile
⏰ 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). (8)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary
🔇 Additional comments (2)
Makefile (2)

64-64: Selective coverpkg fixes cache bloat — good change.

Limiting instrumentation to the module path is the right call to shrink the build cache and speed up CI. Nice.


62-66: Instrumentation scope and module path verified. Module path is github.com/cloudposse/atmos and coverage instrumentation includes exactly all 51 local packages (matching ./...).

Copy link

codecov bot commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.97%. Comparing base (4c89983) to head (471238f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1444      +/-   ##
==========================================
+ Coverage   55.93%   55.97%   +0.04%     
==========================================
  Files         274      274              
  Lines       28928    28928              
==========================================
+ Hits        16181    16193      +12     
+ Misses      10955    10941      -14     
- Partials     1792     1794       +2     
Flag Coverage Δ
unittests 55.97% <ø> (+0.04%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cloudposse Needs Cloud Posse assistance no-release Do not create a new release (wait for additional code changes) size/xs Extra small size PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant