Skip to content

Commit 0f7487f

Browse files
committed
refactor: complete explicit lifetime fixture migration
1 parent 7f2e379 commit 0f7487f

188 files changed

Lines changed: 880 additions & 756 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.

‎src/daemon/__tests__/app-log-session-resource.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ function makeContext(
486486
createdAt: Date.now(),
487487
actions: [],
488488
};
489-
sessionStore.set(sessionName, session);
489+
sessionStore.publish(sessionName, session);
490490
const resourcePath = appLogResourceStore.resolvePath(sessionStore.resolveSessionDir(sessionName));
491491
return {
492492
admissionLedger: createAppLogAdmissionLedger(),

‎src/daemon/__tests__/back-runtime.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ test('request router joins back admission to execution, recording, and ref inval
138138
const sessionStore = makeSessionStore('agent-device-back-generic-');
139139
const session = makeSession('back-runtime', { device: appleDevice });
140140
activateCompleteRefFrame(session);
141-
sessionStore.set(session.name, session);
141+
sessionStore.publish(session.name, session);
142142
const handler = createRequestHandler({
143143
logPath: '/tmp/daemon.log',
144144
token: 't',

‎src/daemon/__tests__/capture-disclosure.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ beforeEach(() => {
7575
test('mutating find on a system-surface capture discloses the occlusion on the found outcome', async () => {
7676
const sessionStore = makeSessionStore();
7777
const session = makeAndroidSession('default');
78-
sessionStore.set('default', session);
78+
sessionStore.publish('default', session);
7979

8080
const response = await handleFindCommands({
8181
req: {
@@ -102,7 +102,7 @@ test('mutating find on a system-surface capture discloses the occlusion on the f
102102
test('read-only find exists on a system-surface capture discloses the occlusion', async () => {
103103
const sessionStore = makeSessionStore();
104104
const session = makeAndroidSession('default');
105-
sessionStore.set('default', session);
105+
sessionStore.publish('default', session);
106106

107107
const response = await dispatchFindReadOnlyViaRuntime({
108108
req: {
@@ -128,7 +128,7 @@ test('read-only find exists on a system-surface capture discloses the occlusion'
128128
test('wait timeout for app text hidden behind a system surface discloses the occlusion', async () => {
129129
const sessionStore = makeSessionStore();
130130
const session = makeAndroidSession('default');
131-
sessionStore.set('default', session);
131+
sessionStore.publish('default', session);
132132

133133
const response = await dispatchWaitViaRuntime({
134134
req: {
@@ -304,7 +304,7 @@ function serveSheetCapture(): void {
304304
test('mutating find on an in-place system surface discloses it on the found outcome', async () => {
305305
serveSheetCapture();
306306
const sessionStore = makeSessionStore();
307-
sessionStore.set('default', makeIosSession('default', { appBundleId: 'com.example.app' }));
307+
sessionStore.publish('default', makeIosSession('default', { appBundleId: 'com.example.app' }));
308308

309309
const response = await handleFindCommands({
310310
req: {
@@ -331,7 +331,7 @@ test('mutating find on an in-place system surface discloses it on the found outc
331331
test('mutating find that misses on an in-place system surface still discloses it', async () => {
332332
serveSheetCapture();
333333
const sessionStore = makeSessionStore();
334-
sessionStore.set('default', makeIosSession('default', { appBundleId: 'com.example.app' }));
334+
sessionStore.publish('default', makeIosSession('default', { appBundleId: 'com.example.app' }));
335335

336336
const response = await handleFindCommands({
337337
req: {
@@ -378,7 +378,7 @@ test('the shared disclosure helper reports an iOS system surface on both outcome
378378
*/
379379
test('wait timeout whose polls required a foreground repair discloses the repair', async () => {
380380
const sessionStore = makeSessionStore();
381-
sessionStore.set('default', makeIosSession('default', { appBundleId: 'com.example.app' }));
381+
sessionStore.publish('default', makeIosSession('default', { appBundleId: 'com.example.app' }));
382382
legacyDispatchCapture.mockResolvedValue({
383383
backend: 'xctest',
384384
truncated: false,

‎src/daemon/__tests__/daemon-policy.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function makeHandler(
4040
options: { inventory?: readonly DeviceInfo[]; providerInventory?: readonly DeviceInfo[] } = {},
4141
) {
4242
const sessionStore = makeSessionStore('agent-device-daemon-policy-');
43-
sessionStore.set('default', makeIosSession('default', { appBundleId: 'com.example.app' }));
43+
sessionStore.publish('default', makeIosSession('default', { appBundleId: 'com.example.app' }));
4444
const bind = vi.fn(lifecycleDeviceRuntimeGateway.bind);
4545
const inspectFacts = vi.fn(lifecycleDeviceRuntimeGateway.inspectFacts);
4646
const handler = createRequestHandler({

‎src/daemon/__tests__/daemon-runtime-app-log.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ test('daemon shutdown settles fenced app-log cleanup before finalization can rel
123123
forceCleanup,
124124
});
125125
session.appLog = { handle, envelope };
126-
sessionStore.set(session.name, session);
126+
sessionStore.publish(session.name, session);
127127
const resourcePath = appLogResourceStore.resolvePath(
128128
sessionStore.resolveSessionDir(session.name),
129129
);

‎src/daemon/__tests__/focus-runtime.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ test('request router joins focus admission to execution, recording, and ref inva
189189
const sessionStore = makeSessionStore('agent-device-focus-generic-');
190190
const session = makeSession('focus-runtime', { device: appleDevice });
191191
activateCompleteRefFrame(session);
192-
sessionStore.set(session.name, session);
192+
sessionStore.publish(session.name, session);
193193
const handler = createRequestHandler({
194194
logPath: '/tmp/daemon.log',
195195
token: 't',

‎src/daemon/__tests__/generic-settle.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function seedSession(
140140
const session = makeIosSession(sessionName);
141141
setSessionSnapshot(session, buildSnapshotState(snapshotPayload(baseline), {}));
142142
activateCompleteRefFrame(session);
143-
sessionStore.set(sessionName, session);
143+
sessionStore.publish(sessionName, session);
144144
return session;
145145
}
146146

‎src/daemon/__tests__/human-control-router-fixture.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function createHumanControlHarness() {
1313
const lease = registry.allocateLease(HUMAN_CONTROL_LEASE_REQUEST);
1414
const sessionStore = makeSessionStore('agent-device-human-control-');
1515
const sessionName = tenantScopedSessionName(lease.tenantId, 'takeover-test');
16-
sessionStore.set(
16+
sessionStore.publish(
1717
sessionName,
1818
makeIosAppSession(sessionName, {
1919
lease: buildSessionLeaseFromRequest(humanControlRequest(lease), lease),

‎src/daemon/__tests__/is-runtime.test.ts‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ function isRequest(
7474
test('an admitted is inspects once, binds once, and answers through the bound capture', async () => {
7575
const fixture = selectorCaptureFixture({ snapshot: () => buttonSnapshot() });
7676
const sessionStore = makeSessionStore();
77-
sessionStore.set('is-bound', makeAndroidSession('is-bound', { appBundleId: 'com.example.app' }));
77+
sessionStore.publish(
78+
'is-bound',
79+
makeAndroidSession('is-bound', { appBundleId: 'com.example.app' }),
80+
);
7881

7982
const response = await dispatchIsViaRuntime({
8083
req: isRequest('is-bound', ['visible', 'id=auth_continue']),
@@ -95,7 +98,7 @@ test('is absent uses the bound readAny capture for selector-first input without
9598
snapshot: () => ({ nodes: [], backend: 'xctest', producer: 'apple-runner' }),
9699
});
97100
const sessionStore = makeSessionStore();
98-
sessionStore.set('is-absent', makeIosAppSession('is-absent'));
101+
sessionStore.publish('is-absent', makeIosAppSession('is-absent'));
99102

100103
const response = await dispatchIsViaRuntime({
101104
req: isRequest('is-absent', ['label="Removed row"', 'absent']),
@@ -133,7 +136,7 @@ test('is absent bypasses a cached no-match snapshot before evaluating the bound
133136
}),
134137
});
135138
const sessionStore = makeSessionStore();
136-
sessionStore.set(
139+
sessionStore.publish(
137140
'is-absent-fresh',
138141
makeIosAppSession('is-absent-fresh', { snapshot: cachedAbsent }),
139142
);
@@ -168,7 +171,7 @@ test('is absent fails closed for a quality-less legacy iOS root-only capture', a
168171
}),
169172
});
170173
const sessionStore = makeSessionStore();
171-
sessionStore.set('is-legacy-sparse', makeIosAppSession('is-legacy-sparse'));
174+
sessionStore.publish('is-legacy-sparse', makeIosAppSession('is-legacy-sparse'));
172175

173176
const response = await dispatchIsViaRuntime({
174177
req: isRequest('is-legacy-sparse', ['absent', 'label="Removed row"']),
@@ -200,7 +203,7 @@ test('is absent fails closed for a quality-less legacy iOS root-only capture', a
200203
test('is absent rejects depth and scope before binding with typed invalid arguments', async () => {
201204
const fixture = selectorCaptureFixture();
202205
const sessionStore = makeSessionStore();
203-
sessionStore.set('is-absent-flags', makeIosAppSession('is-absent-flags'));
206+
sessionStore.publish('is-absent-flags', makeIosAppSession('is-absent-flags'));
204207

205208
for (const [flag, value] of [
206209
['snapshotScope', 'Login'],
@@ -233,7 +236,7 @@ test('an unavailable capture fact refuses before any bind', async () => {
233236
// The watchOS sentinel shape: capability-supported today, no snapshot backend at the owner.
234237
const fixture = selectorCaptureFixture({ capture: unavailableCapture });
235238
const sessionStore = makeSessionStore();
236-
sessionStore.set('is-refused', makeAndroidSession('is-refused', { appBundleId: 'com.a' }));
239+
sessionStore.publish('is-refused', makeAndroidSession('is-refused', { appBundleId: 'com.a' }));
237240

238241
const response = await dispatchIsViaRuntime({
239242
req: isRequest('is-refused', ['visible', 'id=auth_continue']),
@@ -262,7 +265,7 @@ test('an iOS session with no tracked app is refused with the open hint, not answ
262265
snapshot: () => buttonSnapshot(),
263266
});
264267
const sessionStore = makeSessionStore();
265-
sessionStore.set('is-no-app', makeIosSession('is-no-app'));
268+
sessionStore.publish('is-no-app', makeIosSession('is-no-app'));
266269

267270
const response = await withTestDeviceInventory(
268271
{},
@@ -291,7 +294,7 @@ test('an iOS session WITH a tracked app still answers, so the refusal is the pla
291294
snapshot: () => buttonSnapshot(),
292295
});
293296
const sessionStore = makeSessionStore();
294-
sessionStore.set('is-with-app', makeIosAppSession('is-with-app'));
297+
sessionStore.publish('is-with-app', makeIosAppSession('is-with-app'));
295298

296299
const response = await dispatchIsViaRuntime({
297300
req: isRequest('is-with-app', ['visible', 'label=Continue']),
@@ -308,7 +311,7 @@ test('an iOS session WITH a tracked app still answers, so the refusal is the pla
308311
test('an Android session with no tracked app proceeds, because the owner advertises the without-active-app capture', async () => {
309312
const fixture = selectorCaptureFixture({ snapshot: () => buttonSnapshot() });
310313
const sessionStore = makeSessionStore();
311-
sessionStore.set('is-android-no-app', makeAndroidSession('is-android-no-app'));
314+
sessionStore.publish('is-android-no-app', makeAndroidSession('is-android-no-app'));
312315

313316
const response = await dispatchIsViaRuntime({
314317
req: isRequest('is-android-no-app', ['visible', 'id=auth_continue']),
@@ -329,7 +332,7 @@ test('an Android session with no tracked app proceeds, because the owner adverti
329332
test('a refused request reaches the device by no route at all', async () => {
330333
const fixture = selectorCaptureFixture({ capture: unavailableCapture });
331334
const sessionStore = makeSessionStore();
332-
sessionStore.set('is-direct-refused', makeIosAppSession('is-direct-refused'));
335+
sessionStore.publish('is-direct-refused', makeIosAppSession('is-direct-refused'));
333336
mockRunAppleRunnerCommand.mockResolvedValue({
334337
found: true,
335338
nodes: [
@@ -389,7 +392,7 @@ test('a failing predicate answers COMMAND_FAILED from the bound capture', async
389392
}),
390393
});
391394
const sessionStore = makeSessionStore();
392-
sessionStore.set('is-direct-false', makeIosAppSession('is-direct-false'));
395+
sessionStore.publish('is-direct-false', makeIosAppSession('is-direct-false'));
393396
mockRunAppleRunnerCommand.mockResolvedValue({
394397
found: true,
395398
text: 'Apple Account',
@@ -444,7 +447,7 @@ test('a miss on a surface that never settled carries the unsettled fact, and the
444447
const sessionStore = makeSessionStore();
445448
const session = makeIosAppSession('is-unsettled');
446449
markDeferredInteractionOutcome({ session, command: 'scroll', positionals: [], flags: {} });
447-
sessionStore.set('is-unsettled', session);
450+
sessionStore.publish('is-unsettled', session);
448451
const isVisible = () =>
449452
dispatchIsViaRuntime({
450453
req: isRequest('is-unsettled', ['visible', 'id=target']),
@@ -486,7 +489,7 @@ test('a read after a scroll that moved nothing carries the no-effect outcome, an
486489
const sessionStore = makeSessionStore();
487490
const session = makeIosAppSession('is-no-effect', { snapshot: makeSnapshotState([row]) });
488491
markDeferredInteractionOutcome({ session, command: 'scroll', positionals: ['down'], flags: {} });
489-
sessionStore.set('is-no-effect', session);
492+
sessionStore.publish('is-no-effect', session);
490493
const isVisible = () =>
491494
dispatchIsViaRuntime({
492495
req: isRequest('is-no-effect', ['visible', 'id=row']),

‎src/daemon/__tests__/lease-lifecycle.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test('admitRequestLeaseForLockedScope heartbeats and stores admitted lease on th
2222
deviceKey: 'ios:SIM-001',
2323
clientId: 'client-a',
2424
});
25-
sessionStore.set(
25+
sessionStore.publish(
2626
'default',
2727
makeIosSession('default', {
2828
lease: {
@@ -71,7 +71,7 @@ test('cleanupExpiredLeasedSession consumes expired lease and deletes the session
7171
expiresAt: lease.expiresAt,
7272
},
7373
});
74-
sessionStore.set('default', session);
74+
sessionStore.publish('default', session);
7575
now = 1_011;
7676
const teardownSession = vi.fn(async () => {});
7777

0 commit comments

Comments
 (0)