fix(native)!: preserve incomplete native UI captures (#991)

* fix(native): preserve unknown accessibility child counts

* fix(native): align helper buffer with capture budget

* fix(native): align Swift helper JSON wire size

* fix(native): bound raw helper output to scenario budget
This commit is contained in:
morluto
2026-10-07 23:44:41 +08:00
committed by GitHub
parent 5065fcd520
commit 9f496ef2d4
13 changed files with 178 additions and 21 deletions
+8 -2
View File
@@ -16,6 +16,10 @@ import { ProviderAdapterError } from "../domain/providerAdapterError.js";
import { type AnalysisError } from "../domain/analysisErrorBase.js";
import { err, ok, type Result } from "../domain/result.js";
import { createNativeUiHelperRuntime } from "./NativeUiHelperRuntime.js";
import {
NATIVE_UI_OUTPUT_BUDGET_BYTES,
NATIVE_UI_OUTPUT_WEIGHT,
} from "./NativeUiOutputBudget.js";
const helper = fileURLToPath(
new URL("../../bridge/native/ReaNativeUI.swift", import.meta.url),
@@ -135,8 +139,10 @@ const observeWithHelper = async (
),
);
launchTime = response.result.window.launch_time;
outputBytes += 2 * Buffer.byteLength(JSON.stringify(response.result));
if (outputBytes > 64 * 1024 * 1024)
outputBytes +=
NATIVE_UI_OUTPUT_WEIGHT *
Buffer.byteLength(JSON.stringify(response.result));
if (outputBytes > NATIVE_UI_OUTPUT_BUDGET_BYTES)
return err(
new AnalysisCapabilityUnavailableError(
"native-macos",