Skip to content

feat(native): sync HTML page themes and reader actions - #176

Merged
rynfar merged 4 commits into
nativefrom
nw/87-html-frames-2
Nov 3, 2026
Merged

rynfar merged 4 commits into
nativefrom
nw/87-html-frames-2

Conversation

@rynfar

@rynfar rynfar commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Continues #87 after #91. HTML attachments previously kept the default page colours/fonts, trapped app shortcuts, and opened links without respecting the native destination preference.

Inline and full-screen pages now receive live named-theme colours (converted to sRGB like web), reader font stacks and keybindings without reloading. The shortcut bridge uses web's view-command allowlist and rejects mutating/conflicting bindings and forged named-key/code pairs. Settings exposes the browser destination and PR-link off switch for HTML pages, with web defaults.

The rendered transcript supplies the page's scoped owner, including side chats. A pure core boundary requires a surviving owning view with the same current environment/thread, current active environment, WebKit focus, and recent native user activation before accepting link/shortcut bridge actions. Size notifications stay focus-independent, as on web. Browser tabs use that owner's thread. PR/MR links resolve against readable projects in the link's environment: repository match first, then allowed host lending, with config-loaded, authority/port, Forgejo mount and Azure constraints. Unresolvable links fall through to the browser preference. Context chips reuse the resolver. Forgejo projects without a resolved browser URL use the HTTP remote authority, including its port, for repository matching and host lending; a default-port link cannot borrow a project on another port. With a resolved browser URL, repository matching still checks clone authority, while host lending follows only the browser URL authority and mount, as web does.

HTML now has sandbox allow-scripts allow-forms, matching web. Both native new-window callbacks suppress HTML popup events, and the core boundary rejects any raw navigation event still delivered to either HTML frame mode. The exact-document main-frame lock and page-only IPC remain intact.

Routing exceptions and remaining gaps:

  • MCP keeps its existing native popup/raw-navigation behavior through an explicit per-page policy. Web MCP frames also forbid popups; that native/web difference is left with native: MCP app frames and host bridge (TR-MCPAPP) #98.
  • Resolved PRs use native's standalone PR page; per-thread PR tabs remain a gap. Context-chip fallback still uses the system browser. The native fallback card's explicit “Open in browser” remains an asset-open action outside the page bridge. View shortcuts remain workspace commands.
  • Page image viewer, downloads, remote iframe parity/verification and commit-link diff previews remain unshipped. Native model-picker jump actions, Cmd+C ownership, inline inner scrolling, hover-positioned fullscreen control, timeline follow pin and automatic fullscreen close on thread changes also remain gaps. TR-HTML stays partial.

Validation:

  • Failing-first core cases for owner selection, stale/unfocused/inactive rejection, raw navigation rejection, controller selection, project matching/config loading and browser fallback. The CSP response test first failed with the old popup-enabled policy, then passed for strict HTML and unchanged native MCP responses (including 404s).
  • cargo test --workspace: 1,220 passed. The existing provider/port case also covers default-port rejection and matching-port success without Forgejo webUrl, plus clone-port/browser-URL differences: repository matching rejects the mismatch while host lending succeeds only under the resolved web mount. Both regressions failed before their fixes.
  • cargo clippy --workspace --all-targets -- -D warnings; snapshot build; theme generator, parity sync and client-runtime conformance generation checks passed.
  • Commit hooks check format/lint. Root check:changed expands native Rust files to repo-wide work and was stopped; the required native gates were used.

Evidence is local per factory instructions. GPUI's offscreen renderer shows the fallback card; companion hidden WebKit renders the page using the production document-start script and strict sandboxed response:

  • Before: /private/tmp/native-87-evidence/before-dark-page.png, /private/tmp/native-87-evidence/before-light-page.png, /private/tmp/native-87-evidence/before-browser-settings.png.
  • Current Ocean dark/light: /private/tmp/native-87-evidence/review-dark.png, /private/tmp/native-87-evidence/review-dark.html.png, /private/tmp/native-87-evidence/review-light.png, /private/tmp/native-87-evidence/review-light.html.png.
  • Current live theme/font update on the same loaded page: /private/tmp/native-87-evidence/review-live-update.png, /private/tmp/native-87-evidence/review-live-update.png.json (computed styles and retained mounted marker).
  • Settings controls/off switch: /private/tmp/native-87-evidence/after-browser-settings.png, /private/tmp/native-87-evidence/after-pr-link-settings.png, /private/tmp/native-87-evidence/after-pr-links-disabled.png.
  • Current gate logs: /private/tmp/native-87-evidence/forgejo-web-lending-tests.log, /private/tmp/native-87-evidence/forgejo-web-lending-clippy.log, /private/tmp/native-87-evidence/forgejo-web-lending-build.log; focused red/green logs: /private/tmp/native-87-evidence/forgejo-web-lending-red.log, /private/tmp/native-87-evidence/forgejo-web-lending-green.log.

Unverified: trusted WebKit clicks, typing, shortcut delivery, actual browser/PR opens, wheel handoff and menus over a page. Synthetic WebKit input is dropped; routing is proved in core, not by fabricated runtime input. No real window, paid turn, download, clipboard use, new server or live-home write was used.

Surface check: native HTML and its local settings only; web is the reference. No server, contracts, provider adapters or agent-facing text changed. Existing attachment I/O remains environment-scoped for local/remote connections.

Built with GPT-6.1 Sol in Codex

@rynfar
rynfar force-pushed the nw/87-html-frames-2 branch from 5e64685 to 3013be6 Compare November 3, 2026 21:04
@rynfar
rynfar merged commit 1e319fd into native Nov 3, 2026
@rynfar rynfar mentioned this pull request Nov 3, 2026
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.

1 participant