Skip to content

fix(issue-43): reach iPad Pro with native notifications + in-terminal debug#44

Open
konard wants to merge 3 commits into
mainfrom
issue-43-b91f6f499010
Open

fix(issue-43): reach iPad Pro with native notifications + in-terminal debug#44
konard wants to merge 3 commits into
mainfrom
issue-43-b91f6f499010

Conversation

@konard

@konard konard commented Jun 15, 2026

Copy link
Copy Markdown
Member

Fixes #43.

Summary

The v0.16.0 #39 PR replaced the dead-end iPad-Safari error toast with native VS Code notifications, but the screenshot on issue #43 (taken on a fresh iPad Pro on 2026-06-15) shows the old toast still present — five weeks after #39 shipped. The #39 code was correct; two infrastructure bugs kept the fix from reaching the device.

Root cause 1 — stale service-worker cache (primary)

web/sw.js was cache-first for every path, and CACHE_VERSION was never bumped through #39 / #41 / v0.16.0 / v0.17.0. Every iPad that visited during v0.15.0 pinned the old glue/boot.js forever. The fix:

  • Split caching by mutability — network-first for the app shell (HTML, glue, extensions), cache-first for the huge immutable assets (/vscode-web/, /cheerpx/, /disk/).
  • Bump CACHE_VERSION to v3-…-app2 — the -app{N} epoch forces a one-time eviction of stale caches on every device that activates the new SW.

Root cause 2 — debug surface the user cannot reach (secondary)

