Skip to content

Commit f4ee519

Browse files
cameroncookecodex
andcommitted
fix(runtime): Avoid startup simulator metadata config churn
Stop MCP startup hydration from persisting derived simulator metadata to .xcodebuildmcp/config.yaml. Startup still refreshes simulator defaults in memory so runtime behavior is unchanged, but shared config files no longer get rewritten with machine-specific simulator IDs. Add a regression test to lock the startup refresh contract and update the changelog. Fixes #230 Co-Authored-By: Codex <noreply@openai.com>
1 parent 6fb8b15 commit f4ee519

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
### Fixed
1616

17+
- Fixed startup simulator metadata refresh mutating `.xcodebuildmcp/config.yaml` by keeping derived simulator values in memory instead of persisting them during MCP startup hydration ([#230](https://github.com/getsentry/XcodeBuildMCP/issues/230)).
1718
- Fixed orphaned MCP server processes by attaching shutdown handlers before async startup, explicitly stopping the Xcode watcher during teardown, and adding lifecycle diagnostics for memory and peer-process anomalies ([#273](https://github.com/getsentry/XcodeBuildMCP/issues/273)).
1819

1920
## [2.2.1]

src/runtime/__tests__/bootstrap-runtime.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import { beforeEach, describe, expect, it } from 'vitest';
1+
import { beforeEach, describe, expect, it, vi } from 'vitest';
22
import path from 'node:path';
3+
4+
const { scheduleSimulatorDefaultsRefreshMock } = vi.hoisted(() => ({
5+
scheduleSimulatorDefaultsRefreshMock: vi.fn(),
6+
}));
7+
8+
vi.mock('../../utils/simulator-defaults-refresh.ts', () => ({
9+
scheduleSimulatorDefaultsRefresh: scheduleSimulatorDefaultsRefreshMock,
10+
}));
11+
312
import { bootstrapRuntime, type RuntimeKind } from '../bootstrap-runtime.ts';
413
import { __resetConfigStoreForTests } from '../../utils/config-store.ts';
514
import { sessionStore } from '../../utils/session-store.ts';
@@ -71,6 +80,8 @@ describe('bootstrapRuntime', () => {
7180
beforeEach(() => {
7281
__resetConfigStoreForTests();
7382
sessionStore.clear();
83+
scheduleSimulatorDefaultsRefreshMock.mockReset();
84+
scheduleSimulatorDefaultsRefreshMock.mockReturnValue(false);
7485
});
7586

7687
it('hydrates session defaults for mcp runtime', async () => {
@@ -86,6 +97,14 @@ describe('bootstrapRuntime', () => {
8697
simulatorId: 'SIM-UUID',
8798
simulatorName: 'iPhone 17',
8899
});
100+
expect(scheduleSimulatorDefaultsRefreshMock).toHaveBeenCalledWith(
101+
expect.objectContaining({
102+
reason: 'startup-hydration',
103+
persist: false,
104+
simulatorId: 'SIM-UUID',
105+
simulatorName: 'iPhone 17',
106+
}),
107+
);
89108
});
90109

91110
it('hydrates non-simulator session defaults for mcp runtime', async () => {

src/runtime/bootstrap-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function hydrateSessionDefaultsForMcp(
7373
expectedRevision: revision,
7474
reason: 'startup-hydration',
7575
profile: sessionStore.getActiveProfile(),
76-
persist: true,
76+
persist: false,
7777
simulatorId: activeDefaults.simulatorId,
7878
simulatorName: activeDefaults.simulatorName,
7979
recomputePlatform: true,

0 commit comments

Comments
 (0)