Repository navigation
perf: keep the collaboration edge state in the presence table - #514
Conversation
|
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. |
🛝 WordPress PlaygroundsBuilt from 2d40f5d
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #514 +/- ##
============================================
+ Coverage 95.79% 96.04% +0.25%
- Complexity 255 258 +3
============================================
Files 21 21
Lines 3066 3111 +45
============================================
+ Hits 2937 2988 +51
+ Misses 129 123 -6
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
REST sanitization can bypass reserved-ID validation, and the CLI no longer exposes raw rows as required.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (4)
What changed in this PR
Moves collaboration edge state from transients into reserved presence-table rows, reducing heartbeat option writes.
Changes:
- Stores collaboration counts in
_collabrows with refresh and expiry behavior. - Filters reserved rows from participant-facing APIs and REST endpoints.
- Adds validation, documentation, and regression tests.
| File | Description |
|---|---|
.github/CONTRIBUTING.md |
Updates private-function example. |
README.md |
Documents reserved IDs and collaboration state. |
presence-api.php |
Defines the reserved prefix. |
includes/heartbeat.php |
Persists collaboration state in presence rows. |
includes/functions.php |
Adds raw/client row helpers and filtering. |
includes/class-wp-rest-presence-controller.php |
Filters and rejects reserved IDs. |
tests/test-heartbeat.php |
Tests collaboration-row behavior. |
tests/test-functions.php |
Tests active-room filtering. |
tests/test-rest-controller.php |
Tests REST filtering and validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.



Fixes #512
Without a persistent object cache this was an option write per heartbeat per
collaborating room, and the plugin's only transient.
Two deviations from the issue:
wp_get_active_rooms()needed filtering as well. It is not in the issue'scost table, and the REST rooms endpoint reads it with hydration off, where
the reserved row counts as a user.
_transient_wp_presence_collab_*options are left to core. They expireon the presence TTL and
delete_expired_transientssweeps them daily, so theupgrade routine the issue asks for would duplicate core.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Assisting with implementation and testing