Skip to content

Conversation

@yhakbar
Copy link
Collaborator

@yhakbar yhakbar commented Nov 8, 2025

Description

Accidentally left these tests while debugging earlier and forgot to restore.

Also, noticed that we weren't tracking includes in the ReadFiles slice, so I added a call to track it.

TODOs

Read the Gruntwork contribution guidelines.

  • I authored this code entirely myself
  • I am submitting code based on open source software (e.g. MIT, MPL-2.0, Apache)]
  • I am adding or upgrading a dependency or adapted code and confirm it has a compatible open source license
  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added / Removed / Updated [X].

Migration Guide

Summary by CodeRabbit

  • Chores
    • Enhanced file read tracking for include file processing.
    • Improved test infrastructure with expanded coverage for module filtering and include restriction scenarios.

@vercel
Copy link

vercel bot commented Nov 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
terragrunt-docs Ready Ready Preview Comment Nov 12, 2025 4:48pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 8, 2025

📝 Walkthrough

Walkthrough

Added file read tracking to the include configuration handler to record when included files are processed. Updated integration test helpers to return stdout and stderr as values instead of using pointers, and removed a conditional test guard to enable all test cases to run.

Changes

Cohort / File(s) Summary
File read tracking
config/include.go
Added trackFileRead call in handleInclude to record included file reads during config processing
Test infrastructure and tests
test/integration_include_test.go
Changed test command invocation from RunTerragruntCommand to RunTerragruntCommandWithOutput (returns stdout/stderr instead of using pointers); added new test TestTerragruntRunAllModulesThatIncludeRestrictsSetWithFilter with filter flag support; updated assertions to work with returned stdout string
Test execution flow
test/integration_units_reading_test.go
Removed test guard that conditionally skipped test cases, allowing all cases in TestUnitsReadingWithFilter to execute unconditionally

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The production code change is minimal (single function call addition)
  • Test changes follow a consistent refactoring pattern across multiple assertions
  • Main complexity is understanding the new test helper signature and the conditional skip removal

Possibly related PRs

Suggested reviewers

  • denis256
  • wakeful

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete with a placeholder release notes section and empty migration guide, despite the author checking off all contribution guidelines. Replace the placeholder 'Added / Removed / Updated [X].' with a specific one-line description of what was changed for release notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: re-enabling tests that were accidentally left disabled during debugging, which matches the core content of the PR.
✨ 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 chore/re-enable-units-reading-with-filter-test

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c08330 and 8c35c02.

📒 Files selected for processing (3)
  • config/include.go (1 hunks)
  • test/integration_include_test.go (1 hunks)
  • test/integration_units_reading_test.go (0 hunks)
💤 Files with no reviewable changes (1)
  • test/integration_units_reading_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit configuration file

Review the Go code for quality and correctness. Make sure that the Go code follows best practices, is performant, and is easy to understand and maintain.

Files:

  • config/include.go
  • test/integration_include_test.go
🧠 Learnings (1)
📚 Learning: 2025-08-19T16:05:54.723Z
Learnt from: Resonance1584
Repo: gruntwork-io/terragrunt PR: 4683
File: go.mod:86-90
Timestamp: 2025-08-19T16:05:54.723Z
Learning: When analyzing Go module dependencies for removal, always check for both direct imports and API usage across all Go files in the repository, not just a quick search. The github.com/mattn/go-zglob library is used for filesystem walking and glob expansion in multiple Terragrunt files including util/file.go, format commands, and AWS provider patch functionality.

Applied to files:

  • test/integration_include_test.go
🧬 Code graph analysis (1)
test/integration_include_test.go (3)
test/helpers/package.go (3)
  • RunTerragruntCommandWithOutput (1007-1011)
  • CopyEnvironment (89-105)
  • CleanupTerraformFolder (882-889)
test/helpers/test_helpers.go (1)
  • IsExperimentMode (65-71)
util/file.go (1)
  • JoinPath (626-628)
⏰ 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). (3)
  • GitHub Check: license_check / License Check
  • GitHub Check: lint / lint
  • GitHub Check: Pull Request has non-contributor approval
🔇 Additional comments (3)
test/integration_include_test.go (2)

76-87: LGTM! Clean migration to new helper API.

The update correctly migrates from buffer-based output capture to the new RunTerragruntCommandWithOutput API that returns stdout/stderr as values. The test assertions are properly updated to work with the returned strings.


89-109: Disregard this review comment.

The assertion about missing --tf-forward-stdout is incorrect. The --filter flag provides a unified approach to filtering units and stacks using a sophisticated query syntax, and is independent of output formatting. Across the codebase—including integration_filter_graph_test.go, integration_stacks_test.go, and integration_units_reading_test.go—similar tests use --filter with run --all plan commands without --tf-forward-stdout. The test structure is sound, and the assertions checking stdout for Terraform keywords ("alpha", "beta", "charlie") work correctly with Terragrunt's default output capture, regardless of the --tf-forward-stdout flag presence.

Likely an incorrect or invalid review comment.

config/include.go (1)

139-140: Consider resolving paths to absolute before tracking.

The current implementation passes includeConfig.Path directly to trackFileRead (line 139), but this path may be relative. Inside parseIncludedConfig (lines 36-38), relative paths are resolved to absolute using filepath.IsAbs and util.JoinPath, but this resolved path is stored in a local variable and never updates includeConfig.Path.

Since trackFileRead uses exact string matching for deduplication (slices.Contains), the same included file referenced via different relative paths would be tracked as separate entries. To ensure consistent tracking, consider resolving includeConfig.Path to an absolute path before calling trackFileRead, or pass the resolved absolute path directly.


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

ThisGuyCodes
ThisGuyCodes previously approved these changes Nov 8, 2025
@yhakbar yhakbar force-pushed the docs/documenting-filter-source-attribute branch 2 times, most recently from 4d044b0 to c85155c Compare November 11, 2025 19:23
Base automatically changed from docs/documenting-filter-source-attribute to main November 11, 2025 19:47
@yhakbar yhakbar dismissed ThisGuyCodes’s stale review November 11, 2025 19:47

The base branch was changed.

@yhakbar yhakbar force-pushed the chore/re-enable-units-reading-with-filter-test branch from c9aab9f to 8c35c02 Compare November 12, 2025 16:47
@yhakbar yhakbar merged commit aa676df into main Nov 12, 2025
91 of 92 checks passed
@yhakbar yhakbar deleted the chore/re-enable-units-reading-with-filter-test branch November 12, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants