Skip to content

Commit 36aa663

Browse files
fix(pm): a Blocked-by value opening with none names no target (#38130)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDypKu7B9nwbu5WuV7AEio8)_ Fixes #38086 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感;各席位取卡时,写了「无阻塞」又顺带提到别的卡的卡片重新出现在可取清单里。 - 为什么做:车队取卡工具的读数缺陷,一张优先级最高的卡曾因此被藏起来。 - 出错会怎样:最坏是某张真被挡住的卡被当成可取,席位开工后会读到阻塞并停手;改动可直接撤回。 - 要你做什么:无。 ## What changes `blockedByTargets` in `scripts/pm/check-half-states.mjs` now skips a `Blocked-by:` directive value whose first token is `none` (any case, before any ref; a leading code or emphasis marker is read through). Every `#N` after it is context, not a target. The check is per directive, so a sibling `Blocked-by: #6` on the same line still counts, and `none` appearing after a ref is still prose. Only this reader changes: `directiveValues` serves other keys and stays as it is, and H4's presence test (`hasBlockedByLine`) still counts a `none` line as a line, because H4 asks whether the author left anything, not which card blocks. What else reads the same value: `directiveValues(..., 'Blocked-by')` has exactly one consumer, `blockedByTargets`. Everything else goes through it: `commentBlockedByTargets`, `blockerTargetsFor` (card-pick, `scripts/ci/scheduled-full-run.mjs`, `fleet-roster.mjs`), `buildBlockingIndex`, and the H19/H26/H28 reads. So one guard covers every reader, and no consumer-side change is needed. The `blockerTargetsFor` docblock rules (both channels unioned) are unchanged. Board measurement (REST search `is:issue is:open "Blocked-by: none"`, 26 hits, 2026-11-28 ~02:50Z; bodies plus all 3320 comments read through the base parser): **3 open cards** carry a `Blocked-by: none` value that names a `#N`. All three are in the body channel: #37445, #37446 (named on #36987) and #37405 (named on #36806). 0 are in the comment channel. ## Tests New pins in the self-test battery after the URL-fragment pin: the card's measured line verbatim reads as zero targets; any case and decoration (`None —`, bulleted backticked `NONE`, bolded key, backticked `none`) read as zero; a sibling directive on the same line still counts; `none` after a ref is prose; `nonesuch#9` / `none-of-them #10` are not the token; the `#A, #B` run, bulleted and bolded lines read as before; `hasBlockedByLine` stays true on a `none` line. Readings on head `39633858` (merge of origin/main into the fix commit `a43c62b4`): <details><summary>Self-test, ablation, local gates, card-pick before/after</summary> - `pnpm check:pm-half-states`: exit 0, `check-half-states self-test: 5427 cases pass.` - Ablation (the `BLOCKED_BY_NONE` skip line removed on disk, one line changed, then restored; porcelain empty after): exit 1, `3 of 5427 case(s) failed`. The three that fail are the `none. … #N` pin (got `36987`), the case/decoration pin (got `36806|1|2|3`) and the sibling pin (got `5,6`). - Local derived gates (`dispatch-gates --commands`, 69 families, all run under `os-verify-lock.sh`, VERDICT command-exit 0): 68 exit 0. `pnpm check:i18n-coverage` exits 3 (PREREQUISITE NOT MET: no package `dist/`; this diff touches no package), so it is NOT MEASURED locally and left to CI. `--ran` reconciliation: `69 derived famil(ies) accounted for — 68 run, 1 NOT-MEASURED`. - `node scripts/pm/card-pick.mjs --order area:fleet --why`. On base 93fa911 it prints `· #37445 · p2 · area:fleet · domain:devx — Blocked-by: #36987 (open)`. On this branch it prints `3 · #37445 · p2 · area:fleet … order 1`, as a pick. #37446 appears in neither listing. It was claimed by hand on 7231942694. </details> ## Acceptance notes - H4 (pm:blocked with no `Blocked-by:` line) still treats `Blocked-by: none` as discharging its duty. A card labelled `pm:blocked` whose only line says `none` is now an empty-target block. That is H19's existing "names no open target" row, not a new state. No change here. ## Verification Read first: `blockedByTargets` and `BLOCKED_BY_NONE` (the one behaviour change), then the new pins after `a URL fragment inside a value is not a target`. Two-minute check: `node scripts/pm/card-pick.mjs --order area:fleet --why`. #37445 is in the picks, and the line `#37445 … — Blocked-by: #36987 (open)` is gone (base prints it). --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent d59478f commit 36aa663

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

‎scripts/pm/check-half-states.mjs‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3991,6 +3991,22 @@ export function h13AreaWithoutPmState(issue, nowMs = Date.now()) {
39913991
*/
39923992
const BLOCKED_BY_REF = /(?<![A-Za-z0-9._\/-])([A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)?)?#(\d+)/gu;
39933993

3994+
/**
3995+
* A value whose FIRST token is `none` (any case, before any `#N`) names no
3996+
* target: the author stated there is no blocker, and every `#N` after it is
3997+
* context. The one exception to 「every ref is a target」 above, and the
3998+
* author's own words rather than an ambiguity — the measured
3999+
* 「Blocked-by: none. Order: independent of #36987's ruling.」 (#37445, #37446)
4000+
* otherwise read as blocked by the very card the line says it is
4001+
* independent of, and card-pick held a p1 out of every seat's picks.
4002+
*
4003+
* Token, not prefix: 「nonesuch#5」 or 「none-of-these」 is not the word.
4004+
* A leading code or emphasis marker the per-directive strip left behind
4005+
* (「`none` — …」) is read through. H4's presence test is untouched: a
4006+
* `none` line still tells the machine something, which is all H4 asks.
4007+
*/
4008+
const BLOCKED_BY_NONE = /^[`*_]*none(?![\p{L}\p{N}_#-])/iu;
4009+
39944010
export function blockedByTargets(body) {
39954011
const out = [];
39964012
// The shared decorated-directive reader: ONE value per directive, trimmed
@@ -3999,6 +4015,7 @@ export function blockedByTargets(body) {
39994015
// code. A qualifier must TOUCH its `#` and no match may START inside a
40004016
// path-like token, so a URL fragment in a value names no target.
40014017
for (const value of directiveValues(body, 'Blocked-by')) {
4018+
if (BLOCKED_BY_NONE.test(value)) continue;
40024019
for (const ref of value.matchAll(BLOCKED_BY_REF)) {
40034020
out.push({ repo: ref[1] ?? null, number: Number(ref[2]) });
40044021
}
@@ -28457,6 +28474,25 @@ async function selfTest() {
2845728474
t('blockedByTargets: ONE directive still yields exactly one target', numbersOf(blockedByTargets('`Blocked-by: #4242`')), '4242');
2845828475
t('blockedByTargets: prose naming `#n` OUTSIDE any directive invents nothing', numbersOf(blockedByTargets('We will wait for #9 and #10 before starting.')), '');
2845928476
t('blockedByTargets: a URL fragment inside a value is not a target', numbersOf(blockedByTargets('Blocked-by: #12 (trail: https://example.test/issues/8347#40)')), '12');
28477+
// A `none` value names no target, whatever it names after (#38086). The
28478+
// first pin is the MEASURED line on #37445/#37446, verbatim; the controls
28479+
// keep a ref run, a bulleted and a bolded directive reading as before.
28480+
t('blockedByTargets: the #38086 line — `none. … #N` is ZERO targets', numbersOf(blockedByTargets("Blocked-by: none. Order: independent of #36987's ruling.")), '');
28481+
t('blockedByTargets: …any case, any decoration around the directive', [
28482+
'Blocked-by: None — the ADR can land beside #36806',
28483+
'- `Blocked-by: NONE (see #1)`',
28484+
'**Blocked-by:** none; #2 is context',
28485+
'Blocked-by: `none` — #3 is context',
28486+
].map((b) => numbersOf(blockedByTargets(b))).join('|'), '|||');
28487+
t('blockedByTargets: …and only that directive: a sibling on the line still counts', numbersOf(blockedByTargets('`Blocked-by: none (#5)` · `Blocked-by: #6`')), '6');
28488+
t('blockedByTargets: `none` AFTER a ref is prose, the ref still counts', numbersOf(blockedByTargets('Blocked-by: #7 (none of #8 matters)')), '7,8');
28489+
t('blockedByTargets: a word that merely starts with `none` is not the token', numbersOf(blockedByTargets('Blocked-by: nonesuch#9, none-of-them #10')), '9,10');
28490+
t('blockedByTargets: …and the `#A, #B` run, bulleted and bolded lines read as before', [
28491+
'Blocked-by: #6234, #6245',
28492+
'- Blocked-by: #9823',
28493+
'**Blocked-by:** #9823',
28494+
].map((b) => numbersOf(blockedByTargets(b))).join('|'), '6234,6245|9823|9823');
28495+
t('hasBlockedByLine: a `none` line is still a line (H4 asks presence, not targets)', hasBlockedByLine('Blocked-by: none. Order: independent of #36987.'), true);
2846028496
// The whole directive family reads through `directiveValues`, so all of it
2846128497
// gains the multiplicity — pinned on a NON-`Blocked-by:` key, beside the pin
2846228498
// that a key after a WORD is still prose and invents nothing.

0 commit comments

Comments
 (0)