Return early from script mutator if no script is defined#4711
Open
Return early from script mutator if no script is defined#4711
Conversation
Move the empty command check to the top of `Apply` so that `NewCommandExecutor` (which requires a shell) is not called when no script hook is configured. This avoids a hard dependency on a shell being available during bundle initialization. Closes #4710 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Commit: bae7dc8
16 interesting tests: 7 SKIP, 6 RECOVERED, 3 flaky
Top 22 slowest tests (at least 2 minutes):
|
denik
approved these changes
Mar 11, 2026
| } | ||
|
|
||
| func (m *script) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { | ||
| command := getCommmand(b, m.scriptHook) |
|
|
||
| func (m *script) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { | ||
| command := getCommmand(b, m.scriptHook) | ||
| if command == "" { |
Contributor
There was a problem hiding this comment.
Is there a case for having a script but no command? like variable command?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
script.Applyso thatNewCommandExecutor(which requires a shell to be available) is not called when no script hook is configured.executeHookby passing the resolved command directly instead of re-fetching it from the bundle.Found out about this dependency during investigation of #4710.
Test plan
🤖 Generated with Claude Code