Repository navigation
Conversation
…(part 1 of apache#2034) * Query commit OID under latest: commits(last: 1) in cr-open.graphql and cr-pr.graphql * In data.py from_node(), verify commit.oid == headRefOid case-insensitively and fail closed (discard rollup) on mismatch or missing OID * When discarded, disposition.py blocks APPROVE with 'CI is not reported' * Add regression tests in test_data.py and test_decisions.py Refs apache#2034
shahar1
left a comment
There was a problem hiding this comment.
This adds a fail-closed check that the CI rollup belongs to the head commit, but the case it tests is not the one #2034 reported, and a missing oid (an older vetted-ops install) looks the same as an unreported CI.
Smaller observations
- See inline comments on
tools/pr-management/tests/code_review/test_data.py:82,tools/pr-management/src/pr_management/code_review/data.py:218.
Worth a second look from
Folks with the most context on these paths:
@potiuk— 6 recent commit(s) on the changed paths (frequent contributor, not a committer)
None of them have been notified — asking any of them for an
extra pass is the maintainer's call, and optional.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The findings
below are observations, not blockers; an Apache Magpie
maintainer — a real person — will take the next look at the
PR. If you think a finding is mis-applied, please reply on
the PR and a maintainer will weigh in.More on how Apache Magpie handles maintainer review:
Contributing guide.
… scoping - In data.py, distinguish missing commit OID from mismatched OID when a rollup exists - Flag ci_outdated_query on PR so disposition can gate with an explicit upgrade instruction rather than leaving maintainers guessing why CI is unreported - Clarify test docstrings and naming to reflect Direction 1 (lagging commit edge guard) without overstating coverage of same-head stale rollups - Sync dual-tree mirrors under plugins/magpie-security-tools
shahar1
left a comment
There was a problem hiding this comment.
The head-commit check and the missing-oid handling look right and both earlier threads are addressed; two smaller points remain, about where the out-of-date-query signal shows up and the texts that describe the CI gates.
Smaller observations
- See inline comments on
tools/pr-management/src/pr_management/code_review/cli.py:446,tools/pr-management/src/pr_management/code_review/disposition.py:148.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The findings
below are observations, not blockers; an Apache Magpie
maintainer — a real person — will take the next look at the
PR. If you think a finding is mis-applied, please reply on
the PR and a maintainer will weigh in.More on how Apache Magpie handles maintainer review:
Contributing guide.
| merge_method=pr.default_merge_method, | ||
| pending_not_required=pr.pending_not_required, | ||
| viewer_known=bool(pr.viewer), | ||
| ci_outdated_query=pr.ci_outdated_query, |
There was a problem hiding this comment.
maintainers are immediately informed
A missing OID fails closed to prevent unverified approvals, but surfaces an explicit "vetted-ops is out of date" approval gate and
ci_actionso maintainers are immediately informed.
ci_outdated_query reaches only disposition (Step 6). Under the same skew, context still prints CI: none reported (_ci_line reads only rollup_state) and returns "ci": {"state": null, "real_ci": false}, and queue ranks every PR as real-CI-never-ran with no announcement. The maintainer reads the wrong headline for the whole review and learns the cause at the last step. Have _ci_line return something like CI: cannot be verified (vetted-ops query out of date) when the flag is set, and carry the flag in the ci object; a queue announcement can follow in part 2.
| ci_action = "approve the waiting workflow runs (pr-management-triage), then re-run disposition" | ||
| elif ci_outdated_query: | ||
| gates.append("CI rollup cannot be verified — vetted-ops is out of date (latest commit lacks OID)") | ||
| ci_action = "upgrade vetted-ops to update GraphQL queries, then re-run disposition" |
There was a problem hiding this comment.
Spec-sync pre-check before pushing a functionality PR
Before pushing a PR that ships or changes a skill, tool, or mode — and before pushing a rebase of one onto a
mainthat has moved — confirmtools/spec-loop/.last-syncis at (or near) the currentmaintip and that the affected specs reflect what actually shipped.
This adds a CI gate and a third meaning of ci_action, and two texts still describe the old set. tools/spec-loop/specs/pr-management-family.md lists the gates as "Failing CI, a rollup green from bot checks only, and workflows waiting for approval". plugins/magpie-pr-management/skills/code-review/review-flow.md (Step 6) tells the agent "When ci_action is set, the project's workflows have not run (waiting for approval, or bot checks only)", which is now wrong for the upgrade case: the agent would point the maintainer at workflow approval. Add the head-commit rule and the out-of-date-query gate to both.
Summary
commits(last: 1)can lag behind or return astatusCheckRollupbelonging to a prior commit rather than the PR's trueheadRefOid.cr-open.graphqlandcr-pr.graphql, requestoidonlatest: commits(last: 1) { nodes { commit { oid statusCheckRollup ... } } }.pr_management.code_review.data.from_node():commit_oidstrictly matchesheadRefOid(case-normalized); on mismatch, fail closed by clearingrollup = {}.statusCheckRollupexists butcommit_oidis absent (e.g. an older installedvetted-opsthat lacksoidunderlatest), fail closed on rollup and setci_outdated_query = True.disposition.pick():ci_outdated_queryis set, blockAPPROVEwith an explicit gate ("CI rollup cannot be verified — vetted-ops is out of date (latest commit lacks OID)") and provide an actionableci_action("upgrade vetted-ops to update GraphQL queries, then re-run disposition"), rather than silently showing "CI is not reported".Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
ruff checkpasses acrosstools/andplugins/ruff format --checkpasses acrosstools/andplugins/mypypasses (76 source files checked, 0 issues) in bothtools/andplugins/pytest tools/pr-management/tests/code_review/passes (241 passed)tools/andplugins/forpr_managementandvetted_opstest_data.py:test_from_node_accepts_matching_head_and_commit_oidtest_from_node_discards_rollup_when_commit_oid_mismatches_head_ref_oid(lagging commit edge guard)test_from_node_discards_rollup_and_flags_outdated_query_when_commit_oid_missing(query skew handling)test_from_node_discards_rollup_when_head_ref_oid_missingtest_from_node_accepts_rollup_case_insensitivelytest_decisions.py:test_pr_with_lagging_commit_edge_fails_closed_to_commenttest_pr_with_outdated_vetted_ops_query_gates_approval_with_upgrade_actionRFC-AI-0004 compliance
<PROJECT>,<tracker>,<upstream>,<security-list>) used in all skill / tool prose (thecheck-placeholdersprek hook is the mechanical gate)Linked issues
Refs #2034 (part 1 of 2: Direction 1 fail-closed guard against lagging GraphQL commit edges, plus query-skew defense)
Notes for reviewers (optional)
latestcommit has not advanced toheadRefOid. It does not claim to address cases where GitHub's API attaches a stale rollup to a commit node that already carriesheadRefOid; that case will be addressed in Direction 2 (probing check-runs for the head commit).pr-managementandvetted-ops. A missing OID fails closed to prevent unverified approvals, but surfaces an explicit"vetted-ops is out of date"approval gate andci_actionso maintainers are immediately informed.