Skip to content

Commit bb53b0e

Browse files
committed
docs: keep tool directives only across the touched tree
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VngeKZH6zBuJzNBk5YzUH
1 parent a7c8df6 commit bb53b0e

4 files changed

Lines changed: 0 additions & 36 deletions

File tree

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
// Package tests cannot reach root test helpers (R11); fixture copy of tmp-dir.ts.
21
import fs from 'node:fs';
32
import fsPromises from 'node:fs/promises';
43
import os from 'node:os';
54
import path from 'node:path';
65

7-
/**
8-
* Creates a fresh scratch directory for one test. Cleanup is automatic: the
9-
* unit suite redirects TMPDIR to a per-run directory (scripts/vitest-tmpdir-global-setup.ts)
10-
* that gets removed in one recursive rm after every worker finishes, so
11-
* individual tests never need their own afterEach/afterAll for this.
12-
*/
136
export async function mkdtempForTest(prefix: string): Promise<string> {
147
return fsPromises.mkdtemp(path.join(os.tmpdir(), prefix));
158
}
169

17-
/** Sync counterpart of {@link mkdtempForTest}, for setup code that can't await. */
1810
export function mkdtempForTestSync(prefix: string): string {
1911
return fs.mkdtempSync(path.join(os.tmpdir(), prefix));
2012
}

packages/kernel/src/scoped-provider.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ export function createScopedProvider<TProvider, TInput = TProvider>(
2626
};
2727
}
2828

29-
/**
30-
* Wraps every method call on `target` in `runScope`, so leaf code below the
31-
* method resolves scope-injected state instead of the local default.
32-
*/
3329
export function withMethodScope<T extends object>(
3430
target: T,
3531
runScope: <R>(task: () => Promise<R>) => Promise<R>,

src/__tests__/test-utils/host-process-mock.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,13 @@ type HostProcessModule = typeof import('@agent-device/host-kit/process');
22
type HostProcessIdentityObservation =
33
import('@agent-device/host-kit/process').HostProcessIdentityObservation;
44

5-
/**
6-
* `vi.mock` factory for the host-kit `exec` seam in tests that seed a "live"
7-
* owner from the test process's own identity (readCurrentOwnerIdentity and
8-
* friends) and later have production code re-read it during classification.
9-
*
10-
* readProcessStartTime shells out to `ps` with a 1s timeout; under full-suite
11-
* CPU contention a re-read can miss that deadline and return null, mismatching
12-
* the seeded value and flipping a genuinely-live owner to 'owner-process-dead'.
13-
* This factory assigns our own pid a stable synthetic start time, then serves
14-
* that value so every read is self-consistent without a subprocess. Other pids read as null, same
15-
* as a real `ps` miss. isProcessAlive stays real (a plain `kill(pid, 0)`
16-
* syscall, not a subprocess), so fabricated dead-pid fixtures still classify
17-
* as dead through that non-flaky check.
18-
*
19-
* Usage: `vi.mock('@agent-device/host-kit/process', async (importOriginal) =>
20-
* (await import('<path>/test-utils/host-process-mock.ts')).pinOwnProcessStartTime(importOriginal))`
21-
*/
22-
// Consumed by three suites, but only through `(await import(...)).pinOwnProcessStartTime`
23-
// inside `vi.mock` factories — vitest hoists those above static imports, so the dynamic
24-
// form is required and fallow cannot trace the consumers statically.
255
export async function pinOwnProcessStartTime(
266
importOriginal: () => Promise<HostProcessModule>,
277
): Promise<HostProcessModule> {
288
const actual = await importOriginal();
299
const ownStartTime = 'test-process-start-time';
3010
return {
3111
...actual,
32-
// The seam mock cannot reach readCurrentOwnerIdentity's internal
33-
// readProcessStartTime call, so the recorded identity is pinned here too.
3412
readCurrentOwnerIdentity: () => ({ pid: process.pid, startTime: ownStartTime }),
3513
readProcessStartTime: (pid: number) => {
3614
if (pid !== process.pid) return null;

src/platforms/web/agent-browser-lifecycle.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ vi.mock('@agent-device/host-kit/process', async (importOriginal) => {
1818
const actual = await importOriginal<typeof import('@agent-device/host-kit/process')>();
1919
return {
2020
...actual,
21-
// The port mock cannot reach listHostProcesses' internal runCmd call, so
22-
// the ps read is routed through its runCommand injection point instead.
2321
listHostProcesses: async (options: Parameters<typeof actual.listHostProcesses>[0]) =>
2422
await actual.listHostProcesses({ ...options, runCommand: runCmdMock }),
2523
readProcessStartTime: (pid: number) => `start-${pid}`,

0 commit comments

Comments
 (0)