Uh oh!
There was an error while loading. Please reload this page.
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>
Commit: 51264f3
16 interesting tests: 7 KNOWN, 7 SKIP, 2 flaky
Top 23 slowest tests (at least 2 minutes):
|
Uh oh!
There was an error while loading. Please reload this page.
| func (m *script) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { | ||
| command := getCommmand(b, m.scriptHook) | ||
| if command == "" { |
There was a problem hiding this comment.
Is there a case for having a script but no command? like variable command?
There was a problem hiding this comment.
The script hooks run after variable interpolation, so the command is always fully resolved by the time this code executes. If it resolves to empty then it is not really useful, of course...
There was a problem hiding this comment.
In that case I wonder why not hard error here.
There was a problem hiding this comment.
I don't know, this is quite old code.
In fact, we might be able to yank the experimental scripts section entirely.
The fix here is localized to addressing something I spotted when working on #4710.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
## Summary - Move the empty command check to the top of `script.Apply` so that `NewCommandExecutor` (which requires a shell to be available) is not called when no script hook is configured. - Simplify `executeHook` by passing the resolved command directly instead of re-fetching it from the bundle. Found out about this dependency during investigation of #4710. ## Test plan - [x] Existing unit tests pass - [x] No new behavior introduced; this is a refactor that reorders existing checks 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
## Summary - Move the empty command check to the top of `script.Apply` so that `NewCommandExecutor` (which requires a shell to be available) is not called when no script hook is configured. - Simplify `executeHook` by passing the resolved command directly instead of re-fetching it from the bundle. Found out about this dependency during investigation of #4710. ## Test plan - [x] Existing unit tests pass - [x] No new behavior introduced; this is a refactor that reorders existing checks 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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