-
-
Notifications
You must be signed in to change notification settings - Fork 121
Fix describe 8000 stacks StringSlice flags #1317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
💥 This pull request now has conflicts. Could you fix it @osterman? 🙏 |
📝 WalkthroughWalkthroughThis update changes three CLI flags in Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant FlagParser
User->>CLI: Run describe-stacks with --components, --component-types, --sections (multiple values)
CLI->>FlagParser: Parse flags as string slices
FlagParser-->>CLI: Return parsed slices
CLI-->>User: Proceed with command using multiple values for each flag
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 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 (13)
✨ 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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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)
AGENTS.md (1)
1-1
: Helpful build instruction added.The build prerequisite documentation is valuable for users running tests. Consider using the typographical ellipsis character (…) instead of three periods for better typography, though this is a minor style preference.
-Before running Go tests, build the project with `go build ./...`. +Before running Go tests, build the project with `go build ./…`.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
AGENTS.md
(1 hunks)cmd/describe_stacks.go
(1 hunks)cmd/describe_stacks_test.go
(5 hunks)
🧰 Additional context used
🪛 LanguageTool
AGENTS.md
[style] ~1-~1: Consider using the typographical ellipsis character here instead.
Context: ...unning Go tests, build the project with go build ./...
.
(ELLIPSIS)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Summary
🔇 Additional comments (6)
cmd/describe_stacks.go (2)
136-140
: Flag type changes look solid.The conversion from String to StringSlice flags for components, component-types, and sections properly addresses the parsing issue mentioned in the PR objectives. The default value change from empty string to nil is appropriate for slice flags.
102-106
: Type handling is robust.The switch statement correctly handles []string types using GetStringSlice, and the panic for unsupported types provides clear error reporting. This aligns well with the test case that validates panic behavior.
cmd/describe_stacks_test.go (4)
43-43
: Improved test isolation with initFlags approach.The addition of the initFlags function field allows each test case to define exactly the flags it needs, improving test clarity and isolation. The comprehensive flag definitions match the actual command setup.
Also applies to: 52-63
122-150
: Excellent test coverage for comma-separated parsing.This test case validates that the StringSlice flags correctly parse comma-separated values, which is exactly what the flag type change was meant to enable. The expected values properly demonstrate the parsing behavior.
152-172
: Smart panic test for type mismatch.This test ensures that defining slice flags as String types triggers the expected panic with a clear error message. This validates the robustness of the type switching logic in setCliArgsForDescribeStackCli.
180-181
: Clean test execution pattern.The test execution properly calls initFlags before setting values, ensuring each test has the correct flag definitions. This maintains the improved isolation approach.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1317 +/- ##
==========================================
+ Coverage 50.66% 50.78% +0.12%
==========================================
Files 237 237
Lines 25777 25777
==========================================
+ Hits 13061 13092 +31
+ Misses 11085 11050 -35
- Partials 1631 1635 +4
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:
|
fs.String("file", "", "Write the result to file") | ||
fs.String("format", "yaml", "Specify the output format (`yaml` is default)") | ||
fs.StringP("stack", "s", "", "Filter by a specific stack\nThe filter supports names of the top-level stack manifests (including subfolder paths), and `atmos` stack names (derived from the context vars)") | ||
fs.StringSlice("components", nil, "Filter by specific `atmos` components") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These test cases would not have caught the bug that we faced with issue: #1309
It is testing setCliArgsForDescribeStackCli
if that is what we are looking for.
Summary
--components
,--component-types
, and--sections
as string slicesgo build
before testshttps://chatgpt.com/codex/tasks/task_b_6852e5346c7483329a2a810e0d733569
Summary by CodeRabbit
New Features
Bug Fixes
Documentation