Skip to content

Commit d8644c0

Browse files
committed
chore(gates): keep the runner audit at base after the prep fence (#3220)
Publication moves into refuseRetiredRunnerPublication so startRunnerSessionWithLease keeps its merge-base complexity, and the three start-admission members read through the loadRunnerStartAdmission loader get the same .fallowrc.json dynamic-member suppression the runner's other lazy seams already carry.
1 parent 9def216 commit d8644c0

2 files changed

Lines changed: 33 additions & 12 deletions

File tree

‎.fallowrc.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@
250250
"file": "packages/platform-apple/src/runner/runner-device-readiness.ts",
251251
"exports": ["preflightIosRunnerDeviceReadiness"]
252252
},
253+
{
254+
"comment": "The start-admission fence members are read off the loadRunnerStartAdmission() loader in packages/platform-apple/src/runner/{runner-session,runner-artifact}.ts (the eager-closure budget forbids the static edge); Fallow cannot connect those dynamic member reads.",
255+
"file": "packages/platform-apple/src/runner/runner-start-admission.ts",
256+
"exports": [
257+
"retireAllRunnerStartAdmissions",
258+
"clearAllRunnerStartAdmissionsAfterTeardown",
259+
"assertRunnerStartAdmitsPreparation"
260+
]
261+
},
253262
{
254263
"comment": "The CLI and MCP process entrypoints are loaded lazily by the module table in src/cli/entry.ts; Fallow cannot connect those dynamic member reads.",
255264
"file": "{src/cli/process-entry.ts,src/mcp/server.ts}",

‎packages/platform-apple/src/runner/runner-session.ts‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -348,18 +348,8 @@ async function startRunnerSessionWithLease(
348348
}
349349
// Publication is the second gate: a start whose preparation was admitted before a teardown
350350
// must not register a runner into the device that teardown is settling, or into the fresh
351-
// start a later open has already begun (#3220). The launch this start already paid for is its
352-
// own to stop, and it stops it under the lease lock it still holds.
353-
const { runnerStartAdmitsPreparation, runnerStartRetiredError } =
354-
await loadRunnerStartAdmission();
355-
if (!runnerStartAdmitsPreparation(device.id, startAdmission)) {
356-
await disposeRunnerSession(session, {
357-
graceful: false,
358-
waitTimeoutMs: RUNNER_INVALIDATE_WAIT_TIMEOUT_MS,
359-
leaseLockHeld: true,
360-
});
361-
throw runnerStartRetiredError(startAdmission.retired ?? 'device_teardown');
362-
}
351+
// start a later open has already begun (#3220).
352+
await refuseRetiredRunnerPublication(device, session, startAdmission);
363353
try {
364354
writeRunnerLease(lease);
365355
} catch (error) {
@@ -374,6 +364,28 @@ async function startRunnerSessionWithLease(
374364
return session;
375365
}
376366

367+
/**
368+
* Refuses a launched runner whose start lost admission while it was building: the publication
369+
* a fenced start would make lands on a device teardown is settling or a fresh start already
370+
* owns, so the launch this start already paid for is its own to stop, and it stops it under
371+
* the lease lock the start still holds (#3220).
372+
*/
373+
async function refuseRetiredRunnerPublication(
374+
device: DeviceInfo,
375+
session: RunnerSession,
376+
startAdmission: RunnerStartAdmission,
377+
): Promise<void> {
378+
const { runnerStartAdmitsPreparation, runnerStartRetiredError } =
379+
await loadRunnerStartAdmission();
380+
if (runnerStartAdmitsPreparation(device.id, startAdmission)) return;
381+
await disposeRunnerSession(session, {
382+
graceful: false,
383+
waitTimeoutMs: RUNNER_INVALIDATE_WAIT_TIMEOUT_MS,
384+
leaseLockHeld: true,
385+
});
386+
throw runnerStartRetiredError(startAdmission.retired ?? 'device_teardown');
387+
}
388+
377389
export function assertExpectedRunnerSession(
378390
session: Pick<RunnerSession, 'sessionId'>,
379391
expectedRunnerSessionId: string | undefined,

0 commit comments

Comments
 (0)