Skip to content

feat(shell): replay link in the config pane (#126) - #150

Merged
mparrett merged 4 commits into
mainfrom
feat/help-dev-replay
Jul 23, 2026
Merged

mparrett merged 4 commits into
mainfrom
feat/help-dev-replay

Conversation

@mparrett

@mparrett mparrett commented Jul 9, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #126. Reframed from the earlier help-screen shape — #137's config pane is the natural surface now, so this stacks on #137.

The gap (#126)

?dump-replay= fires (js/emit "xsofy/replay-dump" {:code …}) on death, but nothing web-side listened: the code never surfaced on the primary (mobile) test surface. Native capture (XSOFY_DUMP_REPLAY → stderr) already works and is unchanged.

This change

  • Game: every web run captures live — a bridge emit every 10th turn (and on turn 1, so the chip is current from a run's first action), plus the death capture firing unconditionally on web for the exact final state. Death isn't special: encode-run-safe works on any live world. Native stays opt-in (XSOFY_DUMP_REPLAY / ?dump-replay=).
  • Shell: the emit becomes a chip in the ⚙ config pane — a ?replay= link that reproduces the run in one tap (long-press for the OS copy/share sheet), carrying the session params (mode etc.; seed dropped — the code brings its own). Emits already arrive as window CustomEvents, so there's no new host plumbing. Unavailable codes (parameterized-action runs) keep the chip hidden rather than rendering a dead link, and the chip resets on every new run so it can never link a stale one. Not tier-gated: sharing/reproducing a run is a player feature.

vs the earlier shape

The previous draft rendered a replay-code page inside the game's help screen. The config pane is the better surface: no game-render involvement, tap-to-reproduce instead of transcribing a code by hand, and the same coverage on the mobile test surface. The help-screen implementation is preserved on a local archive branch if the on-demand mid-run capture turns out to be wanted too.

Verification

  • Full loop in browser emulation against the built bundle: turn-1 emit fires, the chip reveals with the real code, and following the link boots the replay (HUD renders, dev chrome preserved). Chip stays hidden for unavailable codes and in the play tier. Native suite: 284 tests, 0 failures.
  • Known sharp edge (pre-existing, out of scope here): an invalid ?replay= code is a fatal decode error ("nth index out of bounds") — filed as Invalid ?replay= code crashes the boot (fatal decode error) #159.

_Config pane with the chip:

image

https://xsofy.quest/pr-preview/pr-150/?replay=AQAAAAAilCqbAwthdXRvZXhwbG9yZQVyaWdodARsZWZ0AAAAAwAUAQQCEA

@mparrett

mparrett commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

@nnunley this is marked draft because I haven't had enough time to think hard about this. I'm not sure if the approach in this PR is the best way.

@nnunley

nnunley commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

As a thought: you can include the current replay link in the browser window using our js bridge.

@mparrett

Copy link
Copy Markdown
Collaborator Author

As a thought: you can include the current replay link in the browser window using our js bridge.

Yeah, good idea. Probably should. I was thinking along the same lines some days ago, but feeling noncommittal about the UI shell as it existed. I thought at the very least, console.log it. I'll think a little more - if not in this PR, I'd land it in/after the one that introduces web UI.

@mparrett mparrett added the deploy-preview Publish a gh-pages WASM preview for this PR label Jul 12, 2026
@github-actions

github-actions Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-23 21:58 UTC

@mparrett

Copy link
Copy Markdown
Collaborator Author

Consider using xterm web-links addon / OSC 8:

https://xtermjs.org/docs/guides/link-handling/

@mparrett
mparrett force-pushed the feat/help-dev-replay branch from 0111520 to dbfcac8 Compare July 13, 2026 23:46
@mparrett mparrett changed the title Dev: replay-code page on the help screen (#126) feat(shell): replay link in the config pane (#126) Jul 13, 2026
@mparrett
mparrett changed the base branch from main to mobile/landscape July 13, 2026 23:46
@mparrett mparrett added deploy-preview Publish a gh-pages WASM preview for this PR review-priority/medium Review after bases land / once rebased and removed deploy-preview Publish a gh-pages WASM preview for this PR labels Jul 14, 2026
@mparrett
mparrett marked this pull request as ready for review July 14, 2026 04:52
mparrett and others added 4 commits July 19, 2026 07:22
Dev-build deaths (?mode=dev) now fire the existing xsofy/replay-dump
capture unconditionally — no ?dump-replay= param needed — and the shell
turns the emit into a chip in the ⚙ config pane: a ?replay= link that
reproduces the run (long-press for the OS copy/share sheet). Emits
already arrive as window CustomEvents, so no new host plumbing.
Unavailable codes (parameterized-action runs) stay hidden rather than
rendering a dead link; the chip is dev-only and invisible until a
capture lands. Native XSOFY_DUMP_REPLAY stderr capture is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…session context

Death isn't special: encode-run-safe works on any live world, so a
dev-gated bridge emit (every 10th turn, and turn 1 so the chip is live
from a run's first action) keeps the config-pane chip current without
dying first. Same :replay-dump channel as the death capture; native
stays a js/emit no-op.

The link also carries the session params now (mode/dpad/…, seed dropped —
the code brings its own): the bare ?replay= URL landed in a chrome-less
play tier that read as a dead click.

Verified end-to-end in emulation: turn-1 emit, chip with a real code,
link boots the replay with HUD + dev chrome. Note: an INVALID ?replay=
code is a fatal decode error (nth out of bounds) — pre-existing, worth
its own issue for a graceful fallback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The live capture and the death capture now fire on every web run (native
stays opt-in via XSOFY_DUMP_REPLAY / ?dump-replay=), and the config-pane
chip loses its dev-only class: sharing/reproducing a run is a player
feature. The chip also resets on every new run (xsofy/startup), fixing
the stale-link window where it kept the previous run's code and a tap
read as doing nothing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The :replay-dump payload carries :turn (live and death emits); the chip
labels itself 't42' instead of a truncated code prefix — the turn tells a
human how fresh the capture is, the code prefix told them nothing.
Falls back to the code snippet if an emit lacks :turn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mparrett
mparrett force-pushed the feat/help-dev-replay branch from 7f36628 to 6f51265 Compare July 19, 2026 14:22
@mparrett
mparrett changed the base branch from mobile/landscape to main July 19, 2026 14:22
@mparrett mparrett closed this Jul 19, 2026
@mparrett mparrett reopened this Jul 19, 2026
@nnunley

nnunley commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

So... Probably actually need a flash warning until you get your partial redraws code in.

@mparrett

Copy link
Copy Markdown
Collaborator Author

So... Probably actually need a flash warning until you get your partial redraws code in.

This is ready to go: #151

@mparrett mparrett added deploy-preview Publish a gh-pages WASM preview for this PR and removed deploy-preview Publish a gh-pages WASM preview for this PR labels Jul 21, 2026
@mparrett

Copy link
Copy Markdown
Collaborator Author

151 was merged, this is now unblocked.

@mparrett

mparrett commented Jul 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Probably actually need a flash warning until you get your partial redraws code in.

@nnunley I want to make sure I didn't miss your intent here. I assumed you were referring to the strobing replay, which was fixed by the (now merged) redraw improvements. Let me know if there was anything else. I'm taking the OSC-8 terminal link as a follow-on, since it'll require a little more thought about where (and when) we want that link to appear in the terminal. I also need to catch myself up on the state of any relevant issues. This PR, for the web replay link, is good to go.

@mparrett
mparrett merged commit 9f7f338 into main Jul 23, 2026
11 of 12 checks passed
@mparrett
mparrett deleted the feat/help-dev-replay branch July 23, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy-preview Publish a gh-pages WASM preview for this PR review-priority/medium Review after bases land / once rebased

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev: wire onEmit in the shell so ?dump-replay= surfaces the replay code on web

2 participants