Skip to content

[STEP-2562] Report what the parser finds in xcodebuild_options - #361

Open
lpusok wants to merge 1 commit into
STEP-2562-5-rejectionsfrom
STEP-2562-6-diagnostics
Open

lpusok wants to merge 1 commit into
STEP-2562-5-rejectionsfrom
STEP-2562-6-diagnostics

Conversation

@lpusok

@lpusok lpusok commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Every builder now returns Command.Diagnostics: findings about the step's additional
options, each ending with the fix ("Remove it." or "Use instead.").
This commit adds the framework and the parser's findings:

  • MalformedOption: an argument xcodebuild refuses (an empty argument, "-sdk macosx"
    quoted as one, a lone dash, "-only-testing:" with no value, a bare word from an unquoted
    value with spaces, a value flag at the end);
  • SuspiciousUserDefault: an option xcodebuild silently ignores ("-destination
    generic/platform=iOS" quoted as one argument, -ENABLE_BITCODE=NO for a build setting).
    The message says today's build runs without it, and offers removing it or the corrected
    form, which applies it.

Corrected forms are rendered with go-shellquote's Join, the inverse of the step's split.
Options.Diagnostics gives a step the parser's findings before its first xcodebuild call.

Validation decides what a builder does with findings: Warn (default) passes everything
through and reports; Fail returns the first one that is not informational as an error.
Nothing changes on the command line.

🤖 Generated with Claude Code

Every builder now returns Command.Diagnostics: findings about the step's additional
options, each ending with the fix ("Remove it." or "Use <corrected form> instead.").
This commit adds the framework and the parser's findings:

- MalformedOption: an argument xcodebuild refuses (an empty argument, "-sdk macosx"
  quoted as one, a lone dash, "-only-testing:" with no value, a bare word from an unquoted
  value with spaces, a value flag at the end);
- SuspiciousUserDefault: an option xcodebuild silently ignores ("-destination
  generic/platform=iOS" quoted as one argument, -ENABLE_BITCODE=NO for a build setting).
  The message says today's build runs without it, and offers removing it or the corrected
  form, which applies it.

Corrected forms are rendered with go-shellquote's Join, the inverse of the step's split.
Options.Diagnostics gives a step the parser's findings before its first xcodebuild call.

Validation decides what a builder does with findings: Warn (default) passes everything
through and reports; Fail returns the first one that is not informational as an error.
Nothing changes on the command line.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Corrective messages mishandle tab-separated flags, and the package documentation overstates action-level validation.

2 open findings
What changed in this PR

Adds parser diagnostics for malformed or suspicious xcodebuild_options, with configurable warning or failure behavior.

Changes:

  • Adds diagnostics and validation APIs to assembled commands.
  • Detects malformed options and suspicious user defaults with corrective messages.
  • Adds diagnostic and validation tests while suppressing duplicate package-resolution diagnostics.
File Description
xcodecommand/​xcodecommand.go Updates package documentation.
xcodecommand/​resolve_package_deps.go Documents diagnostic suppression.
xcodecommand/​resolve_package_deps_test.go Verifies diagnostics remain empty.
xcodecommand/​options.go Documents parser diagnostics.
xcodecommand/​options_test.go Tests diagnostic classification.
xcodecommand/​export.go Adds export validation configuration.
xcodecommand/​diagnostic.go Implements diagnostics and validation.
xcodecommand/​diagnostic_test.go Tests messages, validation, and quoting.
xcodecommand/​command.go Stores diagnostics and enforces validation.
xcodecommand/​build.go Adds validation to build actions.
xcodecommand/​archive.go Adds archive validation configuration.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +119 to +120
flag, value, _ := strings.Cut(arg, " ")
value = strings.Trim(strings.TrimSpace(value), "'\"")
Comment on lines +5 to +6
// checked against the action and laid over the derived flags; findings surface as
// Command.Diagnostics and, under Fail validation, as an error. Runner and its
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants