Skip to content

feat(comments): reply to inline threads and resolve/reopen via the v2 API - #268

Merged
pchuri merged 2 commits into
mainfrom
feat/comment-v2-reply-resolve
Oct 4, 2026
Merged

pchuri merged 2 commits into
mainfrom
feat/comment-v2-reply-resolve

Conversation

@pchuri

@pchuri pchuri commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Problem

  • confluence comment <page> --parent <id> goes through v1 POST /content with ancestors, which can return 400 for inline threads because it needs editor highlight metadata.
  • There is no command to resolve or reopen an inline thread.

Changes

Replies (Confluence Cloud)

  • createComment with a parent now posts through the v2 comment API: POST /api/v2/inline-comments or /footer-comments with parentCommentId and a storage body. No inlineCommentProperties are needed for replies.
  • The parent is looked up first (inline, then footer) to choose the matching endpoint family. If the parent belongs to a different page than the one given, the command fails before posting.
  • The v2 response is reshaped to the v1 fields the CLI prints (id, container, _links), so text output and --json are unchanged.
  • A v2 error is surfaced as-is; there is no silent fallback to v1.
  • Top-level comments and Server/Data Center keep the existing v1 path.

Resolve / reopen

  • New comment-resolve <commentId> [--reopen] (supports --json, blocked in read-only mode).
  • It reads the current version from GET /inline-comments/{id} and sends PUT with version + 1 and resolved.
  • Asking for the state the thread already has is a no-op (no PUT). Dangling threads are rejected with a clear message. Cloud only.

Behavior notes

  • On Cloud, --location and --inline-* options are ignored for replies; the parent decides the thread type.
  • One existing test used a Cloud client to exercise the v1 reply path; it now uses a Server/Data Center client, since that is where v1 replies remain.

Not included

  • Creating a new inline comment on selected text (--inline-selection without editor metadata). It needs live verification against Cloud first.
  • A Pi extension tool for comment-resolve; the Pi write tools have their own allowlist surface.

Testing

  • npm test (40 suites, 1546 tests) and eslint pass.
  • Unit tests cover inline and footer replies, unknown parent, page mismatch, v2 errors, v1 top-level comments, resolve, reopen, no-ops, dangling threads, missing version and non-Cloud; CLI tests cover text and --json output and read-only blocking.
  • Not exercised against a live Confluence Cloud site. The request shapes follow the v2 spec and the behavior reported in [FEATURE] Inline comments via the v2 API: reply to threads, resolve/reopen, and add on selected text #251, including that the update only needs version and resolved.

Refs #251

pchuri added 2 commits October 4, 2026 08:02
… API

Replying to an inline thread through v1 POST /content could fail with a
400 because it needs editor highlight metadata, and there was no way to
resolve or reopen a thread.

On Confluence Cloud, `comment --parent <id>` now posts through the v2
comment API. The parent is looked up first to pick the matching inline
or footer endpoint, and the reply is refused if the parent belongs to a
different page. Server/Data Center keeps the v1 behavior.

Add `comment-resolve <commentId> [--reopen]`, which reads the current
version and updates the inline comment's resolved state. Asking for the
state a thread already has is a no-op and dangling threads are rejected.

Creating a new inline comment on selected text is not included.

Refs #251
- Require numeric comment IDs before any v2 request, so a bad ID gives a
  clear error instead of an API 400 and cannot alter the request path.
- Compare the parent's pageId or blogPostId against the target content,
  so a blog post comment is no longer skipped by the page check.
- Refuse to resolve or reopen a reply; only top-level inline comments
  can be resolved.
- Document the granular-scope requirement for v2 comment calls.
- Cover /wiki/rest/api and scoped-token gateway base URLs in tests.
@pchuri
pchuri merged commit 57033a8 into main Oct 4, 2026
6 checks passed
@pchuri
pchuri deleted the feat/comment-v2-reply-resolve branch October 4, 2026 06:05
github-actions Bot pushed a commit that referenced this pull request Oct 4, 2026
# [2.27.0](v2.26.0...v2.27.0) (2026-10-04)

### Features

* **comments:** reply to inline threads and resolve/reopen via the v2 API ([#268](#268)) ([57033a8](57033a8)), closes [#251](#251)
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.27.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant