LearnNewsExamplesServices
Frontmatter
id18130
titleA rejected reveal round trip skips the Portal's theme switch entirely
stateClosed
labels
bugai
assigneesneo-opus-ada
createdAtSep 2, 2026, 7:11 PM
updatedAtSep 2, 2026, 8:13 PM
githubUrlhttps://github.com/neomjs/neo/issues/18130
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 2, 2026, 8:13 PM

A rejected reveal round trip skips the Portal's theme switch entirely

neo-opus-ada
neo-opus-ada commented on Sep 2, 2026, 7:11 PM

Context

Found by @neo-opus-grace reviewing PR #18127, which added a second caller of startViewTransition(). She flagged the awaited round trip as a new failure surface; it turned out to be a property of the pattern, present in the Portal since the reveal shipped. #18127 guards its own caller and deliberately did not widen into this one.

Live latest-open sweep: checked the latest 12 open issues at 2026-09-02T17:10Z; no equivalent found. Confirmed at the source rather than assumed: ViewportController.mjs:285-291 has no .catch() on the await.

The Problem

Portal.view.ViewportController#onSwitchTheme awaits a remote method and then applies the theme:

await Neo.main.DomAccess.startViewTransition({...});

me.setTheme(newTheme)

The engine method itself is well behaved — it returns false without the View Transition API, and catches a rejected ready or a throwing registration internally, so it resolves rather than rejects. But Neo.main.DomAccess.startViewTransition called from the App worker is a proxy: it posts a message and returns a promise created worker-side. If that round trip rejects — for any reason the main-thread method never observes — the await throws, setTheme is never reached, and the theme button silently does nothing.

That is strictly worse than the outcome the call exists to improve. The reveal is decorative; losing it should cost an animation, not the feature.

The Architectural Reality

The guard cannot live in the engine, and I checked before proposing it there. DomAccess.startViewTransition runs on the main thread and cannot see a transport failure of the promise the worker is holding — by the time the transport fails there is nothing for the callee to catch. Absorbing it in the remote-method bridge would silently swallow rejections for every remote call, which is far too broad. So the guard belongs at each caller that treats the result as decorative.

caller file:line state
Workstation apps/workstation/view/Workspace.mjs guarded in PR #18127, with a red-first arm
Portal apps/portal/view/ViewportController.mjs:285 unguarded — this ticket

The Fix

Append .catch(() => {}) to the awaited call in onSwitchTheme, and state in a comment why a decorative call must not be able to take the theme change down with it. Mirror #18127's unit arm: a stub that rejects, asserting the theme still flips and nothing throws — the arm must fail without the guard.

Acceptance Criteria

  • AC-1 — a rejected startViewTransition round trip still applies the Portal's theme switch, with no throw.
  • AC-2 — the arm is red without the guard and green with it, and no other arm changes state under that mutation.
  • AC-3 — the existing behaviour is untouched when the call resolves: the reveal still plays and the flip still lands inside the delay window.
  • AC-4 — the comment explains the transport-vs-callee distinction, since the engine method looks infallible from the call site and that appearance is exactly what makes the omission easy.

Out of Scope

  • Any change to DomAccess or the remote-method bridge. Explained above: the callee cannot see this, and a bridge-level catch would swallow rejections for every remote call in the framework.
  • Auditing every other awaited remote call for the same shape. Worth doing as its own sweep with its own evidence; bundling it here would turn a two-line fix into an open-ended audit.

Avoided Traps

  • Pushing the guard into the engine because two callers need it. The "N sites, one idiom" instinct is usually right and is wrong here — the engine is on the far side of the boundary that fails.
  • Fixing this inside PR #18127. The Portal's defect is true whether or not that PR exists, so it is not required for it; folding it in would have made an approved diff grow past its stated scope.

Related

  • PR #18127 / #18125 — the Workstation caller, guarded, where this was found.
  • #17739 / PR #17743 — the engine contract that documents what startViewTransition can and cannot observe.

Origin Session ID: 7596538d-5324-419a-b043-95c585d833ea

Retrieval Hint: startViewTransition remote method proxy transport rejection decorative caller catch portal onSwitchTheme

tobiu referenced in commit ec6856b - "fix(portal): a rejected reveal round trip cannot take the theme switch with it (#18130) (#18133) on Sep 2, 2026, 8:13 PM
tobiu closed this issue on Sep 2, 2026, 8:13 PM