Skip to content

Commit 5b39210

Browse files
committed
fix(#2682): keep the disclosure wiring inside the complexity thresholds
The CI Fallow audit named two functions this PR pushed over: - `dispatchInteractionCommand` carried nine commands plus a default. The touch cases stay exactly as ADR 0011's structural guard requires — one delegation each — and the five commands that aim no gesture at a captured target move to their own dispatch, which is a different question anyway. - `snapshotView` had grown one conditional spread per optional signal. The signals it must carry are now a declared list, which is what it always was: the digest drops the tree and keeps the fields that say what the tree means.
1 parent a856ea3 commit 5b39210

2 files changed

Lines changed: 31 additions & 13 deletions

File tree

‎src/daemon/interaction/internal/interaction.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ async function dispatchInteractionCommand(
5454
return await dispatchTargetedTouchViaRuntime(params, 'hover');
5555
case 'fill':
5656
return await dispatchFillViaRuntime(params);
57+
default:
58+
return await dispatchNonTouchInteractionCommand(params);
59+
}
60+
}
61+
62+
/**
63+
* The commands that do not aim a gesture at a captured target. They are a separate question from the
64+
* touch dispatch above, which ADR 0011 holds to one delegation per case.
65+
*/
66+
async function dispatchNonTouchInteractionCommand(
67+
params: RoutedInteractionInput,
68+
): Promise<DaemonResponse | null> {
69+
switch (params.req.command) {
5770
case PUBLIC_COMMANDS.gesture:
5871
return await dispatchGestureViaRuntime(params);
5972
case PUBLIC_COMMANDS.swipe:

‎src/daemon/response-views.ts‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,28 @@ function snapshotView(data: DaemonResponseData, level: ResponseLevel): DaemonRes
2828
.filter((node) => node.hittable === true && node.interactionBlocked !== 'covered')
2929
.slice(0, DIGEST_REF_LIMIT)
3030
.map((node) => ({ ref: node.ref, label: node.label ?? node.value ?? node.identifier }));
31+
// Everything here is negotiable except the tree's own size and refs, so the optional signals are
32+
// carried by name rather than by one spread per field (#1076 refs generation, #2682 target
33+
// activation, and the occlusion/quality/visibility warnings a digest still has to surface).
34+
const carriedFields = [
35+
'visibility',
36+
'snapshotQuality',
37+
'targetActivation',
38+
'warnings',
39+
'fallbackScreenshotPath',
40+
'artifacts',
41+
'refsGeneration',
42+
] as const satisfies readonly (keyof DaemonResponseData)[];
43+
const carried = Object.fromEntries(
44+
carriedFields
45+
.filter((field) => data[field] !== undefined)
46+
.map((field) => [field, data[field]] as const),
47+
);
3148
return {
3249
nodeCount: nodes.length,
3350
refs,
3451
truncated: data.truncated,
35-
...(data.visibility !== undefined ? { visibility: data.visibility } : {}),
36-
...(data.snapshotQuality !== undefined ? { snapshotQuality: data.snapshotQuality } : {}),
37-
// A foreground repair rewrites which app this tree describes, so no response level may drop it
38-
// even though every byte around it is negotiable (#2682).
39-
...(data.targetActivation !== undefined ? { targetActivation: data.targetActivation } : {}),
40-
...(data.warnings !== undefined ? { warnings: data.warnings } : {}),
41-
...(data.fallbackScreenshotPath !== undefined
42-
? { fallbackScreenshotPath: data.fallbackScreenshotPath }
43-
: {}),
44-
...(data.artifacts !== undefined ? { artifacts: data.artifacts } : {}),
45-
// #1076 versioned refs: the one-number generation is the pinning signal for
46-
// the refs above — cheap, and dropping it would strand auto-pinning clients.
47-
...(data.refsGeneration !== undefined ? { refsGeneration: data.refsGeneration } : {}),
52+
...carried,
4853
};
4954
}
5055

0 commit comments

Comments
 (0)