Skip to content

Batch helper: one batch at a time, and a chair button to clear orphans

David ROFF requested to merge DMR-SYSTEM into main

Follow-ups to the reconcile work merged in !49 (merged).

One batch at a time

A second batch is cut fresh from main, so it does not carry the first one's rows. The two MRs then edit the same lines of the same country file and conflict at merge. Nothing was ever double-applied or lost - list_approved_dmrs() already excludes DMR::Batched - but the chair was left unpicking a conflict.

dmr-batch now refuses while a dmr/batch-* MR is still open, naming it and saying what to do about it. The risk rose when amendments and removals started editing rows in place rather than appending, which is what prompted this.

'Check for unmerged batches' button

New button in Chair actions on /contribute/list, next to Run DMR batch. Triggers dmr-reconcile via a DMR_RECONCILE=true pipeline, so the chair can clear DMRs stranded by a closed batch without waiting for the next batch run. The CI rule widened from schedule-only to any pipeline carrying that variable, so the button and a future schedule share one path.

The page also fetches open batch MRs, disables Run DMR batch while one exists, and shows a warning linking to it - so the refusal is visible before a pipeline is spent, rather than in a job log afterwards.

Deliberately not changed

The chair buttons still trigger the full main pipeline, including publish and pages. Flagged and left as-is by decision.

Testing

259 tests pass. open_batch_mrs() is unit-tested for branch-prefix filtering. CI YAML parses; the portal compiles and renders.

Not exercised in the browser: the open-batch warning banner, because no dmr/batch-* MR is currently open - all four are closed. The filter it relies on was proven against this project's real MRs in a read-only dry run, and the server-side refusal is unit-tested, but the banner itself has not been seen rendered.

After merge

Six DMRs (#61 (closed), #59 (closed), #56 (closed), #50 (closed), #46 (closed), #41 (closed)) are still stranded on DMR::Batched from MRs !40 (closed), !44 (closed), !47 (closed) and !48 (closed). Clicking Check for unmerged batches - or running the next batch - returns them to DMR::Approved. Until then the batch button reads '0 approved'.

Merge request reports

Loading