Skip to content

Keep Writer collection metadata across ordinary chapter saves - #246

Merged
callumalpass merged 1 commit into
mainfrom
sprint-w6-writer-docx-perf
Nov 28, 2026
Merged

callumalpass merged 1 commit into
mainfrom
sprint-w6-writer-docx-perf

Conversation

@callumalpass

Copy link
Copy Markdown
Member

Summary

  • Keep collection metadata when the SDK watch proves that an ordinary Markdown note retains its record ID, path and types. Chapter sessions still receive content updates. Lazy body reads check identity, protection and intervening changes.
  • Keep collection rediscovery for membership changes, domain records, ambiguous batches and watch resets. Group outline comment offsets in one pass.
  • Add a Chromium replay that saves an edited chapter while downloading Word. The large collection fixture also verifies that a subsequent note body read needs one SDK request and sends no compiler updates.

Benchmark

Chromium 156, AMD Ryzen 9 7940HS, local DEV MemoryReplica with 60 chapters, 300 comment records and 5,000 sources. Each sample used a fresh browser context with the cache disabled. Baseline 21dc7a0 includes #243 and #245.

Chromium phase, median of 3 Before After
Chapter save to Word download 61.56 s 7.51 s
Before the export handler started 57.82 s 2.28 s
Inside the export handler 3.63 s 5.06 s
Main-thread long-task time 25.73 s 2.73 s

Save-to-download samples ranged from 21.00–78.83 s before and 6.91–19.61 s after on the shared host. The original 44.39 s trace spent 2.62 s inside the export handler, including 1.62 s in Pandoc. The CPU profile attributed the preceding stall to collection scans and contract projection after autosave. The change targets that refresh, while Pandoc continues to generate the same document.

All 16 uncompressed DOCX parts matched across all six downloads after normalizing the two core timestamps. The package checks cover every chapter passage, the saved edit, citation, bibliography and cited footnote. Independent Pandoc extraction also matched. The 300 Writer review comments were loaded in the app. Word contains no review-comment entries under the existing export behavior.

Verification

  • rpnpm run check (catalogue validation, typecheck and tests, including 375 Writer app tests)
  • rpnpm run build:production
  • rpnpm --filter @mdbase-writer/app run typecheck:perf
  • rpnpm --filter @mdbase-writer/app run test:perf-fixture
  • Chromium DOCX replay and package comparison
  • git diff --check and node --check for the benchmark script. The repository has no standalone lint script.

@callumalpass
callumalpass merged commit d10c4ef into main Nov 28, 2026
1 check passed
@callumalpass
callumalpass deleted the sprint-w6-writer-docx-perf branch November 28, 2026 09:05
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