Skip to content

#7818: Review › Delete: Delete All Comments in Document and Delete All Resolved Comments - #7836

Merged
FredApps merged 5 commits into
storytold:mainfrom
RickiNano:feat/7818-delete-all-comments
Dec 1, 2026
Merged

FredApps merged 5 commits into
storytold:mainfrom
RickiNano:feat/7818-delete-all-comments

Conversation

@RickiNano

@RickiNano RickiNano commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7818.

The Review tab could only delete one comment thread at a time. Review › Comments › Delete is now a split button, as in Word. Its menu has:

  • Delete: the comment at the caret and its replies, as before.
  • Delete All Comments in Document: every comment and reply. This uses the existing review.deleteComment {"all": true}, which no button reached before.
  • Delete All Resolved Comments: each resolved comment with its replies, keeping the open ones. This is the new review.deleteComment {"resolved": true}.

Each runs as one undo step and removes the comments' anchors and text parts. The CLI, MCP and control channel get the new parameter through the same command.

Changes

  • crates/engine/src/cmd/review/comments.rs: thread_of becomes threads_of, which takes several roots and builds the reply map once. Deleting thousands of resolved comments stays one pass over the comments, as deleting_a_long_reply_chain_stays_fast requires for one chain. delete_comment takes resolved, which wins over all if both are set.
  • crates/engine/src/cmd/review.rs: the params doc for review.deleteComment.
  • crates/ui-egui/src/ribbon/review.rs: Delete becomes a SplitButton with the three items.
  • crates/engine/src/catalog.rs: two rows for the new menu items. docs/parity-checklist.md regenerated with cargo xtask parity.
  • docs/ui-parity.md, ROADMAP.md: a revision row and a progress-log entry.

Tests

New tests in crates/engine/src/cmd/review/tests.rs:

  • delete_all_resolved_comments_keeps_the_open_ones: two resolved comments, one with a reply, and one open comment holding the caret. The resolved comments, the reply, their text parts and their anchors go. The open comment stays. It is one undo step, and Undo restores all four comments. Fails without the change: resolved was ignored, so the command deleted the comment at the caret.
  • delete_all_resolved_comments_without_resolved_ones_keeps_all: with nothing resolved, nothing is deleted. Fails without the change.
  • delete_all_comments_in_document_deletes_every_comment: covers the all path the new menu item uses. It already passed before this change.

