Repository navigation
Commit 9d1ef56
fix(scripts): refuse PR-only labels on a new issue in issue-create (#31460)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNKXM3PyX5W136u8jKBiA5Q)_
Fixes #31359
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:建卡脚本 `issue-create.mjs` 在发出任何写入之前,先用 `label-write.mjs`
导出的同一条种类规则检查 `--label`;给新 issue 挂只属于 PR 的
`pm:awaiting-merge`(任意大小写)会被拒绝,干跑同样拒绝。
- 为什么改:种类规则此前只守在中继的命令行入口,建卡脚本直接调用 `sendFleetWrite` 绕了过去,PR 专用标签仍能落到新卡上。
- 风险与回滚:只动一个仓内工具脚本,不发布任何包;回滚即还原该文件这一处调用与一条自测。
- 先看:`scripts/pm/issue-create.mjs` 的 `planFrom` 里 `refuseKindLabels`
那三行,其次是干跑电池新增的那条自测。
- 两分钟验证:`node scripts/pm/issue-create.mjs --self-test`,预期 65 条全过;再带
`--dry-run --label PM:AWAITING-MERGE` 跑一次,预期退出码 2 并引出规则原文。
- 需要你做的:无,席位落地。
## What changes
- `scripts/pm/issue-create.mjs` imports `refuseKindLabels`, `KIND_ISSUE`
and `KIND_RULE_AWAITING_MERGE_PR_ONLY` from `scripts/pm/label-write.mjs`
(no rule retyped; no import cycle, the file already imported
`classifyHttp` from there).
- `planFrom` asks `refuseKindLabels({ kind: KIND_ISSUE, add: labels,
ref: 'the new card' })` right after the existing
`rewriteRetiredLaneLabels` call. A refusal joins the plan's errors, so
`main` prints the rule and exits 2 (usage) before any transport is
chosen: dry run, direct POST and relay alike.
- Header gains a short "The kind rule" section; the dry-run battery pin
moves 3 to 4.
- `close-cards.mjs` untouched, as the card says.
## Tests
- New self-test case (dry-run battery): `--dry-run --label
PM:AWAITING-MERGE` exits 2, stderr carries the quoted rule, nothing is
printed as sent, nothing is paced. Self-test 65/65 at the final head
(was 64/64 on main).
- Ablation through `scripts/ablation-replace.mjs --delete` of the `if
(wrongKind) errors.push(wrongKind);` line: anchor 1 to 0 on disk,
self-test exit 1 with exactly that case red (got exit 0, rule not
quoted, plan printed as sent); restored, blob hash equal to HEAD, `git
diff HEAD` empty.
- Manual: the uppercase label prints the rule plus the case-insensitive
note and exits 2; control `--label pm:queue` dry run exits 0.
## Acceptance notes
- None.
## Verification
- `dispatch-gates --tier`: no path-derived mandate, 18 changed lines.
- `dispatch-gates --commands`: 32 derived families, all exit 0 at
7372117; `--ran` reconciles 32 run, 0 NOT-MEASURED. The merge of main
(deac7f4) brought no file under `scripts/`; the same 32 were rerun at
the merge head 17ed0b1, all exit 0, `--ran` 32 run, 0 NOT-MEASURED.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jT5126E7RcpXRu5M3L)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 669a8aa commit 9d1ef56
1 file changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
| |||
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
107 | | - | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
225 | 231 | | |
226 | 232 | | |
227 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
228 | 237 | | |
229 | 238 | | |
230 | 239 | | |
| |||
446 | 455 | | |
447 | 456 | | |
448 | 457 | | |
449 | | - | |
| 458 | + | |
450 | 459 | | |
451 | 460 | | |
452 | 461 | | |
| |||
653 | 662 | | |
654 | 663 | | |
655 | 664 | | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
656 | 670 | | |
657 | 671 | | |
658 | 672 | | |
| |||
0 commit comments