Skip to content

perf(desktop): unblock packaged frontend startup - #2762

Merged
kev1n77 merged 1 commit into
GCWing:1.0.0-explorefrom
kev1n77:fmy/bugfix
Sep 3, 2026
Merged

perf(desktop): unblock packaged frontend startup#2762
kev1n77 merged 1 commit into
GCWing:1.0.0-explorefrom
kev1n77:fmy/bugfix

Conversation

@kev1n77

@kev1n77 kev1n77 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Generate a deterministic frontend revision manifest after the production Vite build.
  • Serve packaged frontend assets directly during startup instead of hashing and copying the full frontend tree before creating the main window.
  • Materialize the packaged revision in the background after the initial page finishes loading, preserving cross-version rollback support.
  • Repair an unreadable primary workbench state after recovering from its committed backup.
  • Remove stale transactional .copy-<uuid> directories without touching valid revisions, similarly named directories, regular files, or symlinks.
  • Preserve compatibility with older packages that do not contain a frontend revision manifest.

Fixes: N/A (no linked issue).

Type and Areas

Type:

  • Performance improvement
  • Regression fix
  • Test

Areas:

  • Desktop/Tauri
  • Web build and release packaging
  • Frontend workbench persistence and recovery

Motivation / Impact

Release builds previously walked, hashed, and copied the complete packaged frontend before creating the main window. The current frontend contains 982 files and approximately 75.95 MB of assets, making cold startup noticeably slow.

The packaged frontend now has a build-time content identity, allowing the desktop runtime to initialize from a small manifest and immediately serve packaged assets. The full rollback copy happens after the window loads.

Measured in an isolated release-fast launch:

  • Frontend workbench initialization: approximately 3 ms
  • Main window shown: approximately 1.31 seconds
  • Initial page load finished: approximately 1.94 seconds
  • Full packaged revision caching completes in the background

The change also ensures that backup-based state recovery repairs the primary state file and that interrupted background copies do not accumulate indefinitely.

Verification

  • pnpm run fmt:rs
  • cargo check -p bitfun-desktop
  • cargo build -p bitfun-desktop
  • cargo test -p bitfun-desktop --lib --no-run
  • pnpm run test:release-packaging
    • 40 tests passed
  • pnpm run desktop:build:release-fast
    • Production frontend built successfully
    • Revision manifest generated for 982 files / 75,954,287 bytes
    • Release-fast desktop executable built successfully
  • Isolated real-process startup verification:
    • Started the release-fast executable with a corrupt primary state and valid backup.
    • Confirmed the primary state was repaired.
    • Confirmed exactly one state.invalid.* preservation file was created.
    • Confirmed a second launch did not create another invalid-state file.
    • Confirmed a valid stale .copy-<uuid> directory was removed after page load.
    • Confirmed a similarly named non-UUID directory was preserved.

The desktop Rust test executable compiled successfully, but executing it on this Windows host failed before test entry with STATUS_ENTRYPOINT_NOT_FOUND (0xc0000139). The affected behaviors were therefore additionally verified through the real release-fast desktop process.

Reviewer Notes

  • The startup path reads only frontend-revision.json and basic index.html metadata; it does not traverse or hash the full frontend tree.
  • Packages built before this manifest was introduced use a compatibility identity derived from existing packaged metadata.
  • Background materialization remains transactional and preserves the existing rollback model.
  • Stale-directory cleanup only accepts canonical lowercase UUID directory names directly under the revision root.
  • No persisted schema migration is required. Existing and older state shapes remain readable.
  • This is a local desktop startup/cache change. Remote workspace, remote control, Peer Device Mode, and Detached Dispatch behavior is unaffected and was not exercised.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable. No user-facing copy or locale changes were required.

@kev1n77
kev1n77 merged commit 23e35fe into GCWing:1.0.0-explore Sep 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