mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-16 17:09:09 +00:00
Shadow mode is meant to observe while Mergify keeps landing the same PRs. It still acted on them: - the tick removed the queue label and commented when it isolated a culprit, when a PR conflicted with the base, when its head was already in the base, and on every eligibility action (head changed after the label, conflicting, not an approver, protected surface, frozen base); - the approval job wrote a `failure` status "approval withdrawn" on every `unlabeled`, a red status on a healthy PR that the other merge path may refuse to merge; - a PR of the in-flight batch merged by Mergify during the candidate CI made the green batch be dropped as "already merged" and recomposed, so shadow rarely recorded `would-land`. In shadow mode only (live mode is unchanged): - tick.mjs writes to a pull request through two methods, removeLabel and the new commentPr, and both are no-ops in shadow. Comments on issues the queue owns (base-red notice, divergence, dashboard) keep going through comment(). - What live mode would have done is recorded instead. A culprit keeps the `culprit-found` event, with "shadow mode: label kept, no comment". A base conflict, a head already in the base and an eligibility label removal become a new `would-dequeue` event (PR, head, reason). - A culprit, a base conflict and an already-in-base head are remembered per head SHA in state.shadow.processed, like a validated head, so they are not batched again (eligibility reason `shadow-processed`). A PR the eligibility rules reject is recorded once per head and not marked: it stays out by its own reason, and a new approval of that head can still queue it. - A PR that another path merged at the tested head during the candidate CI no longer discards a green batch: `would-land` is recorded with "merged meanwhile by another path: #N". A PR merged at another head, or dropped for any other reason, is handled as before. - approve.mjs writes nothing for `unlabeled`. This is safe: checked in eligibility.approvalFor, the older `success` never counts by itself. Without the label the PR is `no-label`; a label put back by a non-approver is `label-not-by-approver`; after an approver's new label only a status created no earlier than 60 s before that label approves the head. A characterization test pins this. Not changed: the approval job still answers a non-approver's label with one comment in shadow mode (the runbook says so). Existing assertions changed on purpose: - tick.test.mjs "shadow bisection composes later segments…": the culprit #3 now keeps its label (was `[]`) and is in shadow.processed (keys were 1, 2, 4); the test also asserts the culprit-found event and that no label removal or comment was written. Existing tests whose setup (not assertions) changed, because they ran the committed shadow config while pinning live behaviour: - approve.test.mjs uses the committed config with mode "live"; - tick.test.mjs "main: the client counts only the App's own comment markers" passes a live config through OMNI_QUEUE_CONFIG.