Skip to content

M14: restore save stamps after immediate web-save errors - #6824

Merged
benandez merged 3 commits into
storytold:mainfrom
MMexicann:patch-46
Nov 17, 2026
Merged

benandez merged 3 commits into
storytold:mainfrom
MMexicann:patch-46

Conversation

@MMexicann

@MMexicann MMexicann commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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 96741f9d4a751554f69ed75d168f95f65333a8af remain 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

  • Bug Fixes
    • Failed web saves now preserve the document’s metadata, zoom level, undo history, dirty state, and file path.
    • Serialization or download-delivery errors no longer leave save-related changes applied to the document.
    • Save errors are reported while retaining the document’s prior state. Successful saves continue to update the document as before.

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.
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The web save path now restores document values after serialization or delivery errors. Tests cover metadata preservation on failure and metadata updates after successful downloads.

Changes: Web save rollback

Layer / File(s) Summary
Save rollback and validation
crates/ui-egui/src/app/commands.rs, crates/ui-egui/src/file_dialogs/tests.rs
The web save path snapshots zoom, author, timestamps, and revision before saving. It restores these values when serialization or delivery fails. Tests check failure outcomes and successful download updates.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • Issue 4588 concerns host save completion and retry after failed storage. This change restores save metadata when a host save callback fails.

Suggested reviewers: aiongg, batistalucasv, vangel76

Merge Risk: Minimal · up to 379db

Failed web saves now preserve the document's revision, timestamps, author and zoom. No merge-blocking risk was identified; hosted checks are still pending.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: after an immediate web-save error (serialization failure or rejected download/host save), the document's save stamps are restored. The changeset does this in commands.…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: after an immediate web-save error (serialization failure or rejected download/host save), the document's save stamps are restored. The changeset does this in commands.rs and adds regression tests for failed web saves. The title uses the 'M14' milestone prefix, which is a label rather than a description, but the rest of the title is specific and accurate.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 96741f9 and 379db24.

Files selected for processing: 2

  • crates/ui-egui/src/app/commands.rs
  • crates/ui-egui/src/file_dialogs/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@benandez benandez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.password stays set. This is older than the PR.

@benandez benandez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.password stays set after a failed password save (pre-existing).

@benandez
benandez merged commit 8a9d04e into storytold:main Nov 17, 2026
9 checks passed
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.

2 participants