Skip to content

Conversation

@cameroncooke
Copy link
Collaborator

@cameroncooke cameroncooke commented Oct 6, 2025

Summary

  • migrate test_sim and get_sim_app_path handlers to session-aware factory with concise schemas
  • add regression coverage for session requirement messaging and logic success/error paths
  • keep simulator tooling aligned with prior build_run_sim migration patterns

Testing

  • npm run format:check
  • npm run lint
  • npm run typecheck
  • npm run build
  • npm run test

Note

Migrates test_sim and get_sim_app_path to session-aware handlers with simplified public schemas and validations, adds comprehensive unit tests, and introduces a migration TODO doc.

  • Simulator tools:
    • Session-aware migration: Refactor src/mcp/tools/simulator/test_sim.ts and src/mcp/tools/simulator/get_sim_app_path.ts to use createSessionAwareTool with concise public schemas (hide session fields), requirement checks, and mutually exclusive param validation.
    • Descriptions: Simplify tool descriptions.
  • Tests:
    • Add unit tests in src/mcp/tools/simulator/__tests__/test_sim.test.ts and src/mcp/tools/simulator/__tests__/get_sim_app_path.test.ts covering export literals, public schema exposure, session-requirement messaging, mutually exclusive params, success path, and executor failure handling.
  • Docs:
    • Add docs/session-aware-migration-todo.md checklist for session-aware migration progress across tools.

Written by Cursor Bugbot for commit 89cd11c. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Documentation

    • Added a “Session-Aware Migration TODO” checklist outlining progress and requirements across tools.
  • Refactor

    • Migrated simulator tools to session-aware handlers with simplified public parameters and clearer validation messages.
    • Streamlined descriptions for simulator commands to improve clarity.
  • Tests

    • Added comprehensive unit tests for simulator app path retrieval and simulator testing tools, covering public behavior, validation, and error handling to enhance reliability.

@claude
Copy link
Contributor

claude bot commented Oct 6, 2025

Claude encountered an error —— View job


I'll analyze this and get back to you.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 6, 2025

Open in StackBlitz

npm i https://pkg.pr.new/cameroncooke/XcodeBuildMCP/xcodebuildmcp@122

commit: 89cd11c

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Walkthrough

Session-aware migration applied to simulator tools. get_sim_app_path.ts and test_sim.ts now use createSessionAwareTool with publicSchema omissions, explicit requirements, and exclusivePairs. New unit tests validate session/default-driven validation and executor wiring. A migration TODO document was added outlining session-default propagation across tools.

Changes

Cohort / File(s) Summary
Documentation: Session-aware Migration TODO
docs/session-aware-migration-todo.md
New planning checklist documenting session-default requirements across tool areas; references session_management_plan.md; includes dated audit and pre-checked items.
Simulator Tool: get_sim_app_path session-aware wrapper
src/mcp/tools/simulator/get_sim_app_path.ts
Replaces createTypedTool with createSessionAwareTool; adds publicSchemaObject omitting session-managed fields; updates description; defines requirements and exclusivePairs; retains get_sim_app_pathLogic unchanged.
Simulator Tool: test_sim session-aware wrapper
src/mcp/tools/simulator/test_sim.ts
Introduces createSessionAwareTool with internal schema, logic, executor, requirements, and exclusivePairs; adds publicSchemaObject omitting session-managed fields; simplifies description; preserves test_simLogic behavior.
Tests: Simulator tools validation and behavior
src/mcp/tools/simulator/__tests__/get_sim_app_path.test.ts, src/mcp/tools/simulator/__tests__/test_sim.test.ts
New suites verifying public surface, session-aware validation (requirements/exclusive), executor interactions, success/failure paths, and schema exposure limited to non-session fields.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Tool as Tool (get_sim_app_path / test_sim)
  participant Session as SessionStore
  participant Validator as Session-Aware Wrapper
  participant Logic as Logic Function
  participant Exec as Command Executor

  User->>Tool: Invoke with public params
  Tool->>Validator: Merge public params + Session defaults
  Validator->>Session: Read defaults (scheme, project/workspace, simulator...)
  Session-->>Validator: Defaults
  Validator->>Validator: Check requirements & exclusivePairs
  alt Validation fails
    Validator-->>User: Error (missing/mutually exclusive)
  else Validation passes
    Validator->>Logic: Call with internal params
    Logic->>Exec: Run xcodebuild / test commands
    Exec-->>Logic: Output / error
    Logic-->>Tool: Result
    Tool-->>User: Result (path / test output)
  end

  note over Validator,Logic: Public schema omits session-managed fields
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

