The WKUserScript at packages/Bus/Sources/Bus/Resources/Injection.js
installs window.jarvisBus at document-start with a hardcoded
`protocolVersion` placeholder. Because the full TS bundle's installer
shape-checks window.jarvisBus and skip-replaces when send/receive/
onOutbound already exist (Vy() in the minified output), the placeholder
IS the version reported in helloAck at runtime. The placeholder had been
stale at 2.0.0 since the first protocol bump (2.0.0 → 2.1.0 → 2.2.0 →
2.3.0), surfacing as runtime 'HUD bundle was built against bus protocol
v2.0.0; the app expects v2.3.0' hard-fails after Phase 9's Plan 04
re-bumped the protocol.
Fix:
- Bump Injection.js's protocolVersion literal to '2.3.0'.
- Extend scripts/check-bus-protocol-version.sh to assert three-way
parity (Swift Protocol.swift ↔ TS protocol.ts ↔ Injection.js) so
this drift can never recur silently.
Verified: bus parity OK at v2.3.0; check-app-builds green; runtime
launch with PID 32607.
Three build-breaking check scripts + two smoke test harnesses + two fixture dirs:
- scripts/check-bus-protocol-version.sh: greps Swift vs TS BUS_PROTOCOL_VERSION
constants, diffs the two fixture directories (packages/Bus/Tests/BusTests/
Fixtures/ vs webview/packages/bus/fixtures/). Fails build on any drift.
- scripts/check-no-evaluate-javascript.sh: scans App/ + packages/ for
`.evaluateJavaScript(` outside test dirs; HUD-04 architectural lint.
- scripts/check-bus-harness-parity.sh: byte-identical check between
canonical webview/bus-harness.html and bundle copy (Plan 02-03 provides
the bundle copy; this script enforces no-drift going forward).
- scripts/test-check-bus-protocol-version.sh + bus-mismatch/ fixture:
drives the protocol-version checker against a v2.0.0/v1.9.0 mismatch,
asserts exit 1 + both versions in error text.
- scripts/test-check-no-evaluate-javascript.sh + bus-evaluate-js/ fixture:
drives HUD-04 lint against bad.swift (evaluateJavaScript) + good.swift
(callAsyncJavaScript). Asserts bad.swift flagged, good.swift not flagged.
Fixture is copied to a temp dir to bypass the production */test-fixtures/*
path-skip rule.
[Rule 3 - Blocking] Normalized Swift-side fixtures to drop trailing newlines.
The 14 JSON files under packages/Bus/Tests/BusTests/Fixtures/ had stray
trailing \n while the TS mirror at webview/packages/bus/fixtures/ did not.
Plan 02-02's SUMMARY documented the no-trailing-newline convention (matches
Swift JSONEncoder default) but Plan 02-01's fixtures were authored via a
text editor that added them. Stripping \n lets check-bus-protocol-version.sh
pass without relaxing the byte-equality invariant. Swift CodableRoundTripTests
remain green (24/24) because JSONSerialization ignores trailing whitespace.