-
Notifications
You must be signed in to change notification settings - Fork 424
compile: clarify --action-mode/--action-tag/--gh-aw-ref relationship, enforce mutual exclusivity #39697
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
compile: clarify --action-mode/--action-tag/--gh-aw-ref relationship, enforce mutual exclusivity #39697
Changes from all commits
4749595
6d976c6
ef20803
d11d8c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -228,7 +228,9 @@ func validateActionModeConfig(actionMode string) error { | |
|
|
||
| mode := workflow.ActionMode(actionMode) | ||
| if !mode.IsValid() { | ||
| return fmt.Errorf("invalid action mode '%s'. Must be 'dev', 'release', 'script', or 'action'", actionMode) | ||
| // ActionModeScript is intentionally excluded from this user-facing error: | ||
| // it remains internal and is not advertised as a CLI-supported mode. | ||
| return fmt.Errorf("invalid action mode '%s'. Must be 'dev', 'release', or 'action'", actionMode) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💡 Details
func (m ActionMode) IsValid() bool {
return m == ActionModeDev || m == ActionModeRelease || m == ActionModeScript || m == ActionModeAction
}So
This creates a hidden, undocumented but functional mode with no discoverability path. Two clean resolutions:
Without one of these, a future developer will find a working hidden mode with no rationale for why it exists.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in d11d8c0: added an explicit comment in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/diagnose] 💡 OptionsOption A — keep it as an undocumented internal escape hatch (current state), but add a comment here to make the gap intentional: // Note: ActionModeScript is intentionally excluded — it is an internal mode
// not meant to be set directly by end users via the CLI.
return fmt.Errorf("invalid action mode '%s'. Must be 'dev', 'release', or 'action'", actionMode)Option B — explicitly block it at the CLI layer so the error message and accepted set agree: if mode == workflow.ActionModeScript || !mode.IsValid() {
return fmt.Errorf("invalid action mode '%s'. Must be 'dev', 'release', or 'action'", actionMode)
}Option A is lower-risk if internal automation relies on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in d11d8c0: documented in |
||
| } | ||
|
|
||
| return nil | ||
|
|
||
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.
[/tdd] No regression test for the mutual exclusivity enforcement — the core behavior fix has zero test coverage.
💡 Suggested approach
A unit test in
cmd/gh-aw/main_entry_test.go(pattern already used there:rootCmd.SetArgs(...)+Execute()) could cover both error cases:Without this, a future refactor removing
MarkFlagsMutuallyExclusivewould produce no CI signal.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.
Addressed in d11d8c0: added
TestCompileGhAwRefMutuallyExclusiveFlagsincmd/gh-aw/main_help_text_test.goto cover both--gh-aw-refconflict cases.