Branch map and worktree hygiene (P3062, 2026-10-26)
Branch map
| Branch | Publishes as | Who pushes | Rule |
|---|---|---|---|
master | com.dlnraja.tuya.zigbee (test channel) | automation + manual | Behaviour changes land here first. |
stable-v5 | com.dlnraja.tuya.zigbee.stable | port after soak | Data, CI and safety fixes immediately; behaviour after soak on master. |
bastien-home | com.dlnraja.tuya.zigbee.bastien | promote workflow | Same as stable. While config/promote-publish-hold.json is active, promote only brings CI/test/docs. |
wip/* | never | anyone | Only node22-tests and shadow-policy-check run. Not merged blindly: wip/p3055-parasites and wip/p3057-headroom stay separate. |
wip/rescue/* | never | P3062 rescue | Frozen snapshots of worktrees that had uncommitted/unpushed work (74 refs). Do not delete; they are the safety net for the triage in P3062_WORKTREE_TRIAGE.md. |
int/* | never | short-lived | Integration branch for a batch; fast-forwarded into its target, then dropped locally. |
Publishing workflows are filtered to the three publishing branches. A head commit containing [skip ci] suppresses push-triggered workflows; when that is used during a hold, dispatch node22-tests by hand.
Worktree hygiene
- One worktree per task, under
/tmp/<task>(or/workspace/<task>only if it must outlive a reboot). - Commit as you go. Before leaving a worktree, push its branch (a
wip/*ref is fine). - Remove it when done:
git worktree remove <path>(neverrm -rf, which leaves stale admin entries). - Delete the local branch only when it is merged or pushed. Never delete remote branches as part of clean-up.
- Automated runs call the guard before exiting:
node tools/ci/worktree-hygiene.js --repo <main checkout>(dry run), then add--apply. It only removes worktrees under the temp root that are clean, pushed, older than 6 h, at most 20 per run, and it never touches branches. - Do not leave generated output in the main checkout:
reports/**,data/status/and checkpoints are regenerated by their scripts.
Why
On 2026-10-26 the box had 76 worktrees (disk 50 % used). Several held work that existed nowhere else. The rescue pushed it all to wip/rescue/* first, then triaged, integrated, and removed the worktrees.