Repository navigation
Description
Context
FastLED migration PR FastLED/cli#242 still directly owns Tauri because its Windows viewer reads the native window scale factor and applies 0.92 / scale only above 1.0 (crates/fastled-cli/src/tauri_viewer.rs:364). Browser devicePixelRatio is not the same contract. Kernel page bootstrap (#195, PR #197) runs before page code but currently has no native scale snapshot. Native creation already has a dispatcher on the off-UI creation thread; the private backend scale getter synchronously routes a message to the event loop.
Proposal
Provide an immutable creation-time native-window scale snapshot in the trusted caller bootstrap context, before the first document executes. Keep backend handles and queries private. Preserve origin/main-frame guards and script-free default routes. FastLED retains Windows-only zoom arithmetic and DOM policy.
Acceptance criteria
- Focused RED test for missing bootstrap scale context, then GREEN for finite positive fractional values and invalid-value fallback.
- Query native scale off the UI thread after creating the window and before scheduling webview creation; no synchronous getter inside its UI closure.
- Context is available before page code on initial load and same-origin reload, never injected into subframes, and supplies no native IPC or mutable host capability.
- Existing Linux bootstrap/isolation/teardown proof remains green; native Windows proof and supported-target checks pass before release.
- FastLED subsequently consumes this context and removes direct viewer implementation dependencies after viewer integration validation.
Decisions
- P2 migration capability: required to preserve existing Windows behavior, not a request to change zoom defaults.
- Expose a frozen lexical kernalWindow.initialScaleFactor value to trusted bootstrap source; reserve and document the binding rather than adding a general native eval or IPC API.
- Snapshot only at creation; moving across monitors later does not update it, matching the current one-time FastLED adjustment.
- Fall back to 1.0 for query failure or non-finite/non-positive scale, matching the existing app query fallback and preventing invalid JS numeric literals.
- No new dependency, runtime, public backend type or default-feature GUI activation.
Related issues
Extends #195 (explicit native page bootstrap).
Activity
feat(webview): expose native scale snapshot in bootstrap (refs #200)
feat: rebase application foundations onto kernal-api (#220)
zackees commentedon Sep 16, 2026
Complete; closing with the evidence.
kernal-api — the native scale snapshot reaches the page bootstrap.
src/tauri.rsreads the window'sscale_factor()and threads it into the origin-scoped bootstrap script (script.for_origin(&request.url, dispatcher.scale_factor().unwrap_or(1.0))), withfor_originguarding a non-finite or non-positive value rather than passing it through. The test isbootstrap_exposes_native_scale_snapshot_before_caller_source(src/tauri.rs:1554), whose name states the ordering guarantee this issue is about: the snapshot is present before caller source runs.🤖 Generated with Claude Code