Skip to content

feat(review): anchor-safety validation drops un-commentable suggested changes #2140

Description

@JSONbored

Guard the suggested-change surface against GitHub 422s: drop the suggestion (but keep the finding as a plain comment) when its target line isn't a commentable RIGHT-side diff line. The finding's own line already goes through rightSideLinesFromPatch; this slice makes the suggestion respect the same set and fail-safe.

Deliverables

  • In selectInlineComments (src/review/inline-comments.ts:79) validate the suggestion's anchor against the file's rightSideLinesFromPatch set; strip the suggestion (not the whole comment) when un-anchorable
  • Never emit a suggestion on a file with no usable patch
  • Preserve the existing per-line dedupe + MAX_INLINE_COMMENTS cap
  • Tests: anchorable → suggestion kept; un-anchorable → comment kept, suggestion dropped, no 422 shape; empty patch file

References

  • src/review/inline-comments.ts:49
  • src/review/inline-comments.ts:79
  • src/review/inline-comments.ts:90
  • part of #1956

Part of #1956.


size: S · held for later release (gittensor:feature once activated)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions