Skip to content

Use content hash for mlinter review deduplication - #47830

Merged
ydshieh merged 3 commits into
mainfrom
mlinter_dedup_hash
Aug 7, 2026
Merged

Use content hash for mlinter review deduplication#47830
ydshieh merged 3 commits into
mainfrom
mlinter_dedup_hash

Conversation

@ydshieh

@ydshieh ydshieh commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

CI

Summary

Improves deduplication in post_mlinter_review.py: instead of paginating all PR reviews to find a marker (O(n) API calls), store mlinter state in the PR description itself (O(1)).

Before: scan all reviews for <!-- mlinter-review -->, skip if found — always skips after the first post regardless of whether findings changed.

After: embed a state block in the PR description with the findings hash, commit SHA, and a link to the review. On each run:

  • Read PR description (1 API call) → extract hash → compare with current findings hash
  • Same hash → skip (findings unchanged)
  • Different hash → post new review, update state block in PR description

The findings hash is a short SHA-256 over the sorted (path, line, rule, message) tuples, excluding parse-error sentinels (rule=None).

The state block in the PR description looks like:

<!-- mlinter-state-start -->
<details>
<summary>🤖 mlinter review state</summary>

- hash: `a3f7c2d1`
- commit: `612e7bfc`
- review: https://github.com/owner/repo/pull/123#pullrequestreview-...

</details>
<!-- mlinter-state-end -->

Why PR description (not a separate comment)?

Storing state in a separate PR comment would require scanning all comments to find it — same O(n) problem. The PR description is the only place that can be read and written in O(1) without an external store.

Related

🤖 Generated with Claude Code

Instead of skipping whenever any review with the marker exists, embed a
short SHA-256 hash of the findings in the marker and compare it on each
run. This allows re-posting when findings change across commits while
still skipping identical findings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

ydshieh and others added 2 commits August 7, 2026 11:49
Instead of paginating all PR reviews to find the marker, embed a state
block in the PR description containing the findings hash, commit SHA,
and a link to the review. On each run, read the PR description (1 API
call), compare the stored hash against current findings, and skip if
unchanged. Update the state block after posting a new review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 31167511565:1
Result: success | Jobs: 2 | Tests: 22 | Failures: 1 | Duration: 1m 49s

@ydshieh
ydshieh merged commit 96869d7 into main Aug 7, 2026
34 checks passed
@ydshieh
ydshieh deleted the mlinter_dedup_hash branch August 7, 2026 10:05
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.

2 participants