fix(dev): machine-recognize review-claim and author_decision states (#7508) - #7519
Conversation
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 PR Contract Check SummaryOverall Status: 🟢 PASSED
|
ll7
left a comment
There was a problem hiding this comment.
Exact-head review evidence
Reviewed head e2800b70c26ae367a506f1b6ea4c696e095e52ab (current PR head, verified against GitHub).
Validation performed (parent-run, at head):
pytest tests/dev/test_pr_loop_policy.py -q— 174 passed (150 pre-existing + 24 new).pytest tests/dev/test_snapshot_pr_queue.py -q— 55 passed (companion).ruff checkandruff format --checkon changed files — clean.- CI rollup on head: all 32 checks success/skipped, no failures.
- Smoke: real snapshot through
pr_loop_policy --stdin --jsonexits 0; synthetic snapshot emits bothactive_writerandauthor_decisionstates.
Intended design: pr_loop_policy.py machine-recognizes the #7500 review-claim marker (review-claim: <lane> @ <sha> until <UTC>, review-claim: released @ <sha>) as active_writer (park, no_action/stop) and the decision-required + ### Decision packet combination as author_decision (park, no_action/stop), both taking precedence over blocked_preflight. The #7491 not-ready-sentinel half is explicitly out of scope and linked. Live-head binding, expiry, and release semantics are tested with fixed timestamps.
Findings disposition: No actionable review threads; no fixable findings.
Scope check: Matches issue #7508 contract (Closes #7508). Workflow/tooling only; no benchmark/planner/evidence claim. No follow-up issues required.
Base policy: ordinary-cas @ e2800b70c26a (not base-sensitive; guarded merger performs current-main CAS).
Single-account waiver: Repository operated through one effective account; internal review recorded for exact head above.
pr-metadata: reconciled @ 394210fd62322f60e0f2583ac7fb6877f343b166ebba6e372f6d9410788caabb
gate-verdict: accepted @ e2800b7
Summary
Make
scripts/dev/pr_loop_policy.pymachine-recognize the two workflow markers that PR #7500 introduced togoal-pr-review(docs-only): the advisoryreview-claim: <lane> @ <head> until <UTC>comment marker and theauthor_decisionparking state (decision-requiredlabel +### Decision packetcomment at the live head). PRs parked by either are classifiedactive_writer/author_decisionwith recommended actionno_action/stop, distinct fromblocked_preflight, so reviewer lanes and the factory stop racing on the same branch.Linked Issues
#7508#7500(defines the marker formats),#7491(not-ready-sentinel half, intentionally NOT implemented here)Stack / Dependency
What Changed
scripts/dev/pr_loop_policy.py:VALID_STATESgainsactive_writerandauthor_decision._REVIEW_CLAIM_RE(review-claim: <lane> @ <sha> until <UTC>),_REVIEW_CLAIM_RELEASED_RE(review-claim: released @ <sha>),_DECISION_PACKET_HEADING_RE(### Decision packet), plus aReviewClaimdataclass._parse_review_claim_marker,_review_claim_released_shas,_has_decision_packet_heading,_trusted_marker_comments(OWNER/MEMBER/COLLABORATOR only, reading bothcommentsandreviewsbodies),active_review_claim(unexpired + unreleased + head-bound,now=None->datetime.now(UTC)),has_author_decision_packet(live-head binding; review-body packets must name the live head).classify_pr_statetakes an explicitnowkwarg; draft/error/closed still returnno_actionfirst;active_writer/author_decisionare checked beforeblocked_preflightand the rest of the pipeline (precedence per issue).recommend_actionmaps both new states tono_actionwith named reasons; flow decision isstopfor both.tests/dev/test_pr_loop_policy.py: 24 new tests with fixed timestamps (no monkeypatching): park on unexpired trusted claim, untrusted does not park, released clears, expiry,now == untilis expiry, head mismatch, unparseable timestamp fails closed, claim in review body, parser round-trips, author_decision with/without label and packet, live vs stale head, untrusted packet, precedence overblocked_preflightand over ready-to-merge, draft stillno_action, VALID_STATES contract, queue-level evaluation.CHANGELOG.md: Unreleased -> Changed entry.Why It Matters
Research Result Guidance
Domain-Aware Approval
Falsification / Non-Transfer Check
Next Empirical Action
Validation / Proof
uv run pytest tests/dev/test_pr_loop_policy.py -q— 174 passed (150 pre-existing + 24 new).uv run pytest tests/dev/test_snapshot_pr_queue.py -q— 55 passed (companion).uv run ruff check scripts/dev/pr_loop_policy.py tests/dev/test_pr_loop_policy.py— clean.uv run ruff format --check scripts/dev/pr_loop_policy.py tests/dev/test_pr_loop_policy.py— clean.snapshot_pr_queue --active | pr_loop_policy --stdin --json— exit 0, no crash; synthetic snapshot emitsactive_writerandauthor_decisionstates via the CLI.Performance Evidence
perfchange; section deleted per template guidance.)Risks / Rollout
nowkwarg (default preserves current behavior); existing classifications re-tested (draft still no_action, ready_to_merge precedence preserved).Docs / Provenance
pr_loop_policy.pydocuments the marker grammar, precedence, lane-identity limitation, and the friction(merge-gate): merge-ready + stale 'not merge-ready' body narrative reaches main (#7374, #7435) #7491 out-of-scope boundary; CHANGELOG entry.Downstream Propagation
Follow-Up Issues
Reviewer Notes
review-claim: <lane-id> @ <head-sha> until <UTC>); precedence ofactive_writer/author_decisionoverblocked_preflight; the live-head binding for author_decision packets.