Even after the cache is flushed, the silent-shell advisory (#37) still said “run __rustWebBox.dump() in the browser console.” iPadOS Safari has no easy developer console, so the maintainer brief in #43 specifically demands: “all debug info should be output in VS Code terminal.”

  • The watchdog now inlines a multi-line --- rust-web-box diagnostics --- block straight into the terminal — browser tells, isolation flags, vmPhase, shell-loop stats.
  • dumpRuntime() surfaces the silent-shell signals (outputBytes, silentSpawns, slowFirstOutput) so a terminal screenshot triages the bug.
  • New vm.diagnostics bus method returns {dump, terminalText}.
  • New VS Code command WebVM: Show Diagnostics in Terminal opens a throwaway pseudoterminal on demand.
  • web/glue/boot.js's shell-unhealthy notification points at the new command instead of the browser console.

Requirements coverage (verbatim from #43)

# Requirement Where
1 Only notifications inside VS Code itself Re-audited the codebase; no custom HTML widget or user-facing "browser console" string remains.
2 All debug info in the VS Code terminal web/glue/debug.js (formatDiagnosticsForTerminal), web/glue/webvm-server.js (advisory rewrite, vm.diagnostics), web/extensions/webvm-host/extension.js (new command + pty), web/glue/boot.js.
3 Logs + case study under docs/case-studies/issue-43/ README.md, online-research.md, four .json evidence files, screenshot.
4 More debug output / verbose mode dumpRuntime now surfaces the iPad-Safari silent-spawn signals.
5 Upstream reports No new ticket — see the decision and rationale in online-research.md.
6 Apply across the entire codebase Audit grep targets and findings in the case-study README.
7 One PR This one.

Files touched

changelog.d/20260615_141500_issue_43_terminal_diagnostics_and_sw_cache.md  (new)
docs/case-studies/issue-43/README.md                                       (new)
docs/case-studies/issue-43/online-research.md                              (new)
docs/case-studies/issue-43/issue-43.json                                   (new)
docs/case-studies/issue-43/issue-43-comments.json                          (new)
docs/case-studies/issue-43/issue-screenshot.png                            (new)
docs/case-studies/issue-43/related-prs.json                                (new)
web/sw.js                                                                  (rewritten — split cache strategy)
web/glue/debug.js                                                          (+ formatDiagnosticsForTerminal, + silent-shell signals)
web/glue/webvm-server.js                                                   (+ vm.diagnostics, in-terminal advisory)
web/glue/boot.js                                                           (advisory text)
web/extensions/webvm-host/extension.js                                     (+ showDiagnosticsInTerminal, + command)
web/extensions/webvm-host/package.json                                     (+ command contribution)
web/tests/sw-cache-strategy.test.mjs                                       (new — 13 tests)
web/tests/diagnostics-in-terminal.test.mjs                                 (new — 8 tests)
web/tests/webvm-server.test.mjs                                            (silent-shell advisory assertion updated)

How to reproduce the original bug

  1. On an iPad Pro running iPadOS 17+ Safari, open https://link-foundation.github.io/rust-web-box/ before the Still not working on iPad Pro #43 fix lands.
  2. Wait for the page to settle.
  3. A red toast reading "Could not initialize rust-web-box. Open the browser console for diagnostic info." appears, and the workbench never reaches a usable state.

After this PR, the toast is gone, errors arrive as native VS Code notifications, and WebVM: Show Diagnostics in Terminal prints the diagnostics block on demand.

Test plan

  • node --test web/tests/*.test.mjs293 / 293 passing.
  • web/tests/sw-cache-strategy.test.mjs — 13 tests covering the network-first/cache-first split, COOP/COEP synthesis, range-request bypass, activate-evicts-old-caches, and the -app{N} epoch.
  • web/tests/diagnostics-in-terminal.test.mjs — 8 tests covering the terminal formatter, the vm.diagnostics bus method, the extension command registration, and the boot.js advisory rewrite.
  • Existing web/tests/webvm-server.test.mjs silent-shell test updated to assert the new in-terminal block.
  • cargo clippy --all-targets -- -D warnings clean.
  • Codebase sweep for custom UI / browser console user-facing strings — zero matches outside documentation comments.

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #43
@konard konard self-assigned this Jun 15, 2026
…rminal debug

The v0.16.0 #39 fix replaced the dead-end iPad-Safari error toast with
native VS Code notifications, but iPads kept showing the *old* toast.
Two infrastructure bugs kept the fix from reaching the device:

* The service worker was cache-first for the **app shell** with a
  CACHE_VERSION that was never bumped through #39 / #41. Every iPad
  that visited during v0.15.0 still pinned the old glue/boot.js.
  Switch the shell to network-first, keep cache-first only for the
  immutable assets (/vscode-web/, /cheerpx/, /disk/), and bump
  CACHE_VERSION with an `-app2` epoch so every device evicts the
  stale cache exactly once on activate.

* The silent-shell advisory still said "run __rustWebBox.dump() in
  the browser console" — a dead end on iPadOS Safari, the exact
  device the terminal-silent-hang first surfaces on. Inline the
  diagnostics block straight into the terminal, surface the
  iPad-Safari silent-spawn signals (outputBytes, silentSpawns,
  slowFirstOutput) in dumpRuntime, add a `vm.diagnostics` bus
  method, and contribute a new "WebVM: Show Diagnostics in Terminal"
  command so the user can pull diagnostics on demand from the
  surface they are already looking at.

Audited the whole codebase for surviving custom UI / browser-console
hints — every notification now flows through VS Code's native API,
and no user-facing string mentions a browser console.
@konard konard changed the title [WIP] Still not working on iPad Pro fix(issue-43): reach iPad Pro with native notifications + in-terminal debug Jun 15, 2026
@konard konard marked this pull request as ready for review June 15, 2026 14:16
@konard

konard commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Working session summary

PR #44 is finalized and ready for review: #44

What landed in this PR

Primary fix — stale service-worker cache. web/sw.js now uses network-first for the app shell (HTML, glue, extensions) and cache-first only for the immutable assets (/vscode-web/, /cheerpx/, /disk/); CACHE_VERSION gets an -app2 epoch so every device evicts the stale shell once. That is why iPads kept seeing the old red toast five weeks after the #39 fix shipped — the SW was returning the cached v0.15.0 glue/boot.js.

Secondary fix — debug surface the iPad user can reach. Diagnostics no longer point at the browser console (a dead end on iPadOS Safari). The silent-shell advisory inlines a --- rust-web-box diagnostics --- block straight into the terminal; dumpRuntime() surfaces outputBytes / silentSpawns / slowFirstOutput; a new vm.diagnostics bus method returns {dump, terminalText}; and a new WebVM: Show Diagnostics in Terminal command prints the block on demand.

Evidence + plan. docs/case-studies/issue-43/ carries the case study (timeline, requirements coverage, root-cause analysis), online research, the four evidence JSONs, and the screenshot.

Tests. 293/293 web tests pass — including 13 new SW tests and 8 new diagnostics-in-terminal tests. CI/CD pipeline is green.


This summary was automatically extracted from the AI working session output.

@konard

konard commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $8.952086
  • Calculated by Anthropic: $5.722997
  • Difference: $-3.229089 (-36.07%)

📊 Context and tokens usage:

Claude Opus 4.8: (2 sub-sessions)

  1. 115.6K / 1M (12%) input tokens, 45.9K / 128K (36%) output tokens
  2. 95.7K / 1M (10%) input tokens, 23.8K / 128K (19%) output tokens

Total: (3.9K new + 161.4K cache writes + 3.9M cache reads) input tokens, 38.3K output tokens, $3.945295 cost

Claude Opus 4.7:

  • 115.6K / 1M (12%) input tokens, 38.8K / 128K (30%) output tokens

Total: (90 new + 193.5K cache writes + 5.7M cache reads) input tokens, 38.8K output tokens, $5.006792 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.8 (claude-opus-4-8)
  • Additional models:
    • Claude Opus 4.7 (claude-opus-4-7)

📎 Log file uploaded as Gist (4392KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Still not working on iPad Pro

1 participant