Comment capability group: post_comments behind own-changes and project gates - #31
Merged
Conversation
--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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the comment capability group: the
post_commentstool, the client-side write gate for trail-leaving operations, and the--own-changes-onlyflag.--own-changes-only(mirrorGERRIT_MCP_OWN_CHANGES_ONLY, defaulttrue) resolves intoConfig.AllowForeignChanges; invalid boolean values are reported alongside other configuration errors.checkWriteScoperesolves 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.SetReviewposts a review behind that gate; a learning test pins the go-gerritReviewInput/CommentInputwire shapes, including the unresolved tri-state.post_commentspublishes 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;resolvedinverts to Gerrit'sunresolved; notify defaults toALL.get_change,get_change_comments, andpost_comments; include filters never escalate beyond enabled groups.Closes #13
Closes #14
Closes #15