Skip to content

Diff suggestion comments duplicated instead of moving with code #230

@sentry-junior

Description

@sentry-junior

Diff suggestion comments are sometimes misplaced — duplicated in their original position rather than moving with the associated code when a PR diff shifts.

Symptom

When warden posts a diff suggestion on a PR, if the surrounding code moves (e.g. a block is relocated in a later commit), the suggestion comment is duplicated at the original line instead of following the code it was attached to.

Known facts

  • Observed on active PRs where diff suggestions were generated by warden.
  • The duplicate appears at the original line position; the moved code does not get the suggestion carried over.

Unknowns

  • Whether this is a GitHub API limitation (suggestions are line-anchored, not semantically anchored) or a warden-side issue in how suggestions are constructed.
  • Frequency / reproducibility across different PR shapes.

Root-cause hypotheses

  • GitHub line-anchoring (high confidence): GitHub's suggestion API anchors comments to a specific line number in the diff. When code moves, the anchor becomes stale and GitHub may render a duplicate or orphaned comment. Warden may not have logic to detect or suppress this.
  • Warden re-posts suggestions on diff refresh (medium confidence): If warden re-evaluates the PR after a new commit and re-posts suggestions without deduplication, it would produce duplicate comments.

Next steps

  • Audit warden's suggestion posting logic for deduplication guards.
  • Confirm whether GitHub's native suggestion API has any semantic-anchor support or if this is inherently positional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions