Skip to content

Commit 141c006

Browse files
thymikeeclaude
andcommitted
refactor(daemon): place each relocated runtime test beside the module it is named for
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent d105918 commit 141c006

16 files changed

Lines changed: 33 additions & 62 deletions

packages/daemon/src/server/__tests__/daemon-runtime-composition.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-composition.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { IOS_SIMULATOR, WEB_DESKTOP_DEVICE } from '@agent-device/test-kit/device
1212
import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir';
1313
import { interactorResolution } from '../../core/interactor-resolution.ts';
1414
import { daemonRuntimeDepsFixture } from '../../__tests__/support/daemon-runtime-deps-fixture.ts';
15-
import { startDaemonRuntime, type DaemonRuntimeDepsInput } from '../http/daemon-runtime.ts';
15+
import { startDaemonRuntime, type DaemonRuntimeDepsInput } from './daemon-runtime.ts';
1616

1717
// The server builds its own store, so capture that instance: the proof is about the store the
1818
// server hands to the composition callbacks, not one the test fabricates.

packages/daemon/src/server/__tests__/daemon-runtime-idle-reap.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-idle-reap.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ vi.mock('../../resources/lease-registry.ts', async (importOriginal) => {
1818

1919
import { resolveDaemonPaths } from '@agent-device/daemon-contracts/daemon-resolution';
2020
import { daemonRuntimeDepsFixture } from '../../__tests__/support/daemon-runtime-deps-fixture.ts';
21-
import { startDaemonRuntime } from '../http/daemon-runtime.ts';
21+
import { startDaemonRuntime } from './daemon-runtime.ts';
2222
import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir';
2323

2424
afterEach(() => {

packages/daemon/src/server/__tests__/daemon-runtime-lease-expiry.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-lease-expiry.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ vi.mock('../request-execution-scope.ts', async (importOriginal) => {
3737

3838
import { SessionStore } from '../../core/session-store.ts';
3939
import { daemonRuntimeDepsFixture } from '../../__tests__/support/daemon-runtime-deps-fixture.ts';
40-
import { startDaemonRuntime } from '../http/daemon-runtime.ts';
40+
import { startDaemonRuntime } from './daemon-runtime.ts';
4141
import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir';
4242

4343
afterEach(() => {

packages/daemon/src/server/__tests__/daemon-runtime-lifecycle-shutdown.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-lifecycle-shutdown.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ vi.mock('../../core/session-store.ts', async (importOriginal) => {
2626
},
2727
};
2828
});
29-
vi.mock('../http/server-shutdown.ts', async (importOriginal) => {
30-
const actual = await importOriginal<typeof import('../http/server-shutdown.ts')>();
29+
vi.mock('./server-shutdown.ts', async (importOriginal) => {
30+
const actual = await importOriginal<typeof import('./server-shutdown.ts')>();
3131
return {
3232
...actual,
3333
closeDaemonServers: async (...args: Parameters<typeof actual.closeDaemonServers>) => {
@@ -97,7 +97,7 @@ import {
9797
daemonRuntimeDepsFixture,
9898
} from '../../__tests__/support/daemon-runtime-deps-fixture.ts';
9999
import { lifecycleDeviceRuntimeGateway } from '../../__tests__/support/test-device-runtime-gateway.ts';
100-
import { startDaemonRuntime, teardownDaemonSessionForShutdown } from '../http/daemon-runtime.ts';
100+
import { startDaemonRuntime, teardownDaemonSessionForShutdown } from './daemon-runtime.ts';
101101
import { makeIosSession } from '../../__tests__/support/session-factories.ts';
102102
import { makeSessionStore } from '../../__tests__/support/store-factory.ts';
103103

packages/daemon/src/server/__tests__/daemon-runtime-metadata-ownership.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-metadata-ownership.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
platformOwnerLifecycleFixture,
1717
} from '../../__tests__/support/daemon-runtime-deps-fixture.ts';
1818
import { lifecycleDeviceRuntimeGateway } from '../../__tests__/support/test-device-runtime-gateway.ts';
19-
import { startDaemonRuntime } from '../http/daemon-runtime.ts';
19+
import { startDaemonRuntime } from './daemon-runtime.ts';
2020
import { resolveDaemonPaths } from '@agent-device/daemon-contracts/daemon-resolution';
2121

2222
type DaemonPaths = ReturnType<typeof resolveDaemonPaths>;
@@ -232,7 +232,7 @@ test('a successor published during this daemon lifetime is recorded at detection
232232
test('the loss watch is armed only after this daemon publishes its own record', () => {
233233
// Arming before publication would report a predecessor's record as a takeover of something this
234234
// daemon never owned. Ordering is the invariant, the same way the startup-ordering guards read it.
235-
const source = fs.readFileSync(new URL('../http/daemon-runtime.ts', import.meta.url), 'utf8');
235+
const source = fs.readFileSync(new URL('./daemon-runtime.ts', import.meta.url), 'utf8');
236236
const published = source.indexOf('publishDaemonInfo(socketPort, httpPort);');
237237
const armed = source.indexOf('stopMetadataLossWatch = armDaemonMetadataLossWatch(');
238238

@@ -245,7 +245,7 @@ test('both exits tear the watch down before they touch daemon.json', () => {
245245
// deleted. The startup-failure half of this is unreachable from a test — everything after
246246
// publication needs a real toolchain — so the invariant is read off the source, the same way the
247247
// arming order above is.
248-
const source = fs.readFileSync(new URL('../http/daemon-runtime.ts', import.meta.url), 'utf8');
248+
const source = fs.readFileSync(new URL('./daemon-runtime.ts', import.meta.url), 'utf8');
249249
const stops = [...source.matchAll(/stopMetadataLossWatch\(\);/g)].map((m) => m.index);
250250
const finishes = [...source.matchAll(/await finishDaemonRegistration\(/g)].map((m) => m.index);
251251
expect(stops).toHaveLength(2);

packages/daemon/src/server/__tests__/daemon-runtime-owner-lifecycle.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-owner-lifecycle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
platformOwnerLifecycleFixture,
88
} from '../../__tests__/support/daemon-runtime-deps-fixture.ts';
99
import type { PlatformOwnerLifecycle } from '../../core/platform-owner-lifecycle.ts';
10-
import { startDaemonRuntime } from '../http/daemon-runtime.ts';
10+
import { startDaemonRuntime } from './daemon-runtime.ts';
1111

1212
type LoggedEvent = { phase: string; data?: Record<string, unknown> };
1313

packages/daemon/src/server/__tests__/daemon-runtime-recording-reaper.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-recording-reaper.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vi.mock('@agent-device/host-kit/process', async (importOriginal) => {
1616
});
1717

1818
import { daemonRuntimeDepsFixture } from '../../__tests__/support/daemon-runtime-deps-fixture.ts';
19-
import { startDaemonRuntime } from '../http/daemon-runtime.ts';
19+
import { startDaemonRuntime } from './daemon-runtime.ts';
2020

2121
afterEach(() => {
2222
reapCalls.length = 0;

packages/daemon/src/server/__tests__/daemon-runtime-recording-teardown.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-recording-teardown.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir';
55
import { platformResourceCleanupFixture } from '../../__tests__/support/platform-resource-cleanup-fixture.ts';
66
import { SessionStore } from '../../core/session-store.ts';
77
import { makeRecordingSession } from '../../__tests__/support/session-teardown.fixtures.ts';
8-
import { teardownDaemonSessionForShutdown } from '../http/daemon-runtime.ts';
8+
import { teardownDaemonSessionForShutdown } from './daemon-runtime.ts';
99

1010
afterEach(() => {
1111
vi.useRealTimers();

packages/daemon/src/server/__tests__/daemon-runtime-rpc-flow-failure.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-rpc-flow-failure.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ vi.mock('../request-router.ts', async (importOriginal) => {
3232
});
3333

3434
import { daemonRuntimeDepsFixture } from '../../__tests__/support/daemon-runtime-deps-fixture.ts';
35-
import { startDaemonRuntime } from '../http/daemon-runtime.ts';
35+
import { startDaemonRuntime } from './daemon-runtime.ts';
3636

3737
afterEach(() => {
3838
requestProbe.failuresRemaining = 0;

packages/daemon/src/server/__tests__/daemon-runtime-snapshot-shutdown.test.ts renamed to packages/daemon/src/server/http/daemon-runtime-snapshot-shutdown.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { snapshotRuntimeFixture } from '../../__tests__/support/snapshot-runtime
1212
import { platformResourceCleanupFixture } from '../../__tests__/support/platform-resource-cleanup-fixture.ts';
1313
import { DAEMON_SESSION_TEARDOWN_TIMEOUT_MS } from '../../sessions/session-teardown-budget.ts';
1414
import { dispatchSnapshotViaRuntime } from '../../sessions/snapshot-runtime.ts';
15-
import { teardownDaemonSessionForShutdown } from '../http/daemon-runtime.ts';
15+
import { teardownDaemonSessionForShutdown } from './daemon-runtime.ts';
1616
import { forwardingCreateCommandSurface } from '../../__tests__/support/command-surface-fake.ts';
1717

1818
vi.mock('@agent-device/device-selection/dispatch-resolve', () => ({

0 commit comments

Comments
 (0)