I thump my paw, migrations neat,
Session winds beneath my feet.
Schemes and sims now know their cue,
Defaults whisper what to do.
Tests hop by—greens abound! 🐇
Paths and runners, tightly bound.
Carrot-commit: shipped and sound.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately describes the main change by indicating that the simulator test tools are being migrated to utilize session defaults, capturing the core intent without unnecessary detail.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch session-sim-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cameroncooke cameroncooke force-pushed the session-sim-migration branch from f5da07f to 89cd11c Compare October 6, 2025 20:49
@claude
Copy link
Contributor

claude bot commented Oct 6, 2025

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/session-aware-migration-todo.md (1)

3-3: Fix markdown lint violation on audit line

markdownlint (MD036) flags the italicized audit date as an improper heading. Convert it into a real heading so the doc passes lint checks.

Apply this diff:

-_Audit date: October 6, 2025_
+### Audit date: October 6, 2025

Based on static analysis

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f73662 and 89cd11c.

📒 Files selected for processing (5)
  • docs/session-aware-migration-todo.md (1 hunks)
  • src/mcp/tools/simulator/__tests__/get_sim_app_path.test.ts (1 hunks)
  • src/mcp/tools/simulator/__tests__/test_sim.test.ts (1 hunks)
  • src/mcp/tools/simulator/get_sim_app_path.ts (2 hunks)
  • src/mcp/tools/simulator/test_sim.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{test,spec}.ts: Do not use Vitest mocking APIs in tests (no vi.mock, vi.fn, vi.spyOn, etc.)
In tests, import the core ...Logic function from the tool and use createMockExecutor/createMockFileSystemExecutor to simulate outcomes

Files:

  • src/mcp/tools/simulator/__tests__/get_sim_app_path.test.ts
  • src/mcp/tools/simulator/__tests__/test_sim.test.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Use .ts extensions for all internal relative imports (e.g., import { tool } from './tool.ts')
Use .ts extensions in re-exports for internal files (e.g., export { default } from '../shared/tool.ts')
Use .js extension only for external package entry points (e.g., import ... from '@scope/pkg/file.js')
Never import internal project files using .js extensions

Files:

  • src/mcp/tools/simulator/__tests__/get_sim_app_path.test.ts
  • src/mcp/tools/simulator/get_sim_app_path.ts
  • src/mcp/tools/simulator/__tests__/test_sim.test.ts
  • src/mcp/tools/simulator/test_sim.ts
