Skip to content

Commit 9e9ccc3

Browse files
thymikeeclaude
andcommitted
fix(perf): keep the daemon request phase literal
Only scripts read it, so a root export has no production consumer and fails the fallow audit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8958314 commit 9e9ccc3

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

‎scripts/perf/profile.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { EXEC_COMMAND_PHASE } from '@agent-device/host-kit/command';
33
import { DIAGNOSTIC_STDERR_PREFIX } from '@agent-device/host-kit/diagnostics';
44
import { RETRY_PHASE } from '@agent-device/host-kit/retry';
55
import { test } from 'vitest';
6-
import { DAEMON_REQUEST_PHASE } from '../../src/daemon-client/daemon-client.ts';
76
import {
87
aggregateProfiles,
98
profileRequestLog,
@@ -105,7 +104,7 @@ test('reads the client daemon timer from --debug stderr', () => {
105104
const stderr = [
106105
`${DIAGNOSTIC_STDERR_PREFIX}{"phase":"daemon_startup","durationMs":30,"requestId":"r1"}`,
107106
'noise',
108-
`${DIAGNOSTIC_STDERR_PREFIX}{"phase":"${DAEMON_REQUEST_PHASE}","durationMs":812,"requestId":"r1"}`,
107+
`${DIAGNOSTIC_STDERR_PREFIX}{"phase":"daemon_request","durationMs":812,"requestId":"r1"}`,
109108
].join('\n');
110109
assert.deepEqual(readClientDiagnostics(stderr), { daemonMs: 812, requestId: 'r1' });
111110
assert.deepEqual(readClientDiagnostics(`${DIAGNOSTIC_STDERR_PREFIX}{"phase":"daemon_req`), {});

‎scripts/perf/profile.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { EXEC_COMMAND_PHASE } from '@agent-device/host-kit/command';
22
import { DIAGNOSTIC_STDERR_PREFIX } from '@agent-device/host-kit/diagnostics';
33
import { RETRY_PHASE } from '@agent-device/host-kit/retry';
4-
import { DAEMON_REQUEST_PHASE } from '../../src/daemon-client/daemon-client.ts';
54
import { median } from './stats.ts';
65
import type {
76
MeasurementProfile,
@@ -12,11 +11,12 @@ import type {
1211
Timing,
1312
} from './types.ts';
1413

15-
// The platform-apple façades export only what production code consumes, so its phase names stay
16-
// literal here.
14+
// The platform-apple façades and the root client export only what production code consumes, so
15+
// these phase names stay literal here.
1716
const RUNNER_COMMAND_SEND_PHASE = 'ios_runner_command_send';
1817
const SNAPSHOT_SOURCE_ACQUIRE_PHASE = 'ios.snapshot-source.acquire';
1918
const SNAPSHOT_SOURCE_RECOVERY_PHASE = 'ios_snapshot_source_recovery';
19+
const DAEMON_REQUEST_PHASE = 'daemon_request';
2020

2121
type DiagnosticEvent = {
2222
ts?: string;

‎src/daemon-client/daemon-client.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ import { createRequestGuard, sendRequest } from './daemon-client-transport.ts';
2323
import { isRemoteDaemon, type DaemonInfo } from './daemon-client-metadata.ts';
2424
import { leaseScopeFromRequest } from '@agent-device/contracts/lease-scope';
2525

26-
/** The client diagnostic phase that times one daemon request round trip. */
27-
export const DAEMON_REQUEST_PHASE = 'daemon_request';
28-
2926
export type DaemonRequest = DaemonWireRequest;
3027
export type DaemonResponse = SharedDaemonResponse;
3128
type DaemonTransportOptions = AgentDeviceDaemonTransportContext & {
@@ -141,7 +138,7 @@ async function sendToDaemonOnHost(
141138
settings,
142139
async () => {
143140
const response = await withDiagnosticTimer(
144-
DAEMON_REQUEST_PHASE,
141+
'daemon_request',
145142
async () =>
146143
await sendRequest(
147144
info,

0 commit comments

Comments
 (0)