Skip to content

Comment capability group: post_comments behind own-changes and project gates - #31

Merged
xobotyi merged 3 commits into
mainfrom
feat/comment-group
Jul 10, 2026
Merged

Comment capability group: post_comments behind own-changes and project gates#31
xobotyi merged 3 commits into
mainfrom
feat/comment-group

Conversation

@xobotyi

@xobotyi xobotyi commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Adds the comment capability group: the post_comments tool, the client-side write gate for trail-leaving operations, and the --own-changes-only flag.

  • --own-changes-only (mirror GERRIT_MCP_OWN_CHANGES_ONLY, default true) resolves into Config.AllowForeignChanges; invalid boolean values are reported alongside other configuration errors.
  • checkWriteScope resolves the target change with one fetch and refuses the operation before any mutating request leaves the process — project allowlist first, then change ownership unless foreign changes are allowed.
  • SetReview posts a review behind that gate; a learning test pins the go-gerrit ReviewInput/CommentInput wire shapes, including the unresolved tri-state.
  • post_comments publishes a review in a single call: optional top-level message plus inline, range, file-level, and reply comments. Reply targets are validated against existing comments; resolved inverts to Gerrit's unresolved; notify defaults to ALL.
  • The comment group bundles get_change, get_change_comments, and post_comments; include filters never escalate beyond enabled groups.

Closes #13
Closes #14
Closes #15

xobotyi added 3 commits July 10, 2026 22:16
--own-changes-only (GERRIT_MCP_OWN_CHANGES_ONLY) resolves into
Config.AllowForeignChanges, inverted so the zero value keeps the
restriction on. Defaults to true per the safety contract (ADR 1.2):
trail-leaving operations on changes not owned by the authenticated
account are refused unless the operator opts out with
--own-changes-only=false. Non-boolean values are reported alongside
the other configuration errors.

Refs: #14
checkWriteScope resolves the target change with one fetch and refuses
the operation before any mutating request leaves the process: the
change must pass the project allowlist and, unless foreign changes
are allowed, be owned by the authenticated account.

SetReview posts a review to a change revision behind that gate. A
learning test pins the go-gerrit ReviewInput/CommentInput wire shapes
the comment flow builds on, including the unresolved tri-state that
distinguishes absent from false.

Refs: #14, #15
post_comments publishes a review in a single SetReview call: optional
top-level message plus inline, range, file-level, and reply comments.
Reply targets are validated against the change's existing comments so
typos surface as errors instead of orphan threads; the resolved input
inverts to Gerrit's unresolved wire field. Notify defaults to ALL.

The comment capability group bundles get_change, get_change_comments,
and post_comments -- the minimal read subset the flow needs to stand
on its own. Include filters still never escalate beyond the enabled
groups.

Refs: #13, #15
@xobotyi
xobotyi merged commit eb3e783 into main Jul 10, 2026
4 checks passed
@xobotyi
xobotyi deleted the feat/comment-group branch July 10, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement post_comments tool Implement own-changes enforcement Implement bundled read subsets in registry

1 participant