Repository navigation
Conversation
…uest. Without `author`, the collection still loaded every revision of the parent through wp_get_post_revisions() and filtered out the autosaves, so memory grew with revision count, including for the editor's preload. Run the direct autosave query for every request and have `author` only add `author__in`. Match on `post_name__in` rather than `name`, which made the query singular, and suppress query filters to keep the isolation the get_posts() path had. Apply the per-author dedupe to both paths, and update the `@since` tags to 7.3.0. See #62057. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Add the parameter, return and data provider types suggested in review, type the REST response data and created IDs, and use array_first() for the newest revision. Assert that wp_update_post() returns the post ID and that the newest revision is the ordinary one, not an autosave. Also drop a blank line inside the per-author dedupe loop. See #62057. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stacked on WordPress#7555. Trac ticket: https://core.trac.wordpress.org/ticket/62057
This is the same change as
62057.6.patchon the ticket, as a single commit on top ofticket/62057so it can be reviewed or merged as a delta.What changes
authoronly addsauthor__in. Withoutauthor, the collection previously still loaded every revision throughwp_get_post_revisions(), which is what core's editor preload requests today.post_name__ininstead ofname, so the query isn't singular.suppress_filtersset totrue, preserving the isolation the oldget_posts()path had. Withfalse, a globalposts_where/posts_orderbyfilter applied to theauthorlookup.@since 7.3.0onget_items()andget_collection_params(); staleper_pagewording removed from a test docblock.test_get_items_is_isolated_from_query_filters(unscoped and author scoped).Before / after
Measured at svn r64336. Retained memory is the
memory_get_usage()delta across onerest_do_request()with caches flushed, one PHPUnit process per row. Each post has 3 autosaves plus N ordinary revisions, about 200KB each. Single run per row.authorauthorauthorauthortest_get_items_is_isolated_from_query_filtersagainst each controller:posts_whereran)Testing
Run in the svn checkout at r64336 with WordPress#7555 plus this commit applied:
phpunit --filter WP_Test_REST_Autosaves_Controller: OK (55 tests, 275 assertions)Earlier, with
62057.6.patchapplied:tests/phpunit/tests/rest-api/wpRestTemplateAutosavesController.phpOK (36 tests, 2 skipped) andWP_Test_REST_Schema_InitializationOK (2 tests).AI use
AI assistance: Yes. Tool(s): Claude Code. Used for: reviewing WordPress#7555, writing this change and its test, running the tests and memory measurements above, and drafting this description.
I have reviewed every line and can speak to the approach.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
🤖 Generated with Claude Code