Skip to content

fix(pr-risk): discard reports for changed revisions - #446

Draft
huang47 wants to merge 1 commit into
codex/pr-risk-report-onlyfrom
codex/pr-risk-report-snapshot
Draft

huang47 wants to merge 1 commit into
codex/pr-risk-report-onlyfrom
codex/pr-risk-report-snapshot

Conversation

@huang47

@huang47 huang47 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

A report can become outdated while it is being assembled. This reads the policy at a fixed base revision and discards a grade when the base or head changes before the final check.

snapshot-flow

Motivation

Report-only grading reads policy, checks and changed files in separate requests. A branch moving between those requests can otherwise leave a report carrying a confident grade for a different revision. Pinning policy reads and checking revisions at both ends makes that common mismatch visible.

Provenance

  • Authored by: interactive session
  • Verified:
    • Risk and dependent script suites, ShellCheck, actionlint and repository checks passed.
    • Regression cases cover changed base, changed head, a grade for another head, missing initial revision and failed final recheck.
    • A read-only live script run read policy at the observed base SHA and retained matching base/head identifiers.
    • Tested revision: 6a3625a805be59f2a5aeeea31e86eb07ba00f4ed (same tree tested before commit).
    • Not run: a live reusable workflow and artifact download.
  • Deviations: Separate reads remain non-atomic; an update that changes and returns to the same revision can evade the recheck.

Reviewer context

Summary

  • Read repo policy overrides at the observed base SHA and record that SHA.
  • Discard a grade if the base or head changes, recheck fails, or the grade names another head.
  • Keep missing evidence ungraded; do not claim the remaining reads form an atomic snapshot.

Recovery

Revert this PR to restore the parent report-only behavior. No repository rules or production configuration are changed.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

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