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
* feat(document-api): comment reopen lifecycle inverse (SD-2789)
Implements the missing inverse of `comments.patch({ status:
'resolved' })` so resolve <-> reopen round-trips both at the engine
level and across DOCX. Surfaced on the public Document API as
`comments.patch({ commentId, status: 'active' })`.
Resolve removes the live `comment` mark and inserts
`commentRangeStart` / `commentRangeEnd` anchor nodes around the
same range. Reopen mirrors that: matches anchor nodes by `w:id`,
pairs them in document order, re-inserts the comment mark with
`(commentId, importedId, internal)` attrs, and deletes the anchor
nodes. The `internal` flag falls back to the value stamped on
`commentRangeStart` when no override is provided so import-resolved
comments (with `w15:done="1"`) reopen without losing the flag; the
plan-engine handler reads the entity store value when present and
forwards it as the override path.
Engine
- `reopenCommentById` in `comments-helpers.js` — symmetric inverse
of `resolveCommentById`. Maps positions through `tr.mapping` so
mark inserts and node deletes stay in sync; processes deletes
in descending order to avoid position drift.
- `reopenComment` editor command in `comments-plugin.js`.
Document API
- `ReopenCommentInput` type alongside `ResolveCommentInput`.
- `CommentsPatchInput.status` widened to `'resolved' | 'active'`.
- `validatePatchCommentInput` accepts both values.
- `executeCommentsPatch` routes `status: 'active'` to
`adapter.reopen`.
- `CommentsAdapter.reopen` interface method added.
- Public re-export from the `@superdoc/document-api` barrel.
Adapter
- `reopenCommentHandler` in `comments-wrappers.ts` mirrors
`resolveCommentHandler`: short-circuits to NO_OP when neither
the entity store nor the doc anchors indicate a resolved state,
flips `isDone: false` and clears `resolvedTime` on success.
- Wired into `createCommentsWrapper`.
- `'reopenComment'` added to the `'comments.patch'` capability
list so feature detection still produces a single value for the
operation.
Tests
- Engine-level: reopen restores mark + removes anchors; honors
`internal` from anchor; honors explicit `internal` override;
no-op when not resolved.
- Doc-API: validator accepts `'active'`, rejects others; routes
to `adapter.reopen` not `adapter.resolve`.
- Capability registry test stub gets `reopenComment`.
Generated artifacts
- SDK contract regenerated via `pnpm run generate:all`. Only
formatter normalization landed in `intent-dispatch.ts` —
operation count unchanged.
Out of scope
- Audit history of resolve/reopen events.
- Reopening a deleted comment (delete is irreversible).
- Threaded reply resolution semantics (root only).
- Lab cleanup in `examples/headless/dropin-assessment` —
will land in a follow-up PR alongside the SD-2790 ui.comments
consumer migration.
* fix(document-api): widen comments.patch.status JSON schema to active (PR #2987 review)
The TypeScript type for `CommentsPatchInput.status` was widened to
`'resolved' | 'active'` in the prior commit, but the contract JSON
schema in `contract/schemas.ts` still enumerated only `['resolved']`.
After `generate:all`, the SDK / CLI / MCP / tool-catalog clients
that hydrate from the contract schema would have rejected
`status: 'active'`, leaving reopen reachable only from direct
TypeScript callers — not the documented contract surface.
Widens the input schema's enum to `['resolved', 'active']` and
extends the description to call out the lifecycle-inverse semantics
so contract-driven generators (Mintlify reference, OpenAI tool
schema, Python SDK) all see the same shape as the typed surface.
Output schemas (`commentInfoSchema`, `commentDomainItemSchema`, the
listing fragment) keep `['open', 'resolved']` — those describe
*states a comment can be in*, not *transitions a caller can
request*. Two intentionally different vocabularies: input is
imperative (`'active'` = "reopen this"), output is the resulting
state (`'open'`).
Regenerated artifacts via `pnpm run generate:all`:
- `apps/docs/document-api/reference/comments/patch.mdx` —
reference doc now lists both enum values + describes reopen.
- `_generated-manifest.json` — manifest hash refresh.
* fix(super-editor): add reopenComment to CommentCommands typings (PR #2987 review)
0 commit comments