Bus: 'JarvisBusWorld' documentation drift across 20+ docstrings post fb41c5f rename to WKContentWorld.page #45

Closed
opened 2026-05-12 19:08:33 +00:00 by KofTwentyTwo · 0 comments
KofTwentyTwo commented 2026-05-12 19:08:33 +00:00 (Migrated from github.com)

Summary

Commit fb41c5f unified the WKWebView bridge on WKContentWorld.page, but the codebase still describes the prior topology in 20+ docstrings and one variable comment. Not a runtime bug — but exactly the stale-doc trap that produces the next outage: a future agent reads bridge.ts:60 and "fixes" the duck-type-guard branch because the rationale no longer applies, deleting load-bearing protection.

Evidence

  • WebviewBridge.swift:10: "Install a WKScriptMessageHandlerWithReply in an isolated content world (JarvisBusWorld)..." — no longer true; page scripts CAN observe (shared world)
  • Injection.js:1: "Injected at document-start in WKContentWorld('JarvisBusWorld')." — wrong
  • bridge.ts:60-99: "WKContentWorld attach-to-existing path (H-02)" — the duck-type isJarvisBusShape check is still load-bearing (prevents bundle's installJarvisBus from clobbering Injection.js's stub), but the reason documented is now obsolete
  • main.tsx:9-15: comments still describing cross-world attach
  • AppDelegate.swift:484: same drift
  • webview/packages/bus/dist/bridge.{js,d.ts} — shipped build artifact with stale comments

Recommended fix

Rename "JarvisBusWorld" → "page" / "shared world" in all comments. Rewrite the bridge.ts:60-99 rationale to reflect that the duck-type guard is now defensive against double-install (Injection.js + bundle both running installJarvisBus-like logic in same world), not cross-world attach. Bump the bus package patch version.

Test

  • Grep gate scripts/check-no-jarvis-bus-world-references.sh: assert no comment matches JarvisBusWorld outside historical commit-message refs

Source

  • Audit: .planning/audit-2026-05-12/bus-hud-audit.md (2026-05-12) — finding S2 (Documentation drift)
## Summary Commit `fb41c5f` unified the WKWebView bridge on `WKContentWorld.page`, but the codebase still describes the prior topology in 20+ docstrings and one variable comment. Not a runtime bug — but exactly the stale-doc trap that produces the next outage: a future agent reads `bridge.ts:60` and "fixes" the duck-type-guard branch because the rationale no longer applies, deleting load-bearing protection. ## Evidence - `WebviewBridge.swift:10`: "Install a `WKScriptMessageHandlerWithReply` in an isolated content world (`JarvisBusWorld`)..." — no longer true; page scripts CAN observe (shared world) - `Injection.js:1`: "Injected at document-start in WKContentWorld('JarvisBusWorld')." — wrong - `bridge.ts:60-99`: "WKContentWorld attach-to-existing path (H-02)" — the duck-type `isJarvisBusShape` check is still load-bearing (prevents bundle's `installJarvisBus` from clobbering Injection.js's stub), but the *reason* documented is now obsolete - `main.tsx:9-15`: comments still describing cross-world attach - `AppDelegate.swift:484`: same drift - `webview/packages/bus/dist/bridge.{js,d.ts}` — shipped build artifact with stale comments ## Recommended fix Rename "JarvisBusWorld" → "page" / "shared world" in all comments. Rewrite the `bridge.ts:60-99` rationale to reflect that the duck-type guard is now defensive against double-install (Injection.js + bundle both running `installJarvisBus`-like logic in same world), not cross-world attach. Bump the bus package patch version. ## Test - Grep gate `scripts/check-no-jarvis-bus-world-references.sh`: assert no comment matches `JarvisBusWorld` outside historical commit-message refs ## Source - Audit: `.planning/audit-2026-05-12/bus-hud-audit.md` (2026-05-12) — finding S2 (Documentation drift)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KofTwentyTwo/Jarvis#45