Repository navigation
Close the manual's window on Back to game in the installed app - #2349
Conversation
Since 4.5.0 the manual lives on help.verticopolis.com, outside the app's scope, so the installed app opens it in a browser view over itself. Back to game there still ran the in-app rule: ask the game over a same-origin BroadcastChannel, hear nothing from the other host, and load the game in place, which put a second copy of the game inside the manual's view. When the game's address is on another host than the page, the button now closes the page (saying so if the browser refuses) without asking, which brings back the app and its running game. Same-host pages keep the old rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ms7trYsinXUbmcSQZ3d6N7
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
maniator
left a comment
There was a problem hiding this comment.
Stand-in review (Copilot, Codex and PR-Agent are down): GO at 23a7a3f
Ran stand-in-pr-review with /bmad-code-review (Blind Hunter, Edge Case Hunter, Acceptance Auditor, one lean pass) on head 23a7a3f235e600decef2075f5e5e6a698538d38d. No patch and no defer findings, so nothing goes to the backlog.
What I checked
- Every Back to game on the manual's host goes cross-host. The menu bar's game item, the title bar's game button and the front page's Play button all take
siteHref("/"), which ishttps://verticopolis.com/in a production build (checked withVC_HELP_ORIGINset) and/otherwise. The help host's shared 404 page usesGAME_HOME, also absolute in production. Each listener is on the anchor itself, soe.currentTarget.hrefis the game's address and never the"/"fallback. - #2316's same-origin rule still holds. Previews and staging keep
/help(siteHref("/")is/), the game host's own pages (How to Play, release notes, the game's 404) link/orhttps://verticopolis.com/on the same origin, so they still ask overvc-game-presenceand load the game in place when nothing answers. The two existing installed-app tests still run that path and pass. - Fallback when
window.close()is refused. The cross-host branch goes through the samecloseOrSayas a browser tab: after 250 ms, if the view is still open, it fills#back-note(present on every help page viaHeader.astro) and moves focus there. The player then taps the view's own close button and lands on the running game. No second copy of the game starts on any path, which is the important part: two copies could both autosave the same tower. - Tests.
fromGame,helpSiteMenuandnotFoundPagesuites pass locally (42). WithfromGame.tsreverted tomain, the new test fails (stillOpencalled,closenot called), so it guards the fix. - Change note, history, version.
app: patch,crate: none, one Player line; no version edited. One commit with a clear message, based on currentmain(2b991a4). No em-dashes. "Back to Game" in the note matches the menu item's label. - Hot path. No section 1 surface: one URL comparison on a button click on a help page.
Optional (not required for GO)
- When the close is refused inside the app's browser view, the note says "Your tower is still open in its own tab. Close this tab to get back to it." It is accurate enough, since the view has a close button, but "window" would read better there than "tab". Fine to leave.
- This path only runs on production, because previews and staging keep the manual under
/help. Once 4.5.2 is live, one tap of Back to game in the installed app on a phone confirms whether Chrome's view honorswindow.close()or shows the note. - Design note, no change asked: if a manual page on the other host ever loaded in the app's own window, closing would end the app rather than reload the game. The tower is saved when the page goes away, so nothing is lost, and that beats starting a second game. Today the game opens every manual link with
window.openortarget="_blank", so this does not arise.
Verdict: GO at 23a7a3f, on the condition that the required checks finish green (e2e, test and the screenshot shards were still running when I reviewed).
Reviewed against Verticopolis conventions (.github/copilot-instructions.md).
Generated by Claude Code
📸 Screenshot drift checkNo drift: the committed screenshots already match a fresh deterministic generation. ✅ |
Requested by Naftali · project thread
What & why
Production bug on 4.5.1, reported by Naftali: in the installed app, Back to game in the Player's Manual opens the game inside the manual's popped-out window instead of returning to the app.
Since 4.5.0 (#2339) the manual is on help.verticopolis.com, outside the app's scope, so the app opens it in a browser view over itself.
backToOpenGame(src/ui/fromGame.ts) still ran the in-app rule from #2316. It asked the game over the same-originvc-game-presenceBroadcastChannel, heard nothing from the other host, and calledlocation.replace("https://verticopolis.com/"). That loaded a second copy of the game inside the manual's view.Now, when the game's address (the link's href) is on another origin than the page, Back to game closes the page without asking. If the browser keeps it open, it shows the existing "close this tab" note. Closing the view brings back the app with its running game. Same-host pages keep #2316's rule: a
/helpbuild on previews and staging, and the game's own 404 page.Type of change
Game mode impact
n/a: the manual's Back to game button only.
Quality gates
npm run typechecknpm run lintnpm test(CI.fromGame,helpSiteMenuandnotFoundPagesuites pass locally, 42 tests, including a new one for a manual on another host.)npm run build(CI)Versioning
.changesnote with the rightapp:andcrate:levels, or this PR changes no deployed pathpackages/verticopolis-engine/README.mdand/orengine-rs/CRATE_README.md, or read both and putreadmes: unchangedin the note, or this PR changes no engine sourceComplexity
n/a: no hot path. One URL comparison on a button click.
Hot-path record (section 6): no hot-path surface
Screenshots / recordings
n/a: no visual change. Naftali's report is in the project thread.
Notes for reviewers
help_menu_pickgame.window.close(). If it doesn't, the player sees the note and taps the view's close button, which still returns to the running game rather than opening a second one.Generated by Claude Code