Ver código fonte

fix: skip nil actions when rebuilding the action map

A config that fails to decode can leave nil entries in the action list,
which made -syntaxcheck panic instead of reporting the decode failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 23 horas atrás
pai
commit
add4f1c545

+ 3 - 0
service/internal/executor/executor_actions.go

@@ -101,6 +101,9 @@ func (e *Executor) RebuildActionMap() {
 	}
 
 	for configOrder, action := range e.Cfg.Actions {
+		if action == nil {
+			continue
+		}
 		if action.Entity != "" {
 			registerActionsFromEntities(e, configOrder, action.Entity, action, req)
 		} else {

+ 8 - 0
service/internal/executor/executor_test.go

@@ -1232,3 +1232,11 @@ func TestLogEntryOutputAvailableWhileRunning(t *testing.T) {
 	assert.True(t, snapshot.ExecutionFinished)
 	assert.Contains(t, snapshot.Output, "hello-mid-run")
 }
+
+func TestRebuildActionMapSkipsNilActions(t *testing.T) {
+	e, cfg := testingExecutor()
+	cfg.Actions = append(cfg.Actions, nil)
+
+	assert.NotPanics(t, e.RebuildActionMap)
+	assert.Len(t, e.MapActionBindings, 1)
+}