Skip to content

fix(desktop): validate and atomically persist main window state - #2973

Merged
kev1n77 merged 1 commit into
GCWing:mainfrom
kev1n77:fmy/bugfix
Sep 11, 2026
Merged

fix(desktop): validate and atomically persist main window state#2973
kev1n77 merged 1 commit into
GCWing:mainfrom
kev1n77:fmy/bugfix

Conversation

@kev1n77

@kev1n77 kev1n77 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replace the window-state plugin with desktop-owned geometry validation and atomic persistence.

  • Repair invalid dimensions and inaccessible positions before restoring the main window.
  • Preserve normal bounds while maximized, minimized, fullscreen, or hidden.
  • Repair invalid geometry when activating the window through the tray, secondary launch, or application commands.
  • Preserve the legacy .window-state.json format and unknown fields.

Type and Areas

Type: Bug fix

Areas: Desktop/Tauri, dependencies, regression tests, developer documentation

Motivation / Impact

Invalid saved dimensions, such as 65519 × 65526, can restore the main window at an unusable size. The previous plugin could also overwrite repaired state with stale cached data on exit.

The desktop now validates geometry against monitor bounds and scaling, restores usable defaults when necessary, and atomically saves validated snapshots.

Verification

  • rustfmt --check --edition 2021 src/apps/desktop/src/tray.rs — passed after conflict resolution.
  • git diff --check and git diff --cached --check — passed.
  • Startup contract tests — 50 passed after rebase using:
    pnpm exec vitest run --config $windowTestConfig src/app/startup/startupPerformanceContract.test.ts
    The temporary configuration contained export default { test: { environment: "node" } };.
  • pnpm --dir src/web-ui run test:run src/app/startup/startupPerformanceContract.test.ts — blocked by the missing @xterm/headless/lib-headless/xterm-headless.mjs dependency file.
  • cargo test -p openbitfun-desktop --lib window_state_support::tests — compiled before rebase, but the test executable could not start (0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND).
  • pnpm run check:core-boundaries — blocked by a dangling HarmonyOS libbitfun_crypto.so link.

Remote workspace, remote control, Peer Device Mode, and Detached Dispatch were not exercised.

Reviewer Notes

  • Existing state files remain compatible; no manual migration is required.
  • Geometry repairs preserve the original file in a backup. Unparseable or unrecognized records are left untouched.
  • The window-state plugin is removed to prevent its exit cache from overwriting validated state.
  • The rebase preserves upstream Win+D/tray restoration behavior and adds geometry repair after successful unminimization.
  • Native window behavior on macOS and Linux 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.

@kev1n77
kev1n77 merged commit 8a44544 into GCWing:main Sep 11, 2026
14 checks passed
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