Skip to content

refactor(platform): move Windows session-end adapter out of Tauri - #6122

Closed
4o3F wants to merge 1 commit into
fix/windows-session-endfrom
refactor/session-end-platform-adapter
Closed

4o3F wants to merge 1 commit into
fix/windows-session-endfrom
refactor/session-end-platform-adapter

Conversation

@4o3F

@4o3F 4o3F commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Moves the Windows session-end adapter, which has no Tauri dependency, out of backend/tauri into nyanpasu-platform. The GUI now only composes it, and a future CLI frontend can reuse it. Stacks on #6119. Refs #6054.

Changes

  • backend/tauri/src/shutdown_hook.rs moves to nyanpasu-platform/src/session_end/windows.rs: the hidden Win32 window and its 2 Windows tests.
  • backend/tauri/src/utils/session_end.rs moves to nyanpasu-platform/src/session_end/protocol.rs: the pure message decision, ShutdownCompletion and its 5 tests.
  • Callers import the new location directly; no re-export shims remain in backend/tauri.
  • The 30-second cleanup wait is now a parameter supplied by setup.rs. The first confirmation still fixes the deadline, and later confirmations keep it.
  • Otherwise no behavior change. The moved files differ from the originals only in imports, visibility, doc comments and that parameter.

Verification

  • Passing: platform session_end tests (5), clash-nyanpasu tests (184; the 5 moved tests now run in platform), clippy, rustfmt, lint:architecture-ledger and lint:backend-boundaries.
  • The platform suite has only the known environment-specific proxy-port failure.
  • The Windows code was not compiled locally (no mingw for aws-lc-sys), so the window tests need Windows CI.

CLI note (not implemented)

A future console frontend should treat CTRL_C/CTRL_BREAK as a normal stop. It should treat CTRL_CLOSE/CTRL_LOGOFF/CTRL_SHUTDOWN as a confirmed session end and block in the handler until cleanup is done. A process that loads user32 stops receiving the logoff and shutdown console events, so a CLI also needs this hidden-window hook.

@4o3F
4o3F added this pull request to stack #6120 November 1, 2026 09:24
@semanticdiff-com

semanticdiff-com Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  backend/nyanpasu-platform/src/session_end/windows.rs  32% smaller
  backend/nyanpasu-platform/src/session_end/protocol.rs  29% smaller
  backend/Cargo.lock Unsupported file format
  backend/nyanpasu-platform/Cargo.toml Unsupported file format
  backend/nyanpasu-platform/src/lib.rs  0% smaller
  backend/nyanpasu-platform/src/session_end/mod.rs  0% smaller
  backend/tauri/Cargo.toml Unsupported file format
  backend/tauri/src/lib.rs  0% smaller
  backend/tauri/src/setup.rs  0% smaller
  backend/tauri/src/setup_tests.rs  0% smaller
  backend/tauri/src/utils/exit.rs  0% smaller
  backend/tauri/src/utils/mod.rs  0% smaller

Keep Win32 session handling and shutdown acknowledgement in the neutral
platform crate so the GUI only composes the adapter and its callback,
and a future CLI frontend can reuse it.

Supply the cleanup wait bound from setup while preserving the first
confirmation's deadline.

Refs #6054
@4o3F
4o3F force-pushed the refactor/session-end-platform-adapter branch from 649be9e to df54648 Compare November 1, 2026 11:21
@4o3F
4o3F removed this pull request from stack #6120 November 1, 2026 11:21
@4o3F
4o3F changed the base branch from fix/session-core-lifecycle to fix/windows-session-end November 1, 2026 11:21
@4o3F
4o3F added this pull request to stack #6125 November 1, 2026 11:22
@4o3F 4o3F closed this Nov 1, 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