Road to 10 — Wave 2 · PR-T2

# sync_versions round-trip test

14 assertions · bash · locks in #1407 behavior

## What it locks

Lane 2 #1407 added a function to `scripts/stamp-counts.sh` that reads `package.json` and propagates the version to 6 sibling files. No test existed for it. If someone later refactors and breaks the propagation, the next release would silently drift across files (exactly the bug Lane 2 was designed to prevent).

## Round-trip flow

### 1 — Pre-flight

- Capture all 7 file versions
- Refuse to run if any mismatch
- Arm EXIT trap to restore

→

### 2 — Bump + sync

- pkg.json → 999.888.777
- Run stamp-counts.sh
- Assert all 6 siblings match

→

### 3 — Restore

- pkg.json → original
- Run stamp-counts.sh again
- Assert all restored
- validate-counts agrees

## Local run output

    ▶ Test 1: sync propagates a bump
      ✓ pyproject synced to 999.888.777
      ✓ manifest synced to 999.888.777
      ✓ market-top synced to 999.888.777
      ✓ market-plugin synced to 999.888.777
      ✓ release-please synced to 999.888.777
      ✓ CLAUDE synced to 999.888.777

    ▶ Test 2: sync propagates the restoration back
      ✓ pyproject restored to 7.56.0
      ✓ manifest restored to 7.56.0
      ...

    ▶ Test 3: validate-counts.sh accepts the final state
      ✓ validate-counts passes after round-trip

    ════════════════════════════════════════════════════════════════
      Total: 14  |  Passed: 14  |  Failed: 0
    ════════════════════════════════════════════════════════════════

## Safety

- Trap on EXIT + INT + TERM restores the original version regardless of how the test exits (including Ctrl-C). No wedged states.
- Pre-flight guard aborts if any file is already mismatched — the test refuses to run on a dirty baseline.
- Wired into `tests/run-all-tests.sh` under UNIT TESTS, so `npm test` runs it.