Skip to content

[code-simplifier] Flatten nested if in sandbox strict-mode validation#29676

Merged
pelikhan merged 1 commit intomainfrom
code-simplifier/2026-05-02-c9d0308680474d3e
May 2, 2026
Merged

[code-simplifier] Flatten nested if in sandbox strict-mode validation#29676
pelikhan merged 1 commit intomainfrom
code-simplifier/2026-05-02-c9d0308680474d3e

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 2, 2026

This PR simplifies recently modified code to improve clarity, consistency, and maintainability while preserving all functionality.

Files Simplified

  • pkg/workflow/strict_mode_sandbox_validation.go - Flatten double-nested if into a single combined condition

Improvements Made

Reduced Nesting: Combined if !agent.Disabled { if !isSupportedSandboxType(...) { ... } } into a single if !agent.Disabled && !isSupportedSandboxType(...) { ... }. Reduces indentation and cognitive load with no behavior change.

Changes Based On

Recent changes from #29663 - fix: default sandbox agent type to AWF when not explicit; reject empty type in strict mode

Testing

  • TestValidateStrictSandboxCustomization passes
  • make fmt clean
  • ✅ No functional changes — behavior is identical

Automated by Code Simplifier Agent - analyzing code from the last 24 hours

Note

🔒 Integrity filter blocked 1 item

The following item was blocked because it doesn't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Code Simplifier · ● 1.1M ·

  • expires on May 3, 2026, 4:27 AM UTC

Simplify the double-nested if into a single combined condition for clarity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review May 2, 2026 04:58
Copilot AI review requested due to automatic review settings May 2, 2026 04:58
@pelikhan pelikhan merged commit 5c52ed4 into main May 2, 2026
31 of 32 checks passed
@pelikhan pelikhan deleted the code-simplifier/2026-05-02-c9d0308680474d3e branch May 2, 2026 04:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors strict-mode sandbox validation by flattening a nested conditional into a single combined condition, with the stated goal of improving readability without changing behavior.

Changes:

  • Combine the agent.Disabled guard and sandbox type validation into one if statement.
  • Preserve the existing strict-mode error path for ambiguous sandbox.agent configurations.
  • Leave the surrounding strict-mode validation logic unchanged.
Show a summary per file
File Description
pkg/workflow/strict_mode_sandbox_validation.go Simplifies the strict-mode sandbox.agent validation branch by collapsing nested conditionals.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions github-actions Bot mentioned this pull request May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants