Repository navigation
reviewer: Skip the review of an unchanged patch that reviewed clean - #873
Conversation
Sashiko reviewCommit 5/9 —
|
|
All four findings are valid and fixed in the force-push; the branch is High, embargo release with a stale status. Confirmed, and it Medium, patch_has_human_replies(). Both halves fixed in commit 5. Medium, get_inherited_clean_patches() on the read connection. Low, rerun cleanup deleting a pending inherited check. Fixed in check-pr passes on 5e284b6 with 1730 unit and 88 integration |
c01ab01 to
f6d6d0c
Compare
Sashiko review — v2Commit 8/10 —
|
|
The v2 finding is valid and fixed in the force-push. find_inherited_clean_review() asked about replies to the reviewed The lookup now also asks about every copy that already inherited the check-pr passes with 1730 unit and 88 integration tests. |
f6d6d0c to
5fb8a6f
Compare
Sashiko review — v3Commit 3/10 —
|
|
The v3 finding is valid and fixed in the force-push (commit 3). patch_diffs_equivalent() tested its inputs for emptiness before In the daemon the lookup is keyed on git_patch_id first, so two such check-pr passes with 1730 unit and 88 integration tests. |
5fb8a6f to
10698fb
Compare
Sashiko review — v4Commit 3/10 —
|
|
The v4 finding is valid and fixed in the force-push (commit 3). The normalize_patch_diff_lines() treats a body with no "diff --git " as The test adds mail text, a whitespace-only body, and a hunk that lost check-pr passes with 1730 unit and 88 integration tests. |
10698fb to
bb93bf3
Compare
Sashiko review — v5✓ No issues found across 10 commits. |
Large series are reposted many times with changes to only a few patches. The daemon deduplicates a patch only by message_id, so every repost of an unchanged patch is a new review at full token cost, even when the previous review of the identical diff found nothing. The prior-version context already recognizes the unchanged diff but only tells the model about it; the workflow still runs every stage. Describe an opt-in skip: hash the normalized diff on each patch, and when a completed review of the same hash exists with no findings, record an inherited review row instead of running the model. The document fixes the match conditions (model, prompts, baseline, age), what the skip leaves behind for the dashboard and outbox, and the risks of propagating a false negative. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
A review that inherits its verdict from an earlier review of the same diff needs somewhere to record which review that was, and comparing two reviews by baseline needs the commit each one ran against. The baselines table cannot supply the latter: last_known_commit moves with every sync, so a review's baseline_id names a branch, not a tree. A clean verdict is also only as strong as the review behind it. review.cheap and --stages both narrow a review without changing its model or prompt hash, so nothing on the row tells a narrowed review from a full one. Add inherited_from_review_id, baseline_commit, cheap, and stages to reviews as schema version 22. cheap and stages default to a full review, which is what every review older than the columns was unless its operator narrowed it. The migration checks for the first column before adding any, so a rewound user_version on an already migrated database does not fail on the duplicate ALTER TABLE. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
Deciding whether a reposted patch carries the same change as an earlier one is already done here, inside compute_inter_version_diff, which returns a sentinel string when the normalized diffs match. A caller that only wants the yes-or-no answer has to compare against that string. Add patch_diffs_equivalent, which applies the same normalization (drop the mail header and the index lines, keep every diff line byte for byte) and additionally ignores the line ranges on hunk headers: a rebase onto a tree where earlier code grew or shrank rewrites "@@ -269,15 +267,13 @@" without touching the hunk, and the function context after the ranges still has to match. Whitespace stays significant on purpose: git patch-id ignores it, and a reindented hunk is a different patch. A body with no "diff --git" header matches nothing, itself included, so mail text with no diff in it is never taken for a change. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
Reposted series change a handful of patches and carry the rest unchanged, and every unchanged patch is reviewed again at full cost even when its previous review found nothing. The reviewer is about to learn to reuse such a verdict, and the operator needs to opt in and bound it. Add four keys to [review]: skip_unchanged_clean turns the reuse on, skip_unchanged_clean_max_age_days bounds how old a reused review may be, skip_unchanged_clean_any_model allows reuse across a model or prompt change, and skip_unchanged_clean_require_same_baseline restricts reuse to reviews that ran on the same tree, meaning the same baseline commit under the same earlier patches of the series. Only the age bound has a non-zero default; the baseline check is off because a repost nearly always lands on a newer tip, so requiring the same tree would skip almost nothing. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
Reusing a clean verdict needs the completed reviews of every other patch that carries the same change, newest first, with a mark on the ones that found something: an older clean verdict is only worth reusing when nothing newer disagreed with it. The patches table already indexes git_patch_id, which the ingest path computes for each patch, so that column serves as the lookup key. It cannot be the identity, because git patch-id ignores whitespace; the caller compares the returned diff before trusting a match. Add find_clean_review_candidates, which returns those reviews with the diff, model, prompt hash, baseline commit, coverage, and a has_findings flag the caller needs to decide, and leaves out reviews that themselves inherited a verdict so the chain always ends at a review a model produced. Add the writers for the new columns and a reader for a patch's git_patch_id. Coverage is a ReviewCoverage, built from review.cheap and the --stages list. Its covers() test is one-way. A full review covers a cheap one and any stage subset, and a narrowed review covers only a review narrowed the same way. Add patch_has_human_replies as well. The prior-feedback audit finds replies to an earlier version through patchset lineage, and this lookup matches patches that have none, so the caller needs to ask about one patch mail directly. A reply that is itself a patch or a cover letter does not count, or a series threaded under its first patch would never match. The walk goes on beneath Sashiko's own reply, because an answer to that review is discussion of the patch. get_inheriting_patch_message_ids names the copies that already inherited a review's verdict, so the caller can ask about them too. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
A patchset is clean, and an embargoed one releasable early, only when at least one of its reviews has status Reviewed and every patch either reached its review count or was skipped for touching ignored files. The retry accounting in the reviewer counts Reviewed rows the same way. A patch that inherits a clean verdict from an earlier identical copy leaves a Skipped row instead, so a reposted series whose every patch inherited would sit as Incomplete and stay behind its embargo timer, and a retry of the series would not see that the patch was handled. Let a Skipped review with inherited_from_review_id set count as one finished review in count_successful_reviews, CLEAN_PATCHSET_PREDICATE, and get_patchset_review_outcome. Counting it, rather than exempting the patch as the ignored-files skip does, keeps a rerun honest: the rerun raises the target to two, the inherited row supplies one, and the model runs exactly once more. The status is part of the test so a row that failed after the provenance was written proves nothing. Reclaiming a Pending row for a fresh model run clears the provenance columns, so a review the model then produces is never mistaken for an inherited one and excluded from later lookups. The same statement puts the coverage columns back at a full review, so the row never carries the coverage of a run that was given up. The patch list of an embargoed patchset shows a Reviewed patch as Embargoed. Show an inherited one the same way, or its Skipped status tells a viewer which patches of the series came out clean. The cleanup of an abandoned attempt deletes a patch's unsent Patchwork check unless the patch has a Reviewed row. Spare the check of a patch whose finished pass is an inherited one as well. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
A patchset that finishes with no findings is released from its embargo at once. review_patchset_task() writes the Reviewed status and then calls release_patchset_results() with the PatchsetRow it was handed when the review was claimed, whose status still reads In Review. queue_patchset_notifications() queues the held-back notifications only for a Reviewed patchset, so it queues nothing and then clears the embargo. The positive-review mail and the Patchwork check of every clean embargoed patchset are lost. Hand the release a copy of the row carrying the status that was just written. Fixes: 9351acd ("db, reviewer: restrict Failed patchset embargo release to forge PRs") Signed-off-by: Chuck Lever <cel@kernel.org>
A reposted series carries most of its patches unchanged, and the worker reviews each of them again at full cost even when the identical diff was already reviewed with no findings. The prior-version context tells the model the diff is unchanged, but every stage still runs. When [review] skip_unchanged_clean is set, look up the completed reviews of other patches with the same Git patch ID, newest first, and take the first whose diff matches byte for byte outside the index lines. If that newest review found something, no older clean verdict is reused. If it was clean, record a Skipped review that names it in inherited_from_review_id instead of running the model. A review that inherited its verdict is never itself a source, so a chain of reposts always points back at the review a model produced. A clean source is not enough on its own. It must match the model and prompt set unless skip_unchanged_clean_any_model is set. It must have run at least the pipeline this review would, so a review.cheap or --stages review is inherited only by a review narrowed the same way, and no setting waives that. Nobody but Sashiko may have replied to the reviewed copy or to a copy that already inherited its verdict: the lookup ignores lineage, so a patch criticized on the list and resent under a new thread would otherwise slip past the prior-feedback audit. With skip_unchanged_clean_require_same_baseline set, the baseline commit must match and so must the patches ahead of this one in the series, because a rewritten 1/5 changes what an untouched 3/5 applies to. The shortcut also stands down for work that needs a model run. A rerun raises the patchset's target review count, and the skip is off whenever that count is above one. A patch whose prior-version context carries findings or human discussion is reviewed in full, and so is every patch of a series whose context could not be built. An inherited patch queues no mail. It does queue the Patchwork check a clean model review would, since Patchwork otherwise shows no Sashiko result for it. The check is held back by an embargo and sent on release. A retry of an interrupted series stops at the inherited row the way it stops at a Reviewed one, queues the check if the first attempt did not, and leaves the patch Skipped. Every normal review now records the commit its worktree was checked out at. A cheap or stage-limited review also records its coverage, and its model run waits for that write: the columns default to a full review, so a narrowed run that failed to record itself would later lend its verdict to a full one. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
The patch list and the patch pane both print a bare "Skipped" for a patch the worker did not review, even when the Skipped review row says why. With clean-review reuse the reason names the review the verdict was inherited from, which is the one thing a maintainer looking at the patch needs. Put the review's result text in the list entry's tooltip and in the pane's placeholder, falling back to the bare word when no review row carries a reason. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
The design proposed a new patches.diff_hash column with its own index and a lazy backfill. Implementation found that patches.git_patch_id, computed at ingest and indexed since migration 12, already narrows the search; one exact diff comparison per candidate turns it into the identity the design wanted, so the column and the backfill were dropped. The skip also follows the existing ignored-files path, which leaves a Skipped review row and no outbox entry, rather than the Reviewed row and outbox entry the draft described. Self-review of the first implementation added three invariants the draft lacked: the newest review of a diff overrules older clean ones, a rerun's raised review count disables the skip, and a patch whose prior-version context needs the prior-feedback audit is reviewed in full. The clean-patchset predicate and the review outcome also had to learn the inherited row, or a fully inherited series would never leave its embargo. Two skip conditions are new. One covers review.cheap and --stages, which narrow a review without changing its model or prompt hash. The other refuses a reviewed copy that drew a reply, which lineage-free matching would otherwise hide from the prior-feedback audit. The same-baseline rule now extends to the patches ahead of this one in the series, an inherited patch posts a Patchwork check, and the risks section names what the model and prompt check does not see. Rewrite the identity, lookup, conditions, skip-outcome, observability, and steps sections to say what was built, and record the dropped column under the alternatives. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <cel@kernel.org>
bb93bf3 to
99bb43c
Compare
Sashiko review — v6✓ No issues found across 10 commits. |
Large series are being resent with very sparse changes. A RESEND or
a v+1 of a 49-patch series that touches a handful of patches is
reviewed again in full, and every unchanged patch that reviewed clean
the first time comes back clean at the same price. On our instance a
few such resends in a short span ran up a significant bill for almost
no new information.
This series lets a patch inherit a clean verdict instead. With
[review] skip_unchanged_clean set, a patch whose diff matches an
earlier patch that a model reviewed to completion with no findings
gets a Skipped review row naming that review, and no model run. It is
off by default. On the resend pair that prompted the work, 30 of 49
patches inherited and the series cost roughly half of a full review.
The design document comes first and the last commit brings it in line
with what was built; section 5.3 lists the conditions and section 6
the risks. The decisions worth checking:
Identity is the diff, not lineage. patches.git_patch_id is already
computed and indexed, so it narrows the search, and the diffs are then
compared line for line with only the mail header, index lines, and
hunk line ranges ignored. A patch moved between series or resent under
a new thread matches. Because lineage is not consulted, the lookup
itself refuses a reviewed copy that drew a reply from anyone but
Sashiko; the prior-feedback audit would not otherwise see it.
Only a verdict at least as strong is inherited. The newest review of a
diff overrules older clean ones. The model and prompt hash must match
unless skip_unchanged_clean_any_model is set. A review.cheap or
--stages review is inherited only by a review narrowed the same way,
which needs two new columns since neither changes the model or the
prompt hash. A rerun always gets a model run.
The tree is allowed to drift by default. A repost nearly always lands
on a newer tip and often changes an earlier patch of the series, so
requiring the same tree would skip almost nothing.
skip_unchanged_clean_require_same_baseline turns that requirement on,
for the baseline commit and for the patches ahead in the series, and
skip_unchanged_clean_max_age_days (90) bounds the drift otherwise.
An inherited verdict counts as one finished review, so a fully
inherited series is clean and leaves its embargo. It queues the
Patchwork check a clean model review would and no mail. Behind an
embargo the patch reads as Embargoed.
One commit fixes a defect the series depends on but did not cause.
Since 9351acd the early release of a clean embargoed patchset
passes a row whose status still reads In Review, so nothing held back
is queued before the embargo is cleared. That commit stands alone and
carries a Fixes: trailer.
The schema change is migration 22: four nullable or defaulted columns
on reviews and one index.
Verified on 5e284b6: check-pr passes with 1730 unit and 88
integration tests.