What ran

  • cargo fmt -p wordcraft-engine -p wordcraft-ui-egui -- --check: clean.
  • cargo clippy -p wordcraft-engine -p wordcraft-ui-egui --all-targets -- -D warnings: clean.
  • cargo test -p wordcraft-engine: 1549 passed, 2 failed, both unrelated to this change and from my environment. swiss_german_and_portugal_portuguese_keep_their_languages_rules needs craft-i18n's hyphenation patterns, and CRAFT_I18N_DIR isn't set locally. refused_custom_dictionary_leaves_every_other_option_unchanged passes when run on its own.
  • cargo test -p wordcraft-ui-egui: library 917 passed, 1 failed (interface_symbols_have_glyphs, which needs the craft-fonts directory; CRAFT_FONTS_DIR isn't set locally, and the new labels are plain ASCII). Integration tests: 20 passed.
  • Not run locally: cargo xtask wasm and the full cargo xtask ci. I'm relying on CI for those.

Screenshots

Rendered headlessly with the ui_shot example at this head (de895a6): the sample document with two comments, one of them resolved. The menu was opened, and its item clicked, with ui.click (real pointer input), not by running the command directly.

Before: one open, one resolved Review › Comments › Delete ▾ After Delete All Resolved Comments
Comments pane with an open and a resolved comment Delete split button menu with Delete, Delete All Comments in Document and Delete All Resolved Comments Comments pane with only the open comment left

After the click, review.comments lists only the open comment.

Summary by CodeRabbit

  • New Features
    • The Review tab’s comment deletion menu lets you delete the current comment, all comments in the document, or only resolved comments.
    • Deleting resolved comments also removes their replies while preserving open comments. Deleting all comments removes comments regardless of resolution status.
  • Bug Fixes
    • Undo restores deleted comments and their associated content, including comment text and anchors, in a single undo step.

…Delete All Resolved Comments

Review › Comments › Delete becomes a split button whose menu has Delete,
Delete All Comments in Document (the existing review.deleteComment
{"all": true}) and Delete All Resolved Comments, a new
review.deleteComment {"resolved": true} that deletes each resolved
comment with its replies and keeps the open ones, in one undo step.

thread_of becomes threads_of, taking several roots and building the
reply map once, so deleting many resolved threads stays one pass.
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Review tab now offers actions to delete the current comment, all comments, or all resolved comments. The command deletes resolved comments with their replies and preserves open comments. Tests cover cleanup and undo behavior, and documentation records the feature and updated parity counts.

Changes: Comment deletion

Layer / File(s) Summary
Implement and validate comment deletion
crates/engine/src/cmd/review.rs, crates/engine/src/cmd/review/comments.rs, crates/engine/src/cmd/review/tests.rs
The command accepts a resolved parameter and deletes resolved comments with their replies. Tests cover associated text parts and anchors, open-comment preservation, no resolved comments, all-comment deletion, and undo restoration.
Expose deletion options in the Review tab
crates/engine/src/catalog.rs, crates/ui-egui/src/ribbon/review.rs, ROADMAP.md, docs/parity-checklist.md, docs/ui-parity.md
The catalog and split button expose current-comment, all-comment, and resolved-comment deletion. Roadmap and parity documentation record the feature and updated counts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  participant Reviewer
  participant ReviewSplitButton as Review split button
  participant DeleteCommentCommand as review.deleteComment
  participant CommentState as Comment, text-part, and anchor state
  Reviewer->>ReviewSplitButton: Select Delete All Resolved Comments
  ReviewSplitButton->>DeleteCommentCommand: Invoke with resolved true
  DeleteCommentCommand->>CommentState: Delete resolved comments and their replies
Loading

Possibly related issues

Suggested reviewers: benandez, aiongg

Merge Risk: Minimal · up to 24416

This adds Delete All Comments and Delete All Resolved Comments to the Review tab. Resolved comments are removed with their replies, and open comments are kept. No merge-blocking risk was identified.

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 two new Review > Delete commands, Delete All Comments in Document and Delete All Resolved Comments. The changeset adds both entries to the catalog, implements them in comments.rs a…
Linked Issues check Passed Directly linked issue #7818 asks for a Review-tab way to delete all comments in a document, and a way to delete all resolved comments, each in one action. At head 2441626, crates/engine/src/cmd/review…
Out of Scope Changes check Passed The changes map to #7818. comments.rs adds the resolved parameter and changes thread_of to threads_of so multiple roots share one reply map. review.rs documents the parameter. ribbon/review.rs a…
Full details: Title check

Explanation

The title names the two new Review > Delete commands, Delete All Comments in Document and Delete All Resolved Comments. The changeset adds both entries to the catalog, implements them in comments.rs and the UI split button, and adds tests for them. The title matches the main change and the linked issue #7818.

Full details: Linked Issues check

Explanation

Directly linked issue #7818 asks for a Review-tab way to delete all comments in a document, and a way to delete all resolved comments, each in one action. At head 2441626, crates/engine/src/cmd/review/comments.rs delete_comment handles both. The resolved branch collects every comment with resolved set and passes those roots to threads_of, which adds their replies. The all branch removes every comment key. Both branches feed remove_anchors and the removal of comment parts. crates/ui-egui/src/ribbon/review.rs builds the Delete control as a SplitButton with menu items for {"all": true} and {"resolved": true}. The primary button still sends review.deleteComment with no parameters. The changes since the previous review (threads_of signature, resolved precedence over all) keep these paths intact. I did not open crates/engine/src/cmd/review/tests.rs at this head, so the test claims rest on the PR description and summary. The code requirements are met.

Full details: Out of Scope Changes check

Explanation

The changes map to #7818. comments.rs adds the resolved parameter and changes thread_of to threads_of so multiple roots share one reply map. review.rs documents the parameter. ribbon/review.rs adds the split-button menu. catalog.rs adds the two menu rows. The parity checklist, ui-parity.md and ROADMAP.md entries record the regenerated parity status and the new commands, which the repository tracks. The tests cover the new modes. No unrelated code change appears in the reviewed evidence.

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9c60332 and 2441626.

Files selected for processing: 2

  • ROADMAP.md
  • crates/engine/src/cmd/review/tests.rs

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

@RickiNano
RickiNano marked this pull request as ready for review November 26, 2026 10:28
…comments

# Conflicts:
#	ROADMAP.md
#	docs/ui-parity.md
@RickiNano

Copy link
Copy Markdown
Contributor Author

Merged current main (5deef90). Only the docs conflicted:

The code merged cleanly. cargo xtask parity leaves docs/parity-checklist.md unchanged (512 of 524).

What ran locally (Windows):

  • cargo fmt --all -- --check and cargo clippy -p wordcraft-engine -p wordcraft-ui-egui --all-targets -- -D warnings: clean.
  • cargo test -p wordcraft-engine: lib 1609 passed and 1 failed, swiss_german_and_portugal_portuguese_keep_their_languages_rules, which needs craft-i18n. With CRAFT_I18N_DIR at the pinned craft-i18n.rev it passes. The other test targets passed.
  • cargo test -p wordcraft-ui-egui: lib 969 passed and 1 failed, interface_symbols_have_glyphs, which needs the craft-fonts directory. The integration tests passed.

I didn't run the full cargo xtask ci. I'm relying on CI for wasm and the rest.

main added the headless count; with this PR's two commands it is 512.
@RickiNano

Copy link
Copy Markdown
Contributor Author

Merged current main (5796c66) again. Only docs/ui-parity.md conflicted: main added #5428's status entry, so the status line is main's with the #7818 entry first. The code merged cleanly.

main added a Headless count line to docs/parity-checklist.md. cargo xtask parity puts it at 512 with this PR's two commands, so the regenerated file is in a separate commit (9c60332). The catalog count is unchanged at 512 of 524.

What ran locally (Windows):

  • cargo fmt --all -- --check and cargo clippy -p wordcraft-engine -p wordcraft-ui-egui --all-targets -- -D warnings: clean.
  • cargo test -p wordcraft-engine: lib 1638 passed, 1 failed. The failure is swiss_german_and_portugal_portuguese_keep_their_languages_rules, which needs craft-i18n (not checked out here). The other test targets passed.
  • cargo test -p wordcraft-ui-egui: lib 975 passed, 3 failed:
    • interface_symbols_have_glyphs and symbol_menu_cells_are_compact_and_the_tooltip_names_the_character need the craft-fonts directory. The second fails the same way on current main.
    • hovering_a_bar_member_previews_its_command failed in the full parallel run and passed when run alone.
    • The integration tests passed.

I didn't run the full cargo xtask ci, so I'm relying on CI for wasm and the rest.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed 9c603325 for #7818. The Review ribbon split button keeps single-comment Delete and routes both bulk actions through the same registered command. Delete All Resolved removes the selected threads and their replies, text parts, and anchors without removing open comments. Undo restores the deleted threads in one step.

The Ubuntu gate for this head passed all three bulk-delete cases, the long-reply-chain regression and the UI translation audit. The PR also shows the resolved-only action invoked from the ribbon; the changes after that capture leave the engine and ribbon implementation unchanged. I checked subsequent main changes for overlap with this code.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed the current-main sync. The comment-deletion code and test changes are unchanged; the roadmap conflict keeps the comment-deletion entry and current main history. The exact Ubuntu gate passed 5,911 tests, including Delete All, Delete All Resolved while keeping open threads, the no-resolved-comments case, nested replies, and explicit invalid-ID rejection. Windows and macOS Printing gates also passed.

@FredApps
FredApps merged commit 199162f into storytold:main Dec 1, 2026
24 checks passed
@FredApps

FredApps commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for adding the bulk comment controls. WordCraft now offers Delete All Comments in Document and Delete All Resolved Comments from the Review ribbon. The resolved-only option keeps open threads, and one Undo restores the deleted threads.

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.

Feature request: Add a “Delete All Comments” and "Delete All Resolved Comments"option

2 participants