@deeeed/metamask-harness 0.26.1 → 0.26.3
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,18 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.26.3 - 2026-07-31
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Stop the verified detached analytics collector with its owning harness runtime instead of leaving an idle process behind.
|
|
10
|
+
|
|
11
|
+
## 0.26.2 - 2026-07-31
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Verify Extension MetaMetrics consent through the production Redux store when test-only clean-state hooks are unavailable.
|
|
16
|
+
|
|
5
17
|
## 0.26.1 - 2026-07-31
|
|
6
18
|
|
|
7
19
|
### Fixed
|
package/dist/commands/stop.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { color } from "../cli-color.js";
|
|
2
2
|
import { getAdapterSurface } from "../adapters/surface.js";
|
|
3
3
|
import { usageOut } from "./shared.js";
|
|
4
|
+
import { stopProjectCollector } from "../../library/actions/shared/analytics/collector.mjs";
|
|
4
5
|
import {
|
|
5
6
|
parseArgs,
|
|
6
7
|
optionFlag,
|
|
@@ -23,6 +24,9 @@ async function handleStop(argv) {
|
|
|
23
24
|
if (stop.kind === "headless") {
|
|
24
25
|
return usageOut(json, "stop", stop.message, stop.userAction);
|
|
25
26
|
}
|
|
27
|
+
const collector = await stopProjectCollector(target);
|
|
28
|
+
const signalled = (stop.signalled ?? 0) + (collector.stopped ? 1 : 0);
|
|
29
|
+
const summary = collector.stopped ? `${stop.summary}; stopped analytics collector ${collector.pid}` : stop.summary;
|
|
26
30
|
const next = adapter === "extension" ? `${surface.hints.launch} --target ${shellQuote(target)}` : void 0;
|
|
27
31
|
const userAction = `mm-harness status --target ${shellQuote(target)} --json`;
|
|
28
32
|
if (json) {
|
|
@@ -34,10 +38,10 @@ async function handleStop(argv) {
|
|
|
34
38
|
adapter,
|
|
35
39
|
target,
|
|
36
40
|
status: stop.status === 0 ? "pass" : "fail",
|
|
37
|
-
...stop.signalled !== void 0 ? { signalled
|
|
41
|
+
...stop.signalled !== void 0 || collector.stopped ? { signalled } : {},
|
|
38
42
|
exitCode: stop.status,
|
|
39
43
|
...stop.output ? { output: stop.output } : {},
|
|
40
|
-
...stop.status === 0 ? next ? { next } : {} : { error: { code: "DEV_SERVER_STOP_FAILED", message:
|
|
44
|
+
...stop.status === 0 ? next ? { next } : {} : { error: { code: "DEV_SERVER_STOP_FAILED", message: summary, userAction } }
|
|
41
45
|
},
|
|
42
46
|
null,
|
|
43
47
|
2
|
|
@@ -46,7 +50,7 @@ async function handleStop(argv) {
|
|
|
46
50
|
} else {
|
|
47
51
|
if (stop.output) process.stderr.write(`${stop.output}
|
|
48
52
|
`);
|
|
49
|
-
console.error(`${color(stop.status === 0 ? "ok" : "err", stop.status === 0 ? "\u2713" : "\u2717")} ${
|
|
53
|
+
console.error(`${color(stop.status === 0 ? "ok" : "err", stop.status === 0 ? "\u2713" : "\u2717")} ${summary}`);
|
|
50
54
|
if (stop.status !== 0 || next) console.error(` Next: ${stop.status === 0 ? next : userAction}`);
|
|
51
55
|
}
|
|
52
56
|
return stop.status;
|
|
@@ -7,9 +7,15 @@ runAdapter((input) => withExtensionPage(input, async (page) => {
|
|
|
7
7
|
|
|
8
8
|
async function readConsentState() {
|
|
9
9
|
return page.evaluate(`(async () => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
10
|
+
const hooks = globalThis.stateHooks || {};
|
|
11
|
+
const storeState = hooks.store?.getState?.();
|
|
12
|
+
const cleanState = typeof hooks.getCleanAppState === 'function'
|
|
13
|
+
? await hooks.getCleanAppState()
|
|
14
|
+
: undefined;
|
|
15
|
+
if (!storeState && !cleanState) {
|
|
16
|
+
throw new Error('Extension consent state is unavailable.');
|
|
17
|
+
}
|
|
18
|
+
const metamask = storeState?.metamask ?? cleanState?.metamask ?? {};
|
|
13
19
|
return {
|
|
14
20
|
optedIn: Boolean(metamask.optedIn),
|
|
15
21
|
dataCollectionForMarketing: Boolean(metamask.dataCollectionForMarketing),
|
|
@@ -268,6 +268,22 @@ async function stopCollector(state) {
|
|
|
268
268
|
return true;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
export async function stopProjectCollector(projectRoot) {
|
|
272
|
+
const { stateFile } = collectorPaths(projectRoot);
|
|
273
|
+
const state = await readState(stateFile);
|
|
274
|
+
if (!state) return { stopped: false, pid: null };
|
|
275
|
+
|
|
276
|
+
const stopped = await stopCollector(state);
|
|
277
|
+
if (stopped || !pidAlive(state.pid)) {
|
|
278
|
+
try {
|
|
279
|
+
await unlink(stateFile);
|
|
280
|
+
} catch (error) {
|
|
281
|
+
if (error?.code !== 'ENOENT') throw error;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return { stopped, pid: stopped ? state.pid : null };
|
|
285
|
+
}
|
|
286
|
+
|
|
271
287
|
async function stopSpawnedCollector(pid) {
|
|
272
288
|
if (!pidAlive(pid)) return;
|
|
273
289
|
try {
|