Skip to content

refactor: add application state and recovery stores (3/10) - #5914

Closed
Jocs wants to merge 4 commits into
developfrom
feat/startup-03-storage
Closed

Jocs wants to merge 4 commits into
developfrom
feat/startup-03-storage

Conversation

@Jocs

@Jocs Jocs commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Refs #732, #3500, #645. Part 3 of the startup recovery series.

Summary

Keep window metadata separate from the latest unsaved document contents. Add typed metadata/recovery codecs and isolated storage under the actual user-data directory, with serial atomic replacement, corruption/unknown-version read-only protection, and per-window recovery lookup. Invalid individual windows do not prevent valid windows from loading. Unknown editor fields are not copied into metadata.

Each document overwrites one recovery record. Saved/discarded markers survive an interrupted metadata commit; deletion is serialized with subsequent writes and rejects dirty records. The storage does not infer windows from historical snapshots or decide when a document has been saved/discarded. Runtime checkpoint ordering and document lifecycle are implemented in part 4.

Type of change

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

Test plan

  • TDD: storage imports initially failed; a stable-fallback identity regression failed before the fix.
  • 15 focused real-filesystem cases cover missing/read-only state, malformed/future JSON, serial replacement failure, valid-window salvage, accidental-body exclusion, per-window latest content, saved/discarded markers, concurrent deletion/edit, bad IDs/hashes, write failures, and capture-before-queue isolation from caller mutations.
  • All 1,473 desktop unit tests pass on macOS using the same assertions and a local-only filesystem allow-list extension for shared dependency symlinks.
  • pnpm run lint: existing warnings, no errors.
  • pnpm run typecheck.

Notes for reviewers

Depends on #5913. This branch includes its prerequisite commits so it builds independently while all PRs target develop. Review this part alone at feat/startup-01-contracts...feat/startup-03-storage .

The new stores are not yet wired into default application startup. Original user files and legacy snapshots are not migrated or deleted. Design and issue-coverage documents remain in the agreed desktop folder, outside the repository. Related issues are regression references, not closing claims at this stage.


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 #5914:

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

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

@Jocs

Jocs commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Consolidated into #5917. 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