fix(action): allow checkpoints after out-of-diff findings - #1524
Qiyuanqiii wants to merge 2 commits into
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). |
7592f12 to
2e3bac8
Compare
|
@NanaseInori review |
NanaseInori
left a comment
There was a problem hiding this comment.
I found one checkpoint-safety boundary that should be tightened.
The new exemption is described as applying only to findings that are proven to be outside the PR diff. However, publishBatch currently treats every classifyCommentAgainstDiff(...) == "invalid" result as outsideDiff: true.
invalid is broader than “outside the diff”. In particular, the classifier already returns invalid for a reversed span:
if (startLine > endLine) return "invalid";
That is malformed location metadata, not evidence that the finding lies outside the PR diff. If such a comment triggers the recognized 422 fallback, it is currently counted in outsideDiffCount, so a complete run can satisfy:
stats.failed === outsideDiffCount
and advance the checkpoint even though the only failure was not actually proven out-of-diff. The summary also reports the misleading “outside PR diff hunks” reason for that case.
I think the checkpoint exemption should be tied to a narrower classification than the existing generic invalid result. For example, distinguish outside_diff from malformed, or return an explicit checkpoint-safe reason and set outsideDiff: true only for paths/line ranges proven absent from the complete PR diff inventory.
Please also add a regression where a reversed range receives the matching 422 response and verify that it remains a blocking failure and preserves any existing checkpoint.
Apart from this boundary, the checkpoint flow looks well covered: incomplete diff inventories, changed PR heads, ordinary API failures, mixed failures, multi-batch accumulation, summary publication, carry-forward, and the next range resolution all remain fail-closed as expected.
One documentation nit: the checkpoint_after description says “a finding failed to post” prevents advancement and then immediately introduces an exception. “a blocking publication failure” would describe the new contract more precisely.
NanaseInori
left a comment
There was a problem hiding this comment.
Re-reviewed the latest head (dc4c74b).
The checkpoint-safety issue from my previous review is addressed correctly.
classifyCommentAgainstDiff now distinguishes outside_diff from malformed, and only the former contributes to the non-blocking outsideDiffCount. Reversed ranges and other malformed location metadata therefore remain blocking even when the diff otherwise provides enough information to classify the path.
The regression coverage is also strong here. In particular, the new malformed-range scenarios cover first and carried checkpoints, present/missing/binary paths, and mixtures of malformed and genuinely out-of-diff findings, while verifying that the previous checkpoint is preserved and checkpoint_after remains empty.
The checkpoint_after documentation now also uses “blocking publication failure”, which accurately describes the new exception.
I don't see another code-level blocker in the current implementation. The current CI checks are green.
LGTM from my side.
Description
Summary
checkpoint_rangeto create its first checkpoint and advance existing checkpoints when the only inline posting failures are findings proven to be outside the PR diff.comments_failedaccounting and continue blocking checkpoint advancement for API failures, uncertain diff locations, incomplete reviews, or an unpublished summary.Motivation and Scope
Issue #1521 describes repeated full-branch reviews despite
checkpoint_range: true: out-of-diff findings cannot be posted inline, but they keepstats.failednonzero. The checkpoint writer previously required that count to be zero, even after those findings had been included in the sticky summary. Without an existing checkpoint to carry forward, each later push starts another full-range review.This change implements the issue's proposed exception for out-of-diff comments. A completed review can record its covered head once the summary containing those findings is published. The next push can then review only the commits after that head.
Implementation
outsideDiff: trueonly in the existing HTTP 422 fallback afterclassifyCommentAgainstDiffreturnsoutside_difffor a valid location proven absent from the available PR diff.outside_difffrommalformed. Reversed ranges, non-positive or non-integer line numbers, and empty paths remain blocking; validate metadata before treating an absent file or omitted patch as placement evidence. The summary gives malformed locations their own failure reason.comments_failedcontinues to report them.checkpoint_afteronly when that summary publishes successfully.Compatibility and User Impact
No action inputs, output names, marker schema, or storage locations change.
comments_failedretains its meaning; a nonzero value no longer necessarily means that checkpoint advancement was blocked. The sticky summary still describes the latest reviewed range rather than accumulating findings from every earlier run.Type of Change
How Has This Been Tested?
Validation Environment
go1.26.5 windows/amd64v24.14.0mainat01cf7ff8b94c5087205eaf47a6e67f94dabb2a32Automated Validation
node scripts/github-actions/post-review-comments.test.jsnode scripts/github-actions/check-translation-sync.test.jsmake check: license headers, English-only source check, module tidy, formatting, andgo vetmake test: complete Go test suite with the race detectorgit diff --checkand LF-only verification for all changed filesRegression Coverage
resolveCheckpointRangeand verified that the following run starts at the newly recorded head.Automated Code Review
Ran the repository-requested
ocr review --audience agent --background ...against the review fixes. Two selected files were reviewed with no critical, high, or medium findings. One low-severity comment identified obsolete "tri-state" wording; that comment has been updated to match the explicit classification.Checklist
go fmt,go vet)AI / LLM Disclosure
This PR was prepared with OpenAI Codex (GPT-6) for investigation, regression tests, The open-code-review (
ocr) CLI, configured with DeepSeekdeepseek-v4-flash, was used for automated code review. I have checked my code and take responsibility for it.Known Limitations
npm run test:github-actionsvalidation is not claimed on Windows: the shell contract harness requires/bin/bash, and the plugin contract tests require symbolic-link creation privileges unavailable in this environment. The directly relevant comment-publisher suite and translation-sync tests pass; Linux CI should validate the remaining contracts.make coverage; this patch changes JavaScript action behavior and documentation, with no Go implementation changes.Related Issues
Closes #1521.