Skip to content

[fix](build) Preserve PR-scoped manual code review acceptance - #68872

Closed
shuke987 wants to merge 2 commits into
apache:masterfrom
shuke987:codex/preserve-manual-review-pass
Closed

shuke987 wants to merge 2 commits into
apache:masterfrom
shuke987:codex/preserve-manual-review-pass

Conversation

@shuke987

@shuke987 shuke987 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: #68032, #68622

Problem Summary:

A manual code-review: success status with description force pass is overwritten by subsequent aggregation because it is not a scoped review source. Preserving that unscoped success would also approve other PRs sharing the same commit.

Add an explicit PR comment command:

/force-pass code-review <full 40-character PR head SHA>

The trusted workflow verifies the human comment creator's write/admin permission, an open matching PR, and the exact current head. It records a separate code-review/source/manual/pr-<number>/head-<sha> status linked to the authorizing comment. Aggregation honors that acceptance across automated reruns and base movement, without applying it to a new head or another PR.

The manual-pass job uses the trusted HTTP diagnostics helper for permission checks, PR reads, and source publication; failures retain diagnostic artifacts and do not emit acceptance.

Only the serialized aggregate job now publishes the final code-review context. Remove unconditional pending writes from the runner and local/skip/aggregate paths so they cannot erase manual acceptance. When no open PR uses a head, leave its final status unchanged.

Scope and behavior: GitHub's final commit status is still shared by identical heads. Every open PR on that SHA must independently qualify: accepting A cannot approve B, and B can keep their shared check pending/failed. This PR does not introduce independently green/red merge gates for identical heads or change branch protection. During a rerun, the previous aggregate verdict remains visible until a new aggregate verdict is published; source statuses still report pending. If aggregation fails, the previous final verdict remains until a successful rerun.

Rollout: Merge the workflow and trusted scripts together. Existing unscoped force-pass records are not automatically migrated; a maintainer must issue the explicit command on the intended PR. Comment edits/deletion do not revoke an accepted source. Allow runs using older workflow definitions to finish before final rollout verification. See .github/scripts/manual-code-review-pass.md.

Release note

None

Check List (For Author)

  • Test

    • Unit Test: full script suite on master 18a2cc5e0e48c699c204a5d574791a49a5a22ec8: 276 tests OK, 257 passed and 19 platform skips.
    • Workflow regression: actual shell steps through the diagnostic helper with fake gh cover valid acceptance, stale SHA, read-only actor, failed API reads/writes, manual acceptance over automated failure, new head, another PR sharing the head, and closed-head no-write behavior. Final status has only one serialized writer.
    • Integration: all five review-pipeline PRs together pass 313 tests (294 passed, 19 platform skips); all ten pairwise merges are clean.
    • Static validation: actionlint on all three changed workflows, filtering only its pre-existing unsupported concurrency.queue diagnostic; git diff --check.
    • Live Actions acceptance remains to be verified after merging because validators are loaded from the default branch.
  • Behavior changed:

    • Yes. Add explicit PR/head manual acceptance and retain the previous final verdict until serialized aggregation replaces it.
  • Does this need documentation?

    • Yes. Usage, shared-head limitations and rollout notes are included in this PR.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: None
Related PR: apache#68032, apache#68622

Problem Summary: Aggregate review status overwrites unscoped manual force passes.
Record authorized explicit acceptance for a PR and its current head, honor it
across automated reruns, and prevent reuse for new heads or other PRs. Make the
serialized aggregate job the only final-status writer. Shared heads still
require every open PR to qualify; previous final verdicts remain until the next
successful aggregation. Leave unused heads unchanged after PR closure.

### Release note

None

### Check List (For Author)

- Test: 55 related unit tests, 8 mocked workflow scenarios, actionlint v1.7.7
  with shellcheck disabled, and git diff --check passed. No live status writes.
- Behavior changed: Yes, add PR/head manual acceptance; final status changes
  only on aggregate verdict publication.
- Does this need documentation: Yes, usage and rollout notes included.
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

### What problem does this PR solve?

Related PR: apache#68872, apache#69386, apache#69469

Problem Summary: Merge current master while preserving the serialized aggregate as the only final code-review status writer. Keep diagnostics for existing paths and add trusted helper installation and failure artifacts to the new manual-pass job. Retain the pending step name so early-failure reporting remains compatible.

### Release note

None

