Skip to content

Add search to the rs comments list (Phase 2c)#23063

Draft
nbradbury wants to merge 14 commits into
trunkfrom
feature/rs-comments-list-search
Draft

Add search to the rs comments list (Phase 2c)#23063
nbradbury wants to merge 14 commits into
trunkfrom
feature/rs-comments-list-search

Conversation

@nbradbury

Copy link
Copy Markdown
Contributor

Description

Phase 2c, stacked on the batch-moderation PR: search for the rs comments list, following the rs posts list pattern. The search icon opens an inline query field in the top bar; queries are debounced 250ms with a 3-character minimum, keep the active tab's status filter (so each tab remains meaningful while searching), and closing search restores the normal tab content immediately. Selection mode clears when search opens or closes.

Testing instructions

On the stacked setup (flag on, WP.com or app-password site):

  1. Tap the search icon in the comments list
  • Inline search field opens with the keyboard
  1. Type a word from an existing comment (3+ characters)
  • Matching comments appear for the current tab's status; other tabs search on switch
  1. Type nonsense
  • "No comments matching your search"
  1. Close search (back arrow)
  • Normal tab content returns immediately

Add a Compose comments list backed by wordpress-rs, following the
postsrs/pagesrs pattern. There's no rs mobile-cache support for comments
yet, so each tab pages directly against /wp/v2/comments using the
response's nextPageParams as the cursor.

- 5 filter tabs (All/Pending/Approved/Spam/Trashed). The All and
  Approved tabs use CommentStatus.Custom("all"/"approve") because
  WP_Comment_Query doesn't recognise the "approved" value the rs enum
  serialises to
- Rows show avatar, bold "author on post" title (post titles resolved
  via a batched sparse-field request), snippet, date, pending indicator
- Pull-to-refresh, load-more, retry snackbars, shimmer/empty/error states
- Tapping a row opens the rs comment detail; the list refreshes on return
- Gated in ActivityLauncher.viewUnifiedComments by RS_UNIFIED_COMMENTS +
  site capability (WP.com REST or application password), falling back to
  the legacy list; the now-dead per-tap rs gate inside the legacy list
  fragment is removed

Batch moderation and search follow in stacked PRs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dangermattic

dangermattic commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator
2 Warnings
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ Class CommentsRsListViewModel is missing tests, but unit-tests-exemption label was set to ignore this.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@nbradbury nbradbury changed the base branch from feature/rs-comments-list-batch to trunk July 2, 2026 16:33
@wpmobilebot

wpmobilebot commented Jul 2, 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
Versionpr23063-8d90ca5
Build Number1498
Application IDcom.jetpack.android.prealpha
Commit8d90ca5
Installation URL2a5f4abs7i708
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jul 2, 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
Versionpr23063-8d90ca5
Build Number1498
Application IDorg.wordpress.android.prealpha
Commit8d90ca5
Installation URL7r7suc4vdjorg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 1.91083% with 770 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.36%. Comparing base (a8b4a23) to head (8d90ca5).

Files with missing lines Patch % Lines
...s/android/ui/commentsrs/CommentsRsListViewModel.kt 0.00% 211 Missing ⚠️
...roid/ui/commentsrs/screens/CommentsRsListScreen.kt 0.00% 175 Missing ⚠️
...d/ui/commentsrs/screens/CommentsRsTabListScreen.kt 0.00% 127 Missing ⚠️
...ndroid/ui/commentsrs/screens/CommentsRsListItem.kt 0.00% 88 Missing ⚠️
...ndroid/ui/comments/unified/CommentsRsDataSource.kt 1.42% 69 Missing ⚠️
...ess/android/ui/commentsrs/CommentsRsListUiState.kt 0.00% 50 Missing ⚠️
...rdpress/android/ui/commentsrs/CommentsRsListTab.kt 0.00% 30 Missing ⚠️
...ava/org/wordpress/android/ui/ActivityLauncher.java 0.00% 9 Missing ⚠️
...comments/unified/UnifiedCommentDetailsViewModel.kt 63.15% 3 Missing and 4 partials ⚠️
...press/android/ui/commentsrs/CommentsRsListEvent.kt 0.00% 3 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #23063      +/-   ##
==========================================
- Coverage   37.58%   37.36%   -0.23%     
==========================================
  Files        2328     2335       +7     
  Lines      125829   126590     +761     
  Branches    17320    17435     +115     
==========================================
+ Hits        47289    47296       +7     
- Misses      74668    75420     +752     
- Partials     3872     3874       +2     

☔ 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.

nbradbury and others added 8 commits July 2, 2026 13:27
…rience

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…g and SnackbarMessage

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Danger requires immutable string keys: changed copy gets a new key rather
than editing the old one in place.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Key the post-title cache by (site, post id) so titles can't leak across
  sites, and negative-cache unresolvable ids so they aren't re-requested
  on every page load
- Set perPage explicitly on title batches (server default of 10 silently
  truncated larger batches) and fall back to the pages endpoint for
  comments left unresolved by the posts endpoint
- Discard load-more results whose fetch predates the latest applied first
  page, preventing stale pages/cursors after a silent refresh
- Offer a retry action on load-more failures and auto-advance past pages
  that dedupe away entirely, so pagination can't stall at the list bottom

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Chunk post-title batches to the server's per_page maximum of 100;
  larger values are rejected outright with rest_invalid_param
- Always attempt the pages endpoint for ids the posts endpoint didn't
  resolve, and only negative-cache when both endpoints succeeded
- Clear negative-cached titles on user-initiated refresh so posts
  published after first sight can resolve
