Skip to content

fix(xcode-ide): add bridge proxy diagnostics and default schema handling#310

Open
dpearson2699 wants to merge 3 commits intogetsentry:mainfrom
dpearson2699:fix/252-bridge-path-diagnostics
Open

fix(xcode-ide): add bridge proxy diagnostics and default schema handling#310
dpearson2699 wants to merge 3 commits intogetsentry:mainfrom
dpearson2699:fix/252-bridge-path-diagnostics

Conversation

@dpearson2699
Copy link
Copy Markdown

@dpearson2699 dpearson2699 commented Apr 4, 2026

Summary

Fixes #252

After xcode-ide bridge sync succeeds, paths returned by XcodeGlob are rejected by XcodeRead and RenderPreview with "File not found in project structure". Investigation revealed:

  1. The bridge is a pure passthrough -- arguments flow unchanged from client to Apple's remote Xcode MCP server via xcrun mcpbridge. The "File not found" error originates from Apple's remote server, not this codebase.
  2. The jsonSchemaToZod converter was silently dropping JSON Schema default values, meaning Zod validation could reject or alter arguments the remote server expects.
  3. No diagnostic logging existed in the proxy path, making it impossible to verify what arguments were actually sent/received.

Changes

Bridge proxy diagnostics (registry.ts, tool-service.ts)

  • Added debug-level logging at two layers of the proxy call path:
    • registry.ts: Logs tool name and argument keys when the proxy handler is invoked
    • tool-service.ts: Logs call initiation, result summary (content type count), and errors in invokeTool()
  • Uses existing log utility at debug level -- zero overhead when debug logging is disabled

JSON Schema default value handling (jsonschema-to-zod.ts)

  • Added default to the JsonSchema type definition
  • Created applyDefault() helper that chains .default(value) onto any Zod type
  • Applied default handling in all type branches (string, number, integer, boolean, array, object)
  • This ensures Zod validation preserves default values from remote tool schemas rather than silently dropping them

Integration test for argument passthrough (registry.integration.test.ts)

  • Added Echo tool to the fake MCP server fixture that JSON-echoes received arguments
  • Added passthrough test verifying: file paths with special characters, unicode strings, extra properties, and boolean/numeric values all survive the proxy round-trip unchanged
  • Added explicit tool registration assertion for the Echo tool

Testing

Automated

  • All 1496 tests pass, 15 skipped (pre-existing)
  • Full pre-commit checklist passed: lint:fix, typecheck, format, build, docs:check, test
  • 3-round review: Claude R1 (clean), GPT-5.4 R2 (1 valid finding fixed), Claude R3 (clean)

Manual verification (iOS template project)

  • Cloned XcodeBuildMCP-iOS-Template and opened MyProject.xcodeproj in Xcode
  • CLI xcode-ide call-tool --remote-tool XcodeGlob returned Swift file paths successfully
  • CLI xcode-ide call-tool --remote-tool XcodeRead read files using paths returned by XcodeGlob -- no "File not found" error
  • MCP Inspector (npm run inspect): server initialized successfully
  • Reloaderoo inspect list-tools: 29 tools registered with xcode-ide workflow enabled, 20 bridge-proxied tools visible
  • Reloaderoo inspect call-tool xcode_ide_list_tools: bridge tools returned correctly through MCP proxy path
  • XCODEBUILDMCP_DEBUG=true confirmed active in .vscode/mcp.json dev server config

dpearson2699 and others added 2 commits April 4, 2026 00:41
Add debug logging to xcode-tools-bridge proxy tool calls so the exact
arguments and responses can be inspected when diagnosing bridge-related
issues like XcodeGlob returning paths rejected by XcodeRead/RenderPreview.

Handle the JSON Schema `default` keyword in jsonSchemaToZod so remote
tool schema defaults are preserved through the proxy, preventing
potential argument loss.

Add integration test verifying argument passthrough integrity through
the full proxy pipeline (paths with spaces, unicode, extra properties).

Closes getsentry#252

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dpearson2699 dpearson2699 marked this pull request as ready for review April 4, 2026 19:56
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2199455. Configure here.

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.

xcode-ide bridge: XcodeGlob returns paths rejected by XcodeRead/RenderPreview

1 participant