Skip to content

Commit 975e34e

Browse files
chore(pm): one round source, stateless ROUND_RULE, inflight --paths and is-ancestor pointers (#35237 slice 11) (#38243)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDypKu7B9nwbu5WuV7AEio8)_ Part of #35237 (slice 11: carrier items 20, 21, 22; the card keeps its other items) Clause-②: no Metadata-protocol: none Rule-change: none ## 维护者速读 - 用户无感:车队席位读到的「一轮多长」只剩一处来源,在飞检查命令照文档敲即可运行,查祖先判断的规则能被搜到。 - 属于车队规则收口专题,替各席位解决三条上一轮评审留下的指针与重复常量问题。 - 出错只会让欠审清单或开轮自退按错的轮长判断,不碰产品代码,可直接撤回本 PR。 - 无。 ## What changes - **Item 20** (`scripts/pm/check-owed-reviews.mjs`): `TRIAGE_ROUND_MINUTES` is now `ROUND_MINUTES` imported from `round-open.mjs` (no import cycle: the round-open closure is 5 modules and none of them imports check-owed-reviews). The exported name is kept. Both comments now point at the `seat-lifecycle.md` round line instead of the retired contract-review.md phrase. - **Item 21 (a)** `references/landing-operations.md` 约定③ drops its 「(~60 分钟)」 figure, as slice 9 did for contract-review.md. - **Item 21 (b)** `references/contract-review.md` trigger (b) 「已等满一轮」 now carries the pointer `(seat-lifecycle.md)`. Paid for in the same file by five prose tightenings that keep every rule (`不起第二个 agent` to `不另起 agent`, `所定`, `的`, `而`, `、且`). - **Item 21 (c)** `scripts/pm/round-open.mjs`: the exported `ROUND_RULE` has no `g` flag now (`/一轮 (\d+) 分钟/u`). `roundMinutesOfRule` scans with a local global copy. A new self-test case pins the export as neither global nor sticky, checks that three `.test()` calls answer the same, and checks that the scan still reads every figure. The battery floor goes from 3 to 4. - **Item 22 (a)** `SKILL.md` 〈车道与域〉 spells the in-flight check as the usage line does: `check-handover.mjs --inflight --paths=PATH[,PATH…]`. Paid for in the same file by six tightenings (`绝`, `的`, `就还` to `即`, `自己读的` to `自读`, `自己的` to `自有`, `的`), and no rule is removed. - **Item 22 (b)** The `AGENTS.md` git-history sentence now reads "an `is-ancestor` containment one", so a search for the command lands on it. - **Item 22 (c)** The "why" link went to a section that covered only the windowed half. The section is renamed `Shallow-clone history` (the new anchor is shorter, and that pays for (b)), and one sentence now covers the containment half: a cut only withholds an ancestor path, so exit 0 stands in any clone and a "not an ancestor" result may be the cut; `git-history.mjs ancestor` proves the negative with a control leg, or it refuses. The anchor had no other referrer (git grep). ### Bytes per ratcheted file (`wc -c`, origin/main bd5407e to this head) | File | origin/main | this head | net | ceiling (unchanged) | |:--|--:|--:|--:|--:| | `AGENTS.md` | 78709 | 78708 | -1 | 78712 | | `.claude/skills/pm-dispatch/SKILL.md` | 33342 | 33340 | -2 | 33351 | | `.claude/skills/pm-dispatch/references/contract-review.md` | 6403 | 6402 | -1 | 6419 | | `.claude/skills/pm-dispatch/references/landing-operations.md` | 10673 | 10661 | -12 | 10717 | No CEILINGS row moved. `docs/agents/multi-agent-discipline.md` carries no ceiling. ## Tests All runs are on head `329c808fc8`. <details><summary>Self-tests and ablations (on-disk mutation, then restore)</summary> - `node scripts/pm/round-open.mjs --self-test`: exit 0, `✓ round-open self-test: 39 cases pass across 6 batteries`. - `node scripts/pm/check-owed-reviews.mjs --self-test`: exit 0, `96 cases pass in 10 batteries`. - Ablation A1, `ROUND_MINUTES = 60` changed to `45` in round-open.mjs only. check-owed-reviews goes red through the import (exit 1, `✗ … under a full round, nothing else holding ⇒ WAIT`, 1 of 96). round-open goes red against the seat-lifecycle.md line (exit 1, 2 of 39). - Ablation A2, the `g` flag put back on the export. round-open goes red (exit 1, the new case reads `got [true,[true,false,true],[60,45]]`). That is the `lastIndex` state the card names. - Ablation A3, the seat-lifecycle.md line changed from 60 to 45. round-open goes red (exit 1, `got [45], want [60]`). The 60 to 45 pin still holds. - After each ablation the file was restored, and both suites are green again (exit 0). </details> ## Acceptance notes - `docs/agents/multi-agent-discipline.md` is outside the fence's file list, but item 22 (c) says to fix the link, and fixing the link target there is the cheap way to do it. It is not ratcheted. - No changeset: nothing in the diff ships (`scripts/pm/**`, `.claude/**`, `AGENTS.md` and `docs/agents/**` are fast-lane paths). Hence `skip-changeset`. ## Verification - Files to read first, by risk: `scripts/pm/round-open.mjs` (the `ROUND_RULE` hunk), `scripts/pm/check-owed-reviews.mjs` (the import and constant hunk), and `AGENTS.md` (the history sentence). - Two-minute check: run `node scripts/pm/round-open.mjs --self-test && node scripts/pm/check-owed-reviews.mjs --self-test`. You should see two ✓ lines, with 39 and 96 cases. <details><summary>Local gates: 50 of 50 derived families, every one exit 0</summary> - `node scripts/pm/dispatch-gates.mjs --ran FILE`: `✓ 50 derived famil(ies) accounted for — 50 run, 0 NOT-MEASURED (a DERIVED zero — all 50 recorded an exit code and none of them is 3)`. - `pnpm check:pm-skill-ratchet` exit 0. `pnpm check:pm-governed-prose` exit 0. `pnpm check:pm-dispatch-gates` exit 0. `pnpm check:nul-bytes` exit 0. - `pnpm --filter @objectstack/lint run check:doc-formula-expressions` first exited 3 (dist not built, so it measured nothing). After the formula and lint build under the verify lock (VERDICT command-exit 0) it exits 0. - `node scripts/pm/overlap-check.mjs --branch=claude/issue-35237-slice11-round-and-pointers`: `VERDICT clean exit 0`. - CI families: read them from this PR's check-runs. They were not re-run here. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW)_ <!-- signed: repo:objectstack#1 · os-elon-musk · session_016WV4cxRDKprCtjpEdtiPFW --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 360c494 commit 975e34e

7 files changed

Lines changed: 31 additions & 24 deletions

File tree

‎.claude/skills/pm-dispatch/SKILL.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 →
148148
- 未发版 ⇒ 转 `pm:on-hold`;`Restart-when:` 写安装面判据与唤醒后派发形状,⛔ 不回 `pm:queue`。
149149
- 状态变更不过夜:标签无评论、assignee 无认领评论、结论只在 chat,都是半状态。
150150
- 半状态在结束会话(含限流悬挂)前补齐成对或回滚半边;report-only 巡查见守卫索引。
151-
- 等待他座位也是状态,写在卡上才存在(等谁、自何时),⛔ 不留在会话记忆。
152-
- P0 嫌疑的等待走紧急直接分诊通道,是义务非选项。
151+
- 等待他座位也是状态,写在卡上才存在(等谁、自何时),⛔ 不留会话记忆。
152+
- P0 嫌疑等待走紧急直接分诊通道,是义务非选项。
153153
- 代执行他人指令的关闭、摘标、回收认领,评论带出处三件:谁的指令、原话、在哪说。
154154
- 标签写恒四步:取现集 → 只增删目标 → 写合并集 → 回读 diff 对 union(现集, 增删)。
155155
- union 有而回读缺 = 被并发剥掉,重挂并报告。
@@ -163,7 +163,7 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 →
163163
- 锚定规则:每个包恰属一个域;`domain:*` = 修复落地包的域;`Seam:` 卡默认纵向派发。
164164
- `domain:*` 只决定文件归属:锚定、单认领路径;⛔ 不是队列或优先级单位。域席 server、spec、ui、devx、skills 已退役;脚本仍读或印它处行为未改,读作文件归属或既往席名。
165165
- `Seam:` 卡认领申报两端;验收 = 消费端读该键(活性账本行离开 `planned`)或键随账本行退役。
166-
- 域由分诊读代码判定,⛔ 绝不从 issue 标题的词汇猜域;说不出修复碰哪个文件就还不可标。
166+
- 域由分诊读代码判定,⛔ 不从 issue 标题词汇猜域;说不出修复碰哪个文件即不可标。
167167

168168
| 标签 | 包家族 |
169169
|:--|:--|
@@ -181,7 +181,7 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 →
181181
- 退役 `domain:*` 只退流通,对象保留;`domain:engine`/`domain:services`/`domain:cli` 读作 `domain:server`。
182182
- `domain:*` 与队列只由分诊落笔;两例外:sub-issue 承父卡域、main-red 锚卡,免审计评论。
183183
- 无分诊审计评论 ⛔ 不得认领;车道席自分诊是上行第三例外,住 `triage-duties.md`。
184-
- 派发前在飞检查 `node scripts/pm/check-handover.mjs --inflight`:读 `pm:dispatched` 卡认领申报的文件面,本地求交、不另发查询。
184+
- 派发前在飞检查 `node scripts/pm/check-handover.mjs --inflight --paths=PATH[,PATH…]`:待派面对 `pm:dispatched` 卡认领申报面本地求交、不另发查询。
185185
- 越界只四通道:跟到底的越界面、无主阻塞项、main-red 锚卡、spec.md 搭车。
186186
- 合并队列是共享串行资源:车道买到并行编写,非并行落地。
187187
- 谁发现 flake 谁修或立单,⛔ 不绕行。
@@ -198,7 +198,7 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 →
198198
- ② PR 悬着等人批,同笔挂 `pm:awaiting-merge`;人工直合即审核记录,授权批准 ⇒ 席位落地。
199199
- 指针 `ACCEPT → PR #n comment <id>`;受管/spec 面欠 ①–④,席只达档补审现 head 记录未盖处。
200200
- 核对六项:形态/前提实测/门禁 check-runs/接受的偏差/范围外去向+`Skills-docs:`/落地条款。
201-
- 终稿 = 席位照自己读的 diff 校正 dev 草稿、加席位意见行,置顶席位记录;维护者只读评论。
201+
- 终稿 = 席位照自读 diff 校正 dev 草稿、加席位意见行,置顶席位记录;维护者只读评论。
202202
- `pm:awaiting-merge` 只挂 PR、不入六态,与请审同为等人批清单,随获批或撤回判决离开。
203203
- 批准后再推亦不过期;席位落地 = 过落地前检、清标、ready、auto-merge,踢出/变基同法。
204204
- ③ 请审 = 交棒:ACCEPT 与现 head 同形 PASS 俱在案,同轮一笔 `label-write.mjs --handoff` 交②③。
@@ -212,7 +212,7 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 →
212212
- 入队资格:每 check 绿或预期 skip,⛔ 非必查子集;名单 check-expected-skips.mjs 只判 objectstack。
213213
- 非必查红是真缺陷或坏门,归 PM 入队前处置;第三种按设计而红,三条全立才可带红入队:
214214
- 源码自述 pushed 分支上按设计而红、不跑 `merge_group`、PR 评论记明门与因,缺一即否。
215-
- 本段只适用本循环派发的 dev PR;PM 自己的工具 PR 留维护者。
215+
- 本段只适用本循环派发的 dev PR;PM 自有工具 PR 留维护者。
216216

217217
## 升级与决策
218218

‎.claude/skills/pm-dispatch/references/contract-review.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
后者审其合契约,diff 外被引代码只读;`Scope:` 行分列两者,可放宽、⛔ 不窄于 `hits`。
1414
- 余部归车道席位 `TIER_DEFAULT` 的 ACCEPT,同单独开 PR 并点名;Tier H 人批与队列守卫仍整张 PR。
1515
- 面读 PR 已提交树的文件清单(同队列守卫判 governed 路径)与申报行;⛔ 不读席位自述。
16-
- 已发布面以包的 `exports` 映射为准:从入口类型图不可达、且 `exports` 不可寻址的 `.d.ts` 是
16+
- 已发布面以包的 `exports` 映射为准:从入口类型图不可达且 `exports` 不可寻址的 `.d.ts` 是
1717
出货字节,⛔ 不是已发布接受集,改它不触发 `Clause-②: yes`;legacy node10 深引用在契约之外。
18-
- 四面皆不碰 ⇒ CI 加席位自读 ⛔ 不起第二个 agent;谁跑 = 派发席,档经子代理或卡线程取。
18+
- 四面皆不碰 ⇒ CI 加席位自读 ⛔ 不另起 agent;谁跑 = 派发席,档经子代理或卡线程取。
1919
- p1 卡线程卡交回且欠 L2 ⇒ L1 线程起隔离 L2 子代理,与其 L1 并行,两份意见同回席。
2020
- 送审路由只住此处:车道能取 `CONTRACT_REVIEW_TIER` 才自审;取不到(账号够不到、配额拒 429、
2121
维护者限配)⇒ ⛔ 不降档 ⛔ 非分诊,落交接行并同笔请 L2 席(照 `lanes/l2-review.md`);
2222
无 L2 席在座改点能取该档的兄弟席,皆无则挂等 L2 标记留欠审表待 (a)(b)(c)。交接行:
2323
- `Contract-review-handoff: <l2-review#N|repo:NAME#N|epic:#N#k> — CONTRACT_REVIEW_TIER unavailable (<HTTP status / error>, <UTC time>) · head <sha>`
2424
- 欠审 PR(含 draft)现 head 无记录无活认领且 (a)(b)(c) 之一 ⇒ 车道达档自审或交接,⛔ 非分诊
25-
- (a) 交接行/敲门点名现 head(同轮所点席接)或带等 L2 标记;(b) 现 head 已等满一轮;
25+
- (a) 交接行/敲门点名现 head(同轮所点席接)或带等 L2 标记;(b) 现 head 已等满一轮(`seat-lifecycle.md`);
2626
- (c) 车道收班或离总表,欠审入交班简报;L2 席只接 (a) 所点、自记录 delta、他席皆禁之 head。
2727
- L2 席或车道起审前读 PR:现 head 有记录或活认领 ⇒ ⛔ 不起;否则先落认领行,一 head 一行:
2828
- `Contract-review-claim: <session> · head <full sha> · <UTC>`
@@ -32,7 +32,7 @@
3232
- 逾 24 小时条件未满的 hold 列入分诊轮次记录(`check-owed-reviews.mjs` 标出)。
3333
- L2 记录 = 一条评论落 PR 或卡,席内与各子代理同形;散文、dev 自评、`os-dev-report` 不算。
3434
- 同形 = `## Contract review` 题头之下 `Head-sha:` 行独占码段、①②③逐项、独立性对、PASS/FAIL。
35-
- 同形含首行 `Served-tier:`:值为该面所定档常量名 `CONTRACT_REVIEW_TIER` 或 `TIER_DEFAULT`;无此行不
35+
- 同形含首行 `Served-tier:`:值为该面档常量名 `CONTRACT_REVIEW_TIER` 或 `TIER_DEFAULT`;无此行不
3636
成裁决;模板 `record-recognisers.mjs --template`;前者只经写工具带 `--tier-evidence=`贴:子代理
3737
(显式传该档 model)给输出文件;卡线程未起他 agent、未发消息、未调 Skill 才给本会话转录;
3838
席位开席即调 Skill 恒不合;`verify-review-tier.mjs` 拒即子代理重跑 ⛔ 不改档名。
@@ -41,7 +41,7 @@
4141
- 实质 head 各欠一轮完整 L2,发现逐条定 must-fix/should-fix/nit(无碍正确与契约);有前两级才由
4242
原 L2 审核者读 delta;仅 nit 即终轮,记接受的偏差、转后续卡(`filing-gate.md`)或只改散文面。
4343
- 另记作者:PR `user.login` 非 `objectstack-fleet[bot]` ⇒ ③ 注点名该 login(脱中继写),落地前读。
44-
- ③ 恒查(席位自读同):SQL 可下推处新增 id 物化或应用内 join 而无因由 ⇒ 记发现(AGENTS.md)。
44+
- ③ 恒查(席位自读同):SQL 可下推处新增 id 物化或应用内 join 无因由 ⇒ 记发现(AGENTS.md)。
4545
- 简报从 `record-recognisers.mjs --brief-template` 起稿:只读条款与输入集内建,⛔ 不删 ⛔ 行。
4646
- 独立性对、`Security-touching:`、`Rule-change-verified:` 行取值见 `--template`;子代理记采纳席位。
4747
- ④ 恒由起草者之外的 agent 达档跑,起草已达档不免;喂入同上,⛔ 不喂起草者的结论。
@@ -52,7 +52,7 @@
5252
- head 后移例外:纯重生成或只动散文面原记录续管,落 `Regen-provenance:` 行;余移或现 head 落 FAIL
5353
而已挂 auto-merge ⇒ 派发席读到即照 AGENTS.md disarm 句撤挂,FAIL 记录点名欠撤挂;重挂照 ①。
5454
- ② PR check 全绿,⛔ 非 required 子集;例外:merge-base 同签名的红不计、按设计而红见 SKILL.md。
55-
- 签名 = 失败步 + 首错行,读 base check runs 的 API ⛔ 不凭口述;主干红止血立单不变。
55+
- 签名 = 失败步 + 首错行,读 base check runs API ⛔ 不凭口述;主干红止血立单不变。
5656
- 落地时仍欠 L2 的 PR 在落地 head 补审,L2 席或车道席按 (a)(b)(c) 接;FAIL ⛔ 不修已关 PR。
5757
- 每条 must-fix 引该记录立卡、按发现定级;回退仅限主干红(p0,main-red 约定①)或安全边界。
5858

‎.claude/skills/pm-dispatch/references/landing-operations.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
- p0 fix-forward 止血跳队,限机械、根因已核实;维护者可按 governed 例外人工直合一行修复。
9191
- 止血非机械 ⇒ 锚卡点名归属车道、敲其信箱 `Notify: main-red`;根因卡恒归该车道。
9292
- main-red 约定②:一个失败 check 只锚一张卡,先立者赢,后见者评论到锚卡,⛔ 不另立。
93-
- 约定③:锚卡一轮分诊(~60 分钟)无人认领 ⇒ 分诊与总监当轮轮报点名卡与归属车道。
93+
- 约定③:锚卡一轮分诊无人认领 ⇒ 分诊与总监当轮轮报点名卡与归属车道。
9494
- 再一轮无人认领 ⇒ 分诊贴标准认领行、派一个 os-dev 只做止血;每轮一张,分诊不成车道。
9595
- 止血 PR 的 L1/L2 归车道席或总监,⛔ 非分诊;Tier H 仍等审批人;车道席到场经认领行交回。
9696

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,10 @@ after a checkout-from-ref. Better, stage nothing:
391391
`git restore --source=<ref> -- <path>` (no `--staged`) writes the tree only, a lone
392392
unstaged `M`.
393393

394-
**A windowed history question ("how many commits on `<ref>` in `<window>`"), or a containment
394+
**A windowed history question ("how many commits on `<ref>` in `<window>`"), or an `is-ancestor` containment
395395
one (`git-history.mjs ancestor`), goes through `scripts/pm/git-history.mjs` — answer, or REFUSE**
396-
([why](docs/agents/multi-agent-discipline.md#windowed-history-on-a-shallow-clone)). `historyHorizon()` is the
397-
read-only predicate for tools that answer their own question.
396+
([why](docs/agents/multi-agent-discipline.md#shallow-clone-history)). `historyHorizon()` is the
397+
read-only predicate for tools answering their own question.
398398

399399
**Claim the issue BEFORE you write any code.** Every agent here shares one GitHub identity, so
400400
the assignee field is only a presence bit; the identity record is the `Claim:` comment — first

‎docs/agents/multi-agent-discipline.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ because they read the tree, and a bare `git commit` builds from the **index**
5959
that deletes your own fix, in a PR whose body accurately describes a change it does not
6060
contain.
6161

62-
## Windowed history on a shallow clone
62+
## Shallow-clone history
6363

6464
← [`AGENTS.md` › Multi-agent working discipline](../../AGENTS.md#multi-agent-working-discipline)
6565

6666
A shallow clone answers windowed
6767
`git log`/`rev-list` questions from truncated history at exit 0 with no warning; the tool
68-
proves the window is covered first.
68+
proves the window is covered first. Containment (`merge-base --is-ancestor`) fails one way: a cut
69+
only withholds an ancestor path, never invents one, so exit 0 stands in any clone while a "not an
70+
ancestor" may be the cut; `git-history.mjs ancestor` proves the negative with a control leg or refuses.
6971

7072
## The shared identity’s accepted blind spot
7173

‎scripts/pm/check-owed-reviews.mjs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
* own wait, and a `HOLD` beside `HELD` is one letter from a misread.
8383
* trigger the first that holds: (a) a hand-off line naming the current
8484
* head, or the waiting label — taken the same round; (b) the head
85-
* has waited a full round (`TRIAGE_ROUND_MINUTES`) and no
85+
* has waited a full round (`TRIAGE_ROUND_MINUTES`, the
86+
* `seat-lifecycle.md` round line) and no
8687
* live hold names it; (c) the lane's seat has stood down or is
8788
* absent from the seat roster. A live hold holds (b) alone: the
8889
* lane that holds ends it with (a), and a lane gone is (c).
@@ -115,6 +116,7 @@ import { GOVERNED_APPROVERS, NARROWING_FACE_LINE, narrowingDeclarationsIn, recor
115116
import { FLEET_BOT_LOGIN } from './check-handover.mjs';
116117
import { readClause2Line } from './clause2-line.mjs';
117118
import { parseSeat } from './fleet-roster.mjs';
119+
import { ROUND_MINUTES } from './round-open.mjs';
118120
import { isL2ReviewLane } from './mailbox-open.mjs';
119121
import { ghApi, readAllPages } from './gh-pages.mjs';
120122
import {
@@ -135,8 +137,8 @@ export const EXIT_USAGE = 2;
135137
export const DEFAULT_REPO = 'objectstack-ai/objectstack';
136138
/** The waiting label the dispatching seat hangs at ACCEPT (`references/contract-review.md` 〈等 L2 标记〉). */
137139
export const WAITING_LABEL = 'needs:contract-review';
138-
/** One full round — the rule's 「一轮(约 60 分钟)」, trigger (b). The name is kept: importers read it. */
139-
export const TRIAGE_ROUND_MINUTES = 60;
140+
/** One full round, trigger (b): `round-open.mjs`'s `ROUND_MINUTES`, the number on `seat-lifecycle.md`'s round line — one source, never a second copy. The name is kept: importers read it. */
141+
export const TRIAGE_ROUND_MINUTES = ROUND_MINUTES;
140142
/** The seat posts' label (`seat-post-protocol.md`); `parseSeat` reads each one. */
141143
export const SEAT_LABEL = 'pm:seat';
142144

‎scripts/pm/round-open.mjs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ export const LIFECYCLE_PHRASES = Object.freeze([
109109
'`round-open.mjs`',
110110
]);
111111
/** The round length as that line spells it; the self-test reads the NUMBER out of it, so a changed figure is red. */
112-
export const ROUND_RULE = /一轮 (\d+) 分钟/g;
113-
export const roundMinutesOfRule = (text) => [...text.matchAll(ROUND_RULE)].map((m) => Number(m[1]));
112+
export const ROUND_RULE = /一轮 (\d+) 分钟/u;
113+
/** Stateless: the export carries no `g`, so an importer's `.test()` keeps no `lastIndex`; the scan takes a local global copy. */
114+
export const roundMinutesOfRule = (text) => [...text.matchAll(new RegExp(ROUND_RULE.source, 'gu'))].map((m) => Number(m[1]));
114115

115116
/** The legs this file cannot read, printed under every run. */
116117
export const UNREAD_LEGS = Object.freeze([
@@ -577,7 +578,8 @@ export function main(argv, deps = {}) {
577578
// ---------------------------------------------------------------------------
578579

579580
const SELF_TEST_BATTERIES = Object.freeze({
580-
'the rule text: every phrase this file is built from is in the file that writes it': 3,
581+
// 3 → 4 (#35237 item 21c): the exported ROUND_RULE is stateless — no `g`, so repeated `.test()` answers the same.
582+
'the rule text: every phrase this file is built from is in the file that writes it': 4,
581583
'readings 1 and 2: the newest stand-down brief, the newest seat-signed comment after it': 7,
582584
'reading 3: the newest claim of this seat by another session, and a push on a lane branch': 10,
583585
'reading 4: the first closed lane card with a claim of this seat, timed by its session': 4,
@@ -647,6 +649,7 @@ export function selfTest() {
647649
t('every reading this file takes is a phrase of seat-lifecycle.md 〈开轮互斥〉, the pointer included', LIFECYCLE_PHRASES.filter((p) => !lifecycle.includes(p)), []);
648650
t("⭐ one round's length is the number seat-lifecycle.md spells once, on its round rule line, and ROUND_MINUTES is that number", roundMinutesOfRule(lifecycle), [ROUND_MINUTES]);
649651
t('…and the reading follows the text: another figure on that line reads as that figure (so the pin above goes red), a line without the spelling reads none', [roundMinutesOfRule(lifecycle.replace(`一轮 ${ROUND_MINUTES} 分钟`, '一轮 45 分钟')), roundMinutesOfRule('未满一轮 ⇒ 自退(一轮约一小时)')], [[45], []]);
652+
t('⛔ the exported ROUND_RULE carries no `g` or `y`: an importer\'s repeated `.test()` keeps no `lastIndex`, and the scan above still reads every figure', [ROUND_RULE.global || ROUND_RULE.sticky, [1, 2, 3].map(() => ROUND_RULE.test('一轮 60 分钟')), roundMinutesOfRule('一轮 60 分钟;一轮 45 分钟')], [false, [true, true, true], [60, 45]]);
650653
}
651654

652655
battery('readings 1 and 2: the newest stand-down brief, the newest seat-signed comment after it');

0 commit comments

Comments
 (0)