@deeeed/metamask-harness 0.94.0 → 0.94.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.94.2 - 2026-10-24
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Treat disappeared or reused companion processes as already stopped, preserving the unrelated PID and allowing repeated slot cleanup.
|
|
10
|
+
|
|
11
|
+
## 0.94.1 - 2026-10-22
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Mobile scroll-into-view checks the complete target bounds before treating it as already on screen.
|
|
16
|
+
- iOS simulator launch restarts app processes that have run for six hours or reached 1.5 GiB RSS before opening the dev client, including when the runtime otherwise looks ready.
|
|
17
|
+
|
|
5
18
|
## 0.94.0 - 2026-10-22
|
|
6
19
|
|
|
7
20
|
### Added
|
|
@@ -41,8 +41,6 @@ stop_checkout_idb_companions() {
|
|
|
41
41
|
else
|
|
42
42
|
status=$?
|
|
43
43
|
[ "$status" -eq 1 ] && continue
|
|
44
|
-
printf 'Companion ownership is unknown. Next: mm-harness status --target "%s"\n' "$repo" >&2
|
|
45
|
-
return 1
|
|
46
44
|
fi
|
|
47
45
|
if ! stop_verified_process "$pid" "$identity" 'TERM KILL' 0.1 _idb_companion_owned "$repo" "$udid" "$pid" "$identity"; then
|
|
48
46
|
printf 'Companion %s cleanup was not confirmed. Next: mm-harness status --target "%s"\n' "$pid" "$repo" >&2
|
|
@@ -15,7 +15,9 @@ stop_verified_process() {
|
|
|
15
15
|
fi
|
|
16
16
|
for signal in $signals; do
|
|
17
17
|
if ! "$@"; then
|
|
18
|
-
|
|
18
|
+
current="$(process_identity "$pid")"
|
|
19
|
+
if [ -n "$current" ] && [ "$current" != "$identity" ]; then return 0; fi
|
|
20
|
+
if [ -z "$current" ] && ! kill -0 "$pid" 2>/dev/null; then return 0; fi
|
|
19
21
|
printf 'Process %s ownership changed before stop.\n' "$pid" >&2
|
|
20
22
|
return 1
|
|
21
23
|
fi
|
|
@@ -23,6 +25,7 @@ stop_verified_process() {
|
|
|
23
25
|
for attempt in $(seq 1 20); do
|
|
24
26
|
current="$(process_identity "$pid")"
|
|
25
27
|
if [ -z "$current" ] && ! kill -0 "$pid" 2>/dev/null; then return 0; fi
|
|
28
|
+
if [ -n "$current" ] && [ "$current" != "$identity" ]; then return 0; fi
|
|
26
29
|
if [ "$current" != "$identity" ]; then
|
|
27
30
|
printf 'Process %s identity changed during stop.\n' "$pid" >&2
|
|
28
31
|
return 1
|
|
@@ -127,6 +127,38 @@ function mobileSourceAwareLifecycleAdapters(lifecycle, readinessProbe = probeMob
|
|
|
127
127
|
}
|
|
128
128
|
}));
|
|
129
129
|
}
|
|
130
|
+
function staleMobileAppProcessReason(usage) {
|
|
131
|
+
if (usage.elapsedSeconds !== void 0 && usage.elapsedSeconds >= 6 * 60 * 60) {
|
|
132
|
+
return `app process ${String(usage.pid)} has run for ${Math.floor(usage.elapsedSeconds / 60)} minutes`;
|
|
133
|
+
}
|
|
134
|
+
if (usage.residentBytes !== void 0 && usage.residentBytes >= 1.5 * 1024 ** 3) {
|
|
135
|
+
return `app process ${String(usage.pid)} uses ${Math.round(usage.residentBytes / 1024 ** 2)} MiB RSS`;
|
|
136
|
+
}
|
|
137
|
+
return void 0;
|
|
138
|
+
}
|
|
139
|
+
function readIosAppProcessUsage(env = process.env) {
|
|
140
|
+
const device = env.SIM_UDID || env.IOS_SIMULATOR || "booted";
|
|
141
|
+
const pid = readIosAppPid({ simulator: device }, { env });
|
|
142
|
+
if (pid === null) return {};
|
|
143
|
+
try {
|
|
144
|
+
const output = execFileSync("ps", ["-p", String(pid), "-o", "etime=,rss="], {
|
|
145
|
+
encoding: "utf8",
|
|
146
|
+
timeout: 5e3,
|
|
147
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
148
|
+
});
|
|
149
|
+
const row = output.trim().split("\n").at(-1) ?? "";
|
|
150
|
+
const match = /^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)\s+(\d+)$/u.exec(row.trim());
|
|
151
|
+
if (!match) return { pid };
|
|
152
|
+
const [, days, hours, minutes, seconds, rssKiB] = match;
|
|
153
|
+
return {
|
|
154
|
+
pid,
|
|
155
|
+
elapsedSeconds: Number(days ?? 0) * 86400 + Number(hours ?? 0) * 3600 + Number(minutes) * 60 + Number(seconds),
|
|
156
|
+
residentBytes: Number(rssKiB) * 1024
|
|
157
|
+
};
|
|
158
|
+
} catch {
|
|
159
|
+
return { pid };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
130
162
|
function readAndroidAppPid(node, context) {
|
|
131
163
|
const env = context.env ?? {};
|
|
132
164
|
const device = node.adb_serial ?? node.android_device ?? node.device ?? env.ADB_SERIAL ?? env.ANDROID_SERIAL ?? process.env.ADB_SERIAL ?? process.env.ANDROID_SERIAL;
|
|
@@ -296,5 +328,7 @@ function asRecord(value) {
|
|
|
296
328
|
}
|
|
297
329
|
export {
|
|
298
330
|
mobileSourceAwareLifecycleAdapters,
|
|
299
|
-
|
|
331
|
+
readIosAppProcessUsage,
|
|
332
|
+
resolveMobileLifecycleReadinessTimeout,
|
|
333
|
+
staleMobileAppProcessReason
|
|
300
334
|
};
|
|
@@ -567,7 +567,16 @@ async function queryMobileViewportTarget(input, testId) {
|
|
|
567
567
|
"Mobile ui.scroll scroll_into_view requires the current __AGENTIC__.queryUiTarget bridge."
|
|
568
568
|
);
|
|
569
569
|
}
|
|
570
|
-
|
|
570
|
+
const { rect, viewport } = result;
|
|
571
|
+
return {
|
|
572
|
+
...result,
|
|
573
|
+
visible: result.visible === true && isRecord(rect) && isRecord(viewport) && scrollTargetFillsAxis(rect.x, rect.width, viewport.width) && scrollTargetFillsAxis(rect.y, rect.height, viewport.height)
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
function scrollTargetFillsAxis(start, size, viewport) {
|
|
577
|
+
if (typeof start !== "number" || typeof size !== "number" || typeof viewport !== "number" || !Number.isFinite(start) || !Number.isFinite(size) || !Number.isFinite(viewport) || size <= 0 || viewport <= 0) return false;
|
|
578
|
+
const visible = Math.min(start + size, viewport) - Math.max(start, 0);
|
|
579
|
+
return visible >= Math.min(size, viewport);
|
|
571
580
|
}
|
|
572
581
|
async function waitForMobileViewportTarget(input, testId, timeoutMs) {
|
|
573
582
|
const deadline = Date.now() + Math.max(0, Math.min(timeoutMs, 5e3));
|
|
@@ -8,6 +8,7 @@ import { ensureHarnessFresh } from "../../adapters/harness-freshness.js";
|
|
|
8
8
|
import { pinMobileFeatureFlags } from "../../adapters/mobile/feature-flags.js";
|
|
9
9
|
import { toRemoteFlagSpec } from "../../feature-flags.js";
|
|
10
10
|
import { clearMobileReleaseArtifactState } from "../../adapters/mobile/release-artifact-state.js";
|
|
11
|
+
import { readIosAppProcessUsage, staleMobileAppProcessReason } from "../../adapters/mobile/lifecycle.js";
|
|
11
12
|
async function launchMobile(target, mobileTarget, tier, json, restartApp = false, clearMetro = false, remoteFlags) {
|
|
12
13
|
clearMobileReleaseArtifactState(target);
|
|
13
14
|
await ensureHarnessFresh(target, "mobile");
|
|
@@ -15,12 +16,15 @@ async function launchMobile(target, mobileTarget, tier, json, restartApp = false
|
|
|
15
16
|
const watcherPort = process.env.WATCHER_PORT ? parseInt(process.env.WATCHER_PORT, 10) : void 0;
|
|
16
17
|
const preflightMode = tier === "build" ? "rebuild-native" : "fast";
|
|
17
18
|
const source = mobileSourceCheck(target);
|
|
19
|
+
const staleProcess = !restartApp && source.status === "current" && platform === "ios" ? staleMobileAppProcessReason(readIosAppProcessUsage()) : void 0;
|
|
20
|
+
if (staleProcess) process.stderr.write(`Mobile launch: ${staleProcess}; restarting the app process.
|
|
21
|
+
`);
|
|
18
22
|
const result = await prepareMobile(target, {
|
|
19
23
|
platform,
|
|
20
24
|
json,
|
|
21
25
|
watcherPort,
|
|
22
26
|
preflightMode,
|
|
23
|
-
restartApp: restartApp || source.status !== "current",
|
|
27
|
+
restartApp: restartApp || source.status !== "current" || staleProcess !== void 0,
|
|
24
28
|
clearMetro
|
|
25
29
|
});
|
|
26
30
|
if (result.status !== 0) return result;
|