fix(plugin-sdk-value): guard keyed markDefs unsets against store-referenced definitions - #2984
fix(plugin-sdk-value): guard keyed markDefs unsets against store-referenced definitions#2984christianhg wants to merge 1 commit into
markDefs unsets against store-referenced definitions#2984Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 5bae8ff The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📦 Bundle Stats —
|
| Metric | Value | vs main (0c56f51) |
|---|---|---|
| Internal (raw) | 807.1 KB | - |
| Internal (gzip) | 179.6 KB | - |
| Bundled (raw) | 1.41 MB | - |
| Bundled (gzip) | 345.2 KB | - |
| Import time | 96ms | +0ms, +0.3% |
@portabletext/editor/behaviors
| Metric | Value | vs main (0c56f51) |
|---|---|---|
| Internal (raw) | 4.2 KB | - |
| Internal (gzip) | 1.4 KB | - |
| Bundled (raw) | 3.9 KB | - |
| Bundled (gzip) | 1.3 KB | - |
| Import time | 2ms | +0ms, +1.5% |
@portabletext/editor/plugins
| Metric | Value | vs main (0c56f51) |
|---|---|---|
| Internal (raw) | 5.2 KB | - |
| Internal (gzip) | 1.8 KB | - |
| Bundled (raw) | 5.0 KB | - |
| Bundled (gzip) | 1.7 KB | - |
| Import time | 7ms | +0ms, +1.6% |
@portabletext/editor/selectors
| Metric | Value | vs main (0c56f51) |
|---|---|---|
| Internal (raw) | 96.4 KB | - |
| Internal (gzip) | 22.3 KB | - |
| Bundled (raw) | 92.5 KB | - |
| Bundled (gzip) | 21.0 KB | - |
| Import time | 8ms | -0ms, -0.3% |
@portabletext/editor/traversal
| Metric | Value | vs main (0c56f51) |
|---|---|---|
| Internal (raw) | 40.6 KB | - |
| Internal (gzip) | 10.6 KB | - |
| Bundled (raw) | 41.1 KB | - |
| Bundled (gzip) | 10.6 KB | - |
| Import time | 6ms | +0ms, +2.8% |
@portabletext/editor/utils
| Metric | Value | vs main (0c56f51) |
|---|---|---|
| Internal (raw) | 34.1 KB | - |
| Internal (gzip) | 8.7 KB | - |
| Bundled (raw) | 32.5 KB | - |
| Bundled (gzip) | 8.5 KB | - |
| Import time | 6ms | +0ms, +0.7% |
🗺️ . · ./behaviors · ./plugins · ./selectors · ./traversal · ./utils · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @portabletext/markdown
Compared against main (0c56f517)
| Metric | Value | vs main (0c56f51) |
|---|---|---|
| Internal (raw) | 47.6 KB | - |
| Internal (gzip) | 9.9 KB | - |
| Bundled (raw) | 343.0 KB | - |
| Bundled (gzip) | 96.7 KB | - |
| Import time | 37ms | -2ms, -4.5% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
9c35864 to
867129c
Compare
…ferenced definitions An upcoming editor change emits normalization's unused-definition prunes as item-keyed `unset` patches instead of whole-array sets. `toMergeableMarkDefsPatches` only decomposes whole-array sets, so those unsets would pass through without the referenced-keys guard: a diverged client (its span `marks` overwritten by the other client's flush, its own definition now locally unused) would prune a definition the store's spans still reference, orphaning the other client's annotation at the server. Keyed `markDefs` unsets now go through the same store-side referenced-keys check as decomposed sets and are dropped while the store's spans reference the definition. A dropped prune leaves an unused definition behind at worst; normalization in a later converged session removes it for real. Against the current editor's emission (whole-array sets only) the guard is inert; it ships ahead so a consumer upgrading the editor without upgrading this plugin is never exposed.
867129c to
5bae8ff
Compare
|
Closing as part of the open-PR cleanup, with the work verified and preserved: rebased onto today's |
Preparatory extraction from #2982, which changes the editor to emit normalization's unused-annotation-definition prunes as item-keyed
unsetpatches instead of whole-arraymarkDefssets. Under that emission, a client that has diverged from the store (its spanmarksoverwritten by another client's flush, its own definition now locally unused) prunes a definition the store's spans still reference.toMergeableMarkDefsPatchesonly decomposes whole-array sets, so the keyed unset passed through without the referenced-keys guard and orphaned the other client's annotation at the server; the collision-matrix link scenarios in this package caught exactly that (orphan mark (no markDef)) when run against #2982's emission.Keyed
markDefsunsets now route through the same store-side referenced-keys check as decomposed whole-array sets, and are dropped while the store's spans reference the definition. A dropped prune leaves an unused definition behind at worst, which normalization in a later converged session removes for real, strictly better than a dangling mark.This lands and releases ahead of #2982 because of the published peer range: the plugin's
^7.xpeer accepts an editor with the new emission, so a consumer upgrading@portabletext/editorwithout upgrading this plugin would run the orphan race with no guard. Shipping the guard first closes that window. Against current editor releases the new branch is inert (keyedmarkDefsunsets don't occur), which is also why all suites here pass unchanged onmain's emission; the collision-matrix runs that exercise the guard live in #2982, which stacks on this.