Repository navigation
M14: restore save stamps after immediate web-save errors - #6824
Conversation
Match native save failure behavior when serialization or synchronous delivery fails.
Exercise public Save/SaveAs with serialization, download and host failures while preserving prior state.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
benandez
left a comment
There was a problem hiding this comment.
The code looks good. The restored fields are exactly the five that stamp_save writes, and this matches the native save path in cmd/file.rs. All three failure paths are covered for both save and save-as, and the test fails without the fix.
Requesting changes only because the branch conflicts with main in crates/ui-egui/src/file_dialogs/tests.rs. Please rebase or merge main and I'll approve.
Non-blocking:
- A save through the browser's picker that fails later still keeps the advanced stamps (the description says this is out of scope).
- After a failed password save,
session.passwordstays set. This is older than the PR.
benandez
left a comment
There was a problem hiding this comment.
Reviewed at 379db24. The head is a merge of main into the reviewed code; the net diff against main is app/commands.rs plus the new tests in file_dialogs/tests.rs, and the conflict is gone. The five restored fields (zoom, last_modified_by, created, modified, revision) are exactly what stamp_save writes, and both the serialization-failure and delivery-failure paths restore them; the success path is unchanged. Earlier findings were non-blocking and the code is as I reviewed it.
Non-blocking:
- Same two notes as before: a picker save that fails later keeps the advanced stamps (out of scope per the description), and
session.passwordstays set after a failed password save (pre-existing).
Web Save and Save As stamp the document before serialization and delivery. If serialization or the synchronous download/host callback fails, revision, timestamps, last-modified author and saved zoom still reflect a save that never happened. Preserve the previous five fields on those immediate error paths, matching the native save behavior.
Add a regression through public WordApp::run for both commands: serialization failure, rejected download, rejected host save, an initially clean document, and successful DOCX controls. The failure cases assert prior metadata, zoom, dirty/path state and undo depth.
Validation: a std-only fixture of the exact extracted production stamp/error/control-flow snippets passes all 3 cases; the original snippets fail both rollback cases (1 passed, 2 failed). Clock, serialization, services and surrounding types are mocked in this fixture. Both complete modified files pass rustfmt; independent source/API review found no issue. Full WordApp/UI/wasm tests and cargo xtask ci did not run locally; hosted checks on head
96741f9d4a751554f69ed75d168f95f65333a8afremain pending.Checked current stamp_save and save callback/async contracts, recent main commits, issues and open/closed PRs. Merged #3434 covers native save metadata and Save As error reporting; #6166 and #4886 cover separate storage features. Later asynchronous save outcomes retain their existing handling.
Summary by CodeRabbit