Skip to content

Add edit-in-place comments and diff-hash skip for CI#4

Open
mr-karan wants to merge 1 commit intomainfrom
edit-in-place-diff-hash-skip
Open

Add edit-in-place comments and diff-hash skip for CI#4
mr-karan wants to merge 1 commit intomainfrom
edit-in-place-diff-hash-skip

Conversation

@mr-karan
Copy link
Copy Markdown
Owner

Summary

  • Edit-in-place: Updates the existing hodor review comment instead of creating a new one, eliminating stale comment trails after force pushes
  • Diff-hash skip: Computes SHA-256 of the diff and embeds it in the comment footer as <!-- hodor:diff-hash:sha256:... -->. If the hash matches on the next run, the review is skipped entirely ($0 cost)
  • GitHub comment type change: Switches from gh pr review --comment (review comments) to gh api issue comments, which support editing via API
  • CLI flag: Adds --skip-if-unchanged/--no-skip-if-unchanged (default: enabled when --post is used)
  • Clean review output: Instructs the review template to omit empty issue categories (Critical: None, Important: None, etc.) when no bugs are found

Test plan

  • Unit tests for _compute_diff_hash() (4 tests: with SHA, fallback to branch, failure, consistency)
  • Unit tests for _extract_diff_hash() (3 tests: present, missing, empty)
  • All 45 existing tests pass
  • Integration: run hodor <url> --post on a GitLab MR, verify comment created with diff hash in footer
  • Integration: run again without code changes, verify skip message
  • Integration: push a code change, run again, verify existing comment is updated (not new one created)

When running in CI (GitLab CI / GitHub Actions), hodor now:
- Updates the existing review comment instead of creating a new one
- Computes a SHA-256 hash of the diff and embeds it in the comment footer
- Skips the review entirely if the diff hasn't changed since the last review

This eliminates stale comment trails after force pushes and avoids
wasted LLM costs on unchanged diffs. GitHub comments switch from
review comments (gh pr review) to issue comments (gh api) to enable
editing.

Adds --skip-if-unchanged/--no-skip-if-unchanged CLI flag (default: on).
Also instructs the review template to omit empty issue categories when
no bugs are found.
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