Automattic / Automattic/cortext

Sync collection entries

Open
#166 0 comments 0 reactions 0 assignees View on GitHub
area: collaboration
Dominant language
JavaScript
Stars
51
Forks
2
Avg merge
3h 12m
Merged PRs (30d)
8

Description

## Depends on

* #163 (DataView core-data migration)
* #164 (spike)

## Goal

Editors working on entries in the same DataView merge their changes per field instead of overwriting each other.

## Scope (locks in after the spike)

* Register `_crdt_document` meta on each dynamic entry CPT in `CollectionEntries.php`.
* If the auto-applied post-type config doesn't cover non-block CPTs, write a custom `SyncConfig` for entries.
* Hook entry CRDT invalidation into the same path that re-registers field meta in `CollectionEntries::register_field_meta`. On schema mutation, clear `_crdt_document` on every entry of that collection so they reseed from canonical post meta.

## Constraint

Invalidation only clears `_crdt_document`. It never touches canonical `field-{$field_id}` entry meta.

## Acceptance

* Two browsers editing different fields of the same entry merge cleanly.
* Two browsers editing the same field land on a deterministic merged value.
* Adding a field while a second client has an entry open doesn't corrupt that entry's Yjs state on reload.
* Removing a field strips its key from all entry CRDT docs.
* After invalidation, all canonical `field-{id}` meta on the affected entries is unchanged. PHP test asserts this.
* Playwright tests cover the concurrent edit and schema-mutation reload paths.

---

*This issue is the result of a guided back and forth between Opus 4.7 and GPT 5.5.*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.