test(metaharness): pin versions consistent across 3 package.json files (iter 111)

iter-110 gated each pin's TILDE PREFIX. iter-111 gates the VERSION
ALIGNMENT across the 3 package.json files:
   - package.json (root, dev install)
   - ruflo/package.json (npm i ruflo)
   - v3/@claude-flow/cli/package.json (npm i @claude-flow/cli)

Drift scenario:
   - Someone updates ruflo/package.json to `metaharness: ~0.2.0`
   - Forgets to update the other 2
   - User installing ruflo gets metaharness 0.2.x
   - CI tests against root's `~0.1.11` (still 0.1.x)
   - Production behavior diverges from CI behavior — invisible until
     production hits a metaharness 0.2.x-only bug

iter-111 enforces the pins match across all 3.

WHAT SHIPPED — smoke step 17z74

For each of metaharness, @metaharness/router, @metaharness/kernel:
   - Read the optionalDependencies entry from all 3 package.json files
   - Assert exactly 1 unique pin string (or 0, if package absent from all 3)
   - Failure form: `metaharness-pin-drift:root=~0.1.11,ruflo=~0.2.0,cli=~0.1.11`

The failure message NAMES all 3 versions so the fixer immediately
sees which file is the outlier.

CROSS-REFERENCE INTEGRITY MATRIX (post-iter-111)

| Direction                | Surface                       | Iter |
|--------------------------|-------------------------------|------|
| Source → Target (10 forward)                                   |
| Target → Source (1 reverse)                                    |
| Internal consistency (4)                                       |
| ADR-150 invariants (2, iters 110 + 111)                        |
|   package.json pins      | tilde prefix                  | 110  |
|   pin versions           | consistent across 3 files     | 111  |  ◀ this iter

17 smoke-gated surfaces.

GATES THIS ITER
   smoke:    113 → 114 (step 17z74 green)
   contract: 3 metaharness packages × cross-file pin alignment verified

PIN-POLICY ARC (iters 110 + 111)

   110 — pin SHAPE: must start with ~
   111 — pin VALUE: must match across 3 package.json files

Together they encode the policy: "every metaharness pin uses tilde,
and the same tilde-pin appears wherever the package is referenced."
A drift in either shape OR value surfaces as a specific named smoke
failure.

Co-Authored-By: RuFlo <ruv@ruv.net>
This commit is contained in:
ruv committed 2026-06-17 01:27:52 -04:00
1 parent c1bc0c7408
commit 82c8bacbc6
1 file changed
+28
@@ -191,6 +191,34 @@ grep -q "execCli(\[\s*'-y'\s*,\s*'metaharness@latest'" "$F" 2>/dev/null || \
grep -q "cwd: opts" "$F" || miss="$miss no-cwd-passthrough"
[[ -z "$miss" ]] && ok || bad "$miss"
step "17z74. metaharness pin versions consistent across all 3 package.json (iter 111)"
miss=""
# Each of the 3 package.json files pins metaharness/@metaharness/*
# independently. If they drift, behavior varies by install path:
# - `npm install ruflo` → uses ruflo/package.json
# - `npm install @claude-flow/cli` → uses cli/package.json
# - Repo-clone dev install → uses root package.json
# Pin drift between them means CI tests one version while users get
# another. iter-111 enforces matching pin strings across all three.
ROOTPJ="$ROOT/../../package.json"
RUFLOPJ="$ROOT/../../ruflo/package.json"
CLIPJ="$ROOT/../../v3/@claude-flow/cli/package.json"
for pkg in "metaharness" "@metaharness/router" "@metaharness/kernel"; do
ROOT_PIN=$(node -e "console.log(JSON.parse(require('fs').readFileSync('$ROOTPJ')).optionalDependencies?.['$pkg'] || '')" 2>/dev/null)
RUFLO_PIN=$(node -e "console.log(JSON.parse(require('fs').readFileSync('$RUFLOPJ')).optionalDependencies?.['$pkg'] || '')" 2>/dev/null)
CLI_PIN=$(node -e "console.log(JSON.parse(require('fs').readFileSync('$CLIPJ')).optionalDependencies?.['$pkg'] || '')" 2>/dev/null)
# Skip if package not in any of the 3 (some files only list a subset)
if [[ -z "$ROOT_PIN" && -z "$RUFLO_PIN" && -z "$CLI_PIN" ]]; then
continue
fi
# Compare non-empty pins — they must all match.
PINS=$(echo "$ROOT_PIN $RUFLO_PIN $CLI_PIN" | tr ' ' '\n' | grep -v '^$' | sort -u | wc -l | tr -d ' ')
if [[ "$PINS" != "1" ]]; then
miss="$miss ${pkg}-pin-drift:root=${ROOT_PIN},ruflo=${RUFLO_PIN},cli=${CLI_PIN}"
fi
done
[[ -z "$miss" ]] && ok || bad "$miss"
step "17z73. metaharness packages tilde-pinned (anti-caret regression, iter 110)"
miss=""
# ADR-150 architectural-constraint review-round-1 mandated tilde pinning