Skip to content

Code Quality: PR #416 #1357

Code Quality: PR #416

Code Quality: PR #416 #1357

Triggered via dynamic May 21, 2026 09:10
Status Success
Total duration 1m 24s
Artifacts

codeql

on: dynamic
Matrix: analyze
Fit to window
Zoom out
Zoom in

Annotations

7 warnings
`type_text` omits `previousRuntimeSnapshot` from success result, losing action context for next-step guidance: src/mcp/tools/ui-automation/type_text.ts#L175
Pass `previousRuntimeSnapshot: resolution.snapshot.payload` in the `createUiActionSuccessResult` options, as `tap.ts`, `swipe.ts`, and `drag.ts` all do, so `setUiActionStructuredOutput` can populate action context for suppressed target refs and runtime next-step hints.
[HHK-MAK] `type_text` omits `previousRuntimeSnapshot` from success result, losing action context for next-step guidance (additional location): src/mcp/tools/ui-automation/long_press.ts#L126
Pass `previousRuntimeSnapshot: resolution.snapshot.payload` in the `createUiActionSuccessResult` options, as `tap.ts`, `swipe.ts`, and `drag.ts` all do, so `setUiActionStructuredOutput` can populate action context for suppressed target refs and runtime next-step hints.
O(n²) scan in findActiveForegroundRoot for every UI action response: src/mcp/tools/ui-automation/shared/runtime-next-steps.ts#L383
Each call to `foregroundScore` runs `findSheetGrabberDescendant` (a linear `records.find`) plus a `records.filter` over all elements — so scoring all n candidates costs O(n²). On complex screens with hundreds of AX elements this executes synchronously on every UI action that emits next-step context. Consider pre-indexing descendants by path prefix before the reduce loop to bring this down to O(n log n).
[2CC-QVM] O(n²) scan in findActiveForegroundRoot for every UI action response (additional location): src/mcp/tools/ui-automation/shared/runtime-snapshot.ts#L460
Each call to `foregroundScore` runs `findSheetGrabberDescendant` (a linear `records.find`) plus a `records.filter` over all elements — so scoring all n candidates costs O(n²). On complex screens with hundreds of AX elements this executes synchronously on every UI action that emits next-step context. Consider pre-indexing descendants by path prefix before the reduce loop to bring this down to O(n log n).
Seven runtime snapshot helper functions duplicated verbatim across two files: src/utils/structured-output-envelope.ts#L106
The functions `compactRuntimeSnapshotText`, `normalizedRuntimeSnapshotText`, `isHiddenRuntimeTarget`, `isLowPriorityRuntimeTarget`, `isContentRichTapTarget`, `isAlreadySelectedRuntimeTarget`, `getRuntimeTargetDisplayPriority`, and `sortRuntimeTargetsForDisplay` are all defined identically in both this file and `src/utils/renderers/domain-result-text.ts`; extract them to a shared module (e.g. `src/utils/runtime-snapshot-utils.ts`) and import from both.
[FEN-C5A] Seven runtime snapshot helper functions duplicated verbatim across two files (additional location): src/utils/renderers/domain-result-text.ts#L1169
The functions `compactRuntimeSnapshotText`, `normalizedRuntimeSnapshotText`, `isHiddenRuntimeTarget`, `isLowPriorityRuntimeTarget`, `isContentRichTapTarget`, `isAlreadySelectedRuntimeTarget`, `getRuntimeTargetDisplayPriority`, and `sortRuntimeTargetsForDisplay` are all defined identically in both this file and `src/utils/renderers/domain-result-text.ts`; extract them to a shared module (e.g. `src/utils/runtime-snapshot-utils.ts`) and import from both.
[FEN-C5A] Seven runtime snapshot helper functions duplicated verbatim across two files (additional location): src/utils/structured-output-envelope.ts#L57
The functions `compactRuntimeSnapshotText`, `normalizedRuntimeSnapshotText`, `isHiddenRuntimeTarget`, `isLowPriorityRuntimeTarget`, `isContentRichTapTarget`, `isAlreadySelectedRuntimeTarget`, `getRuntimeTargetDisplayPriority`, and `sortRuntimeTargetsForDisplay` are all defined identically in both this file and `src/utils/renderers/domain-result-text.ts`; extract them to a shared module (e.g. `src/utils/runtime-snapshot-utils.ts`) and import from both.