Repository navigation
Keep saved Reader posts in the cache - #1729
Conversation
XCFramework BuildThis PR's XCFramework is available for testing. Add to your .package(url: "https://github.com/automattic/wordpress-rs", branch: "pr-build/1729")Built from 9ccab48 |
|
From Claude: Pages saved by URL sort above every imported post, in reverse order. What happens: Example: local saves, newest first, Who sees it: anyone whose device had both posts and pages saved by URL, after the first import. On iOS, the old Saved screen's order is what we send, so their list visibly reshuffles. Seen in wordpress-mobile/WordPress-iOS#26372's upgrade test, which sent only posts, so it reordered nothing; the URL case is from reading the code. Suggested fix: walk the saves oldest first. Collect bulk keys, and before each URL, send the bulk keys collected so far (in batches of 100, as now), then save the URL. Each request then goes out after everything older than it, and the server's dates follow the device's order. |
90789ce to
e1b7994
Compare
Adds wordpress_com_accounts, reader_posts, reader_streams, reader_stream_items, reader_saved_state and reader_saved_local_only (migrations 0015-0018), their repositories, and WpApiCache::remove_wordpress_com_account, which deletes every Reader row for an account through ON DELETE CASCADE.
ReaderSavedService now takes a WpApiCache and the account's user ID. It stores what it knows after every change, so status() answers from disk after a relaunch and a write made just before the app quit still wins over a lagging refresh. Adds ReaderSavedPostsCollection (saved_posts()), import_local_saves and local_only_keys, and the Swift makeReaderSavedService(source:cache:userID:) and WordPressApiCache.removeWordpressComAccount(userId:).
reader_saved_keys holds each key from the newest refresh with its save ID, date saved and URL, as GET /wpcom/v2/read/saved/keys returned it. reader_saved_state keeps the refresh's time and counts alongside the device's own writes, which stay a versioned JSON blob. A later full sync can build on the keys table without another request, and the stored URLs let a relaunch find a post by its URL even if the device's own state can't be read.
… the bindings - A recorded read/saved response, with one save of each kind, shows the list sends a whole Reader post for a WordPress.com post, most of one for a feed item, and little more than the URL for a page saved by URL. - The live saved posts tests use the cached service, and check the list survives a new service on the same cache. - Relaunch against a database file, upgrading a cache that stopped at 0014, and an ignored timing test at the 1,000-key cap. - Swift tests that use the service the way an app does, through WordPressAPI and WordPressApiCache only.
- A load-more started during a refresh is stale: it no longer starts while the first page loads, and storing the first page bumps the stream version, so one already in flight is discarded instead of ending the list early. - A URL save that gets a 401, 403, 408 or 429 during import is a failure to retry, not a refusal kept on the device for good. - After a relaunch, this device's map of where keys are stored replaces the one built from the saved keys, so a URL no longer stored as its post stays that way. - Two imports at once send the saves once. - A refresh keeps a post whose unsave is still in flight, since the unsave can fail. - A failed page only marks the list as failed if no refresh started since.
…nd reads `import_local_saves` stored the device's copy of each post with `upsert`, where it wins, so an old title or image replaced what the saved list had already stored, until that page was fetched again. It now uses `ReaderPostRepository::fill_missing`, which only fills in fields the stored post lacks. A keys refresh rewrites every row of `reader_saved_keys`, and each row fired a relevant update, about 2,000 for a full list. The saved list doesn't read that table, and the state the refresh changes is written to `reader_saved_state` too, so the table is no longer one of the list's. `unsaved_before` is no longer stored. Its times are never after the refresh that adds them, so only a read already in flight can predate one, and a relaunch ends those. Pruning the stored list reads each post's identity rather than every column, including its HTML.
e1b7994 to
9ccab48
Compare
…ixes Saves and unsaves are idempotent, so a tap's request is sent even when the row matches what the server last said: the server may have changed since. That puts back a post unsaved on the web and saved again here before a sync, and unsaves a Jetpack post from its external view. A new tapped column marks a row whose tap isn't answered yet. From #1720 and #1729: - A key with an ID of 0 or an empty URL is refused with PostCannotBeSaved before it becomes a row, and an import leaves it out. An empty URL in the keys isn't stored as an alias. - The import fills in only what the saved list's copy of a post doesn't have. - A refresh writes only rows and state it changes, so one that changes nothing tells the saved list nothing. It fills in a row's date rather than replacing the list's. - A tap looks up only its post's row id, never the post. Also documents the lag gap as a known limit that read_token would close.
… unsave A key with an ID of 0, or an empty URL, writes out but can't be read back, so one in the state would make the whole stored state unreadable once #1729 persists it. `save_url`, `unsave_key` and the other writes now refuse one with `PostCannotBeSaved` before it becomes a write, and an import answers one with `invalid_input` without sending it. A keys entry with an empty `url` has none. A refresh now drops what can no longer matter: recent saves that read as unsaved with no write left to them, and where a key is stored when neither it nor what it's stored as is saved or in use. Past the 1,000 keys a saved post can be missing from them, so the map is kept whole. `ReaderSavePostResponse.resolved` reads as `Unknown` when the response leaves it out. Nothing reads it, so a save that worked no longer fails to parse.
…ixes Saves and unsaves are idempotent, so a tap's request is sent even when the row matches what the server last said: the server may have changed since. That puts back a post unsaved on the web and saved again here before a sync, and unsaves a Jetpack post from its external view. A new tapped column marks a row whose tap isn't answered yet. From #1720 and #1729: - A key with an ID of 0 or an empty URL is refused with PostCannotBeSaved before it becomes a row, and an import leaves it out. An empty URL in the keys isn't stored as an alias. - The import fills in only what the saved list's copy of a post doesn't have. - A refresh writes only rows and state it changes, so one that changes nothing tells the saved list nothing. It fills in a row's date rather than replacing the list's. - A tap looks up only its post's row id, never the post. Also documents the lag gap as a known limit that read_token would close.
…he (#1720) * Add ReaderSavedService to wp_mobile The saved posts API's reads can lag behind its writes, so an app that refetches after a save can briefly see the post unsaved again. `ReaderSavedService` applies each change straight away, undoes it if the request fails or is cancelled, and keeps it on top of what the server returns until the server has had time to catch up. The rules live in `state.rs` as plain code with the clock passed in: - Only a post's newest write decides its state, and only until its window ends; after that the server's list decides. An older write that finishes after a newer one has finished is dropped. - Each post's writes are kept in one list, by the key the server stores it under once that's known, so a post saved under another key still reads as saved and unsaving sends the stored key. - A refresh is judged by when it started, not when it lands: one that started inside a write's window may have read the server from before it. `model_tests.rs` checks the rules against an independent reference model through random interleavings of writes, failures, cancellations, stale and out-of-order refreshes, stored keys and URL spellings. A short run is part of `cargo test`; the deep run is opt-in. * Prototype: send a post's writes one at a time, and test against a fake server The saved state no longer guesses what the server holds. It relies on three facts: an answered write was applied, a read includes every write applied `MAX_READ_LAG` before it started, and a post's writes are applied in the order they're sent. - **One write per post at a time.** Each write waits its turn behind every unfinished earlier write that shares a key, so the server always ends up as the user last tapped. This replaces the `WriteId` ordering and "drop an older write that finishes later". - **Decided per key.** A key's newest write decides it until a read that started `MAX_READ_LAG` after the write finished has been applied. Time passing changes nothing on its own. - **Unsave sends every key** the post may be saved under, including the key the server stores it as. `post_not_found` on a key not known to be saved counts as unsaved. - **Stored keys are the server's word.** A write's response replaces the mapping, including removing it, and a refresh teaches the URL of a post saved by its IDs. - **Past the 1,000 keys**, a post the list hasn't shown is `Unknown`, not `NotSaved`. - **Imports** start their writes oldest first, so `recent_saves` is newest first. `model_tests.rs` is replaced by `fake_server_tests.rs`. It drives the real service against a fake API that's just a set of keys with a history, through random taps, response orders, failures, cancellations, saves from other devices and stale reads. It checks four rules against the user's taps or the fake's state: taps show, the server ends up as tapped, a quiet session settles on the server, and untouched posts show the newest read. * Keep the newest list read of a post, not the last to land A slow list read that started earlier replaced a newer one's record of a post, and a refresh that started between them then dropped it. Found by the deep fake-server run (13 of 20,000 sessions). * Keep a stored key when an unsave echoes the key it was sent Checked against the live API: deleting a URL that isn't saved echoes the URL, which says nothing about where the post is stored. Only a save's response now removes a mapping. The fake server answers deletes the way the live API does: it echoes the save it removed, a feed item resolves to its post, and deleting a key that isn't saved is a 200. * Replace the random fake-server tests with known starts, actions and end states The random sessions found bugs, but couldn't say what any one case should do. `scenario_tests.rs` replaces them with tests that each start from a known state, take one known action, and check an end state written out by hand. - `every_start_and_action` crosses the 11 states a post can be in (unknown or read, saved or not, changed elsewhere since, a write in flight, a write just answered, past the key limit) with 10 actions (save or unsave, answered or refused, a cancelled save, fresh, stale and out-of-order refreshes, the list loading, time passing). Each of the 110 rows gives the status, count, recent saves, what the server holds and the requests sent. A test checks every pair is in the table once. - Scenario tests cover what the table can't: taps reaching the server in order, Jetpack posts, URLs and RSS items stored under other keys, and the sequences where a stored key is learned mid-queue. The fake answers as the live API did on 2026-11-04. Each of eight deliberate breaks of the design fails at least one of these tests. * Send every write one at a time, and fix what review found A max-effort review of `be4aebed` found that writes to one post weren't always kept in order, that a cancelled Android call could leave the server opposite to the last tap, and that a just-saved post showed twice. Each finding was proven with a failing test. - **One queue for every write.** A tap waits for every earlier unfinished tap, whatever the post, so the order no longer depends on which keys the device has learned are one post. Writes are ordered by tap, so a key an unsave learns mid-queue takes its tap's place. - **Cancellation and lost answers.** A write cancelled after its request went out, or one that timed out or got an unreadable answer, may have been applied: it stands until a read can say, rather than being undone. On Android, writes should run in a scope that outlives the screen, since a request cancelled after sending can still land after the next one. - **Recent saves.** A post leaves `recent_saves` once the saved list shows it, so it isn't shown twice. Imports never enter it. - **List reads.** A list read is judged by when it started, like a refresh: it can show a post this device unsaved once it started `MAX_READ_LAG` after the unsave, and it stands until a refresh that started `MAX_READ_LAG` after it. Past the 1,000 keys, a refresh can't see what the list showed, so the list still says. - **The count** uses the `total` in each write's answer, so it's right past the key limit and before the first refresh, and counts each save once by the key it's stored under. - **Smaller fixes:** stored keys follow a chain, the write queue no longer grows, `decides()` and the per-key turns are gone, and the duplicate CHANGELOG entry is removed. `scenario_tests.rs` now crosses 14 starting states with 16 actions, 224 hand-written rows, and adds scenarios for the review's sequences. Each of 19 deliberate breaks of the design fails at least one test. * Stop treating the saved list as saved status, and fix what plan review found Reads do lag, but briefly (measured on the live API on 2026-11-05), so the 2-minute window stays. What changes: - The saved list no longer says a post is saved. Only the saved keys and this device's writes do. - Recent saves are their own list of save taps. A post leaves it once the saved list shows it, and it only shows while the post reads as saved. - A write the device gave up on stands for twice the window, and a read that includes a newer write to the key includes the older ones too. - Past 1,000 saves, a refresh keeps an answered write to a post the keys can't see. - The count only adjusts for writes after the one whose answer gave the total. - A failed write stands if it may have been applied (timeouts, connections lost mid-request, unreadable answers, 5xx), and is undone otherwise (offline, DNS, refused, TLS, 4xx). - An import takes one place in line, and starts each batch's writes when it sends the batch. * Fix the count after a refresh, and what else code review found - A refresh that started after a write's answer now gives the count from its own total and keys. It may already have writes sent after that answer, such as a save that timed out but was applied. - A refresh keeps a post's writes together while one to another of its keys may not be included yet, so a Jetpack unsave that partly timed out stays unsaved. - A list read that started before a refresh saying a post isn't saved hides the post. - Saving a URL known to be a saved post no longer counts one extra while in flight. - Past the 1,000 keys is judged by how many keys the server returned, not how many are left after normalizing. * Narrow list hiding to pruned unsaves, and fix two count cases from review - A list read is hidden behind a later refresh only for a post whose unsave that refresh included, not for any post the refresh doesn't have. Saved posts the keys haven't caught up with, and Jetpack posts the list returns by their feed item, show again. - Past the 1,000 keys, a refresh that may lag behind a write's answer no longer replaces the answer's total, since it can't count writes to posts it doesn't have. - A save not yet answered counts under the key the server stores it as, when the device knows it, so a feed item save given up on doesn't count twice. - Documents the count's remaining limits. * Hide a pruned unsave until reads include it, and drop the past-keys count rule - A post whose unsave a refresh pruned stays hidden from list reads that started before the unsave was included, not before the refresh. A post past the keys whose unsave never landed shows again in a list read late enough to include it. - A listed post stays hidden while any of its unsaves may be missing from the read, not only its newest write, so a Jetpack unsave that partly timed out stays hidden. - Reverts keeping the answered total past the 1,000 keys: it made the count wrong after a refresh that already had this device's timed-out write. A lagging refresh past the keys is documented as a limit instead. * Keep a pruned post hidden until reads include every unsave pruned with it A Jetpack unsave whose delete of one key timed out and whose other delete was answered is pruned together. The post now stays hidden from list reads that may predate the later of the two, not just the newest write's. * Fail an import batch whose results don't match its keys Results are matched to keys by position. A result missing from the middle shifted every later one onto the wrong key, so a saved post read as unsaved and another was recorded as stored under its key. A batch with a different number of results than keys now fails with `UnexpectedImportResults`, and its saves stand until a refresh can include them. * Refuse keys the API can't take, and stop the state growing with every unsave A key with an ID of 0, or an empty URL, writes out but can't be read back, so one in the state would make the whole stored state unreadable once #1729 persists it. `save_url`, `unsave_key` and the other writes now refuse one with `PostCannotBeSaved` before it becomes a write, and an import answers one with `invalid_input` without sending it. A keys entry with an empty `url` has none. A refresh now drops what can no longer matter: recent saves that read as unsaved with no write left to them, and where a key is stored when neither it nor what it's stored as is saved or in use. Past the 1,000 keys a saved post can be missing from them, so the map is kept whole. `ReaderSavePostResponse.resolved` reads as `Unknown` when the response leaves it out. Nothing reads it, so a save that worked no longer fails to parse. * Add account-scoped Reader tables to the cache Adds wordpress_com_accounts, reader_posts, reader_streams, reader_stream_items, reader_saved_state and reader_saved_local_only (migrations 0015-0018), their repositories, and WpApiCache::remove_wordpress_com_account, which deletes every Reader row for an account through ON DELETE CASCADE. * Keep ReaderSavedService's state and the saved list in the cache ReaderSavedService now takes a WpApiCache and the account's user ID. It stores what it knows after every change, so status() answers from disk after a relaunch and a write made just before the app quit still wins over a lagging refresh. Adds ReaderSavedPostsCollection (saved_posts()), import_local_saves and local_only_keys, and the Swift makeReaderSavedService(source:cache:userID:) and WordPressApiCache.removeWordpressComAccount(userId:). * Store the saved keys in a table instead of a JSON blob reader_saved_keys holds each key from the newest refresh with its save ID, date saved and URL, as GET /wpcom/v2/read/saved/keys returned it. reader_saved_state keeps the refresh's time and counts alongside the device's own writes, which stay a versioned JSON blob. A later full sync can build on the keys table without another request, and the stored URLs let a relaunch find a post by its URL even if the device's own state can't be read. * Test the saved posts cache against WordPress.com, a database file and the bindings - A recorded read/saved response, with one save of each kind, shows the list sends a whole Reader post for a WordPress.com post, most of one for a feed item, and little more than the URL for a page saved by URL. - The live saved posts tests use the cached service, and check the list survives a new service on the same cache. - Relaunch against a database file, upgrading a cache that stopped at 0014, and an ignored timing test at the 1,000-key cap. - Swift tests that use the service the way an app does, through WordPressAPI and WordPressApiCache only. * Fix what review found in the saved posts cache - A load-more started during a refresh is stale: it no longer starts while the first page loads, and storing the first page bumps the stream version, so one already in flight is discarded instead of ending the list early. - A URL save that gets a 401, 403, 408 or 429 during import is a failure to retry, not a refusal kept on the device for good. - After a relaunch, this device's map of where keys are stored replaces the one built from the saved keys, so a URL no longer stored as its post stays that way. - Two imports at once send the saves once. - A refresh keeps a post whose unsave is still in flight, since the unsave can fail. - A failed page only marks the list as failed if no refresh started since. * Keep the saved list's copy on import, and cut what a refresh writes and reads `import_local_saves` stored the device's copy of each post with `upsert`, where it wins, so an old title or image replaced what the saved list had already stored, until that page was fetched again. It now uses `ReaderPostRepository::fill_missing`, which only fills in fields the stored post lacks. A keys refresh rewrites every row of `reader_saved_keys`, and each row fired a relevant update, about 2,000 for a full list. The saved list doesn't read that table, and the state the refresh changes is written to `reader_saved_state` too, so the table is no longer one of the list's. `unsaved_before` is no longer stored. Its times are never after the refresh that adds them, so only a read already in flight can predate one, and a relaunch ends those. Pruning the stored list reads each post's identity rather than every column, including its HTML. * Keep saved posts in one table and send them from an outbox Replaces state.rs, the write log, the 60s window and recent saves with one row per save in reader_saved_posts: what the user wants, what the server last said, and whether a request is in doubt. One lane sends what the server doesn't have yet, reads the keys, and loads list pages, in order. A request without an answer waits for a sync to say what the server has, then is sent again if needed. API changes: save and unsave return an outcome; sync() replaces refresh; status and saved_count return Result; is_recent is is_pending; the import report gains pending; list_posts, recent_saves, local_only_keys and StaleLoadMore are gone. A 403 is a refusal only for saved_limit_reached. The scenario table and the other tests are ported to the new API, with each changed expectation tagged with its reason. * Send every tap's request, and carry over #1720's and #1729's latest fixes Saves and unsaves are idempotent, so a tap's request is sent even when the row matches what the server last said: the server may have changed since. That puts back a post unsaved on the web and saved again here before a sync, and unsaves a Jetpack post from its external view. A new tapped column marks a row whose tap isn't answered yet. From #1720 and #1729: - A key with an ID of 0 or an empty URL is refused with PostCannotBeSaved before it becomes a row, and an import leaves it out. An empty URL in the keys isn't stored as an alias. - The import fills in only what the saved list's copy of a post doesn't have. - A refresh writes only rows and state it changes, so one that changes nothing tells the saved list nothing. It fills in a row's date rather than replacing the list's. - A tap looks up only its post's row id, never the post. Also documents the lag gap as a known limit that read_token would close. * Update the Swift wrapper for the saved posts outbox Exports ReaderSavedOutcome, describes sync() and sharing one instance in makeReaderSavedService's doc, and moves ReaderSavedServiceTests to the throwing status and savedCount. Adds a test that a save made offline is pending and shows at once, with requests failed by a URLProtocol stub. * Check the update hook installs in the refresh hook test * Fix what the outbox review found A tap made during a sync no longer follows the sync's keys, so it can't be sent as the opposite request. A refused request only undoes the row if no tap was made since it was sent. A request the server answers for that post alone, like a 403, skips the row for the round instead of stopping every later write. Past the 1,000 keys, a row in doubt that the keys can't decide is sent again, and a row whose date only came from a tap is left alone, since saving a post already saved keeps its old date on the server (checked on the live API on 2026-11-13). A Jetpack post the list returns by its feed item is matched to its row by URL, so a sync keeps it in the list. Unsaving a Jetpack post also sends the delete for its feed item, which can be a separate older save. A local-only save the keys return is no longer local-only. A refusal is kept only while a tap waits to hear it. * Describe the outbox design in the changelog * Import saves any time, and keep saves past the cap waiting for room `import_local_saves` ran once per account and kept a save the server refused on this device for good: never sent, even after an unsave made room, and reported as `Synced` if tapped. The apps also need to import a list read from a file whenever the user picks one. `import_saves` replaces it. Each entry is a save: one already saved stays as it is and one unsaved is saved again, so importing a list twice sends nothing. A refusal undoes it, as it does a tap's. A save past the account's save cap is undone if a tap is waiting on it, which now fails with `ReaderSavedError::TooManySaves`. Any other, such as an import's or an offline tap's, stays saved and waits for room. A send round tries waiting saves last, after every unsave, and tries the oldest alone: if it's refused again the rest wait, so a full account costs one request per sync. `sync()` returns `TooManySaves` while any wait, `saves_waiting_for_room()` counts them, and `ReaderSavedListItem.is_waiting_for_room` marks them. Unsaving one removes it without a request, as the server never had it. Migration 0018 isn't on trunk, so `local_only` becomes `waiting_for_room` and `imported_local_saves` goes, with no new migration. * Fix what the review of the outbox on e1da604 found From crazytonyli's review in #1720: - Unsaving a save waiting for room sends the unsave. It used to remove the row without a request, which read `Unknown` and lost the unsave if another device had saved the post since. The unsave stops waiting for room, as it needs none, and a `post_not_found` answer is the unsave done. - Bulk results are matched to the keys they name, so a reordered response no longer merges two saves into one row. A result for a key the server resolved to another, or a rejected one, answers the key in its place. Two results for one row leave the batch waiting for a sync, with the new `ReaderSavedError::UnmatchedImportResults`, as a wrong result count does. - A bulk batch ends at the first row it can't take, such as a URL, so a mixed import reaches the server in the order it was saved. - Past the 1,000 keys, a sync decides only rows newer than the oldest key returned. One with the same date may be the next key. The scenario tests' fake server can now date a key later than the rest. * Keep every URL the server stores as a saved post The server stores several URLs of one post as the post. On the live API on 2026-11-15, a post's own domain, its wordpress.com address, its `http` address and its `?p=` link all saved as the post's key. A row kept one URL, so saving a post by a second URL left that URL reading `NotSaved`, and once a save had taken the column, the keys couldn't add the post's main address either. `reader_saved_post_urls` holds them instead of `reader_saved_posts.url_key`: one row per URL, deleted with its saved post. `DbReaderSavedRow.url_key` becomes `url_keys`. Migration 0018 isn't on trunk, so it changes in place. A `wp.me` short link isn't resolved, and saves as a URL of its own, so the server can hold two saves of one post. That's left to the server.
Description
Keeps
ReaderSavedService's state and the saved list inWpApiCache, under the WordPress.com account, so saved posts survive a relaunch and an app can show the list offline. This is phase 1 of moving Reader storage out of the apps: Saved Posts first, then the other streams on the same tables.Stacked on #1720.
status()answers from disk. Before the first refresh it reads what the last refresh and this device's writes said, notUnknown.WpApiCache::remove_wordpress_com_accountremoves every Reader row for the account throughON DELETE CASCADE.Changes
Cache (
wp_mobile_cache, migrations 0015–0018)wordpress_com_accounts: account-level data belongs to an account rather than a site. Every Reader table references it withON DELETE CASCADE, which a new test enforces.reader_posts: one row per post per account, keyed by its normalized saved key (post:B:P,feed-item:F,url:U). Every column but the identity is nullable, and an upsert doesn't overwrite a field withNULL, so a source that sends part of a post doesn't erase what another sent. It has the columns the later Reader streams need, so they won't need a migration.reader_streams/reader_stream_items: a stream's paging, sync state and order. The saved list is thesavedstream, ordered bydate_saved.reader_saved_keys: every key fromGET /wpcom/v2/read/saved/keys, with its save ID,date_savedand URL. A later full sync can join it againstreader_poststo find the posts it hasn't fetched, without another request.reader_saved_state: when that refresh started and its counts, plus a versioned JSON blob of this device's writes that may still override the server. The blob only matters for a few minutes after a write. Keeping it out of the schema means the state rules can keep changing without migrations. One that can't be read is ignored, which only costs the protection for writes made just before the app quit.reader_saved_local_only: saves the server refused on import, kept on the device.Service (
wp_mobile)ReaderSavedService::newtakes the cache and the account'sWpComUserId, and returns aResult. It stores what it knows after every change.saved_posts()returnsReaderSavedPostsCollection:load_itemsreads from the cache,refreshloads the keys and page 1, andload_next_pagefollowspage_handle. Recent saves come first, a recent unsave hides at once, and posts past page 1 stay after a refresh unless they're known to be unsaved.import_local_savesmoves an app's local saves to the account once. It's the iOS import plan, moved to Rust: dedupe, bulk keys, URLs one at a time. A key the server refuses stays saved on the device, reads asSavedinstatus(), and shows in the list.Swift
WPComApiClient.makeReaderSavedService(source:cache:userID:)andWordPressApiCache.removeWordpressComAccount(userId:), plus typealiases for the new types.What
read/savedreally returnsThe plan assumed the saved list sends little more than keys. It doesn't. We recorded it on 2026-11-07 with one save of each kind: a WordPress.com post comes back as a whole Reader post, and a feed item as most of one (title, content, dates, site, feed). Only a page saved by URL is just its identity, URL and author. The response is checked in as
wp_api/tests/wpcom/reader_saved/list_recorded.json, with the author, content and site details replaced.ReaderSavedPostreads a subset of those fields, so the cache stores that subset for now. Parsing more of them, such as the site icon, tags and comment count, is a follow-up.Test plan
cargo test -p wp_mobile -p wp_mobile_cache -p wp_api --lib: all pass (384, 174, 2399). All of Add ReaderSavedService to wp_mobile, with saved posts kept in the cache #1720's service tests pass unchanged against an in-memory cache.saved_list_timings, ignored by default): refresh ~5 ms, a save ~0.5 ms,load_itemsfor 1,001 items ~3 ms, loading the state at launch ~0.8 ms, a 40-post page ~2 ms.cargo run -p wp_com_e2e -- reader_saved(4 passed), including a new test that refreshes the collection and reads it back through a second service on the same cache.make xcframework-only-macos,swift build,BUILDKITE=1 swift test(109 passed, including the newReaderSavedServiceTests, which use onlyWordPressAPIandWordPressApiCacheas an app does).:api:kotlin:compileKotlin).cargo clippy --workspace --all-targets --all-features -D warnings,cargo fmt --check,swift format lint --strict.Changelog
CHANGELOG.mdunder## [Unreleased], using the Keep a Changelog categories (Added,Changed,Deprecated,Removed,Fixed,Security). Prefix breaking changes with**BREAKING:**.