Skip to content

refactor: plan startup sessions and coordinate closing (5/10) - #5915

Closed
Jocs wants to merge 4 commits into
developfrom
feat/startup-05-session
Closed

Jocs wants to merge 4 commits into
developfrom
feat/startup-05-session

Conversation

@Jocs

@Jocs Jocs commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Refs #645, #3577, #732, #5596. Part 5 of the startup recovery series.

Summary

Define latest-session membership, all five startup selection policies, and coordinated window/application close behavior as independently testable logic. Restoring windows uses the actual session membership, explicit file requests take priority, ordinary-tab filtering preserves selected-window recovery content, and empty results produce a blank document.

The close controller collects decisions before discarding or destroying windows, commits the final session before destruction, keeps windows open on canceled/failed saves, and rejects unapproved newer edits or changed window membership during quit. Single-window close and application quit have distinct APIs.

These modules use typed external ports and do not activate a new application entry point. The later real-IO integration must verify the same behavior before related requests can be closed.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Internal refactor

Test plan

  • TDD: initial missing modules failed; the new-window-during-discard regression failed before membership capture/revalidation was fixed; closed-tab resurrection and stale reading-state regressions failed before recovery merging was corrected.
  • 61 focused tests, including all 40 startup-policy/boolean combinations, original-state immutability, last-window fallback, view-state filtering, stale/unreferenced recovery markers, reading-state retention without body rewrites, interrupted Save As, saved-file retention, cancel/failure ordering, revision changes, wrong-window checkpoints, retry after cancellation, and missing window identity.
  • All 1519 desktop unit tests pass locally with the local-only shared-dependency filesystem allow list.
  • pnpm run lint: existing warnings, no errors.
  • pnpm run typecheck.

Notes for reviewers

Depends only on #5913, not on concrete storage #5914. This branch includes its prerequisite commits and targets develop. Review only this part at feat/startup-01-contracts...feat/startup-05-session .

Session and startup logic have no Electron/filesystem effects. Close ports replace external operations in controller tests; real filesystem behavior is covered separately by part 3 and is integrated later. No user data is migrated and no production close/startup path changes yet. Design/progress documents remain in the agreed desktop folder.


By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Build artifacts for PR #5915:

Run: https://github.com/marktext/marktext/actions/runs/40540395193

Artifact Size Link
marktext-macos-x64 332.4 MB Download
marktext-windows-arm64 327.3 MB Download
marktext-linux-arm64 571.7 MB Download
marktext-macos-arm64 320.8 MB Download
marktext-windows-x64 335.4 MB Download
marktext-linux-x64 730.8 MB Download

@Jocs

Jocs commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Consolidated into #5916. All commits and tests are retained there; this duplicate review thread is closed without merging into develop.

@Jocs Jocs closed this Oct 28, 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