Skip to content

Commit df066e2

Browse files
thymikeeclaude
andauthored
refactor(daemon): resolve configuration from the owning runtime host (#3826)
* refactor(daemon): read configuration and paths from the runtime host, not the process (#3753) Every daemon and session-journal module that read `process.env` or `process.cwd()` now takes the runtime `HostEnvironment` its owner already holds. `SessionStore` receives the host at construction and hands its cwd to `SessionScriptWriter`, the recorder, and the replay coordinator; the event-log cap, idle-reap window, and session-idle expiry take their env as a required parameter; the HTTP server's env and cwd are required options and reach the download-archive spawn explicitly. No behavior changes: the daemon always passed exactly these values. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(android): keep TV remote fixture independent of bundled IME The D-pad fixture does not model IME registration. Explicitly opt out so building Android artifacts cannot turn this scenario into an unrelated helper readiness wait. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(daemon): specify source order in suite progress fixture Pass explicit source files so progress event expectations do not depend on native directory enumeration order. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(apple): wait for detached bridge evidence contents File creation precedes the shell write, so poll the expected cwd evidence rather than file existence. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 26e7cb5 commit df066e2

136 files changed

Lines changed: 1412 additions & 675 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/daemon/src/__tests__/support/handlers/session-test-harness.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import type { DaemonResponse } from '@agent-device/kernel/contracts';
22
import { isMacOs } from '@agent-device/kernel/device';
33
import { legacyDispatchCapture } from '../legacy-snapshot-capture-fixture.ts';
44
import { expect, vi, beforeEach } from 'vitest';
5-
import { createTestAppLogLiveHandle, mkdtempForTestSync } from '@agent-device/test-kit';
5+
import {
6+
createLiveTestHostEnvironment,
7+
createTestAppLogLiveHandle,
8+
mkdtempForTestSync,
9+
} from '@agent-device/test-kit';
610
import type { AppLogLiveState } from '@agent-device/contracts/app-log-runtime';
711
import { localRuntimeOwner } from '@agent-device/contracts/platform-runtime';
812
import { createDurableResourceEnvelope } from '@agent-device/capture-kit';
@@ -178,7 +182,7 @@ beforeEach(() => {
178182

179183
export function makeSessionStore(): SessionStore {
180184
const root = mkdtempForTestSync('agent-device-session-handler-');
181-
return new SessionStore(path.join(root, 'sessions'));
185+
return new SessionStore(path.join(root, 'sessions'), createLiveTestHostEnvironment());
182186
}
183187

184188
export function makeSession(name: string, device: SessionState['device']): SessionState {

‎packages/daemon/src/__tests__/support/handlers/snapshot-handler.fixtures.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import path from 'node:path';
2-
import { buildNodes, mkdtempForTestSync } from '@agent-device/test-kit';
2+
import {
3+
buildNodes,
4+
createLiveTestHostEnvironment,
5+
mkdtempForTestSync,
6+
} from '@agent-device/test-kit';
37
import type { ProviderDeviceRuntime } from '@agent-device/contracts/device';
48
import type { RawSnapshotNode, SnapshotNode } from '@agent-device/kernel/snapshot';
59
import { buildSnapshotSignatures } from '@agent-device/capture-kit/snapshot-freshness';
@@ -16,7 +20,7 @@ import { platformResourceCleanupFixture } from '../platform-resource-cleanup-fix
1620

1721
export function makeSessionStore(): SessionStore {
1822
const root = mkdtempForTestSync('agent-device-snapshot-handler-');
19-
return new SessionStore(path.join(root, 'sessions'));
23+
return new SessionStore(path.join(root, 'sessions'), createLiveTestHostEnvironment());
2024
}
2125

2226
export function makeSession(

‎packages/daemon/src/__tests__/support/store-factory.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import path from 'node:path';
22
import { SessionStore } from '../../core/session-store.ts';
3-
import { mkdtempForTestSync } from '@agent-device/test-kit';
3+
import { createLiveTestHostEnvironment, mkdtempForTestSync } from '@agent-device/test-kit';
44
import type { SessionRef, SessionState } from '../../core/session-state.ts';
55

66
export function makeSessionStore(prefix = 'agent-device-test-'): SessionStore {
77
const tempRoot = mkdtempForTestSync(prefix);
8-
return new SessionStore(path.join(tempRoot, 'sessions'));
8+
return new SessionStore(path.join(tempRoot, 'sessions'), createLiveTestHostEnvironment());
99
}
1010

1111
export function makeStoredSessionRef(session: SessionState, address = session.name): SessionRef {

‎packages/daemon/src/core/__tests__/selector-recording.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import { recordIfSession } from '../selector-recording.ts';
1313
import { SessionStore } from '../session-store.ts';
1414
import { makeIosSession } from '../../__tests__/support/session-factories.ts';
1515
import type { DaemonRequest } from '../daemon-request.ts';
16-
import { mkdtempForTestSync } from '@agent-device/test-kit';
16+
import { createLiveTestHostEnvironment, mkdtempForTestSync } from '@agent-device/test-kit';
1717

1818
function makeStore(): SessionStore {
1919
const root = mkdtempForTestSync('agent-device-selector-recording-');
20-
return new SessionStore(path.join(root, 'sessions'));
20+
return new SessionStore(path.join(root, 'sessions'), createLiveTestHostEnvironment());
2121
}
2222

2323
function req(command: string, flags: DaemonRequest['flags'] = {}): DaemonRequest {

0 commit comments

Comments
 (0)