Skip to content

fix: Omit -configuration when none is provided#460

Open
hujunfeng wants to merge 1 commit into
getsentry:mainfrom
hujunfeng:bugfix/issue-443-omit-configuration-debug
Open

fix: Omit -configuration when none is provided#460
hujunfeng wants to merge 1 commit into
getsentry:mainfrom
hujunfeng:bugfix/issue-443-omit-configuration-debug

Conversation

@hujunfeng

Copy link
Copy Markdown

Summary

Build, test, app-path, and clean tools always injected -configuration Debug into the xcodebuild invocation when no configuration was supplied. This overrode the scheme's Run-action build configuration, producing the wrong build settings (including bundle identifier) for schemes that use a non-Debug configuration such as Debug-dev. This PR omits -configuration when it is not set, so xcodebuild honors the scheme's configuration.

Fixes #443

Background

xcodebuild -scheme X <action> run on its own resolves the configuration from the scheme's per-action Build Configuration (e.g. the Run action, Debug by default but customizable to Debug-dev). By always passing -configuration Debug, XcodeBuildMCP forced resolution against Debug.xcconfig instead of the scheme's actual configuration.

Root cause was three layers:

  • SharedBuildParams.configuration was a required string.
  • The two command-building chokepoints pushed the flag unconditionally: build-utils.ts (command.push('-configuration', params.configuration)) and app-path-resolver.ts (... ?? 'Debug').
  • Every tool defaulted params.configuration ?? 'Debug' before reaching those chokepoints.

Solution

  • Made configuration optional in the shared types: SharedBuildParams, SharedTestExecutorParams, TestPreflightResult (and its resolver param), plus the per-tool Prepared*Execution interfaces.
  • The two chokepoints now push -configuration only when a value is set.
  • Removed the ?? 'Debug' fallback from all 13 build/test/app-path/clean tools so undefined flows through.
  • clean omits configuration from its displayed artifact when unset. Build/test/app-path display paths already guard on presence, so no stray Configuration: line or configuration: undefined renders.

Behavior after this change:

  • No configuration argument and no session default -> -configuration is omitted; xcodebuild uses the scheme's configuration.
  • Explicit configuration argument or session default -> passed through exactly as before.

-showBuildSettings (used by the app-path resolver, with no action) defaults to the build action, so it resolves the same configuration as the build step. Omitting -configuration keeps build and get-app-path consistent and also fixes the prior latent case where get-app-path forced Debug while a scheme-honoring build could produce a different configuration.

Testing

  • npm test — all 2667 unit tests pass. Added chokepoint tests in build-utils.test.ts and app-path-resolver.test.ts (assert the flag is omitted when unset and present with the right value when set); updated the no-configuration command-generation assertions across the tool tests to expect no -configuration.
  • npm run typecheck — clean (src, tests, benchmarks).
  • npm run lint and npm run format:check — clean.
  • npm run build — succeeds.

Notes

  • Snapshot integration fixtures are NOT included in this PR. 76 fixtures were generated without an explicit configuration and still encode -configuration Debug / Configuration: Debug, so the snapshot CI job will be red until they are regenerated with npm run test:snapshot:update. Left for the maintainer per repo conventions on not hand-editing fixtures.
  • No CHANGELOG entry is included; left for the maintainer.
  • Follow-up (out of scope, pre-existing): the build tools' suggested get_*_app_path next-step params do not thread an explicitly-provided configuration. Not a regression (the old code forced Debug there too) and unaffected when configuration comes from a session default.

🤖 Generated with Claude Code

Build, test, and app-path tools always injected `-configuration
Debug`, which overrode the scheme's Run action configuration and
produced the wrong build settings (including bundle identifier) for
schemes that use a non-Debug configuration.

When no configuration argument or session default is set,
`-configuration` is now omitted so xcodebuild honors the scheme's
configuration. Configuration is optional in the shared build/test
params and only passed through to xcodebuild when provided.

Fixes getsentry#443

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

@cameroncooke cameroncooke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@hujunfeng looks good thanks for the PR!

@pkg-pr-new

pkg-pr-new Bot commented Jul 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/xcodebuildmcp@460

commit: bce24bd

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.

[Bug]: Build tools inject hardcoded -configuration Debug, overriding the scheme's configuration

2 participants