🧠 Learnings (1)
📚 Learning: 2025-09-21T19:27:22.795Z
Learnt from: CR
PR: cameroncooke/XcodeBuildMCP#0
File: AGENTS.md:0-0
Timestamp: 2025-09-21T19:27:22.795Z
Learning: Applies to **/*.{test,spec}.ts : In tests, import the core ...Logic function from the tool and use createMockExecutor/createMockFileSystemExecutor to simulate outcomes

Applied to files:

  • src/mcp/tools/simulator/__tests__/get_sim_app_path.test.ts
🧬 Code graph analysis (4)
src/mcp/tools/simulator/__tests__/get_sim_app_path.test.ts (3)
src/utils/session-store.ts (1)
  • sessionStore (47-47)
src/mcp/tools/simulator/get_sim_app_path.ts (1)
  • get_sim_app_pathLogic (139-290)
src/test-utils/mock-executors.ts (1)
  • createMockExecutor (27-75)
src/mcp/tools/simulator/get_sim_app_path.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-174)
src/mcp/tools/simulator/__tests__/test_sim.test.ts (1)
src/utils/session-store.ts (1)
  • sessionStore (47-47)
src/mcp/tools/simulator/test_sim.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-174)
src/utils/command.ts (1)
  • getDefaultCommandExecutor (199-210)
🪛 markdownlint-cli2 (0.18.1)
docs/session-aware-migration-todo.md

3-3: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: code-review
  • GitHub Check: Cursor Bugbot

@cameroncooke
Copy link
Collaborator Author

@cursor review

Copy link
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.

✅ Bugbot reviewed your changes and found no bugs!


@cameroncooke cameroncooke merged commit 79736a3 into main Oct 14, 2025
10 of 11 checks passed
@cameroncooke cameroncooke deleted the session-sim-migration branch October 14, 2025 18:57
carmandale added a commit to carmandale/XcodeBuildMCP that referenced this pull request Oct 16, 2025
Merge upstream commits bringing session-aware pattern to additional tools:
- getsentry#125: Migrate clean/list_schemes/show_build_settings to session defaults
- getsentry#122: Migrate test_sim and get_sim_app_path to session defaults

## Conflict Resolution

Resolved conflicts in 3 files by keeping our improved implementation:

### 1. src/utils/typed-tool-factory.ts
- KEPT: Our simplified factory (48 lines vs upstream's 100+ lines)
- KEPT: Removed requirements DSL (Zod-first validation)
- KEPT: Simplified API (positional params vs config object)
- KEPT: exclusivePairs as 4th parameter (critical for XOR field pruning)

### 2. src/mcp/tools/simulator/test_sim.ts
- KEPT: Our comprehensive implementation with utilities
- KEPT: mapPlatformStringToEnum for type safety
- KEPT: logUseLatestOSWarning utility
- KEPT: Simplified factory API
- KEPT: macOS platform rejection validation

### 3. src/mcp/tools/simulator/__tests__/test_sim.test.ts
- KEPT: Our comprehensive 500+ line test suite (23 session tests + empty string tests)
- UPSTREAM HAD: Basic session tests only

## Upstream Tool Migration

Updated 4 upstream tools to use our simplified factory API:
- list_schemes.ts - Updated to positional params, removed .omit() bug
- show_build_settings.ts - Updated to positional params, removed .omit() bug
- get_sim_app_path.ts - Updated to positional params, removed .omit() bug
- clean.ts - Updated to positional params, removed .omit() bug

## Test Fixes

Fixed test expectations in 4 upstream test files:
- list_schemes.test.ts - Updated for correct public schema (no .omit())
- show_build_settings.test.ts - Updated for correct public schema
- clean.test.ts - Updated for correct public schema
- get_sim_app_path.test.ts - Fixed fake path issues

## Upstream Benefits from Our Improvements

Upstream tools now benefit from:
- ✅ Simplified factory API (cleaner code)
- ✅ Fixed .omit() bug (explicit params work correctly)
- ✅ XOR field pruning (explicit overrides session for XOR fields)
- ✅ Better error handling (no server crashes)
- ✅ Shared utilities (platform-utils, simulator-validation, shared-schemas)

## Quality Validation

✅ TypeCheck: Zero errors
✅ Lint: Zero errors
✅ Build: Successful (91 test files)
✅ Tests: 1,233/1,233 passing (100% pass rate)

## Commits Merged from Upstream

- 4bbfe5d: feat(project-discovery): migrate clean/list/show to session defaults
- 79736a3: feat(simulator): migrate test_sim and get_sim_app_path to session defaults

Total: 2 upstream commits + our local improvements merged successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant