Repository navigation
Commit b91dc73
fix(pm): mailbox-open warns at open time when --close will leave the --head branch (#31430)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9Ubb3yYQa743K3EEuBTKHDP1HE)_
Fixes #31385
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:`mailbox-open.mjs` 以 `--head` 开信箱时,若分支名不是 `claude/mailbox-*`,在建
PR 之前(含 `--dry-run`)向 stderr 打印一条醒目警告:`--close` 会留下这个分支,并给出
`claude/mailbox-<slug>` 的拼法。
- 为什么改:云席位常用会话指定分支开信箱,收工 `--close` 时分支被留下,直到收工才发现;现在开信箱当场就看得到。
- 风险与回滚:只多一行 stderr 输出,退出码、relay 动作、删除围栏(`mailbox_branch_delete` /
`MAILBOX_BRANCH_SHAPE`)都不变;回滚即 revert 本 PR。
- 先看:`scripts/pm/mailbox-open.mjs` 的 `headLeftWarning` 与 `main()`
中调用它的两行。
- 两分钟验证:`node scripts/pm/mailbox-open.mjs --repo
objectstack-ai/objectstack --seat domain:skills#2 --login zhuangjianguo
--head claude/project-thread-a81t4h --dry-run`,预期 stderr 出现一条 `--close
will LEAVE it` 警告并点名 `claude/mailbox-skills-2`,退出码 0。
- 需要你做的:无,席位落地。
## What changes
- New pure `headLeftWarning(plan)` in `scripts/pm/mailbox-open.mjs`: for
an open plan whose head was named with `--head` and does not match
`MAILBOX_BRANCH_SHAPE` (imported from `fleet-write/ops.mjs`, never
retyped), it returns one warning naming the head, saying `--close` will
leave it, and naming `claude/mailbox-SLUG`. Null for the pushed default
branch, a matching head, or a close.
- `main()` prints it once on stderr after the validator and before
either the dry-run print or the live open, so it shows before the pull
is created and on `--dry-run`. Exit code and stroke are unchanged.
- Header step ② notes the warning and that it is a warning, never a
refusal (card ask 3).
- `--self-test`: one plan-level case (warns on a thread branch, names
the slug spelling; silent on `claude/mailbox-*`, the default branch and
a close) and one CLI case (dry run on `claude/project-thread-a81t4h`,
the seat's own mailbox #31401 head: exactly one warning, exit 0, same
actions file; a `claude/mailbox-skills-2` head prints none). Battery
pins 11 to 12 and 7 to 8.
- Not touched, as ruled: `mailbox_branch_delete`,
`MAILBOX_BRANCH_SHAPE`.
## Tests
- `node scripts/pm/mailbox-open.mjs --self-test`: `✓ mailbox-open
self-test: 89 cases in 10 batteries pass.` (was 87).
- `pnpm exec eslint scripts/pm/mailbox-open.mjs`: exit 0.
## Acceptance notes
- Skip-changeset: `scripts/pm/**` only, nothing a package publishes
moves.
- No ablation: the diff is a script (os-dev.md: scripts are not
ablated); the self-test cases assert the warning's presence and absence
directly.
## Verification
<details><summary>dispatch-gates: 31 derived commands, all exit 0,
reconciled (run at 1aa4992, before the merge of main, which touched no
scripts/pm file)</summary>
All 31 commands from `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack` exited 0, including `pnpm
check:pm-dispatch-gates` (fast tier, 2205 cases, 488 s). `--ran`
reconciliation: `31 derived famil(ies) accounted for — 31 run, 0
NOT-MEASURED`. After merging `origin/main` (head 729e975), the
self-test was rerun: 89/89.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jUskASWbr1U7xn3KBQ)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent efc5e0a commit b91dc73
1 file changed
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| |||
293 | 296 | | |
294 | 297 | | |
295 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
296 | 309 | | |
297 | 310 | | |
298 | 311 | | |
| |||
496 | 509 | | |
497 | 510 | | |
498 | 511 | | |
| 512 | + | |
| 513 | + | |
499 | 514 | | |
500 | 515 | | |
501 | 516 | | |
| |||
512 | 527 | | |
513 | 528 | | |
514 | 529 | | |
515 | | - | |
| 530 | + | |
516 | 531 | | |
517 | 532 | | |
518 | 533 | | |
519 | 534 | | |
520 | 535 | | |
521 | | - | |
| 536 | + | |
522 | 537 | | |
523 | 538 | | |
524 | 539 | | |
| |||
591 | 606 | | |
592 | 607 | | |
593 | 608 | | |
| 609 | + | |
594 | 610 | | |
595 | 611 | | |
596 | 612 | | |
| |||
680 | 696 | | |
681 | 697 | | |
682 | 698 | | |
| 699 | + | |
683 | 700 | | |
684 | 701 | | |
685 | 702 | | |
| |||
0 commit comments