Skip to content

Commit 1f63bf3

Browse files
committed
refactor(open): type the open request lock with defined resolution options
An open always resolves its advisory lock device with the open-target options, so its lock type states that `options` is defined. Only replay and explicit selector locks can lack options. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016qAu53rMak1bXMuR5U2gF4
1 parent bcb5ac9 commit 1f63bf3

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

‎packages/daemon/src/server/request-binding.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,18 @@ function resolveFreshSessionBindingRequest(req: DaemonRequest): DaemonRequest {
9393
}
9494
}
9595

96+
type FreshSessionDeviceLock = {
97+
flags: NonNullable<DaemonRequest['flags']>;
98+
options: ResolveTargetDeviceOptions | undefined;
99+
};
100+
101+
/** An `open` always resolves its lock device with the open-target options. */
102+
type OpenDeviceLock = FreshSessionDeviceLock & { options: ResolveTargetDeviceOptions };
103+
96104
async function resolveFreshSessionDeviceLock(
97105
req: DaemonRequest,
98106
env: EnvMap,
99-
): Promise<
100-
| {
101-
flags: NonNullable<DaemonRequest['flags']>;
102-
options: ResolveTargetDeviceOptions | undefined;
103-
}
104-
| undefined
105-
> {
107+
): Promise<FreshSessionDeviceLock | undefined> {
106108
if (req.command === 'open') return await resolveOpenDeviceLock(req, env);
107109
if (req.command === 'replay') return await resolveReplayDeviceLock(req, env);
108110
return resolveExplicitDeviceLock(req, env);
@@ -134,7 +136,7 @@ async function resolveFreshSessionDevice(
134136
}
135137
}
136138

137-
async function resolveOpenDeviceLock(req: DaemonRequest, env: EnvMap) {
139+
async function resolveOpenDeviceLock(req: DaemonRequest, env: EnvMap): Promise<OpenDeviceLock> {
138140
// Deferred to keep the daemon's eager closure within scripts/__tests__/eager-closure-budgets.ts.
139141
const { resolveOpenTargetDeviceOptions } =
140142
await import('../core/open-target-device-resolution.ts');

0 commit comments

Comments
 (0)