Skip to content

feat: prevent duplicate review comments with content-based dedup - #2

Merged
makinosp merged 3 commits into
mainfrom
feat/content-dedup
Aug 9, 2026
Merged

feat: prevent duplicate review comments with content-based dedup#2
makinosp merged 3 commits into
mainfrom
feat/content-dedup

Conversation

@makinosp

@makinosp makinosp commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Prevents the review agent from posting the same review comment repeatedly, even when the LLM reports the same concern on a different line.

Previously, incremental mode only skipped comments whose line range overlapped a previously-posted bot comment. With content-based dedup, a comment is also skipped when its wording matches a bot comment already posted on the same path, regardless of line.

Changes

  • Content-based deduplication (src/domain/post-comments.ts)
    • normalizeContent — strips the summary marker, Markdown decoration, collapses whitespace, lowercases.
    • jaccardSimilarity — token-set Jaccard coefficient.
    • isDuplicateContent — normalized exact match or Jaccard similarity at-or-above threshold.
    • isDuplicateComment — combines the existing line-overlap rule with the content rule (OR-ed), same path + RIGHT-side history only.
  • incremental is now enabled by default (actions/review/action.yml, README) — default changed falsetrue.
  • New action inputs
    • content-based-deduplication (default true) — enable/disable the content rule.
    • content-similarity-threshold (default 0.8) — Jaccard threshold in (0, 1].
  • CLI plumbing (src/cli.ts) — REVIEW_CONTENT_BASED_DEDUPLICATION, REVIEW_CONTENT_SIMILARITY_THRESHOLD env vars wired through ReviewCliConfigReviewOptionspostReview.
  • Tests — 24 new tests covering normalizeContent, jaccardSimilarity, resolveContentThreshold, isDuplicateContent, isDuplicateComment, and postReview content-based dedup integration.

Validation

  • pnpm typecheck
  • pnpm test — 215/215 ✅
  • pnpm lint

Notes

This branch is based on main and contains only the dedup feature (no formatting/refactor changes — those live in PR #1).

@makinosp
makinosp merged commit 42bf169 into main Aug 9, 2026
1 check passed
@makinosp
makinosp deleted the feat/content-dedup branch August 9, 2026 04:36
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.

1 participant