code-coordinator 0.5.855__py3-none-any.whl → 0.5.856__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {code_coordinator-0.5.855.dist-info → code_coordinator-0.5.856.dist-info}/METADATA +1 -1
- {code_coordinator-0.5.855.dist-info → code_coordinator-0.5.856.dist-info}/RECORD +9 -9
- coord/drive.py +34 -0
- coord/merge_queue.py +182 -2
- coord/review.py +96 -32
- {code_coordinator-0.5.855.dist-info → code_coordinator-0.5.856.dist-info}/WHEEL +0 -0
- {code_coordinator-0.5.855.dist-info → code_coordinator-0.5.856.dist-info}/entry_points.txt +0 -0
- {code_coordinator-0.5.855.dist-info → code_coordinator-0.5.856.dist-info}/licenses/LICENSE +0 -0
- {code_coordinator-0.5.855.dist-info → code_coordinator-0.5.856.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
code_coordinator-0.5.
|
|
1
|
+
code_coordinator-0.5.856.dist-info/licenses/LICENSE,sha256=851BVZZwf_pEv2ydSlMmcZrwnwSS5YJ98wdLze7lyL8,4212
|
|
2
2
|
coord/__init__.py,sha256=3FN2qrrxtW87xSsSD557YcMwHLDahnFK8LvqQI7Wlf4,9783
|
|
3
3
|
coord/_board_mapping.py,sha256=n1kuHjxFisPci-sH5JfOpC57sbnT--z6uVQM4ZT8u6U,13667
|
|
4
4
|
coord/acceptance.py,sha256=WspJv7soXc2cSXgn9s78BHD8y0qeGBIyaNmsAl4pYVc,119974
|
|
@@ -56,7 +56,7 @@ coord/dispatch_liveness.py,sha256=M1YGzcYP-NxIkskmhV6R_MUj1DwRx40woCBrlEsl3ik,15
|
|
|
56
56
|
coord/dist_name.py,sha256=XDhumYscJahwcaKjmSw135HYsnXQjwGGxRo0Qv4b0xM,5583
|
|
57
57
|
coord/dr_promote.py,sha256=xS9fFvzrY-EjSEj1XMSwD7RtjbBhhXZT76XFLnddDng,60329
|
|
58
58
|
coord/dr_verify.py,sha256=BGPBvFf3_yNc4RwCoBS1h8oEYdT3yOUJ04GtXDawRCA,45701
|
|
59
|
-
coord/drive.py,sha256=
|
|
59
|
+
coord/drive.py,sha256=sB9E_LBIz09xLPQ68ShvNe3tAWZW5jo3ZOq7uACT95I,407281
|
|
60
60
|
coord/drive_queue.py,sha256=f5YCfVlA8tnfpQF4FjYNp3ruGcJpHJ5wN5uIXjCpU8U,584507
|
|
61
61
|
coord/drive_sessions_snapshot.py,sha256=chbg-5_vwfOItXnJ5rlYDuvOs-47uHXbiKuV8mihY3s,8194
|
|
62
62
|
coord/drive_state.py,sha256=X-8aiSEK-0YRRrbVzNq1NVVNfBoUPSbBLEo9b-fPtGU,69924
|
|
@@ -95,7 +95,7 @@ coord/machine_metrics.py,sha256=paWqBTZgeIi7w1pgH5QSJL59UxwetxE8bXblzzcspSI,1630
|
|
|
95
95
|
coord/machine_onboard.py,sha256=6QynWfcXkG54JIyJou-0aCfdnomzUtKD4NPLr_pz3hQ,126936
|
|
96
96
|
coord/machine_pause.py,sha256=8-Kha1BtGFY1dYRenyNYlRqgOg0vWmgCiB2FjPWjM1k,49091
|
|
97
97
|
coord/machine_stats.py,sha256=muwodHYjFDUFY4z5D10DUMM-_eQJW47OZSjf6fRaVuE,6021
|
|
98
|
-
coord/merge_queue.py,sha256=
|
|
98
|
+
coord/merge_queue.py,sha256=sIJZ1pcs5nQYcHG8G3sJbocpyqM2nH4evvGjc2LROSo,618930
|
|
99
99
|
coord/milestone_chat.py,sha256=d568DGTDxT2A6FaF2vA8zzPPTrzwbCyttef49FpKZvo,26538
|
|
100
100
|
coord/milestone_dispatch.py,sha256=08UZ_6lL4yBHCITBL0zvbQ-T3XkRJfSTmXe0g_Ujcc0,71766
|
|
101
101
|
coord/milestone_gate.py,sha256=W81H0t8bFes9Yf86GEBsqkWiVHjEtj6GRwrZiiGiv4A,30528
|
|
@@ -144,7 +144,7 @@ coord/reports.py,sha256=c_dlr374AeFOS_NHFC8KgvICFaDkfrBUoGa7s5tsxOI,273683
|
|
|
144
144
|
coord/rest_schema.py,sha256=lFib2xTQb121BWeCRXRtRpoFtoWZJqCWIqAKzy0WCZk,12611
|
|
145
145
|
coord/restart_cmd.py,sha256=HCaWG3vx_nOt2NokzbEuuG4y-UDf16vWYC2iw8aS4DE,5729
|
|
146
146
|
coord/revalidate.py,sha256=fygeChSUF4GfAybu_Tu5K1WeDfOHKkgYKCLNZgdj7R0,66278
|
|
147
|
-
coord/review.py,sha256=
|
|
147
|
+
coord/review.py,sha256=mxbHNvnF6aTcFkPZJErfDwi4Y4Rf0Kz5wu-Vdg0U1sw,431143
|
|
148
148
|
coord/scorecard.py,sha256=axe_doBJBBFWtN21JZDRSijwDI0xaZrt2oVYbwJPW7U,20211
|
|
149
149
|
coord/self_health.py,sha256=9PLVdaEReFLUY6y2QXMGVd6U1CdHAh9_8MzduwBOzAY,10651
|
|
150
150
|
coord/serve_app.py,sha256=Jk-ob-isxlZZ9T9Miuf6Y7r1VimRho5GmKncVyFNuyU,620186
|
|
@@ -321,8 +321,8 @@ coord/skills/review-verdict-recovery/SKILL.md,sha256=Grg8GWkJLK20ct2YiigbTFfNOki
|
|
|
321
321
|
coord/skills/tui-quadraui-workflow/SKILL.md,sha256=4hUZza9wSSnPhf0eRAOh2r_MQZxK2pXYO5g-kxmJq-U,3832
|
|
322
322
|
coord/skills/update-issue/SKILL.md,sha256=VrPinEmLZrCSNDrnz96hQomyO403o5c4i0RdsnUnWA0,3642
|
|
323
323
|
coord/templates/deploy-cloudflare.node.yml,sha256=icsTiWn2ziQJnpZODhhFKYlnqjt2xAXsbwlQufdxhuM,2078
|
|
324
|
-
code_coordinator-0.5.
|
|
325
|
-
code_coordinator-0.5.
|
|
326
|
-
code_coordinator-0.5.
|
|
327
|
-
code_coordinator-0.5.
|
|
328
|
-
code_coordinator-0.5.
|
|
324
|
+
code_coordinator-0.5.856.dist-info/METADATA,sha256=riCOwOGgTCbncGowo5b44PFcFpaM5VfAzUj9BxwqCYM,17855
|
|
325
|
+
code_coordinator-0.5.856.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
326
|
+
code_coordinator-0.5.856.dist-info/entry_points.txt,sha256=o-Hq8pvG7ReGePvN_4iOKjLNqiq-MJ43HbPurqjNPZo,41
|
|
327
|
+
code_coordinator-0.5.856.dist-info/top_level.txt,sha256=w5sTrXesTCebhXyYv2qufOZGo0PoD1Lxgn0Q3MAXjh4,6
|
|
328
|
+
code_coordinator-0.5.856.dist-info/RECORD,,
|
coord/drive.py
CHANGED
|
@@ -188,6 +188,7 @@ from coord.merge_queue import (
|
|
|
188
188
|
is_ci_pending_reason,
|
|
189
189
|
is_ci_unreadable_reason,
|
|
190
190
|
is_merge_gate_reserved_reason,
|
|
191
|
+
is_out_of_delta_full_review_reason,
|
|
191
192
|
is_stale_smoke_reason as _mq_is_stale_smoke_reason,
|
|
192
193
|
stale_smoke_anchor as _mq_stale_smoke_anchor,
|
|
193
194
|
)
|
|
@@ -5184,6 +5185,7 @@ def _effective_merge_gate_reason(
|
|
|
5184
5185
|
or is_ci_flaky_reason(state.merge_reason)
|
|
5185
5186
|
or is_ci_unreadable_reason(state.merge_reason)
|
|
5186
5187
|
or is_merge_gate_reserved_reason(state.merge_reason)
|
|
5188
|
+
or is_out_of_delta_full_review_reason(state.merge_reason)
|
|
5187
5189
|
):
|
|
5188
5190
|
return state.merge_reason, False
|
|
5189
5191
|
fallback = _extract_gate_refusal_reason(counters.last_merge_diagnostic)
|
|
@@ -6111,6 +6113,38 @@ def _decide_merge(
|
|
|
6111
6113
|
serialize_merge=True,
|
|
6112
6114
|
)
|
|
6113
6115
|
|
|
6116
|
+
# The out-of-delta merge gate (`coord.merge_queue.
|
|
6117
|
+
# is_out_of_delta_full_review_reason`) is the identical self-refreshing
|
|
6118
|
+
# shape as the merge-gate reservation just above: a scoped re-review
|
|
6119
|
+
# chain flagged something outside its own delta (or approved without
|
|
6120
|
+
# resolving a prior finding), and the merge-queue gate itself already
|
|
6121
|
+
# auto-dispatches the one full review that clears it
|
|
6122
|
+
# (`dispatch_full_review_for_out_of_delta_gate`) the moment this reason
|
|
6123
|
+
# is produced. Nothing about retrying resolves it faster than that
|
|
6124
|
+
# review landing a verdict — but nothing else on this driver's own path
|
|
6125
|
+
# re-reads the board to notice it cleared either, so this re-checks
|
|
6126
|
+
# every poll, attempt-exempt, the same as the reservation case. A
|
|
6127
|
+
# retry that finds the review still pending/in flight is a no-op on the
|
|
6128
|
+
# dispatch side (`dispatch_review`'s own dedupe), so repeating this does
|
|
6129
|
+
# not risk a second dispatch.
|
|
6130
|
+
if is_out_of_delta_full_review_reason(state.merge_reason):
|
|
6131
|
+
aid = state.merge_aid or state.work_aid
|
|
6132
|
+
return Action(
|
|
6133
|
+
kind=RUN,
|
|
6134
|
+
label=(
|
|
6135
|
+
"MERGE: out-of-delta gate requires a full review — "
|
|
6136
|
+
f"re-checking, not spending an attempt: {state.merge_reason}"
|
|
6137
|
+
),
|
|
6138
|
+
command=("merge", "--only", aid, "--method", opts.merge_method),
|
|
6139
|
+
on_error="warn",
|
|
6140
|
+
error_message=(
|
|
6141
|
+
"coord merge returned non-zero (or the merge lock timed out) "
|
|
6142
|
+
"while re-checking the out-of-delta full-review gate — "
|
|
6143
|
+
"re-checking next poll"
|
|
6144
|
+
),
|
|
6145
|
+
serialize_merge=True,
|
|
6146
|
+
)
|
|
6147
|
+
|
|
6114
6148
|
# #3254: the FIFTH CI-outcome case, checked right after the four
|
|
6115
6149
|
# self-refreshing siblings above — `coord.merge_queue.is_ci_absent_reason`
|
|
6116
6150
|
# (#1904's `checks_absent`: this repo declares CI but reported ZERO
|
coord/merge_queue.py
CHANGED
|
@@ -1036,6 +1036,64 @@ def head_already_approved(
|
|
|
1036
1036
|
)
|
|
1037
1037
|
|
|
1038
1038
|
|
|
1039
|
+
def full_review_already_approves_head(
|
|
1040
|
+
board,
|
|
1041
|
+
*,
|
|
1042
|
+
assignment_id: str,
|
|
1043
|
+
branch: str,
|
|
1044
|
+
branch_head_sha: str | None,
|
|
1045
|
+
) -> bool:
|
|
1046
|
+
"""Narrower sibling of :func:`head_already_approved`: is *branch*'s
|
|
1047
|
+
current head already covered by a FULL (non-scoped) approving review,
|
|
1048
|
+
specifically?
|
|
1049
|
+
|
|
1050
|
+
:func:`coord.review.dispatch_review`'s
|
|
1051
|
+
``require_full_review_for_out_of_delta_gate`` caller needs exactly this
|
|
1052
|
+
question, not :func:`head_already_approved`'s — that caller's whole
|
|
1053
|
+
point is to dispatch a full review on top of a head a *scoped* review
|
|
1054
|
+
already approved, so the plain "any approving review" answer would
|
|
1055
|
+
refuse the very dispatch it exists to make. But once a FULL review has
|
|
1056
|
+
itself approved this exact head, re-checking that bare SHA match here
|
|
1057
|
+
(rather than skipping the #4002 check outright, which the out-of-delta
|
|
1058
|
+
gate's own ``check_already_approved=False`` would otherwise do
|
|
1059
|
+
unconditionally) is what stops a later, independent dispatch call from
|
|
1060
|
+
re-reviewing a leg a full review has already cleared.
|
|
1061
|
+
|
|
1062
|
+
Deliberately does NOT delegate to :func:`scan_approved_reviews` (unlike
|
|
1063
|
+
:func:`head_already_approved`) — that scan returns on the FIRST
|
|
1064
|
+
matching approval it finds walking the chain, which in the exact
|
|
1065
|
+
scenario this function exists for is the SCOPED approval (it is always
|
|
1066
|
+
recorded before the full one this function is looking for), not the
|
|
1067
|
+
full one. This walks the same chain (:func:`_chain_work_ids`) but
|
|
1068
|
+
checks every review in it rather than stopping at the first hit, so a
|
|
1069
|
+
later full approval is never hidden behind an earlier scoped one.
|
|
1070
|
+
|
|
1071
|
+
Same fail-closed-on-unknown-head and same-exact-SHA-only semantics as
|
|
1072
|
+
:func:`head_already_approved` — no patch-id/ancillary-diff carry
|
|
1073
|
+
forward, see its docstring for why that's correct for this narrow a
|
|
1074
|
+
question.
|
|
1075
|
+
"""
|
|
1076
|
+
if not branch or not branch_head_sha:
|
|
1077
|
+
return False
|
|
1078
|
+
probe = _ApprovalProbe(
|
|
1079
|
+
assignment_id=assignment_id,
|
|
1080
|
+
branch=branch,
|
|
1081
|
+
branch_head_sha=branch_head_sha,
|
|
1082
|
+
)
|
|
1083
|
+
pool = list(getattr(board, "completed", []) or []) + list(getattr(board, "active", []) or [])
|
|
1084
|
+
branch_work_ids = _chain_work_ids(probe, pool)
|
|
1085
|
+
if not branch_work_ids:
|
|
1086
|
+
return False
|
|
1087
|
+
return any(
|
|
1088
|
+
getattr(a, "type", None) == "review"
|
|
1089
|
+
and getattr(a, "review_of_assignment_id", None) in branch_work_ids
|
|
1090
|
+
and getattr(a, "review_verdict", None) == "approve"
|
|
1091
|
+
and not getattr(a, "review_scoped", False)
|
|
1092
|
+
and getattr(a, "review_head_sha", None) == branch_head_sha
|
|
1093
|
+
for a in pool
|
|
1094
|
+
)
|
|
1095
|
+
|
|
1096
|
+
|
|
1039
1097
|
def find_scoped_review_candidate(
|
|
1040
1098
|
entry: "QueuedMerge",
|
|
1041
1099
|
board,
|
|
@@ -3475,6 +3533,34 @@ def is_merge_gate_reserved_reason(reason: str | None) -> bool:
|
|
|
3475
3533
|
return (reason or "").startswith(MERGE_GATE_RESERVED_PREFIX)
|
|
3476
3534
|
|
|
3477
3535
|
|
|
3536
|
+
# The out-of-delta merge gate (`_out_of_delta_review_gate`) is the SAME
|
|
3537
|
+
# self-refreshing shape as `MERGE_GATE_RESERVED_PREFIX` above: nothing about
|
|
3538
|
+
# retrying resolves it faster than real time — only the auto-dispatched full
|
|
3539
|
+
# review this gate triggers (`dispatch_full_review_for_out_of_delta_gate`)
|
|
3540
|
+
# landing a verdict does — so a live `coord drive` session re-checks it every
|
|
3541
|
+
# poll without spending `--max-merge-attempts`, exactly the treatment
|
|
3542
|
+
# `coord.drive._decide_merge` already gives the reservation case.
|
|
3543
|
+
# Deliberately NOT phrased "review required"/"review not approved" — either
|
|
3544
|
+
# substring would make `coord.drive._merge_gate_kind` misclassify this as
|
|
3545
|
+
# the ORDINARY review gate, which would then escalate to a human on first
|
|
3546
|
+
# encounter via `_merge_gate_divergence` (this driver's cached
|
|
3547
|
+
# `review_verdict` routinely already reads "approve" here, since that is
|
|
3548
|
+
# exactly what the preceding scoped round recorded) instead of getting the
|
|
3549
|
+
# self-refreshing retry treatment below.
|
|
3550
|
+
OUT_OF_DELTA_FULL_REVIEW_PREFIX = "full-review gate: "
|
|
3551
|
+
|
|
3552
|
+
|
|
3553
|
+
def is_out_of_delta_full_review_reason(reason: str | None) -> bool:
|
|
3554
|
+
"""True when *reason* names the out-of-delta gate's block — see
|
|
3555
|
+
:data:`OUT_OF_DELTA_FULL_REVIEW_PREFIX`.
|
|
3556
|
+
|
|
3557
|
+
The single implementation of this classification: callers whose input is
|
|
3558
|
+
a persisted `merge_reason`/`entry.error` string use this instead of
|
|
3559
|
+
re-deriving it, mirroring :func:`is_merge_gate_reserved_reason`.
|
|
3560
|
+
"""
|
|
3561
|
+
return (reason or "").startswith(OUT_OF_DELTA_FULL_REVIEW_PREFIX)
|
|
3562
|
+
|
|
3563
|
+
|
|
3478
3564
|
def ci_rollup_all_clear(summary: Any) -> bool:
|
|
3479
3565
|
"""``True`` when a ``merge_plan`` row's ``ci_summary`` positively shows
|
|
3480
3566
|
every check on that PR has finished and none of them failed (#2158,
|
|
@@ -8665,6 +8751,57 @@ def out_of_delta_full_review_pending(
|
|
|
8665
8751
|
return _out_of_delta_review_gate(entry, board, gh_ops, config=config).pending
|
|
8666
8752
|
|
|
8667
8753
|
|
|
8754
|
+
def dispatch_full_review_for_out_of_delta_gate(
|
|
8755
|
+
entry: "QueuedMerge", board, config, **dispatch_review_kwargs,
|
|
8756
|
+
) -> "Assignment | None":
|
|
8757
|
+
"""Auto-dispatch the one full (non-scoped) review the out-of-delta gate
|
|
8758
|
+
(`_out_of_delta_review_gate`) requires before *entry* can merge.
|
|
8759
|
+
|
|
8760
|
+
Resolves the work leg the gate is blocked on (`_work_assignment_for_
|
|
8761
|
+
entry`) and dispatches a review for it via
|
|
8762
|
+
`coord.review.dispatch_review`, passing
|
|
8763
|
+
`require_full_review_for_out_of_delta_gate=True` so that call's
|
|
8764
|
+
ordinary "one review per leg" guard does not refuse the very review
|
|
8765
|
+
this gate exists to require. Every OTHER guard inside `dispatch_review`
|
|
8766
|
+
still applies — in particular its active-dispatch dedupe and atomic
|
|
8767
|
+
claim, both keyed on the work leg's own `assignment_id` — so calling
|
|
8768
|
+
this again while a review is already pending or in flight for the same
|
|
8769
|
+
head is a safe no-op, and a new push (which lands as a new work leg
|
|
8770
|
+
with a new `assignment_id`) re-arms it automatically.
|
|
8771
|
+
|
|
8772
|
+
*dispatch_review_kwargs* forwards straight through to
|
|
8773
|
+
`coord.review.dispatch_review` (`http_client`, `pr_lookup`,
|
|
8774
|
+
`claude_md_reader`, ... — the exact same injection points that
|
|
8775
|
+
function's own callers use) rather than duplicating its parameter list
|
|
8776
|
+
here; tests inject stubs the same way they do for a direct
|
|
8777
|
+
`dispatch_review` call.
|
|
8778
|
+
|
|
8779
|
+
Returns the dispatched review `Assignment`, or `None` when no work leg
|
|
8780
|
+
could be resolved on *board*, `dispatch_review` itself declined, or it
|
|
8781
|
+
raised — either way check the resolved work leg's own
|
|
8782
|
+
`review_dispatch_reason` for why; an unexpected exception is caught
|
|
8783
|
+
here and recorded there too (mirroring `dispatch_review`'s own `_deny`
|
|
8784
|
+
convention) rather than propagating and aborting the rest of this
|
|
8785
|
+
merge-queue pass over an unrelated entry's dispatch failure.
|
|
8786
|
+
"""
|
|
8787
|
+
if board is None:
|
|
8788
|
+
return None
|
|
8789
|
+
work = _work_assignment_for_entry(entry, board)
|
|
8790
|
+
if work is None:
|
|
8791
|
+
return None
|
|
8792
|
+
from coord.review import dispatch_review # noqa: PLC0415
|
|
8793
|
+
|
|
8794
|
+
try:
|
|
8795
|
+
return dispatch_review(
|
|
8796
|
+
work, board, config,
|
|
8797
|
+
require_full_review_for_out_of_delta_gate=True,
|
|
8798
|
+
**dispatch_review_kwargs,
|
|
8799
|
+
)
|
|
8800
|
+
except Exception as exc: # noqa: BLE001 — must not crash the merge pass
|
|
8801
|
+
work.review_dispatch_reason = f"full-review auto-dispatch raised: {exc}"
|
|
8802
|
+
return None
|
|
8803
|
+
|
|
8804
|
+
|
|
8668
8805
|
def _test_author_effective_issue_number(entry: QueuedMerge, board) -> int | None:
|
|
8669
8806
|
"""#2191: the child issue a ``type="test-author"`` merge entry's slice
|
|
8670
8807
|
is actually FOR — resolved via ``coord.models.effective_issue_number``
|
|
@@ -10533,9 +10670,52 @@ def process(
|
|
|
10533
10670
|
entry, board, gh_ops, config=config,
|
|
10534
10671
|
)
|
|
10535
10672
|
if _ood_gate.pending:
|
|
10536
|
-
entry
|
|
10673
|
+
# The gate alone never gets the entry unstuck —
|
|
10674
|
+
# auto-dispatch the full review it requires.
|
|
10675
|
+
# Idempotent: `dispatch_full_review_for_out_of_
|
|
10676
|
+
# delta_gate` routes through `dispatch_review`'s own
|
|
10677
|
+
# active-dispatch dedupe and atomic claim (both keyed
|
|
10678
|
+
# on the work leg's assignment_id), so a review
|
|
10679
|
+
# already pending or in flight for this head makes
|
|
10680
|
+
# this a no-op; a new push lands as a new work leg
|
|
10681
|
+
# and re-arms it. The message carries
|
|
10682
|
+
# `OUT_OF_DELTA_FULL_REVIEW_PREFIX` so
|
|
10683
|
+
# `coord.drive`'s own merge-reason classifier can
|
|
10684
|
+
# give this the same self-refreshing, attempt-exempt
|
|
10685
|
+
# retry treatment it gives a CI-pending/merge-gate-
|
|
10686
|
+
# reserved reason.
|
|
10687
|
+
_full_review = dispatch_full_review_for_out_of_delta_gate(
|
|
10688
|
+
entry, board, config,
|
|
10689
|
+
)
|
|
10690
|
+
if _full_review is not None:
|
|
10691
|
+
msg = (
|
|
10692
|
+
f"{OUT_OF_DELTA_FULL_REVIEW_PREFIX}"
|
|
10693
|
+
f"{_ood_gate.reason} — dispatched full "
|
|
10694
|
+
f"review {_full_review.assignment_id} to "
|
|
10695
|
+
"satisfy it"
|
|
10696
|
+
)
|
|
10697
|
+
else:
|
|
10698
|
+
_ood_work = _work_assignment_for_entry(entry, board)
|
|
10699
|
+
_dispatch_reason = getattr(
|
|
10700
|
+
_ood_work, "review_dispatch_reason", None,
|
|
10701
|
+
)
|
|
10702
|
+
_manual_target = (
|
|
10703
|
+
getattr(_ood_work, "assignment_id", None)
|
|
10704
|
+
or entry.assignment_id
|
|
10705
|
+
)
|
|
10706
|
+
msg = (
|
|
10707
|
+
f"{OUT_OF_DELTA_FULL_REVIEW_PREFIX}{_ood_gate.reason}"
|
|
10708
|
+
) + (
|
|
10709
|
+
f" (full-review auto-dispatch declined: "
|
|
10710
|
+
f"{_dispatch_reason})"
|
|
10711
|
+
if _dispatch_reason
|
|
10712
|
+
else " (full-review auto-dispatch declined "
|
|
10713
|
+
"— see logs; dispatch one manually for "
|
|
10714
|
+
f"{_manual_target})"
|
|
10715
|
+
)
|
|
10716
|
+
entry.error = msg
|
|
10537
10717
|
events.append(MergeEvent(
|
|
10538
|
-
entry, "full_review_required",
|
|
10718
|
+
entry, "full_review_required", msg,
|
|
10539
10719
|
))
|
|
10540
10720
|
continue # #292: skip this entry; try the next in the group
|
|
10541
10721
|
# Smoke gate (#465/#821): refuse to merge when the interactive smoke
|
coord/review.py
CHANGED
|
@@ -4650,6 +4650,7 @@ def dispatch_review(
|
|
|
4650
4650
|
exempt_dependency_issue_is_closed_fetcher=None,
|
|
4651
4651
|
tranche_open_issue_lister=None,
|
|
4652
4652
|
tranche_closed_epic_lister=None,
|
|
4653
|
+
require_full_review_for_out_of_delta_gate: bool = False,
|
|
4653
4654
|
) -> Assignment | None:
|
|
4654
4655
|
"""Open a PR for `completed` and dispatch a review assignment.
|
|
4655
4656
|
|
|
@@ -4752,6 +4753,20 @@ def dispatch_review(
|
|
|
4752
4753
|
get_closed_epics`; inject stubs in tests so this advisory lookup never
|
|
4753
4754
|
shells out to a live ``gh``. Entirely fail-open — see that function's
|
|
4754
4755
|
docstring.
|
|
4756
|
+
|
|
4757
|
+
*require_full_review_for_out_of_delta_gate* lets exactly one caller —
|
|
4758
|
+
the out-of-delta merge gate's own auto-dispatch — through the "one
|
|
4759
|
+
review per leg" guard below for a leg that already carries an approved
|
|
4760
|
+
*scoped* verdict. That gate's whole point is to require a SECOND,
|
|
4761
|
+
full-diff review on top of a scoped approval, so the ordinary single-
|
|
4762
|
+
review invariant does not apply here. It also disables the #4002
|
|
4763
|
+
`check_already_approved` SHA-match at the per-item gate below for the
|
|
4764
|
+
same reason: that leg's current head IS the one the scoped approval
|
|
4765
|
+
covers, so leaving the check on would deny the exact dispatch this
|
|
4766
|
+
flag exists to make. Every other guard (the active-dispatch dedupe,
|
|
4767
|
+
the atomic claim, the terminal-work/TOS checks) still runs unchanged,
|
|
4768
|
+
so this still dispatches at most once per leg while a review is
|
|
4769
|
+
pending or in flight for it.
|
|
4755
4770
|
"""
|
|
4756
4771
|
# #1627: every early-exit guard below used to be a bare `return None`,
|
|
4757
4772
|
# collapsing 11 distinct outcomes into one signal the caller couldn't
|
|
@@ -4855,42 +4870,49 @@ def dispatch_review(
|
|
|
4855
4870
|
# where *completed*'s own snapshot is stale but the verdict already
|
|
4856
4871
|
# landed durably — see that function's docstring for why the claim
|
|
4857
4872
|
# table alone cannot close this gap.
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4873
|
+
#
|
|
4874
|
+
# Both this and the scoped-cover check right below are skipped when
|
|
4875
|
+
# *require_full_review_for_out_of_delta_gate* is set — that caller is
|
|
4876
|
+
# dispatching the SECOND, full review the out-of-delta gate requires on
|
|
4877
|
+
# top of an already-recorded scoped approval, so the condition these
|
|
4878
|
+
# checks refuse is exactly the one it means to produce.
|
|
4879
|
+
if not require_full_review_for_out_of_delta_gate:
|
|
4880
|
+
if completed.review_verdict is not None:
|
|
4881
|
+
return _deny(
|
|
4882
|
+
f"assignment {completed.assignment_id} already has a recorded "
|
|
4883
|
+
f"review verdict {completed.review_verdict!r} — refusing a "
|
|
4884
|
+
"second review (#3670)"
|
|
4885
|
+
)
|
|
4866
4886
|
|
|
4867
|
-
|
|
4868
|
-
return _deny(
|
|
4869
|
-
f"assignment {completed.assignment_id} already has a recorded "
|
|
4870
|
-
"review verdict in the database — refusing a second review "
|
|
4871
|
-
"(#3670, stale board snapshot)"
|
|
4872
|
-
)
|
|
4887
|
+
from coord.state import has_recorded_review_verdict # noqa: PLC0415
|
|
4873
4888
|
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
(
|
|
4880
|
-
a for a in list(board.active) + list(board.completed)
|
|
4881
|
-
if a.review_scoped_work_id == completed.assignment_id
|
|
4882
|
-
and review_covers(
|
|
4883
|
-
a, completed.assignment_id, include_dead=False, board=board,
|
|
4889
|
+
if has_recorded_review_verdict(completed.assignment_id):
|
|
4890
|
+
return _deny(
|
|
4891
|
+
f"assignment {completed.assignment_id} already has a recorded "
|
|
4892
|
+
"review verdict in the database — refusing a second review "
|
|
4893
|
+
"(#3670, stale board snapshot)"
|
|
4884
4894
|
)
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4895
|
+
|
|
4896
|
+
# A scoped re-review that covered this leg carries the leg only in
|
|
4897
|
+
# `review_scoped_work_id` until `propagate_review_verdict` re-points
|
|
4898
|
+
# it, so neither check above sees it yet. Its verdict is about to
|
|
4899
|
+
# land on this leg; a second, full review would only repeat it.
|
|
4900
|
+
_scoped_cover = next(
|
|
4901
|
+
(
|
|
4902
|
+
a for a in list(board.active) + list(board.completed)
|
|
4903
|
+
if a.review_scoped_work_id == completed.assignment_id
|
|
4904
|
+
and review_covers(
|
|
4905
|
+
a, completed.assignment_id, include_dead=False, board=board,
|
|
4906
|
+
)
|
|
4907
|
+
),
|
|
4908
|
+
None,
|
|
4893
4909
|
)
|
|
4910
|
+
if _scoped_cover is not None:
|
|
4911
|
+
return _deny(
|
|
4912
|
+
f"assignment {completed.assignment_id} is already covered by "
|
|
4913
|
+
f"scoped review {_scoped_cover.assignment_id} "
|
|
4914
|
+
f"({_scoped_cover.status}) — refusing a second review"
|
|
4915
|
+
)
|
|
4894
4916
|
|
|
4895
4917
|
# Dedupe: don't fire a second review if one's already in flight for this
|
|
4896
4918
|
# completed work assignment. This in-memory check is a fast path only —
|
|
@@ -4984,9 +5006,50 @@ def dispatch_review(
|
|
|
4984
5006
|
except Exception: # noqa: BLE001 — fail-safe: missing SHA is not blocking
|
|
4985
5007
|
pass
|
|
4986
5008
|
|
|
5009
|
+
if require_full_review_for_out_of_delta_gate:
|
|
5010
|
+
# The out-of-delta gate's whole point is a SECOND, full review
|
|
5011
|
+
# on top of a head a *scoped* round already approved — but
|
|
5012
|
+
# once a FULL (non-scoped) review has itself approved this
|
|
5013
|
+
# exact head, the gate has already cleared (see
|
|
5014
|
+
# `_out_of_delta_review_gate`) and nothing should dispatch
|
|
5015
|
+
# another metered review for it. This is the "more rigorous
|
|
5016
|
+
# check than a bare SHA match" that justifies bypassing the
|
|
5017
|
+
# #4002 check below for a scoped-only approval, without
|
|
5018
|
+
# reopening it for a head a full review already cleared.
|
|
5019
|
+
from coord import merge_queue as mq # noqa: PLC0415
|
|
5020
|
+
|
|
5021
|
+
if mq.full_review_already_approves_head(
|
|
5022
|
+
board,
|
|
5023
|
+
assignment_id=completed.assignment_id,
|
|
5024
|
+
branch=completed.branch,
|
|
5025
|
+
branch_head_sha=review_head_sha,
|
|
5026
|
+
):
|
|
5027
|
+
return _deny(
|
|
5028
|
+
f"{completed.repo_name}#{completed.issue_number}'s "
|
|
5029
|
+
f"current head {(review_head_sha or '?')[:12]} already "
|
|
5030
|
+
"has a full (non-scoped) approving review in its work "
|
|
5031
|
+
"chain — the out-of-delta gate should already be "
|
|
5032
|
+
"clear; refusing a redundant dispatch"
|
|
5033
|
+
)
|
|
5034
|
+
|
|
4987
5035
|
# #4002: the per-item gate — one review per (repo, issue) in flight
|
|
4988
5036
|
# at a time, and never against a head already approved in this
|
|
4989
5037
|
# work's chain. See `claim_review_item_dispatch_gate`'s docstring.
|
|
5038
|
+
#
|
|
5039
|
+
# *require_full_review_for_out_of_delta_gate* skips the SHA-match
|
|
5040
|
+
# half of this gate (`check_already_approved=False`) for exactly
|
|
5041
|
+
# the same reason it skips the #3670 checks above: the caller's own
|
|
5042
|
+
# out-of-delta verdict already established that this exact head —
|
|
5043
|
+
# approved only by a scoped round — still needs a full review, so
|
|
5044
|
+
# the #4002 "head already approved" refusal would otherwise deny
|
|
5045
|
+
# the very dispatch this gate exists to make (mirrors
|
|
5046
|
+
# `dispatch_scoped_review`'s `is_base_move` use of the same
|
|
5047
|
+
# parameter, for the same kind of already-verified-elsewhere head).
|
|
5048
|
+
# The check immediately above already ruled out the one case this
|
|
5049
|
+
# bypass would otherwise wrongly let through — a head a full review
|
|
5050
|
+
# has already approved — so disabling it here is safe; the
|
|
5051
|
+
# in-flight/dedupe half of the gate (one lease per (repo, issue))
|
|
5052
|
+
# still applies unchanged.
|
|
4990
5053
|
_item_allowed, _item_deny_reason = claim_review_item_dispatch_gate(
|
|
4991
5054
|
repo_name=completed.repo_name,
|
|
4992
5055
|
issue_number=effective_issue_number(completed),
|
|
@@ -4996,6 +5059,7 @@ def dispatch_review(
|
|
|
4996
5059
|
board=board,
|
|
4997
5060
|
branch_sha_fetcher=branch_sha_fetcher,
|
|
4998
5061
|
head_sha=review_head_sha,
|
|
5062
|
+
check_already_approved=not require_full_review_for_out_of_delta_gate,
|
|
4999
5063
|
)
|
|
5000
5064
|
if not _item_allowed:
|
|
5001
5065
|
return _deny(_item_deny_reason)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|