fix: Reduce log spam for imports outside base directory#1780
Conversation
Changed import path validation logging from WARN to TRACE level to prevent
excessive log spam when using legitimate parent directory imports.
**Problem:**
When atmos.yaml is placed in `.github/atmos.yaml` and imports `../atmos.yaml`,
each import resolution triggers a warning. In GitHub Actions, this creates
hundreds of duplicate warnings since atmos is called multiple times.
**Example scenario:**
```
.github/atmos.yaml:
import:
- ../atmos.yaml
Base directory: /home/runner/_work/infra/infra
Import resolves to: /home/runner/_work/infra/atmos.yaml (outside base)
Result: WARN spam on every atmos invocation
```
**Solution:**
Import paths outside the base directory are a valid use case for shared
configurations. Changed from `log.Warn()` to `log.Trace()` so the message
is only visible at trace logging level, consistent with other import-related
logging in the same file (lines 108, 111, 114).
**Logging level rationale:**
- TRACE: Detailed import flow (attempting merge, success/failure per file)
- DEBUG: Error conditions (failed to resolve path, invalid imports)
- WARN: User-actionable problems
- INFO: High-level operations
This message is informational trace data about import resolution, not a
debug-level error condition or user-actionable warning.
**Testing:**
Added TestProcessLocalImport_OutsideBaseDirectory to verify imports outside
base directory work correctly and only log at trace level.
Resolves parent directory import warning spam in GitHub Actions and CI/CD.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
📝 WalkthroughWalkthroughModified logging for imports outside the base directory from warning to trace level and added a test case validating that Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (4)pkg/**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/*_test.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/!(*_test).go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
🧠 Learnings (11)📓 Common learnings📚 Learning: 2025-05-23T19:51:47.091ZApplied to files:
📚 Learning: 2025-09-23T02:30:42.362ZApplied to files:
📚 Learning: 2024-11-19T23:00:45.899ZApplied to files:
📚 Learning: 2025-05-23T19:51:47.091ZApplied to files:
📚 Learning: 2025-05-23T19:51:47.091ZApplied to files:
📚 Learning: 2025-09-23T02:30:42.362ZApplied to files:
📚 Learning: 2025-05-23T19:51:47.091ZApplied to files:
📚 Learning: 2024-10-28T01:51:30.811ZApplied to files:
📚 Learning: 2025-02-21T20:56:05.539ZApplied to files:
📚 Learning: 2025-02-21T20:56:20.761ZApplied to files:
🧬 Code graph analysis (1)pkg/config/imports.go (1)
⏰ 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). (10)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1780 +/- ##
==========================================
+ Coverage 70.71% 70.76% +0.05%
==========================================
Files 432 432
Lines 39916 39916
==========================================
+ Hits 28227 28248 +21
+ Misses 9286 9267 -19
+ Partials 2403 2401 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Resolved snapshot conflicts by taking main's version. User will regenerate snapshots as needed for ai-1 branch changes. Merged changes from main: - feat: add error handling infrastructure with context-aware capabilities (#1763) - fix: Resolve changelog check failures on large PRs (#1782) - Refine homepage hero and typing animation (#1781) - fix: Reduce log spam for imports outside base directory (#1780) - feat: Add custom sanitization map to test CLI for test-specific output rules (#1779) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
These changes were released in v1.199.0-rc.0. |
what
why
When using import paths that resolve outside the base directory, the warning message was being logged repeatedly during CI/CD workflows, creating excessive log spam. This is particularly noticeable in GitHub Actions where atmos is invoked multiple times.
The message "Import path is outside of base directory" is informational trace data about the import resolution process, not a user-actionable warning. Imports outside the base directory are a valid use case for shared configurations.
references
pkg/config/imports.go) which use TRACE levelSummary by CodeRabbit
Tests
Bug Fixes