From fadf2bc133c02e7acab81d933d93939d847d945e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 04:27:10 +0000 Subject: [PATCH] refactor: flatten nested if in validateStrictSandboxCustomization Simplify the double-nested if into a single combined condition for clarity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/workflow/strict_mode_sandbox_validation.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/workflow/strict_mode_sandbox_validation.go b/pkg/workflow/strict_mode_sandbox_validation.go index f52002f3299..f295855f62d 100644 --- a/pkg/workflow/strict_mode_sandbox_validation.go +++ b/pkg/workflow/strict_mode_sandbox_validation.go @@ -44,15 +44,13 @@ func (c *Compiler) validateStrictSandboxCustomization(sandboxConfig *SandboxConf // configuration is unambiguous. A bare object (e.g. { version: "v0.25.29" } // with no id) would silently default to AWF in non-strict builds but that // implicit defaulting is not acceptable in strict mode. - if !agent.Disabled { - if !isSupportedSandboxType(getAgentType(agent)) { - return fmt.Errorf( - "strict mode: 'sandbox.agent' must specify an explicit 'id' (e.g., id: awf). " + - "A sandbox agent without an 'id' is ambiguous and not allowed in strict mode. " + - "Add 'id: awf' to your sandbox.agent configuration. " + - "See: https://github.github.com/gh-aw/reference/sandbox/", - ) - } + if !agent.Disabled && !isSupportedSandboxType(getAgentType(agent)) { + return fmt.Errorf( + "strict mode: 'sandbox.agent' must specify an explicit 'id' (e.g., id: awf). " + + "A sandbox agent without an 'id' is ambiguous and not allowed in strict mode. " + + "Add 'id: awf' to your sandbox.agent configuration. " + + "See: https://github.github.com/gh-aw/reference/sandbox/", + ) } if agent.Command != "" {