- Cap unattended load-more auto-advance at 3 pages and let it handle
  empty pages, not just fully-deduplicated ones
- Don't cancel/re-fire an identical in-flight title-resolve batch
- Add CommentsRsDataSourceTest covering the cache, fallback, and
  chunking behavior, plus ViewModel tests for the new paging rules

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Cancel a tab's in-flight title-resolve job on user refresh so a job
  holding pre-clear 'not found' results can't re-apply them via the
  identical-ids guard
- Generation-stamp the negative cache so a fetch already in flight when
  the user cleared can't re-poison entries with pre-clear results
- Make the data source tests execute each request's builder lambda
  against a mocked uniffi client, asserting the endpoint, include count,
  and perPage actually sent — the chunking test now fails if chunking is
  reverted, and the posts-before-pages order is asserted, not assumed

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolves the Android Lint code-scanning alerts on CommentsRsDataSourceTest:
SparseAnyPostWithViewContext and PostsRequestFilterListWithViewContextResponse
are pure data classes, so the tests now build real instances.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Detail opened from the rs list backfills the FluxC cache (WP.com) and
  resolves the post title via rs, so title and like state are correct
- Detail reports RESULT_OK only when the comment changed; the list only
  refreshes then, keeping paged lists and scroll position intact
- Guard against duplicate first-page fetches; skip the retry snackbar
  when a silent refresh fails on a tab that already shows comments
- Clear isLoadingMore when a refresh replaces the list so paging can't
  stall behind the busy guard
- Stop the load-more trigger firing on the empty pre-layout list and
  re-arm it when the list size changes
- Evict all cached post titles for the site on user refresh so renamed
  posts pick up their new title
- Track COMMENT_FILTER_CHANGED on tab changes like the legacy list
- Restore the singleTop launch mode the legacy comments activity has
- Drop the dead initializingTabs bookkeeping
- Merge RsCommentListItem into RsComment (one shared type and mapper)
- Move the new unit tests to a follow-up PR to reduce this PR's size

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nbradbury nbradbury force-pushed the feature/rs-comments-list-search branch from 6cfe5e1 to 57bff96 Compare July 3, 2026 12:27
@wpmobilebot

wpmobilebot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: wordpressRelease):

--- ./build/reports/diff_manifest/WordPress/wordpressRelease/base_manifest.txt	2026-07-03 13:55:18.230671622 +0000
+++ ./build/reports/diff_manifest/WordPress/wordpressRelease/head_manifest.txt	2026-07-03 13:55:19.533146180 +0000
@@ -383,6 +383,11 @@
             android:launchMode="singleTop"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
+            android:name="org.wordpress.android.ui.commentsrs.CommentsRsListActivity"
+            android:label="@string/comments"
+            android:launchMode="singleTop"
+            android:theme="@style/WordPress.NoActionBar" />
+        <activity
             android:name="org.wordpress.android.ui.comments.unified.UnifiedCommentsEditActivity"
             android:label="@string/edit_comment"
             android:theme="@style/WordPress.NoActionBar" />

Go to https://buildkite.com/automattic/wordpress-android/builds/27262/canvas?sid=019f283a-e15b-4ffe-8cf5-3779c442ff45, click on the Artifacts tab and audit the files.

@wpmobilebot

wpmobilebot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: jetpackRelease):

--- ./build/reports/diff_manifest/WordPress/jetpackRelease/base_manifest.txt	2026-07-03 13:55:18.737562182 +0000
+++ ./build/reports/diff_manifest/WordPress/jetpackRelease/head_manifest.txt	2026-07-03 13:55:20.013175605 +0000
@@ -571,6 +571,11 @@
             android:launchMode="singleTop"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
+            android:name="org.wordpress.android.ui.commentsrs.CommentsRsListActivity"
+            android:label="@string/comments"
+            android:launchMode="singleTop"
+            android:theme="@style/WordPress.NoActionBar" />
+        <activity
             android:name="org.wordpress.android.ui.comments.unified.UnifiedCommentsEditActivity"
             android:label="@string/edit_comment"
             android:theme="@style/WordPress.NoActionBar" />

Go to https://buildkite.com/automattic/wordpress-android/builds/27262/canvas?sid=019f283a-e15c-49ae-8d4b-4df15086efa5, click on the Artifacts tab and audit the files.

nbradbury and others added 5 commits July 3, 2026 08:42
- Delete the now-unused ActivityLauncher.viewUnifiedCommentsDetails
- Track title-resolve jobs as a plain per-tab Job: cancel-and-relaunch
  is cheap because the data source caches resolved titles
- Drop the dead tab parameter from onCommentClick and the unused
  snackbarMessages default argument

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Long-press a comment to enter selection mode, then tap rows to build the
selection. The top bar swaps to a contextual action bar offering the same
per-tab actions as the legacy list's action mode (approve/unapprove/spam/
not-spam/trash/restore/delete), with confirmation dialogs for trash and
delete-permanently and COMMENT_BATCH_* analytics.

Moderation runs the rs writes in parallel, aggregates any failures into a
single snackbar, then refreshes all initialized tabs, since moderated
comments move between them. Selection clears on tab change and after each
batch action.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Search icon in the top bar opens an inline query field (like the rs posts
list): queries are debounced 250ms with a 3-character minimum, keep the
active tab's status filter, and clear back to the normal tab content when
search closes. Selection mode is cleared when search opens or closes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nbradbury nbradbury force-pushed the feature/rs-comments-list-search branch from 57bff96 to 8d90ca5 Compare July 3, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants