@deeeed/metamask-harness 0.3.5 → 0.3.6

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
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.6 - 2026-07-04
4
+
5
+ ### Fixed
6
+ - **Install manifest carries target checkout identity (`targetRevision`)** — `adapters/mobile/inject.sh` stamps the target repo's `HEAD` (resolved once, up front, via `git rev-parse --verify HEAD`) and an explicit `installMode` into the mobile install manifest on both install paths (product-owned/metadata-only and overlay). Consumers (the farm recipe hook) can now gate their fast path on manifest identity matching the current checkout instead of manifest existence, closing the stale-manifest hole where a gitignored manifest survives a branch switch to a bridge-less checkout. Install now fails with teaching guidance when the target `HEAD` cannot be resolved (not-a-repo, unborn branch), instead of stamping an unusable `targetRevision`. Contract tests cover the identity stamp on both paths and the unborn-HEAD refusal.
7
+
3
8
  ## 0.3.5 - 2026-07-04
4
9
 
5
10
  ### Fixed
@@ -60,6 +60,19 @@ if ! command -v harness_root >/dev/null 2>&1; then
60
60
  exit 1
61
61
  fi
62
62
  TARGET="$(cd "$TARGET" && pwd)"
63
+ # The install stamps this checkout's HEAD into the manifest as its identity. If we
64
+ # cannot resolve it (not a git repo, unborn HEAD, git unavailable) we must not
65
+ # install with an unidentifiable target: a downstream consumer could not tell a
66
+ # stale manifest (left behind by a previous branch/tag) from a current one. Fail
67
+ # loud with escape guidance rather than stamping an "unknown" revision.
68
+ # --verify fails cleanly (no stdout) on an unborn HEAD, where plain `rev-parse
69
+ # HEAD` would echo the literal "HEAD" and slip past the emptiness check below.
70
+ TARGET_REV="$(git -C "$TARGET" rev-parse --verify HEAD 2>/dev/null || true)"
71
+ if [ -z "$TARGET_REV" ]; then
72
+ echo "Refusing mobile recipe harness install: cannot resolve the target checkout HEAD in $TARGET." >&2
73
+ echo "Next: ensure the target is a git checkout with at least one commit (git -C \"$TARGET\" rev-parse HEAD succeeds), then retry the install." >&2
74
+ exit 1
75
+ fi
63
76
  METAMASK_RUNNER_DIR="$RUNNER_DIR"
64
77
  METAMASK_RUNNER_SOURCE_KIND="runner-self"
65
78
  METAMASK_RUNNER_REVISION="$(git -C "$RUNNER_DIR" rev-parse HEAD 2>/dev/null || echo unknown)"
@@ -272,10 +285,11 @@ if [ "$FORCE_OVERLAY" = false ] && has_product_owned_mobile_harness; then
272
285
  fi
273
286
  node -e '
274
287
  const fs = require("fs");
275
- const [runnerOwnerDir, runnerOwnerRevision, runnerDir, runnerRevision, runnerSourceKind, adapterRuntime, target, scriptDir, manifestPath, harnessRoot, harnessRel, cleanupCommand] = process.argv.slice(1);
288
+ const [runnerOwnerDir, runnerOwnerRevision, runnerDir, runnerRevision, runnerSourceKind, adapterRuntime, target, scriptDir, manifestPath, harnessRoot, harnessRel, cleanupCommand, targetRevision] = process.argv.slice(1);
276
289
  const m = {
277
290
  adapter: "mobile",
278
291
  installMode: "product-owned",
292
+ targetRevision,
279
293
  installedAt: new Date().toISOString(),
280
294
  source: {
281
295
  runnerOwnerDir,
@@ -308,7 +322,7 @@ if [ "$FORCE_OVERLAY" = false ] && has_product_owned_mobile_harness; then
308
322
  note: "This checkout already contains the Mobile in-app bridge. Runner install only writes recipe-harness metadata and must not overwrite tracked in-app bridge files."
309
323
  };
310
324
  fs.writeFileSync(manifestPath, JSON.stringify(m, null, 2) + "\n");
311
- ' "$RUNNER_DIR" "$SOURCE_REV" "$METAMASK_RUNNER_DIR" "$METAMASK_RUNNER_REVISION" "$METAMASK_RUNNER_SOURCE_KIND" "$ADAPTER_DIR" "$TARGET" "$SCRIPT_DIR" "$HARNESS_DIR/manifest.json" "$HARNESS_ROOT" "$HARNESS_REL" "$CLEANUP_COMMAND"
325
+ ' "$RUNNER_DIR" "$SOURCE_REV" "$METAMASK_RUNNER_DIR" "$METAMASK_RUNNER_REVISION" "$METAMASK_RUNNER_SOURCE_KIND" "$ADAPTER_DIR" "$TARGET" "$SCRIPT_DIR" "$HARNESS_DIR/manifest.json" "$HARNESS_ROOT" "$HARNESS_REL" "$CLEANUP_COMMAND" "$TARGET_REV"
312
326
  echo "Installed mobile recipe harness metadata only (in-app bridge detected): $HARNESS_DIR/manifest.json"
313
327
  exit 0
314
328
  fi
@@ -637,9 +651,11 @@ SOURCE_REV="$(git -C "$RUNNER_DIR" rev-parse HEAD 2>/dev/null || echo unknown)"
637
651
  CLEANUP_COMMAND="RECIPE_HARNESS_ROOT=$HARNESS_ROOT $(printf '%q' "$CLEANUP_SH") --target $(printf '%q' "$TARGET")"
638
652
  node -e '
639
653
  const fs = require("fs");
640
- const [runnerOwnerDir, runnerOwnerRevision, runnerDir, runnerRevision, runnerSourceKind, adapterRuntime, target, backupDir, scriptDir, manifestPath, mobileAgenticSource, harnessRoot, harnessRel, cleanupCommand] = process.argv.slice(1);
654
+ const [runnerOwnerDir, runnerOwnerRevision, runnerDir, runnerRevision, runnerSourceKind, adapterRuntime, target, backupDir, scriptDir, manifestPath, mobileAgenticSource, harnessRoot, harnessRel, cleanupCommand, targetRevision] = process.argv.slice(1);
641
655
  const m = {
642
656
  adapter: "mobile",
657
+ installMode: "overlay",
658
+ targetRevision,
643
659
  installedAt: new Date().toISOString(),
644
660
  source: {
645
661
  runnerOwnerDir,
@@ -669,7 +685,7 @@ node -e '
669
685
  ]
670
686
  };
671
687
  fs.writeFileSync(manifestPath, JSON.stringify(m, null, 2) + "\n");
672
- ' "$RUNNER_DIR" "$SOURCE_REV" "$METAMASK_RUNNER_DIR" "$METAMASK_RUNNER_REVISION" "$METAMASK_RUNNER_SOURCE_KIND" "$ADAPTER_DIR" "$TARGET" "$BACKUP_DIR" "$SCRIPT_DIR" "$HARNESS_DIR/manifest.json" "${MOBILE_AGENTIC_SOURCE:-}" "$HARNESS_ROOT" "$HARNESS_REL" "$CLEANUP_COMMAND"
688
+ ' "$RUNNER_DIR" "$SOURCE_REV" "$METAMASK_RUNNER_DIR" "$METAMASK_RUNNER_REVISION" "$METAMASK_RUNNER_SOURCE_KIND" "$ADAPTER_DIR" "$TARGET" "$BACKUP_DIR" "$SCRIPT_DIR" "$HARNESS_DIR/manifest.json" "${MOBILE_AGENTIC_SOURCE:-}" "$HARNESS_ROOT" "$HARNESS_REL" "$CLEANUP_COMMAND" "$TARGET_REV"
673
689
 
674
690
  ENSURE_DEPS="$SCRIPT_DIR/../shared/ensure-runner-deps.sh"
675
691
  if [ -f "$ENSURE_DEPS" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeeed/metamask-harness",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mm-harness": "bin/mm-harness"