Skip to content

Load and save comment edits via wordpress-rs without a FluxC row - #23100

Merged
nbradbury merged 10 commits into
trunkfrom
rs-comments-edit
Jul 15, 2026
Merged

Load and save comment edits via wordpress-rs without a FluxC row#23100
nbradbury merged 10 commits into
trunkfrom
rs-comments-edit

Conversation

@nbradbury

@nbradbury nbradbury commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Builds on the RS comment editor (#23084), which already saved via wordpress-rs but still leaned on FluxC to load the comment and as a hard precondition for saving. This PR updates that to use wp-rs for comment editing.

Testing

  1. Enable RS Unified Comments (Me → Experimental Features).
  2. WP.com site: Comments → open a comment → Edit → fields pre-fill (raw content) → save → detail refreshes with the change.
  3. Application-password self-hosted site: same flow — previously depended on a FluxC row; both load and save must now work with an empty FluxC cache.
  4. Comment notification → detail → Edit → save (notification identifier path).
  5. Non-rs site (plain XML-RPC self-hosted): legacy detail → Edit still loads/saves via FluxC.

Lift the debug-only restriction so the new wordpress-rs comments screens
can be opted into outside debug builds for broader soak testing. The flag
still defaults off and routing is unchanged.
On rs-capable sites (WP.com REST or application password) the comment editor
now loads via the edit-context retrieve (raw content + author email) and saves
via wordpress-rs without requiring a pre-existing FluxC comment row — the
post-save cache mirror is best-effort, applied only when a row exists. Non-rs
sites (XML-RPC via the legacy/reader launch points) keep the FluxC load and
save path unchanged.
@dangermattic

dangermattic commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr23100-a4b498e
Build Number1498
Application IDorg.wordpress.android.prealpha
Commita4b498e
Installation URL4ppn219dmpeeg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr23100-a4b498e
Build Number1498
Application IDcom.jetpack.android.prealpha
Commita4b498e
Installation URL1nj7g1decnjqo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.59%. Comparing base (e13ab23) to head (a4b498e).

Files with missing lines Patch % Lines
...i/comments/unified/UnifiedCommentsEditViewModel.kt 88.88% 0 Missing and 5 partials ⚠️
...ndroid/ui/comments/unified/CommentsRsDataSource.kt 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #23100      +/-   ##
==========================================
+ Coverage   37.58%   37.59%   +0.01%     
==========================================
  Files        2341     2341              
  Lines      127106   127121      +15     
  Branches    17614    17619       +5     
==========================================
+ Hits        47767    47789      +22     
+ Misses      75427    75419       -8     
- Partials     3912     3913       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ocalCommentId

- Add a test covering the reader identifier on an rs-capable site (the
  real-world reader edit path: rs load + rs save + reader table update)
- Collapse mapCommentEssentials' duplicated fallback into loadCommentViaRs/
  loadCommentViaFluxC helpers, matching the save-side naming
- Remove SiteCommentIdentifier.localCommentId and the detail screen pipeline
  that fed it — nothing reads it now that the editor addresses comments by
  remote id
@nbradbury
nbradbury changed the base branch from rs-comments-non-debug to trunk July 14, 2026 17:10
The rs empty-list tests hit the opposite-behaving rs mirror guard (save
succeeds, skip mirror); nothing exercised the FluxC branch where a missing
cache row must fail the save with no DONE and no analytics.
The editor loads the comment from the network, so opening it offline showed
an empty screen with a load-error snackbar. Guard onEditClicked with the
detail screen's existing isOffline() check, matching moderation and reply.
The rs detail was guarded in the previous commit, but the legacy detail
(which hosts comment notifications when the rs detail isn't used) and the
reader could still open the editor offline, showing an empty screen with a
load-error snackbar. Use NetworkUtils.checkConnection, the same idiom both
files already use for reply and moderation.
The stub is load-bearing — without it Mockito returns null for the non-null
suspend return and the happy-path test fails. Only the payload is unused, not
the stub itself.
@nbradbury
nbradbury marked this pull request as ready for review July 14, 2026 19:01
@nbradbury
nbradbury requested a review from adalpari July 14, 2026 19:01

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

🚢 it!

@nbradbury
nbradbury merged commit 72fc641 into trunk Jul 15, 2026
23 checks passed
@nbradbury
nbradbury deleted the rs-comments-edit branch July 15, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants