mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
A fix the rules take for every line can still be wrong for one of them, typically because it builds on code that line does not have. The only ways to keep it out were backport/skip, which keeps it off every line, and --defer, which holds it out of one batch: the next batch tried it again, and a conflict that would never resolve came back every run. run --drop N --reason R records a drop in the line's record, bound to the original's merge commit on main, and every later record carries it, a new batch's included. What the open batch carries of a dropped original comes off it the way --defer takes one off; any other drop changes only the record, so a batch on a line that moved since stays where it is. --undrop withdraws one. Both need an open batch, as every write to the record does. A drop comes after the rules and the carries: backport/skip, rules 2 to 4 or the line itself decide first and the drop stays on record, and backport/include does not lift it. check notes a dropped original, the body lists it, fold refuses it, and a record whose drop names another original's merge stops every command. Each report keeps the record's drops with the merge commit each is bound to and its reason, held on read to the same rules, so an earlier report still says why after an undrop. A reason now travels from a body to terminals, bodies and comments, so a reason or a file name in a record is believed only in the form a run writes it, one clean line, and so is a report's diagnostic. Output that repeats a reason, file names, a report ID or a state GitHub reports escapes it. Assisted-By: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Backport tasks
The backport batch is built by backport-batch, and two steps around it need a maintainer's judgement. Each is a task with fixed inputs, one allowed output and a check in code that the result passes before anything is pushed. Both wait on the batch pull request: the batch's comment lists the deferred conflicts, and a failed batch CI shows on its checks.
| Task | Input | Output | Check |
|---|---|---|---|
| Resolve a conflict | a deferred conflict on the batch pull request | the original's commits picked under one merge on the batch branch, or one pick for a squash | backport-batch fold, and backport-batch verify in CI |
| Attribute a failed batch CI | the failing jobs of the batch pull request | the culprit deferred to the next batch | backport-batch run --defer |
Rules for every task
- Push nothing but the branch of the open batch pull request,
backport-batch/<line>-<yyyymmdd>in this repository, and only what the task's check accepted. Never push tomainor arelease-*branch, and never open a second batch pull request: the scheduled run continues the open one. - Change no file the original pull request does not change. A conflict that cannot be resolved inside those files is not resolved: the original stays deferred.
- Never rewrite the batch branch by hand. A plain push to it is a fast-forward; only
backport-batch run --defer --pushreplaces it, leased on the head it rebuilt. - Leave the batch pull request's title and body to the tool: it rewrites both on every run, and a hand edit is lost or, inside the
backport-batchblock, makesrun,check,foldandnotifyrefuse the body, and inside thebackport-batch-reportblock makesrun --pushandbackport-batch reportrefuse it. Leave the tool's report comments as they are too: each keeps one classification of the line, and an edited one makesbackport-batch reportrefuse it. - When the task cannot be done within these rules, push nothing and leave a comment on the batch pull request saying why, so the next maintainer to look finds it. Nothing is lost by waiting: a red batch does not merge, and a deferred original goes to the next batch.
Getting the tool
Build it from main, in a clean worktree of this repository whose origin is this repository and with gh authenticated as someone who can push to the batch branch:
git fetch origin
git worktree add --detach ../backport-task origin/main
cd ../backport-task
go build -o /tmp/backport-batch ./cmd/backport-batch
Run it from that worktree. Every command but notify and report fetches origin first, and run, check, fold and lines read the policy from origin/main.