Skip to content

fix(policy): let a pull request register its own exceptions after a success oracle verdict - #3019

Merged
joeharris76 merged 3 commits into
developfrom
fix/comment-policy-review-gated-registration
Oct 16, 2026
Merged

joeharris76 merged 3 commits into
developfrom
fix/comment-policy-review-gated-registration

Conversation

@joeharris76

Copy link
Copy Markdown
Collaborator

Summary

CI reads comment-policy exceptions and pinned scope notices from the base commit. A change that edits a fixture and its registry entry together therefore could not pass: the new entry only counted after it was merged, and the change could not merge without it.

This lets a pull request register its own exceptions and notice pins, but only after the oracle reviewer has posted a success verdict for the exact head commit.

  • oracle_review_covers requires a completed oracle-review check run from the GitHub Actions app, from the oracle-review workflow, on the head commit, and a success verdict review from benchbox-oracle for that same head. A check that merely passed is not enough, because it also passes for changes that touch no protected path. The latest verdict wins.
  • Candidate scope notices must name paths already pinned at the base, carry digests that match the head bytes, and stay inside the byte range pinned at the base, so a pin cannot widen into a whole-file exclusion.
  • Every API error, missing token, or malformed response returns false, which leaves the base policy in force.
  • The comment-policy job receives GITHUB_TOKEN with checks: read and actions: read so it can look the verdict up.
  • docs/internal/comment-policy.md describes the procedure.

Fixture digest scoping, which an earlier version of this change also carried, is not part of this change.

Verification

  • tests/unit/scripts/test_comment_policy.py and tests/unit/scripts/test_comment_cleanup_scope.py pass (960 tests), including the verdict lookup against fake API responses: foreign app, wrong workflow, other head, failure verdict, non-oracle author, latest verdict, and API errors.
  • make comment-policy-check and make pr-preflight pass.
  • This change touches soundness-protected checker wiring, so it needs an oracle success verdict on its head before it merges.

…uccess oracle verdict

CI reads comment-policy exceptions and pinned scope notices from the base
commit, so a change that edits a fixture and its registry entry together
could never pass: the new entry did not count until it was merged first, and
the change could not merge without it.

The comment-policy job now counts exceptions and scope-notice pins added by
the pull request itself, but only when the oracle reviewer has posted a
success verdict for the exact head commit and the completed oracle-review
check run came from the oracle-review workflow on that commit. A check that
merely passed does not qualify, because it also passes for changes that touch
no protected path. Candidate scope notices must name paths already pinned at
the base, carry digests that match the head bytes, and stay inside the byte
range pinned at the base, so a pin cannot widen into a whole-file exclusion.
Any API error, missing token, or malformed response leaves the base policy
in force.

The job is granted read access to checks and actions so it can look the
verdict up.

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: failure for 3ed3eb19b9e72b24b87239ff3b3cad61fdd2d4e9

This result supersedes those for earlier heads; their open review threads still apply.

Tier: medium-high (366 code lines exceed 150; touches 3 areas).

Decision: SHIP WITH FIXES.

Reviewer: muse (muse muse-spark-1.3-contributor, effort medium).

Same-PR exception/scope self-registration gated only on an oracle head verdict is bypassable: cover is not bound to the scanned checkout, and candidate pins check ranges but not base-byte content, making retained verification tautological.

Reviewers not available

  • sol: absent (error)
  • luna: absent (error)

Comment thread scripts/check_comment_cleanup_scope.py
Comment thread scripts/check_comment_cleanup_scope.py
Comment thread scripts/check_comment_policy.py
… against the base

The review-gated registration trusted the pull request event alone. A stale
event, or a checkout that is not the reviewed head, could authorize
self-registered exceptions on an unreviewed tree. Oracle cover now requires a
clean checkout that is the reviewed head, or a merge commit whose second parent
is the reviewed head and whose tree is exactly the merge of its parents.

Candidate scope notices also had to stay inside the pinned byte range but
nothing compared their bytes to the base, and the retained and blob digests
were recomputed from the head, so a rewritten notice passed its own pin. The
candidate range must now hold bytes identical to the base, and the digests the
checker enforces come from the base blob.

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for 153d6a916c8ae990c9c72d8f21d3b0a0b516210a

This result supersedes those for earlier heads; their open review threads still apply.

Tier: medium-high (459 code lines exceed 150; touches 3 areas).

Decision: SHIP.

Reviewer: muse (muse muse-spark-1.3-contributor, effort medium).

Prior D1/D2/D3 are fixed: oracle cover is now bound to the scanned checkout, reviewed head, successful bound workflow run and latest success verdict; candidate ranges require containment plus base-byte and base-blob continuity; candidate pins are validated against head then re-anchored to base digests and re-verified. No new merge-blocking defects found in the changed scope/policy gates; remaining edge cases fail closed.

Verified fixed: D1, D2, D3. Resolve their review threads.

Scope: files changed since head 3ed3eb19b9e72b24b87239ff3b3cad61fdd2d4e9 was reviewed.

@benchbox-oracle benchbox-oracle Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oracle-verdict: success for ce72e57e7267f6034a5210b7574a53fa51536701

This result supersedes those for earlier heads; their open review threads still apply.

Tier: medium-high (459 code lines exceed 150; touches 3 areas).

Decision: SHIP, carried from head 153d6a916c8ae990c9c72d8f21d3b0a0b516210a.

The patch is unchanged since head 153d6a916c8ae990c9c72d8f21d3b0a0b516210a was reviewed, so its decision is carried to this head without running a reviewer. Its open review threads still apply.

@joeharris76
joeharris76 merged commit 8414ffb into develop Oct 16, 2026
76 of 78 checks passed
@joeharris76
joeharris76 deleted the fix/comment-policy-review-gated-registration branch October 16, 2026 12:56

This branch was previously deployed

1 inactive deployment
oracle — ce72e57e Deployed Oct 16, 2026 by joeharris76 via post #826
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