Repository navigation
Conversation
|
🔍 OpenCodeReview found 1 issue(s) in this PR.
|
| "routed": 0, "skipped": 0, "failed": 0, "summary_url": None, | ||
| "summary_failed": True} |
There was a problem hiding this comment.
ZERO_STATS is missing the new summary_failed key that was added to the stats dict returned by publish(). While write_stats_file currently uses .get() and won't crash, this creates an inconsistent schema: any caller or test that directly accesses stats["summary_failed"] after receiving ZERO_STATS (e.g., from the error paths at lines 1603, 1607, 1623) will get a KeyError. Add the key to keep the constant consistent with the documented stats structure.
Suggestion:
| "routed": 0, "skipped": 0, "failed": 0, "summary_url": None, | |
| "summary_failed": True} | |
| "routed": 0, "skipped": 0, "failed": 0, "summary_url": None, | |
| "summary_failed": True} | |
| # Also update ZERO_STATS (line 1492-1493) to include the new key: | |
| # ZERO_STATS = {"total": 0, "inline": 0, "summary": 0, | |
| # "routed": 0, "skipped": 0, "failed": 0, "summary_url": None, | |
| # "summary_failed": False} |
|
@gengwg resolve conflicts |
22a31b0 to
8ef3c53
Compare
| upsert_summary(poster, body, config.get("sticky_summary", True), | ||
| tag=summary_tag_for(run_tag)) | ||
| return 0 | ||
| return 1 |
There was a problem hiding this comment.
Could you update the README’s “skip if already reviewed” example alongside this change? Returning 1 here is correct when OCR was expected to produce a result. But that example deliberately exits the Python wrapper before creating ocr-result.json when it finds an existing review. The next YAML step still invokes post_review.py, so a subsequent push to an already-reviewed MR now fails the job. The default template is unaffected.
I reproduced this with a mocked existing MR note in a clean directory: the wrapper exited 0 without running OCR or writing JSON; the subsequent poster exited 0 on the base commit and 1 on this PR.
Please invoke the poster only in the branch that actually runs OCR, and propagate its exit status there. That keeps an intentional skip green without masking a genuinely missing result. Those two cases would make a useful regression check.
What this changes
examples/gitlab_ci/post_review.pynow returns a non-zero exit status when:Summary writes now carry an explicit success outcome instead of using
summary_urlas a proxy for success. A stale URL from a failed update no longer hides the failure, and a successful GitLab response without a note URL does not cause a false failure.ZERO_STATSexposes the samesummary_failedfield on early exits.The publishing flow still finishes and renders failed inline findings into the summary before returning the error. Findings with no line information and findings intentionally routed to the summary remain nonfatal. The existing
.gitlab-ci.ymlgate already capturesPOST_EXIT_CODE, so these failures now reach the pipeline status as its comments describe.Tests
Added coverage for failed inline posts, summary read and update failures, malformed JSON, early-exit stats, summary-only findings, and a successful summary response without a URL.
python -m unittest discover -s examples/gitlab_ci -p '*_test.py': 161 tests passed.make check,make test, andmake buildpassed. For the local Go test run, submodule recursion was disabled because the host's global Git setting conflicts with the tests'git grep --untrackedmode.AI/LLM disclosure
This change was implemented and tested with AI assistance using OpenCode with Kimi K3.1 Pro, based on publication failures observed in a real private GitLab MR pipeline. The complete diff and the failure-path control were reviewed before submission. No private repository links or credentials are included, and no AI attribution is included in the commit.