### Check List (For Author)

- Test: 276 script tests OK, 19 platform skips. Durable workflow tests cover authorization, failed reads/writes, PR/head scope, closed heads and single final writer. actionlint with only the existing queue diagnostic filtered; diff check.
- Behavior changed: Manual-pass API failures now retain diagnostics; intended manual acceptance semantics remain unchanged.
- Does this need documentation: No additional user-facing behavior beyond the existing manual-pass guide.
@shuke987

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Static review of all 10 changed files at b6fb4df found no new actionable issues. No existing inline findings were supplied to reconfirm. All three independent reviewers returned NO_NEW_VALUABLE_FINDINGS; the initial risks were resolved with evidence.

The reviewed flow is: created PR comment -> live author permission and open PR/head validation -> manual PR/head source -> serialized aggregation of all open PR contexts on that head -> final code-review status.

Applicable critical checkpoints:

  • Goal and proof: the manual source overrides automated results for the accepted PR/head, survives base movement, and leaves other PRs on the same head independently gated. Validator, resolver and extracted-workflow tests cover these behaviors; their assertions were reviewed statically.
  • Scope and reuse: the change is focused on manual acceptance and final-status ownership. It reuses the existing diagnostics helper, source-status protocol and reusable aggregator.
  • Concurrency: source producers may overlap, while final writes use the same head-specific aggregate concurrency group. Queued aggregation reads current durable sources. Each source producer explicitly invokes aggregation after publication. Retaining the previous final verdict during reruns or aggregation failures is documented behavior.
  • Lifecycle: acceptance is tied to the explicit SHA and PR number. A racing push cannot redirect it to the new head. Current/previous-head, close/reopen, base movement, comment creation/edit/delete and shared-head paths were traced. No static initialization or object-lifetime change applies.
  • Configuration: no Doris configuration item is added; permission and PR state are read for each command.
  • Compatibility and rollout: automated/local/skip source formats remain supported. Ignoring legacy unscoped force-pass records is intentional and documented. Trusted scripts and workflows must roll out together; old in-flight workflow behavior and live acceptance verification are documented limits. No symbols or storage formats change.
  • Parallel paths: manual, local, skip, automated and PR lifecycle paths retain explicit aggregate callers. Acceptance does not depend on status events generated by GITHUB_TOKEN. Caller permissions and trusted checkouts were inspected.
  • Conditions and errors: the parser requires a complete command and current full SHA, a matching open PR, a human creator matching the sender, and live write/admin permission. Validation/read/write failures stop before acceptance outputs; successful source publication precedes downstream aggregation. The permission endpoint contract was checked against GitHub's API documentation.
  • Test coverage: positive and negative fixtures cover malformed/denied/stale commands, wrong or closed PRs, read/write failures, precedence, reruns, base movement, new/shared/closed heads, diagnostics wiring and final-writer ownership. Workflow conditions, outputs, needs and permissions were checked directly because the shell fixtures do not execute the Actions scheduler.
  • Test-result accuracy: expected fixture outcomes agree with the inspected control flow; no generated regression result files change. Python syntax parsing succeeded for all six changed Python files.
  • Observability: manual sources link to the authorizing comment and identify author/PR; rejection errors explain the failed check. API failures retain diagnostic artifacts, and aggregate statuses link to the workflow run.
  • Persistence and data writes: latest status ID wins per exact source context. The source write precedes success outputs; final publication is serialized and respects publish=false when no open PR uses the head. There are no Doris transaction, EditLog or failover changes.
  • Performance: the implementation reuses existing paginated reads and status scans. No material new hot path, redundant API loop or retry behavior was found.
  • Other risks: PR/head isolation, aggregate scheduling, publication ordering and the suspected release-workflow rollout path were independently rechecked and dismissed with evidence. Current GitHub event documentation confirms the default-branch context used for PR lifecycle runs.

Thrift/protobuf field IDs, FE-BE variables, database visibility/version/delete-bitmap invariants, BE memory/null handling and C++ static initialization are not affected. No additional user focus was provided.

Verification was static only: no builds or tests were run, and hosted Actions acceptance was not exercised. The fake-gh tests do not establish live scheduler/API behavior; that remains the documented rollout verification. There are no unresolved code candidates or uncovered changed paths within this review scope.

Review converged after 1 round(s).

@shuke987 shuke987 closed this Nov 2, 2026
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.

2 participants