Conversation
📝 WalkthroughWalkthroughCompute a normalized, relative, extensionless workflow filename for error messages/resume commands; add a failing subdirectory workflow fixture, its stderr golden snapshot and test case validating the resume command; add a .gitignore entry for Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI as Atmos CLI
participant Exec as Workflow Executor
participant Err as Error Handler
User->>CLI: atmos workflow fail -f subdir/test
CLI->>Exec: Run workflow steps
Exec->>Exec: Execute step1 (terraform plan ...)
Exec-->>Err: Step failed
Err->>Err: Normalize workflow path (toSlash, trim base, strip leading '/', remove extension)
Err-->>CLI: Construct resume cmd: atmos workflow fail -f subdir/test --from-step step1
CLI-->>User: Print failure, Explanation, and resume command
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Out-of-scope changes
Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (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). (5)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
tests/fixtures/scenarios/workflows/stacks/workflows/subdir/test.yaml (1)
6-6: Add a trailing newlineYAML linter flags the missing newline at EOF.
Apply this diff:
- - command: terraform plan mock -s idontexist + - command: terraform plan mock -s idontexist +tests/test-cases/workflows.yaml (1)
265-286: Test case covers the filepath scenario wellGood addition verifying the resume command uses the relative path without extension. Consider adding another case with a deeper nesting (e.g., subdir/deeper/test) in a follow-up to guard against future regressions.
internal/exec/workflow_utils.go (1)
168-179: Quote --from-step when it contains spaces (defensive UX)If a step name includes whitespace, the resume command will break. Cheap guard: quote only when needed to avoid snapshot churn.
Apply this diff:
- resumeCommand := fmt.Sprintf( - "%s workflow %s -f %s --from-step %s", - config.AtmosCommand, - workflow, - workflowFileName, - step.Name, - ) + stepName := step.Name + if strings.ContainsAny(stepName, " \t") { + stepName = fmt.Sprintf("%q", stepName) + } + resumeCommand := fmt.Sprintf( + "%s workflow %s -f %s --from-step %s", + config.AtmosCommand, + workflow, + workflowFileName, + stepName, + )
📜 Review details
Configuration used: .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.
📒 Files selected for processing (5)
.gitignore(1 hunks)internal/exec/workflow_utils.go(1 hunks)tests/fixtures/scenarios/workflows/stacks/workflows/subdir/test.yaml(1 hunks)tests/snapshots/TestCLICommands_atmos_workflow_failure_with_filepath.stderr.golden(1 hunks)tests/test-cases/workflows.yaml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go
📄 CodeRabbit Inference Engine (.cursor/rules/atmos-rules.mdc)
**/*.go: Use Viper for managing configuration, environment variables, and flags
Use interfaces for external dependencies to facilitate mocking
All code must pass golangci-lint checks
Follow Go's error handling idioms
Use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider using a custom error type for domain-specific errors
Follow standard Go coding style
Use gofmt and goimports to format code
Prefer short, descriptive variable names
Use snake_case for environment variables
Document all exported functions, types, and methods
Document complex logic with inline comments
Follow Go's documentation conventions
Use Viper for configuration management
Support configuration via files, environment variables, and flags
Follow the precedence order: flags > environment variables > config file > defaults
Files:
internal/exec/workflow_utils.go
🧠 Learnings (4)
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
PR: cloudposse/atmos#1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
tests/snapshots/TestCLICommands_atmos_workflow_failure_with_filepath.stderr.golden
📚 Learning: 2025-06-02T14:12:02.710Z
Learnt from: milldr
PR: cloudposse/atmos#1229
File: internal/exec/workflow_test.go:0-0
Timestamp: 2025-06-02T14:12:02.710Z
Learning: In the atmos codebase, workflow error handling was refactored to use `PrintErrorMarkdown` followed by returning specific error variables (like `ErrWorkflowNoSteps`, `ErrInvalidFromStep`, `ErrInvalidWorkflowStepType`, `ErrWorkflowStepFailed`) instead of `PrintErrorMarkdownAndExit`. This pattern allows proper error testing without the function terminating the process with `os.Exit`, enabling unit tests to assert on error conditions while maintaining excellent user-facing error formatting.
Applied to files:
tests/snapshots/TestCLICommands_atmos_workflow_failure_with_filepath.stderr.goldeninternal/exec/workflow_utils.gotests/test-cases/workflows.yaml
📚 Learning: 2025-02-14T23:12:38.030Z
Learnt from: Listener430
PR: cloudposse/atmos#1061
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:8-8
Timestamp: 2025-02-14T23:12:38.030Z
Learning: Test snapshots in the Atmos project, particularly for dry run scenarios, may be updated during the development process, and temporary inconsistencies in their content should not be flagged as issues.
Applied to files:
tests/snapshots/TestCLICommands_atmos_workflow_failure_with_filepath.stderr.golden
📚 Learning: 2025-06-02T14:12:02.710Z
Learnt from: milldr
PR: cloudposse/atmos#1229
File: internal/exec/workflow_test.go:0-0
Timestamp: 2025-06-02T14:12:02.710Z
Learning: In the atmos codebase, workflow error handling was refactored to use `PrintErrorMarkdown` followed by returning the error instead of `PrintErrorMarkdownAndExit`. This pattern allows proper error testing without the function terminating the process with `os.Exit`, enabling unit tests to assert on error conditions.
Applied to files:
tests/snapshots/TestCLICommands_atmos_workflow_failure_with_filepath.stderr.goldeninternal/exec/workflow_utils.gotests/test-cases/workflows.yaml
🧬 Code Graph Analysis (4)
.gitignore (1)
tests/cli_test.go (1)
applyIgnorePatterns(366-385)
tests/fixtures/scenarios/workflows/stacks/workflows/subdir/test.yaml (1)
internal/exec/workflow_test.go (1)
TestExecuteWorkflow(13-234)
internal/exec/workflow_utils.go (2)
pkg/schema/schema.go (1)
Workflows(360-363)internal/exec/workflow_test.go (1)
TestExecuteWorkflow(13-234)
tests/test-cases/workflows.yaml (2)
internal/exec/stack_utils_test.go (1)
TestBuildTerraformWorkspace(13-101)internal/exec/workflow_test.go (1)
TestExecuteWorkflow(13-234)
🪛 YAMLlint (1.37.1)
tests/fixtures/scenarios/workflows/stacks/workflows/subdir/test.yaml
[error] 6-6: no new line character at the end of file
(new-line-at-end-of-file)
⏰ 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). (4)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Lint (golangci)
- GitHub Check: Analyze (go)
- GitHub Check: Summary
🔇 Additional comments (2)
.gitignore (1)
48-48: LGTM: ignore rule scoped and harmlessAdding internal/exec/output.* looks safe and prevents committing transient outputs from tests.
tests/snapshots/TestCLICommands_atmos_workflow_failure_with_filepath.stderr.golden (1)
1-24: Snapshot matches the new behaviorThe stderr snapshot correctly reflects the updated resume command format with subdir/test.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1404 +/- ##
==========================================
+ Coverage 55.18% 55.32% +0.13%
==========================================
Files 272 272
Lines 28487 28491 +4
==========================================
+ Hits 15721 15763 +42
+ Misses 10989 10948 -41
- Partials 1777 1780 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…sse/atmos into DEV-3557/workflow-error-filepath
|
These changes were released in v1.188.0. |
what
why
references
Summary by CodeRabbit
Bug Fixes
Tests
Chores