You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(document-api): soften metadata.remove atomicity wording + add story (SD-3104)
The metadata.remove contract claimed 'both succeed or neither does,' but
the adapter writes to two separate state systems (ProseMirror doc + OOXML
package) with no shared commit primitive. The adapter resolves the target
up-front so the common failure mode lands before any state change, but a
crash strictly between the two writes can leave a dangling payload.
Wording now reflects that.
Also adds tests/doc-api-stories/tests/metadata/all-commands.ts: a real
Editor + DOCX round-trip story covering attach / list / get / resolve /
update / remove. Goes through the SDK + CLI like the rest of the doc-api
stories. Catches the gap that smoke unit tests cannot: that the adapter
actually wraps a text range, writes the payload, and resolves the anchor
back to a SelectionTarget on a live editor.
Copy file name to clipboardExpand all lines: apps/docs/document-api/reference/index.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -641,5 +641,5 @@ The tables below are grouped by namespace.
641
641
| <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><ahref="/document-api/reference/metadata/list"><code>metadata.list</code></a></span> | <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.metadata.list(...)</code></span> | List anchored-metadata entries in the document, optionally filtered by consumer namespace and/or a `within` selection (returns only entries whose anchor overlaps `within`). |
642
642
| <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><ahref="/document-api/reference/metadata/get"><code>metadata.get</code></a></span> | <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.metadata.get(...)</code></span> | Get a single anchored-metadata entry by id, including its JSON payload. |
643
643
| <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><ahref="/document-api/reference/metadata/update"><code>metadata.update</code></a></span> | <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.metadata.update(...)</code></span> | Replace the JSON payload of an existing anchored-metadata entry. Replace semantics; no merge. The anchor is left untouched. |
644
-
| <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><ahref="/document-api/reference/metadata/remove"><code>metadata.remove</code></a></span> | <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.metadata.remove(...)</code></span> |Atomically remove an anchored-metadata entry. Strips the anchor SDT wrapper (its content stays in the document) and deletes the payload entry from the Storage Part; both succeed or neither does. When the backing part has no remaining entries, the part itself is removed. |
644
+
| <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><ahref="/document-api/reference/metadata/remove"><code>metadata.remove</code></a></span> | <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.metadata.remove(...)</code></span> |Remove an anchored-metadata entry. Strips the anchor content-control wrapper (its content stays in the document) and deletes the payload entry from the Storage Part. In v1 these writes are sequenced, not transactional: the adapter resolves the target up-front so missing-target failures land before any state change, but a crash strictly between the two writes can leave a dangling payload. When the backing part has no remaining entries, the part itself is removed. |
645
645
| <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><ahref="/document-api/reference/metadata/resolve"><code>metadata.resolve</code></a></span> | <spanstyle={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.metadata.resolve(...)</code></span> | Find where an anchored-metadata entry is anchored in the document. Returns the SelectionTarget covering the anchor content. |
Copy file name to clipboardExpand all lines: apps/docs/document-api/reference/metadata/remove.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
2
title: metadata.remove
3
3
sidebarTitle: metadata.remove
4
-
description: Atomically remove an anchored-metadata entry. Strips the anchor SDT wrapper (its content stays in the document) and deletes the payload entry from the Storage Part; both succeed or neither does. When the backing part has no remaining entries, the part itself is removed.
4
+
description: "Remove an anchored-metadata entry. Strips the anchor content-control wrapper (its content stays in the document) and deletes the payload entry from the Storage Part. In v1 these writes are sequenced, not transactional: the adapter resolves the target up-front so missing-target failures land before any state change, but a crash strictly between the two writes can leave a dangling payload. When the backing part has no remaining entries, the part itself is removed."
5
5
---
6
6
7
7
{/* GENERATED FILE: DO NOT EDIT. Regenerate via `pnpm run docapi:sync`. */}
8
8
9
9
## Summary
10
10
11
-
Atomically remove an anchored-metadata entry. Strips the anchor SDT wrapper (its content stays in the document) and deletes the payload entry from the Storage Part; both succeed or neither does. When the backing part has no remaining entries, the part itself is removed.
11
+
Remove an anchored-metadata entry. Strips the anchor content-control wrapper (its content stays in the document) and deletes the payload entry from the Storage Part. In v1 these writes are sequenced, not transactional: the adapter resolves the target up-front so missing-target failures land before any state change, but a crash strictly between the two writes can leave a dangling payload. When the backing part has no remaining entries, the part itself is removed.
12
12
13
13
- Operation ID: `metadata.remove`
14
14
- API member path: `editor.doc.metadata.remove(...)`
Copy file name to clipboardExpand all lines: apps/docs/document-engine/sdks.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -737,7 +737,7 @@ The SDKs expose all operations from the [Document API](/document-api/overview) p
737
737
|`doc.metadata.list`|`metadata list`| List anchored-metadata entries in the document, optionally filtered by consumer namespace and/or a `within` selection (returns only entries whose anchor overlaps `within`). |
738
738
|`doc.metadata.get`|`metadata get`| Get a single anchored-metadata entry by id, including its JSON payload. |
739
739
|`doc.metadata.update`|`metadata update`| Replace the JSON payload of an existing anchored-metadata entry. Replace semantics; no merge. The anchor is left untouched. |
740
-
|`doc.metadata.remove`|`metadata remove`|Atomically remove an anchored-metadata entry. Strips the anchor SDT wrapper (its content stays in the document) and deletes the payload entry from the Storage Part; both succeed or neither does. When the backing part has no remaining entries, the part itself is removed. |
740
+
|`doc.metadata.remove`|`metadata remove`|Remove an anchored-metadata entry. Strips the anchor content-control wrapper (its content stays in the document) and deletes the payload entry from the Storage Part. In v1 these writes are sequenced, not transactional: the adapter resolves the target up-front so missing-target failures land before any state change, but a crash strictly between the two writes can leave a dangling payload. When the backing part has no remaining entries, the part itself is removed. |
741
741
|`doc.metadata.resolve`|`metadata resolve`| Find where an anchored-metadata entry is anchored in the document. Returns the SelectionTarget covering the anchor content. |
742
742
|`doc.insertTab`|`insert tab`| Insert a real Word tab node at a collapsed text insertion point. Accepts the same target/ref shortcuts as insert, but only for point inserts. |
743
743
|`doc.insertLineBreak`|`insert line-break`| Insert a real Word line-break node at a collapsed text insertion point. Accepts the same target/ref shortcuts as insert, but only for point inserts. |
@@ -1215,7 +1215,7 @@ The SDKs expose all operations from the [Document API](/document-api/overview) p
1215
1215
|`doc.metadata.list`|`metadata list`| List anchored-metadata entries in the document, optionally filtered by consumer namespace and/or a `within` selection (returns only entries whose anchor overlaps `within`). |
1216
1216
|`doc.metadata.get`|`metadata get`| Get a single anchored-metadata entry by id, including its JSON payload. |
1217
1217
|`doc.metadata.update`|`metadata update`| Replace the JSON payload of an existing anchored-metadata entry. Replace semantics; no merge. The anchor is left untouched. |
1218
-
|`doc.metadata.remove`|`metadata remove`|Atomically remove an anchored-metadata entry. Strips the anchor SDT wrapper (its content stays in the document) and deletes the payload entry from the Storage Part; both succeed or neither does. When the backing part has no remaining entries, the part itself is removed. |
1218
+
|`doc.metadata.remove`|`metadata remove`|Remove an anchored-metadata entry. Strips the anchor content-control wrapper (its content stays in the document) and deletes the payload entry from the Storage Part. In v1 these writes are sequenced, not transactional: the adapter resolves the target up-front so missing-target failures land before any state change, but a crash strictly between the two writes can leave a dangling payload. When the backing part has no remaining entries, the part itself is removed. |
1219
1219
|`doc.metadata.resolve`|`metadata resolve`| Find where an anchored-metadata entry is anchored in the document. Returns the SelectionTarget covering the anchor content. |
1220
1220
|`doc.insert_tab`|`insert tab`| Insert a real Word tab node at a collapsed text insertion point. Accepts the same target/ref shortcuts as insert, but only for point inserts. |
1221
1221
|`doc.insert_line_break`|`insert line-break`| Insert a real Word line-break node at a collapsed text insertion point. Accepts the same target/ref shortcuts as insert, but only for point inserts. |
'Atomically remove an anchored-metadata entry. Strips the anchor SDT wrapper (its content stays in the document) and deletes the payload entry from the Storage Part; both succeed or neither does. When the backing part has no remaining entries, the part itself is removed.',
6414
+
'Remove an anchored-metadata entry. Strips the anchor content-control wrapper (its content stays in the document) and deletes the payload entry from the Storage Part. In v1 these writes are sequenced, not transactional: the adapter resolves the target up-front so missing-target failures land before any state change, but a crash strictly between the two writes can leave a dangling payload. When the backing part has no remaining entries, the part itself is removed.',
6415
6415
expectedResult: 'Returns an AnchoredMetadataMutationResult with the removed entry id on success or a failure.',
0 commit comments