diff --git a/.claude/agents/os-dev.md b/.claude/agents/os-dev.md index 566257b11f3..73f100e3e7d 100644 --- a/.claude/agents/os-dev.md +++ b/.claude/agents/os-dev.md @@ -270,7 +270,7 @@ model: opus - 全文 ⛔ 不出现 HTML 注释:sanitizer 落库后吃短尖括号片段,连反引号里的也吃。 - 例外二:harness 自写 PR 正文首行归属注释原样留、只报,`Fixes #` 紧随;派发令要求才独占 - 末个非空行写 ``(`PR_BODY_TRAILER_SHAPE`,读方亦认 `LANE@ACCOUNT`);其余 dev 自写仍禁。 + 末个非空行写 ``(`PR_BODY_TRAILER_SHAPE`,读方亦认 `LANE#N`);其余 dev 自写仍禁。 - 凡要上 GitHub 的文本,尖括号形状片段一律改占位词拼写(`FIELD`、`IDENT.MEMBER` 一类)。 - 各派发模式(`mode:subagent`、`mode:cloud`、`mode:thread`)下 GitHub 都是报告的权威源。 - 评论、PR 正文都读回到尾:只认首行标记保不住正文,sanitizer 可从首个 tag 形片段吃到尾。 diff --git a/.claude/skills/pm-dispatch/SKILL.md b/.claude/skills/pm-dispatch/SKILL.md index f202ffb9c38..de4010ad67a 100644 --- a/.claude/skills/pm-dispatch/SKILL.md +++ b/.claude/skills/pm-dispatch/SKILL.md @@ -49,7 +49,7 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 → - L2 契约审核:PR 碰 `references/contract-review.md` 契约四面才欠,加在 L1 之上,⛔ 永不替代 L1。 - L2 档随面定(`contract-review.md`);L1 与 `TIER_DEFAULT` 审核恒归车道,⛔ 永不归 L2 席。 - ⛔ L1 规则不及 L2,L2 规则不及 L1;L2 席的账号、独立性、信箱与只写记录诸规只管 L2 席。 -- GitHub PR review 与 CI check 名不属两级;旧词与旧路径只读不写,唯在座 `review#N` 席仍写原名。 +- GitHub PR review 与 CI check 名不属两级;旧词与旧路径只读不写,唯未改名席仍签旧名。 ## 入口与角色 @@ -79,7 +79,7 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 → - 项目席唤醒 = PR 订阅 + 自建自绑巡查 routine(总监席与按需席除外);⛔ 无 `send_later` 链。 - 探针先行:fire 的第一动作是一次最便宜的车道盘点查询,⛔ 在它之前不读任何长文本。 - 队列空(逐卡表见 `references/seat-lifecycle.md`)+ 无在飞 + 无待 L1/L2 + 决策箱无新答复 ⇒ 自退。 -- 分诊席与车道席常驻(按需席除外),断粮换号重开席与信箱;裁决归总监。 +- 分诊席与车道席常驻(按需席除外),断粮换号坐新号的席;裁决归总监。 - 子代理裁决逐份过转录核验采信。 ## 阶段细则索引 @@ -173,7 +173,7 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 → | `domain:spec` | `packages/spec` 整包:schema 形状、`contracts/**`、退役行为半边、strictness 台账;describe/JSDoc/墓碑散文/错误 guidance 与 alias 表;`packages/spec/scripts/**`、`packages/spec/docs/**` 及按锚定规则的例外归本域的工具链(域边界枚举与席内分派见 `references/domains/spec.md`) | | `domain:ui` | `ui/**` 全部代码:`@object-ui/*` 库与 `ui/apps/*`、`ui/packages/types` 与 schema 语料、`ui/scripts` 与门禁工具、文档随所记录的面走;`packages/console`(dist 由 `pnpm console:build` 生成 ⛔ 不手改);协议恒归 `domain:spec`,受管面归 `domain:skills`;见 `references/domains/ui.md` | | `domain:cloud` | 涉 cloud(专题打 `area:cloud`)即整卡归 cloud PM(`repo:cloud` 席):读或改 cloud 代码、生产方或带 cloud 半边;本仓车道 ⛔ 不认领;只缺事实读数者留车道敲信箱;cloud PM 跟到关卡,余下本仓活写明 cloud 事实后另立卡;判据见 `references/cross-repo-coordination.md` | -| `security` · `l2-review` · `eval`(车道,无 `domain:*` 标签) | 本仓安全公告(私有仓卡归该仓车道,cloud 即上行);席位 `security#N` 见 `references/lanes/security.md`;永不公开的规则只住 `references/security-findings.md`。L2 席、AI 评测席见 `references/lanes/l2-review.md`、`references/lanes/eval.md` | +| `security` · `l2-review` · `eval`(车道,无 `domain:*` 标签) | 本仓安全公告(私有仓卡归该仓车道,cloud 即上行);席位见 `references/lanes/security.md`;永不公开的规则只住 `references/security-findings.md`。L2 席、AI 评测席见 `references/lanes/l2-review.md`、`references/lanes/eval.md` | | `repo:objectstack`(全仓调度,无 `domain:*` 标签) | 跨各域按座位贴点名的专题认领本仓卡;cloud 与安全公告除外;见 `references/lanes/objectstack.md` | | (无固定归属,按落点分诊) | `packages/apps/*`、`examples/*`(归它演练的子系统,测试基建见 devx 行)、`docs/audits/**` | @@ -308,7 +308,7 @@ Account: `` (the seat's linked user as `GET /user` answers it; alw Branch: `claude/issue--` Worktree: `-issue-` Domain: `domain:` -Seat: `repo:#` | `epic:##` (this PM's seat; absent = seat 1) +Seat: `repo:@` | `epic:#@` (this PM's seat, as it signs) File surface: `<预期触碰的目录>` (stop on breach; explain in the report) Container & model: ``, `mode:subagent | mode:cloud | mode:thread`, `model: <档位词,引当次 --tier 输出;天花板拼 CONTRACT_REVIEW_TIER,同行引其 MANDATORY 路径行或 reason:(逐卡裁决,或常设档位令的 id 与时刻);⛔ 不抄模型 id>`, `effort: ` Clause-②: yes | no diff --git a/.claude/skills/pm-dispatch/references/area-lease.md b/.claude/skills/pm-dispatch/references/area-lease.md index e98470de580..ca569446278 100644 --- a/.claude/skills/pm-dispatch/references/area-lease.md +++ b/.claude/skills/pm-dispatch/references/area-lease.md @@ -17,7 +17,7 @@ ## 开席 1. 席位会话坐席:座位贴存根、自有信箱(`project-forms.md`)、租约表。 - - 信箱一步恒不省;重坐、换号或移座恒开新信箱。 + - 信箱一步恒不省;重坐恒开新信箱。 2. 每区一条项目线程,由协调者开(`coordinator.md`);L1 线程照上节。 - 开场消息逐字带:「照 `execution-duties.md`〈定档〉:认领 Container & model 行写档位与 effort,派 `os-dev` 显式传 model、effort 并贴该行」 3. 维护者在每条新席线程亲写一句授权行:auto mode 只认本线程维护者原话,转述与点选不算。 @@ -65,4 +65,4 @@ - 用量近 80% 即交接:停派任何级;在途照 `os-dev.md` 资源纪律 5 推完并点名,每条工作分支留 draft PR;余照 `seat-post-protocol.md` 清单。 - 交接与各区现状落座位贴评论:所有权、open PR、下一步、待批、坑;⛔ 不只留项目或记忆。 -- 新旧账号重叠时座位贴写所有权切分:旧号持有的 PR 清单与新号可取集;新号只取后者。 +- 换号 = 新号坐自己的席(席不过户);旧号的卡逐卡 `Release:` 回队,新号照常认领。 diff --git a/.claude/skills/pm-dispatch/references/contract-review.md b/.claude/skills/pm-dispatch/references/contract-review.md index 57d8c3717b4..8b8167042b8 100644 --- a/.claude/skills/pm-dispatch/references/contract-review.md +++ b/.claude/skills/pm-dispatch/references/contract-review.md @@ -20,7 +20,7 @@ - 送审路由只住此处:车道能取 `CONTRACT_REVIEW_TIER` 才自审;取不到(账号够不到、配额拒 429、 维护者限配)⇒ ⛔ 不降档 ⛔ 非分诊,落交接行并同笔请 L2 席(照 `lanes/l2-review.md`); 无 L2 席在座改点能取该档的兄弟席,皆无则挂等 L2 标记留欠审表待 (a)(b)(c)。交接行: -- `Contract-review-handoff: — CONTRACT_REVIEW_TIER unavailable (, ) · head ` +- `Contract-review-handoff: — CONTRACT_REVIEW_TIER unavailable (, ) · head ` - 欠审 PR(含 draft)现 head 无记录无活认领且 (a)(b)(c) 之一 ⇒ 车道达档自审或交接,⛔ 非分诊 - (a) 交接行/敲门点名现 head(同轮所点席接)或带等 L2 标记;(b) 现 head 已等满一轮(`seat-lifecycle.md`); - (c) 车道收班或离总表,欠审入交班简报;L2 席只接 (a) 所点、自记录 delta、他席皆禁之 head。 diff --git a/.claude/skills/pm-dispatch/references/coordinator.md b/.claude/skills/pm-dispatch/references/coordinator.md index a809d0a4536..7e0197b0b84 100644 --- a/.claude/skills/pm-dispatch/references/coordinator.md +++ b/.claude/skills/pm-dispatch/references/coordinator.md @@ -4,21 +4,21 @@ ## 一、车道归属登记在座位贴(coordinator 开席位线程前读;席位线程坐席时读) -- 项目管哪些车道只由项目指令声明;每条车道开一个席位线程,坐该车道空着的座位贴。 -- 一个项目在一条车道默认一席,维护者明说开座位(「开座位」「再开一个座位」)才加席。维护者对本项目已有席的车道再点 `area:*`(「接 area:X」「再开一个 area:X」)⇒ 交给该席:席把 `area:X` 写进座位贴标题与接卡行,照 `area-lease.md` 分区(自开一区或并入现有区);⛔ 不另开席位线程、座位贴、信箱或巡检。 +- 项目管哪些车道只由项目指令声明;每条车道开一个席位线程,坐本账号在该车道的座位贴(无则问维护者一次)。 +- 一个账号在一条车道恒一席,席不过户。维护者对本项目已有席的车道再点 `area:*`(「接 area:X」「再开一个 area:X」)⇒ 交给该席:席把 `area:X` 写进座位贴标题与接卡行,照 `area-lease.md` 分区(自开一区或并入现有区);⛔ 不另开席位线程、座位贴、信箱或巡检。 - 车道没有本项目的席时照常开席;下文 L2 积压加开照旧。 - 席位线程在贴的说明段写「由 X 账户的项目负责」;贴协议与互斥照 `seat-lifecycle.md`。 -- 一车道归一项目:座位贴 🟢 写他账号 ⇒ 车道已有主;仲裁者是座位贴,⛔ 不是项目记忆。 -- ⛔ 不坐别席,另一项目在飞卡由其席跟完;维护者指令行改写 ⇒ 按 `project-forms.md` 接管。 -- L2 积压 ⇒ 自开一条 `l2-review` 席位线程,⛔ 不先问维护者,开后在项目聊天说一句。 +- 座位贴 🟢 写他账号 ⇒ 是他账号的席;仲裁者是座位贴,⛔ 不是项目记忆。 +- ⛔ 不坐别席,另一项目在飞卡由其席跟完;维护者强制接管令照 `project-forms.md`,只取卡。 +- L2 积压 ⇒ 在本账号的 `l2-review` 席下加开一条线程,⛔ 不先问维护者,开后在项目聊天说一句。 - 积压 = 就绪 head 等 L2 记录逾约 30 分钟,或在座审核席人均排队逾约 3 个 head。 -- L2 新席坐空座、开信箱、按认领分行;队列排空即签退加开席,⛔ 不留闲席;用量墙照第六节。 +- 加开线程按认领分行;队列排空即签退,⛔ 不留闲线程;用量墙照第六节。 ## 二、跨车道取卡(coordinator 每次唤醒读) - 取卡面 = 各车道 open 卡,次序现读 `card-pick.mjs --order <序>`;判据照 `execution-duties.md`。 - 维护者只说改级 ⇒ 只落级,评论照 `filing-gate.md` 引原话;⛔ 不借此开线程,照取卡全序。 -- 每张卡交其车道的席位线程;车道无席位线程而座位贴空着 ⇒ 先开席位线程再交卡。 +- 每张卡交其车道的席位线程;车道无席位线程而本账号的席空着 ⇒ 先开席位线程再交卡。 - 维护者 ⛔ 不逐卡点名车道:车道读卡 `area:*` 与父单;S/M 分流见 `dispatch-runbook.md` 卡线程节。 ## 三、全项目一个上限,p1 先(coordinator 调度读;席位交候选时读) diff --git a/.claude/skills/pm-dispatch/references/cross-repo-coordination.md b/.claude/skills/pm-dispatch/references/cross-repo-coordination.md index 1246715f0a1..2e048064e53 100644 --- a/.claude/skills/pm-dispatch/references/cross-repo-coordination.md +++ b/.claude/skills/pm-dispatch/references/cross-repo-coordination.md @@ -8,8 +8,8 @@ - 新仓登记是一张清单:座位贴、标签、类别归属、门禁盘点、写身份锁移植(deny + hooks)。 - 新仓三件:加入 `GOVERNED_REPOS`、安装车队 App、宪章住新仓(`lanes/.md` 仅指针);应用仓无分诊席。 - 新仓准入只问一句:真需要常设席位吗;hotcrm 宪章住 hotcrm 仓 `docs/PRIORITIES.md`(The seat 节)。 -- 车道可分席(席号 `· seat N`):忙时一车道开多席,闲时收归一席;每席独立座位贴。 -- 认领评论带 `Seat: <席>#N` 行申报席号(缺省席 1);同席认领互斥,他席认领不触发自退。 +- 车道可分席(一账号一席):忙时一车道开多席,闲时收归一席;每席独立座位贴。 +- 认领评论带 `Seat:` 行申报本席,同署名;同席认领互斥,他席认领不触发自退。 - 拆分触发预登记:单轮逼近 fire 周期,或某仓在全序下持续断粮 ⇒ 按仓拆回多席。 - seam 卡单一归属:归修复落地仓的席,双仓皆动 objectstack 侧主导;涉 cloud 者归 cloud PM(域表)。 - `scripts/pm/**` 等住 objectstack 的全板工具链单写手恒为 objectstack 侧席,他侧上游立卡回链。 diff --git a/.claude/skills/pm-dispatch/references/domains/skills.md b/.claude/skills/pm-dispatch/references/domains/skills.md index a73871e7869..430783cd3b6 100644 --- a/.claude/skills/pm-dispatch/references/domains/skills.md +++ b/.claude/skills/pm-dispatch/references/domains/skills.md @@ -26,7 +26,7 @@ - 棘轮以删减付账;砍点逐条核幸存,被砍内容若在别处无家,砍掉就是丢规则。 - 「Instruments serve the fleet」答不出 ⇒ `Suggested-grade: p3` 或建议不做,⛔ 不自入队;级归分诊。 - 内部指令面中文,机器判据恒英文;认领前重读全线程;标签写 read-modify-write 加回读。 -- QA 波次何时开轮只住 `../lanes/qa.md`;`qa#1` 的 §6 例行与场景半边逐开发波跑,不是波次。 +- QA 波次何时开轮只住 `../lanes/qa.md`;QA 席的 §6 例行与场景半边逐开发波跑,不是波次。 ## 席内判断 diff --git a/.claude/skills/pm-dispatch/references/lanes/cloud.md b/.claude/skills/pm-dispatch/references/lanes/cloud.md index c3a0eae1628..e0c3b994539 100644 --- a/.claude/skills/pm-dispatch/references/lanes/cloud.md +++ b/.claude/skills/pm-dispatch/references/lanes/cloud.md @@ -4,7 +4,7 @@ ## 形态 -- 本车道为单车道仓执行座位,可分席 `repo:cloud#N`:在 cloud 仓认领、派发、L1 审核、落地。 +- 本车道为单车道仓执行座位,席 `repo:cloud@ACCOUNT`:在 cloud 仓认领、派发、L1 审核、落地。 - cloud 卡首触归本车道,⛔ 不归分诊(`triage-duties.md` 日对账条);分诊只做下文兜底。 - 卡线程派发令住项目文件的 `pm-orders/cloud/seatN/` 目录。 - 范围:cloud 全仓;本仓 `domain:cloud`+`repo:cloud` 卡认领前先转入,转法与例外照多仓协调规则 1。 @@ -14,6 +14,6 @@ - 首触、定级、取卡序、企业版与安全卡规则见 cloud 仓 `docs/strategy/triage-rules.md` 与 `docs/strategy/core-functions.md`;⛔ 本文件不抄。 - 卡阻于 objectstack 卡 ⇒ 挂 `pm:blocked` 或认领它的本车道席敲阻塞卡车道席 `Request: assist`。 -- 阻塞卡未认领或停车改敲 `triage#1`;每张阻塞卡一次,轮记列明敲了谁;不限级(维护者令)。 +- 阻塞卡未认领或停车改敲分诊席;每张阻塞卡一次,轮记列明敲了谁;不限级(维护者令)。 - 兜底:分诊日对账见 cloud 卡无状态逾 4 h ⇒ 写信本车道各席;分诊 ⛔ 不代打标签。 - 发版板(窗内升 `priority:p0`)在 cloud 仓的生产者是本车道(`seat-post-protocol.md` 发版板节)。 diff --git a/.claude/skills/pm-dispatch/references/lanes/director.md b/.claude/skills/pm-dispatch/references/lanes/director.md index bd4acd9b462..9b190011d84 100644 --- a/.claude/skills/pm-dispatch/references/lanes/director.md +++ b/.claude/skills/pm-dispatch/references/lanes/director.md @@ -78,4 +78,4 @@ - 每张板恰好一个生产者;鲜度节奏、清板三选一见 `../seat-post-protocol.md`。 - 见新 tag 族发布 ⇒ 在 cloud 与每个应用仓立平台版本 bump 单;单张封顶,已有则追评刷新。 - bump 单等待卡清单 = hold 索引(`Restart-when:`/`Blocked-by:` 点名该发布的 open 卡),查询落正文。 -- 车队总表由坐席/接管/收班同笔重生成;一席一行,⛔ 不手改;见 `../project-forms.md`。 +- 车队总表由坐席/收班同笔重生成;一席一行,⛔ 不手改;见 `../project-forms.md`。 diff --git a/.claude/skills/pm-dispatch/references/lanes/eval.md b/.claude/skills/pm-dispatch/references/lanes/eval.md index e0306fc7569..709bb005ad6 100644 --- a/.claude/skills/pm-dispatch/references/lanes/eval.md +++ b/.claude/skills/pm-dispatch/references/lanes/eval.md @@ -3,7 +3,7 @@ ## 座位与唤醒 -- 席位 `eval#N`,首席 `eval#1`;签名、座位贴、信箱同他席;无 `domain:*` 标签、无 `pm:queue`。 +- 席位 `eval@ACCOUNT`;签名、座位贴、信箱同他席;无 `domain:*` 标签、无 `pm:queue`。 - 定时归本席自控(维护者令):自建自调 Routines;各项节奏住座位贴。 ## 评测范围 diff --git a/.claude/skills/pm-dispatch/references/lanes/l2-review.md b/.claude/skills/pm-dispatch/references/lanes/l2-review.md index 114c2e3b9d7..11d0a0e669d 100644 --- a/.claude/skills/pm-dispatch/references/lanes/l2-review.md +++ b/.claude/skills/pm-dispatch/references/lanes/l2-review.md @@ -3,16 +3,16 @@ ## 座位 -- 席位 `l2-review#N`,一席一座位贴;坐席账号能达 `CONTRACT_REVIEW_TIER`。 +- 席位 `l2-review@ACCOUNT`,一账号一席一贴;坐席账号能达 `CONTRACT_REVIEW_TIER`。 - 席会话档位与 effort 照 `../execution-duties.md` 定档节;每送审 head 起一个全新只读子代理达档审,⛔ 席内达档审。 -- 每席开一个 `pm:mailbox` PR(`mailbox-open.mjs --seat l2-review#N`);签名、坐席与收班同他席。 +- 每席开一个 `pm:mailbox` PR(`mailbox-open.mjs`);签名、坐席与收班同他席。 ## 路由 -- 先请本账号开的审核席(本项目线程,从线程清单与 `seat-online` 帖找);皆忙才溢至他账号席。 +- 先请本账号的审核席(其下线程,从线程清单与 `seat-online` 帖找);皆忙才溢至他账号席。 - 同项目向 L1/L2 席请审、delta 与回告发线程消息,⛔ 不敲信箱;信箱只留跨账号或跨项目。 - N 席按认领分行:欠审表每个 head 先贴 `Contract-review-claim:` 者持有;后者撤回弃产出。 -- 兜底接 head 只住 contract-review.md 欠审接审行,`check-owed-reviews.mjs` 同读;⛔ 不按席号路由。 +- 兜底接 head 只住 contract-review.md 欠审接审行,`check-owed-reviews.mjs` 同读;⛔ 不按席名路由。 - 每日抽查约 1/5 席位自审记录(≤50 行自落、自做 L2),≤10 条、契约面先;不过即退回该席。 - delta 归原 L2 审核者;L2 席下班留下旧记录 ⇒ 下一 L2 席接 delta,交接行点名它。 diff --git a/.claude/skills/pm-dispatch/references/lanes/objectstack.md b/.claude/skills/pm-dispatch/references/lanes/objectstack.md index b762d104fcc..ce31efd1ee1 100644 --- a/.claude/skills/pm-dispatch/references/lanes/objectstack.md +++ b/.claude/skills/pm-dispatch/references/lanes/objectstack.md @@ -4,8 +4,8 @@ ## 形态 -- 席位 `repo:objectstack#N`,可多席、多账号;签名、座位贴、信箱、坐席与收班同他席。 -- 一个项目在本车道默认一席(维护者明说开座位才加席);席接哪些 `area:*` 是该席的属性,写在座位贴标题与接卡行。维护者再点一个 `area:*` 是改该席的接卡面并在席内分区,⛔ 不是加席(`coordinator.md` 一)。 +- 席位 `repo:objectstack@ACCOUNT`,一账号一席;签名、座位贴、信箱、坐席与收班同他席。 +- 一个账号在本车道恒一席;席接哪些 `area:*` 是该席的属性,写在座位贴标题与接卡行。维护者再点一个 `area:*` 是改该席的接卡面并在席内分区,⛔ 不另开席(`coordinator.md` 一)。 - 每席照 area-lease.md 分区运作:区线程、L1 线程、区内落地;本文只写全仓与多席特有者。 - ⛔ 非单车道仓席:cross-repo-coordination.md 单车道仓条、seat-lifecycle.md 单车道仓行不适用。 - 首触与 `domain:*` 归分诊(`triage-duties.md`);本车道立卡带 area/type/级,⛔ 不产、不改 `domain:*`。 @@ -33,4 +33,4 @@ ## 落地与归维护者 - 落地与交席照 area-lease.md 区内规则与 SKILL.md〈路径分叉〉。 -- 开席、加席、收席由维护者召唤;需裁事项照 SKILL.md〈升级与决策〉。 +- 开席、收席由维护者召唤;需裁事项照 SKILL.md〈升级与决策〉。 diff --git a/.claude/skills/pm-dispatch/references/lanes/qa.md b/.claude/skills/pm-dispatch/references/lanes/qa.md index ad1fc511192..f90d77cce6a 100644 --- a/.claude/skills/pm-dispatch/references/lanes/qa.md +++ b/.claude/skills/pm-dispatch/references/lanes/qa.md @@ -3,7 +3,7 @@ ## 座位与唤醒 -- 席位 `qa#N`,首席 `qa#1`;签名、座位贴、信箱同他席;无 `domain:*` 标签、无 `pm:queue`。 +- 席位 `qa@ACCOUNT`;签名、座位贴、信箱同他席;无 `domain:*` 标签、无 `pm:queue`。 - 自启三信号:新发版 tag ⇒ 冒烟;未暂停 epic 子卡全关 ⇒ 里程碑验收;每周一轮例行。 - 维护者仍可另敲一轮;发版只认新 tag 族读数,⛔ 不凭口头或分支名自判发版。 diff --git a/.claude/skills/pm-dispatch/references/lanes/queue.md b/.claude/skills/pm-dispatch/references/lanes/queue.md index 43ab7ad8194..c8ca5611089 100644 --- a/.claude/skills/pm-dispatch/references/lanes/queue.md +++ b/.claude/skills/pm-dispatch/references/lanes/queue.md @@ -3,7 +3,7 @@ ## 座位与唤醒 -- 席位 `queue#N`,首席 `queue#1`;签名、座位贴、信箱同他席;无 `domain:*` 标签、无 `pm:queue`。 +- 席位 `queue@ACCOUNT`;签名、座位贴、信箱同他席;无 `domain:*` 标签、无 `pm:queue`。 - 每 15–20 分钟巡查合并队列;⛔ 不持车道卡、不派 `os-dev`、不开 PR,自己不落地任何东西。 - 落地最多的席位不兼本席:判插队与出队有利益冲突;它只管自己在队的 PR。 - 本席未开时,分诊在每小时巡查里临时兼本章程:p0 队列 flake 修复获 ACCEPT 当轮照 (a) 插队, diff --git a/.claude/skills/pm-dispatch/references/lanes/review.md b/.claude/skills/pm-dispatch/references/lanes/review.md index df46a7c728e..4ffa6041eac 100644 --- a/.claude/skills/pm-dispatch/references/lanes/review.md +++ b/.claude/skills/pm-dispatch/references/lanes/review.md @@ -1 +1 @@ -已更名:章程住 `l2-review.md`;在座 `review#N` 席签名与致它的行仍写原名,只新席用 `l2-review#N`。 +已更名:章程住 `l2-review.md`;`review` 与它同一车道,新写用 `l2-review@ACCOUNT`,旧名记录仍读。 diff --git a/.claude/skills/pm-dispatch/references/lanes/security.md b/.claude/skills/pm-dispatch/references/lanes/security.md index e8cf6ae5dd0..6c687dad5aa 100644 --- a/.claude/skills/pm-dispatch/references/lanes/security.md +++ b/.claude/skills/pm-dispatch/references/lanes/security.md @@ -6,7 +6,7 @@ ## 座位 -- 席位 `security#N`,首席 `security#1`,只管本仓公告;签名、座位贴、坐席与收班同他席。 +- 席位 `security@ACCOUNT`,只管本仓公告,持公告者见贴;签名、座位贴、坐席与收班同他席。 - 无 `domain:security` 标签、无 `pm:queue`、无文件面:私卡照第 3、9 节,修复落在归属包。 - 坐席者 = 能读写本仓安全公告的账号(管理员或安全经理)的会话;读不了 ⛔ 不坐。 - 公告的读、建与写只照第 3 节;中继拒或本席空缺照第 3、9 节。 @@ -58,4 +58,4 @@ ## 收班 -- 台账与每份在飞公告留在座位贴,⛔ 不释放进 `pm:queue`;接任者坐席即接台账。 +- 台账与每份在飞公告留在座位贴,⛔ 不释放进 `pm:queue`;接职者坐席即接台账。 diff --git a/.claude/skills/pm-dispatch/references/project-forms.md b/.claude/skills/pm-dispatch/references/project-forms.md index 8fcf0c37836..23da8b42e54 100644 --- a/.claude/skills/pm-dispatch/references/project-forms.md +++ b/.claude/skills/pm-dispatch/references/project-forms.md @@ -12,7 +12,7 @@ - 首词恒为技能目录名 `pm-dispatch`;⛔ 不用 `fleet`,它已是 bot 与中继的名字。 - 席位词 = 中文名或车道文件名:总监 = `director.md`,分诊 = `triage.md`,L2 或复核 = `l2-review.md`。 - 其余席位词同 `lanes/` 下文件名(去 `.md`),如 cloud;验证 = `qa`+`eval` 一席。 -- 一车道多席:协调者取 🟢 行写本账号的那一席;无则取空席;再无则问维护者一次。 +- 一车道多席:协调者取本账号的那一席(`LANE@ACCOUNT`);无则问维护者一次,⛔ 不坐他账号的席。 - 其余一切住本文:⛔ 不往项目里贴模板;⛔ 不在账号层复制技能。 ## 席位是读出来的,不是配出来的 @@ -24,7 +24,7 @@ ## 接管不等撞墙账号 -- 🟢 行写着别的账号 ⇒ 指令行即维护者强制接管令。 +- 席不过户;维护者强制接管令只取卡,逐卡照下行。 - 四件形状见 `execution-duties.md` 认领节;台账 = 标签 + assignee + `Claim:` + `head:claude/` PR。 - 台账按 `assignee:<旧登录名>` 读;⛔ 项目记忆与共享目录永不是台账,只是本账号的缓存。 - 项目记忆只存维护者原话(带时间)与技能指针,⛔ 不复述规则;与技能相左 ⇒ 照技能,删该行。 @@ -32,9 +32,9 @@ ## 信箱 PR -- 每席一个 draft PR,键是席位 ⛔ 非账号,epic 席 `epic:##` 同样开;标签 `pm:mailbox`+`pinned`。 +- 每席一个 draft PR,键是席位 ⛔ 非账号(分支 slug `LANE_ACCOUNT-0`),epic 席 `epic:#@ACCOUNT` 同样开;标签 `pm:mailbox`+`pinned`。 - 正文首行 `Mailbox-of: <席位> · `;坐席即开(`mailbox-open.mjs`)并订阅,存根记 `Mailbox:`。 -- 永不合并,不欠 CI,落地与台账查询排除它;移交或换账号关旧开新;评论首行 `To: <席位>`。 +- 永不合并,不欠 CI,落地与台账查询排除它;评论首行 `To: <席位>`。 - 次行恒为一键,下列事件必敲;一事一行 ≤200 字节,只写键与编号;表外即半态。 - 跨账号或跨项目:车道→L2 或兄弟席 `Request: contract-review`;反向随记录 `Notify: contract-review`。 - 任一席→分诊:p0 嫌疑、main 红、确定性队列红 `Request: urgent-triage`。 @@ -47,7 +47,7 @@ - p0/p1 卡阻于他车道未认领或闲置 ≥3h 的卡:认领席(未认领则分诊)→其车道 `Request: assist`。 - 收方随记录(认领/ETA/不接理由)回 `Notify: assist`;ETA 或 2h 无记录交分诊,彼道无席呈决策卡。 - 上下线→兄弟席与分诊 `Notify: seat-online`、`Notify: seat-offline`;清单变→兄弟席 `Notify: split`。 -- 持发现席→`security#1`:公告建成或误公开卡挂标即 `Notify: security`,只带编号;私有仓卡不敲。 +- 持发现席→持公告的安全席:公告建成或误公开卡挂标即 `Notify: security`,只带编号;私有仓卡不敲。 - 分诊→认领席:认领卡或 open PR 闲置 ≥3h `Request: progress`;反向随记录 `Notify: progress`。 - 记录 = 项上写下一步与 ETA 的评论、§C 停车或释放;同项 60 分钟一敲,答 ETA 到期前不敲。 - ⛔ 不敲:回执、重发;收方订阅 PR 已载者;停车或待决策卡的项的进度;问维护者走决策卡。 @@ -57,4 +57,4 @@ ## 总表 -- objectstack 置顶 issue「车队总表」,一席一行;坐席/接管/移交重生成,列照 `fleet-roster.mjs`。 +- objectstack 置顶 issue「车队总表」,一席一行;坐席/收班重生成,列照 `fleet-roster.mjs`。 diff --git a/.claude/skills/pm-dispatch/references/seat-lifecycle.md b/.claude/skills/pm-dispatch/references/seat-lifecycle.md index 42c56fa9d78..dc96712387c 100644 --- a/.claude/skills/pm-dispatch/references/seat-lifecycle.md +++ b/.claude/skills/pm-dispatch/references/seat-lifecycle.md @@ -5,9 +5,9 @@ - 开轮互斥:fire 后首个写动作前读四个读数,未收班活动任一未满一轮 ⇒ 自退(一轮 60 分钟);现读 `round-open.mjs`。 - 读数一、二:最近的收班简报,与晚于它的最新开轮标记。 - 开轮标记是轮中会话在座位贴上的唯一痕迹;标记可漏写,认领不可省。 -- 读数三:本车道 `pm:dispatched` ∪ `pm:queue` 卡最新非本 session 同席号的 `Claim:` 评论。 +- 读数三:本车道 `pm:dispatched` ∪ `pm:queue` 卡最新非本 session 同席的 `Claim:` 评论。 - 或收班简报后卡分支有推送:推即认领,欠一条 `Claim:`。 -- 读数四:本车道 `state=CLOSED` 按 `updated_at` 降序首张带同席号且非豁免 `Claim:` 卡的 session ID。 +- 读数四:本车道 `state=CLOSED` 按 `updated_at` 降序首张带同席且非豁免 `Claim:` 卡的 session ID。 - 不占席:评审链、总监席,在任 PM 会话与其租约表会话两两互见(含推送);三、四只增自退。 - 总监席多场并行、无在任者:读数一、二与自退对它不成立;执行席互斥照旧。 - 收班简报是前任不再写的显式声明,是释放标记不是锁:简报即最新事件 ⇒ 立即坐席。 @@ -21,9 +21,9 @@ - 贴 = 座位(标签 `pm:seat`),正文固定四段现值:当前 PM / 继承台账 / 热文件串行队 / 说明。 - 项目席的贴是存根,只留他账号要读的;模板见 `seat-post-protocol.md`。 -- 存根外的姿态、台账与轮报住项目;标题、assignee、坐席审计评论与跨账号移交简报照旧。 +- 存根外的姿态、台账与轮报住项目;标题、assignee、坐席审计评论与收班简报照旧。 - 正文只由在任座位 PM 编辑且为权威;标题(仅慢状态)与 assignee 是派生视图,三者同笔更新。 -- 维护者强制接管令取席位、队列、在飞卡、未起工卡与待落地 PR;⛔ 不等原认领者注记。 +- 维护者强制接管令取队列、在飞卡、未起工卡与待落地 PR,⛔ 不取席位(席不过户);⛔ 不等原认领者注记。 - 子代理 dev 的返回消息、探活与续派只在派发会话;落地或 `Release:` 后归新席位。 - 贴内只放指向车道文件的指针,升级走技能 PR,⛔ 不手抄接力。 - 写侧刷新点 = 轮次边界;中途状态由卡上 claim 评论与指针行、PR 上 `## 席位核对` 承载。 @@ -38,10 +38,9 @@ - 坐席同笔:建自绑巡查 routine、开信箱并订阅、存根记 `Patrol:` 与 `Mailbox:`、发 `seat-online`。 - 席会话的档位与 effort 照 `execution-duties.md` 定档节;坐席时低于即登记行注明,请账号主人照该值重开。 - 席会话 ⛔ 中途不改 effort;要另一档就起隔离子代理。 -- 收班同笔删 routine、关信箱、发 `seat-offline`;强制接管者代发 `seat-online`(`project-forms.md`)。 +- 收班同笔删 routine、关信箱、发 `seat-offline`。 - 下班席(`seat-offline`,或两敲 `Request: progress` 无答走接管四件)的在飞归同车道在线兄弟席。 - 兄弟席 `Resume-from:` 引简报或轮次记录认领;待裁先等字;无兄弟席「待席」;公告归安全席。 -- 移座:让席旧号仍排空即移空席、开自有信箱,原贴写所有权切分,毕评 `ownership transferred`。 - 离任留守只写点名的已 ACCEPT 待队列或待人批 PR,⛔ 不读队列、不新派发、不碰未点名卡。 - 留守卡在 `seat-offline` 同笔落其车道一态并清 assignee;漏者分诊读到该敲门当轮代落。 - 换班报告默认零建议,只收三类:原则错/缺、可机械化项、平台事实变化(事实表改一行)。 diff --git a/.claude/skills/pm-dispatch/references/seat-post-protocol.md b/.claude/skills/pm-dispatch/references/seat-post-protocol.md index 0cefb947285..2d09500f1e6 100644 --- a/.claude/skills/pm-dispatch/references/seat-post-protocol.md +++ b/.claude/skills/pm-dispatch/references/seat-post-protocol.md @@ -4,7 +4,7 @@ - 四段现值由在任座位在写侧刷新时收缩;⛔ 岗位说明 PR 不代改贴正文。 - 标题即状态板,固定格式 `[PM seat] <座位名> — <状态>`;`label:pm:seat` 列表页即舰队状态板。 -- 多席车道每席一贴,座位名带席号后缀 `repo:X · seat N`;席 1 省略后缀,沿用现贴。 +- 座位名恒为 `LANE@ACCOUNT`,各车道同,`@` 前后无空格;一账号一车道一席一贴,席不过户。 - 状态词表:`🟢 ` 在任、`🟢 Routine`、`⏳ vacant`、`⏸️ paused`。 - assignee = 在任 PM 的 GitHub 账号,退场或回收时摘除;无 assignee = 空缺,与标题互校。 - 例外:Routine 座位的 bot 通常不可 assign,以标题为准。 @@ -15,10 +15,12 @@ - 班次叙事 ⛔ 不进贴正文:逐卡状态在卡与 PR 上必填,合计走轮次报告。 - 存根四项:在座账号与项目 · 上任时刻 · 热文件串行队 · 指针行「姿态台账住项目」。 - 加 `Patrol:` `Mailbox:`,可选撞墙注记(HH:MM 恢复);坐席、串行队/cron 改、撞墙、移交才刷存根。 -- 标题与说明段接卡行同写本席接的 `area:*` 与 epic,工具只读标题;接卡面变即重写,重述、接管、移席照抄。 -- 接管压缩:接任 PM 按四段模板重述新正文;旧账留上版 body revision,审计评论带版本指针。 +- 标题与说明段接卡行同写本席接的 `area:*` 与 epic,工具只读标题;接卡面变即重写,重述照抄。 +- 坐席压缩:继任会话按四段模板重述新正文;旧账留上版 body revision,审计评论带版本指针。 - 热文件串行队收重叠检查(`area-lease.md`)排后的卡与车道章程点名的串行链,跨轮跨班次常设:文件或链 → 有序卡片清单 → 每张卡认领的区域。 -- 新增座位贴(加席)先查 `pm:seat` 索引再立贴,席号取本车道最大席号加一。 +- 新增座位贴先查 `pm:seat` 索引再立贴;离场账号的卡逐卡 `Release:` 回队。 +- 旧 `LANE#N` 记录恒可读、不重发,归其签名账号;在任贴原地改名,改名前署名与 `Seat:` 行仍写旧名。 +- 改名席先以 PR 在 `scripts/pm/seat-numbers.mjs` 落行,合并后才改名;首次切换实测新名不渲染成提及。 ## 活性、写侧刷新与收班 @@ -26,15 +28,15 @@ - 会话座位查最新产出评论的时间戳;回收 = 改正文 + 审计评论。 - 可跑读法:本车道 `pm:dispatched` 卡按 `updated_at` 降序一搜,或读最新认领评论。 - 写侧刷新三时刻:派发、收班、暂停或交接前;时间戳恒取自 `post-stamped.mjs`。 -- 帖与卡正文首行恒为署名 `LANE#N · ACCOUNT · SESSION`(读方亦认 `LANE@ACCOUNT`);缺即写工具拒发(`post-stamped.mjs` 头注)。 -- PR 正文末非空行署 ``,整篇经 `dispatch.mjs` 的 `issue_patch`。 +- 帖与卡正文首行恒为署名 `座位名 · ACCOUNT · SESSION`;缺或他号签 `LANE@X` 即写工具拒发(`post-stamped.mjs` 头注)。 +- PR 正文末非空行署 ``,整篇经 `dispatch.mjs` 的 `issue_patch`;两处读方亦认旧 `LANE#N`。 - 刷新前回执敲门;`--body` 拦截:评论晚于末次戳 ⇒ `--ack-through=ID`;空座欠账无卡号 ⇒ 拒写。 - 耐久状态只住正文或以 App 写入;正文守中继上限 60,000 字节,超大贴由半状态巡查浮出。 - 协议升级迁移状态或巡检发现正文不符时,当场改正文 + 审计评论。 - Routine 座位的收尾简报也落本席座位贴,即下轮自退守卫的读数。 - 留守写面 = 简报点名的 PR,残余定时器同界;留不了才热移交:收单注记 + 点名看护者。 - 收单注记写评审判据、落地步骤与当前状态;看护只守落地,⛔ 评审判断不可外包。 -- 看护者默认下任座位;在跑云会话经 poke 触发器投递,⛔ 非 `SendMessage` 直投。 +- 看护者默认同车道在线兄弟席;在跑云会话经 poke 触发器投递,⛔ 非 `SendMessage` 直投。 - 收班序列不看维护者措辞:`check-handover.mjs` 退出 0 → 刷正文与标题 → 简报最终一笔。 - 末尾巴合并 ⇒ 贴上一条尾清注记;继任立即坐席,点名集作围栏。 - 标题滞后是可修半状态,坐席时顺手修,⛔ 非阻塞;留守登记(谁、哪些尾巴)= 说明段一行。 @@ -47,13 +49,13 @@ 1. 立即停止新派发。 2. 认领卡落地,或同笔 `Release:`+`Resume-from:`+清 assignee 交回 `pm:queue`;`needs_decision` 进决策箱。 -3. 全量枚举本车道队列、决策箱与 findings,成接任台账;等裁决的卡只挂 `needs-user-decision`。 +3. 全量枚举本车道队列、决策箱与 findings,成继承台账;等裁决的卡只挂 `needs-user-decision`。 4. 台账义务逐条带卡号(条件型开 `pm:blocked`+`Blocked-by:`,定时型 `Restart-when:`),正文只放指针。 5. 第 2、3 步由 `node scripts/pm/check-handover.mjs --session=ID --account=LOGIN` 核,退出 0 才写空座正文。 6. 贴正文改 `⏳ vacant` + 台账:前任会话 ID、注销时间、队列快照、串行队、跨车道备忘。 -7. 收班简报与审计评论存档;接任指引 = `/pm-dispatch 接手` + 先读座位贴。 +7. 收班简报与审计评论存档;本账号再坐席先读座位贴。 8. 在飞卡与留跑会话贴里点名(卡号+派发会话 ID);派出的会话离任 PM 自 `archive_session`。 -9. 关本席信箱(`mailbox-open.mjs --close N`),接任者坐席时按席重开;向维护者交最终报告。 +9. 关本席信箱(`mailbox-open.mjs --close N`),再坐席时重开;向维护者交最终报告。 ## 座位 Routine 创建 diff --git a/.claude/skills/pm-dispatch/references/security-findings.md b/.claude/skills/pm-dispatch/references/security-findings.md index c879503232a..ab11d380a94 100644 --- a/.claude/skills/pm-dispatch/references/security-findings.md +++ b/.claude/skills/pm-dispatch/references/security-findings.md @@ -24,7 +24,7 @@ - 只发维护者为该版批准的清单:经中继换正文、定版本、再发布;运行编号记座位贴,⛔ 无正文。 - 两操作皆被拒 ⇒ 会话专递(选 A):机制只在会话交维护者,由其建草稿,⛔ 不换账号重发。 - 回退时座位贴只写不透明编号与状态,⛔ 无细节。 -- 公开仓修复只由 `security#1` 席以无卡派发令照章程按组派 `os-dev`;机制只进派发令与公告。 +- 公开仓修复只由持公告的安全席以无卡派发令照章程按组派 `os-dev`;机制只进派发令与公告。 - 用到公告的临时私有 fork ⇒ 修复从该 fork 落地。 - 私有仓私卡 = 该仓带 `security` 标签的普通 issue,经中继 `issue_create` 立,机制写在其中。 - 私有仓卡归该仓车道,照其规则派修、L1/L2 审核、落地;第 2、6 节照旧。 @@ -56,10 +56,10 @@ - 立卡门、server 与 security 车道、信箱、`checklist-test` 与 `os-dev` 只指向本文,⛔ 不留第二份。 - ⛔ 本规则不新增门禁、不新增标签。 -## 9. 归属:公告归 `security#1` 席,私有仓卡归该仓车道 +## 9. 归属:公告归安全席,私有仓卡归该仓车道 -- 公开仓的公告从接收到发布归 `security#1` 席(章程 `lanes/security.md`),发现者只报不修。 +- 公开仓的公告从接收到发布归安全席(章程 `lanes/security.md`),发现者只报不修。 - ⛔ 不扩本 PR 或分支,不自开修复分支,不在同一面顺手加固;dev 只走第 5 节上报。 - 席位两件事:照第 3 节建私卡;公告敲 `Notify: security · GHSA-ID`,只带编号;私有仓不敲。 -- 中继拒 ⇒ 机制会话里交 `security#1` 或私有仓车道席;席空缺交维护者;发布清单归维护者。 +- 中继拒 ⇒ 机制会话里交安全席或私有仓车道席;席空缺交维护者;发布清单归维护者。 - 任务绕不开它 ⇒ 报 `blocked`,只写「a security item is with the owner seat」;席位停卡,⛔ 不绕行。 diff --git a/scripts/pm/card-pick.mjs b/scripts/pm/card-pick.mjs index c752c9f6aca..6841cf107aa 100644 --- a/scripts/pm/card-pick.mjs +++ b/scripts/pm/card-pick.mjs @@ -107,7 +107,10 @@ import { readSignatureLine, seatIdOf, seatMark, + seatNameId, + signedSeatId, subIssueParentPath, + withSeatNumbers, } from './check-half-states.mjs'; import { ghApi, readAllPages } from './gh-pages.mjs'; @@ -312,9 +315,10 @@ export function claimReason(comments, seat) { if (own === null || own.kind === 'release') return null; const sig = own.signature; if (!sig) return 'Claim: (unsigned) — another session holds it unless the claim names you'; - // Lane AND mark: a `#N` claim is that numbered seat's, an `@ACCOUNT` claim that account's — never each other's. - const who = seatIdOf(sig.lane, sig.seat); - if (seat && seat.name === who) return `Claim: by this seat (${who}) — already yours, not a new pick`; + // Lane AND mark: a `#N` claim is that numbered seat's, an `@ACCOUNT` claim that account's — never each other's, + // except through the retired-number table: a renamed seat's earlier `#N` claim, signed by its account, is its own. + const who = signedSeatId(sig); + if (seat && seatNameId(seat.lane, seat.seat) === who) return `Claim: by this seat (${who}) — already yours, not a new pick`; return `Claim: by ${who}`; } @@ -592,7 +596,7 @@ export function fixtureGet(fixture, repo) { const USAGE = [ 'card-pick — which ready cards a seat takes next (read-only; the claim re-read still arbitrates).', '', - ' node scripts/pm/card-pick.mjs --order epic:#N,area:NAME,… [--seat LANE#N|LANE@ACCOUNT] [--repo OWNER/NAME]', + ' node scripts/pm/card-pick.mjs --order epic:#N,area:NAME,… [--seat LANE@ACCOUNT] [--repo OWNER/NAME] (an old LANE#N still reads)', ' [--limit N] [--why] [--json] [--fixture FILE] [--now ISO]', ' node scripts/pm/card-pick.mjs --self-test', '', @@ -624,7 +628,7 @@ export function parseArgs(argv) { } else if (flag === '--seat') { const v = take(); opts.seat = parseSeat(v); - if (!opts.seat) return { error: `--seat must be LANE#N or LANE@ACCOUNT (a seat signature's first part), got \`${v}\`` }; + if (!opts.seat) return { error: `--seat must be LANE@ACCOUNT (a seat signature's first part; an old LANE#N still reads), got \`${v}\`` }; } else if (flag === '--limit') { const v = take(); if (!/^[1-9][0-9]*$/.test(String(v ?? ''))) return { error: `--limit must be a positive integer, got \`${v}\`` }; @@ -686,7 +690,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ "p3: an area's close-out after every p2 of that item; an epic's children keep their child order": 7, 'Blocked-by: an open target holds, a closed-unmerged PR holds, a merged PR and a closed issue release, cross-repo is read': 7, 'the same-grade order and the epic child order': 5, - 'the candidate definition: label reasons, claims and the triage audit': 12, + 'the candidate definition: label reasons, claims and the triage audit': 14, 'the walk: every page, the count checked, the limit and --why': 11, 'the CLI: usage, exits and the footer': 14, }); @@ -868,6 +872,11 @@ export async function selfTest() { t('⭐ a claim signed `LANE@ACCOUNT` reads as that account\'s seat: already yours for it, another seat\'s for everyone else', [claimReason([claim(ACC)], parseSeat('repo:objectstack@os-bill')), claimReason([claim(ACC)], parseSeat('repo:objectstack@OS-Bill')), claimReason([claim(ACC)], parseSeat('repo:objectstack#5'))], ['Claim: by this seat (repo:objectstack@os-bill) — already yours, not a new pick', 'Claim: by this seat (repo:objectstack@os-bill) — already yours, not a new pick', 'Claim: by repo:objectstack@os-bill']); t('⛔ account X\'s claim is not read as account Y\'s seat of the same lane — and X signing Y\'s seat is no signature at all', [claimReason([claim(ACC)], parseSeat('repo:objectstack@os-warren')), claimReason([claim('repo:objectstack@os-bill · os-warren · session_01ABCDEFGH')], parseSeat('repo:objectstack@os-bill'))], ['Claim: by repo:objectstack@os-bill', 'Claim: (unsigned) — another session holds it unless the claim names you']); t('⭐ CONTROL — a `#1` claim by a vacant seat still reads as seat 1\'s: ⛔ not as the account seat of the login on it, nor of any other account', [claimReason([claim(SIG)], parseSeat('repo:objectstack@os-warren')), claimReason([claim(SIG)], parseSeat('repo:objectstack@os-bill')), claimReason([claim(SIG)], parseSeat('repo:objectstack#1'))], ['Claim: by repo:objectstack#1', 'Claim: by repo:objectstack#1', 'Claim: by this seat (repo:objectstack#1) — already yours, not a new pick']); + // A retired number and the account seat it became (`seat-numbers.mjs`): seat 5's post is renamed to os-bill's. + const T5 = [{ lane: 'repo:objectstack', number: 5, account: 'os-bill' }]; + const OLD5 = 'repo:objectstack#5 · os-bill · session_01ABCDEFGH'; + t('⭐ after a rename the seat\'s old `#5` claim, signed by its account, is already its own — under `--seat LANE@ACCOUNT` and under the old `--seat LANE#5` alike', withSeatNumbers(T5, () => [claimReason([claim(OLD5)], parseSeat('repo:objectstack@os-bill')), claimReason([claim(ACC)], parseSeat('repo:objectstack#5'))]), ['Claim: by this seat (repo:objectstack@os-bill) — already yours, not a new pick', 'Claim: by this seat (repo:objectstack@os-bill) — already yours, not a new pick']); + t('⛔ …an EARLIER holder\'s `#5` claim is not the renamed account\'s, a vacant seat\'s `#1` claim is no account\'s, and with no row the old claim is the numbered seat\'s', [withSeatNumbers(T5, () => claimReason([claim('repo:objectstack#5 · os-old · session_01ABCDEFGH')], parseSeat('repo:objectstack@os-bill'))), withSeatNumbers(T5, () => claimReason([claim('repo:objectstack#1 · os-bill · session_01ABCDEFGH')], parseSeat('repo:objectstack@os-bill'))), withSeatNumbers([], () => claimReason([claim(OLD5)], parseSeat('repo:objectstack@os-bill')))], ['Claim: by repo:objectstack#5', 'Claim: by repo:objectstack#1', 'Claim: by repo:objectstack#5']); const fleetCard = card(['area:ux', 'priority:p2'], { user: APP }); const r = await run({ issues: [fleetCard], comments: { [fleetCard.number]: [{ body: 'just a note' }] } }); t('⭐ a fleet card with no triage audit record is not a candidate', r.others[0]?.reasons, ['no triage audit — knock triage']); @@ -911,7 +920,7 @@ export async function selfTest() { t('both spellings of an option are read', [parseArgs(['--order=area:ux', '--limit=2']).opts.limit, parseArgs(['--order', 'epic:#7']).opts.order[0].number], [2, 7]); t('--order as the last argument with no value is a usage error; --order "" is the p0/p1-only order', [Boolean(parseArgs(['--order']).error), parseArgs(['--order', '']).opts?.order], [true, []]); t('--seat reads every lane a seat signature carries, an epic seat\'s epic:#N included', [parseSeat('epic:#35205#1')?.name, parseSeat('domain:ui#2')?.name, parseSeat('area:ux#1'), parseSeat('repo:objectstack#5 x')], ['epic:#35205#1', 'domain:ui#2', null, null]); - t('--seat reads both seat marks: `LANE@ACCOUNT` names the seat by its account, lower-cased, an epic seat\'s included; `LANE@` and both marks at once are refused', [parseSeat('repo:objectstack@OS-Bill'), parseSeat('epic:#35205@os-bill')?.name, parseSeat('repo:objectstack#5')?.seat, parseSeat('repo:objectstack@'), parseSeat('repo:objectstack#5@os-bill'), Boolean(parseArgs(['--order', 'area:ux', '--seat', 'repo:objectstack@os-bill']).opts?.seat), parseArgs(['--order', 'area:ux', '--seat', 'os-bill']).error?.includes('LANE#N or LANE@ACCOUNT')], [{ lane: 'repo:objectstack', seat: '@os-bill', name: 'repo:objectstack@os-bill' }, 'epic:#35205@os-bill', 5, null, null, true, true]); + t('--seat reads both seat marks: `LANE@ACCOUNT` names the seat by its account, lower-cased, an epic seat\'s included; `LANE@` and both marks at once are refused', [parseSeat('repo:objectstack@OS-Bill'), parseSeat('epic:#35205@os-bill')?.name, parseSeat('repo:objectstack#5')?.seat, parseSeat('repo:objectstack@'), parseSeat('repo:objectstack#5@os-bill'), Boolean(parseArgs(['--order', 'area:ux', '--seat', 'repo:objectstack@os-bill']).opts?.seat), parseArgs(['--order', 'area:ux', '--seat', 'os-bill']).error?.includes('must be LANE@ACCOUNT')], [{ lane: 'repo:objectstack', seat: '@os-bill', name: 'repo:objectstack@os-bill' }, 'epic:#35205@os-bill', 5, null, null, true, true]); t('⭐ the footer names lane ownership and the sub-epic an area item holds, beside the five legs it named before', [UNREAD_LEGS.length, UNREAD_LEGS.some((l) => l.startsWith('lane ownership — ')), UNREAD_LEGS.some((l) => l.startsWith('an area item that holds a sub-epic — '))], [7, true, true]); t('⛔ the lane-ownership leg reads `domain:*` as file ownership, never as the seat\'s lane: lanes are seats and epics', [UNREAD_LEGS.some((l) => /outside this seat's lane|against your lane/.test(l)), UNREAD_LEGS.some((l) => l.startsWith('lane ownership — ') && l.includes('file ownership only'))], [false, true]); const c = card(['area:ux', 'priority:p2', 'domain:ui']); diff --git a/scripts/pm/check-half-states.mjs b/scripts/pm/check-half-states.mjs index d99a068a201..1b993eb3594 100644 --- a/scripts/pm/check-half-states.mjs +++ b/scripts/pm/check-half-states.mjs @@ -1004,6 +1004,8 @@ import { isEntrypoint } from '../invoked-as.mjs'; // The seat record's heading and verdict have ONE reading, shared with // fleet-roster's landing-verdict read; H43 and H69 ask it, never re-spell it. import { SEAT_RECORD_MARKER, seatRecordAccepts, seatRecordOf } from './seat-record.mjs'; +// The retired seat numbers and the account seat each became — the leaf table `seatMarkOf` reads, below. +import { SEAT_NUMBER_ACCOUNTS } from './seat-numbers.mjs'; /** * The repo this file sweeps when nothing says otherwise. It is a FALLBACK for a @@ -1289,17 +1291,18 @@ export const RELEASE_COMMENT_MARKER = /^\s*>?\s*Release\s*:/mi; // wrote it. The maintainer's ruling (「让发帖脚本 post-stamped 强制每条帖子第一行带署名: // 车道#席位号 · 账户 · 会话,缺署名就拒发」) puts all of it on the FIRST non-empty line: // -// LANE#N · ACCOUNT · SESSION e.g. `domain:skills#2 · os-justin · session_01…` +// LANE@ACCOUNT · ACCOUNT · SESSION e.g. `repo:objectstack@os-justin · os-justin · session_01…` // // LANE a seat as the role table spells it: `domain:` or `repo:` plus a lowercase // name (`domain:engine-core` carries a hyphen, measured on the label set), // `epic:#` plus the parent card, `triage`, `director`, `coordinator`, `security`, `l2-review` (old spelling `review`), `qa`, `eval` or `queue` -// N the seat number, from 1 -// @ACCOUNT in place of `#N` is the SECOND accepted seat mark (ruling record 7249169754): a seat named by -// the account that holds it, `repo:objectstack@os-justin · os-justin · session_01…`. Its account is -// the signing ACCOUNT, compared lower-cased; under another account the line is a near miss. Readers -// accept both marks; every writer's default is still `#N`. A seat is its lane AND its mark: `#N` -// reads as that numbered seat, `@ACCOUNT` as that account's, and neither is read as the other. +// @ACCOUNT the seat mark every new write carries (ruling record 7249169754, Q1 A): a seat is named by the +// account that holds it, one seat per account per lane. Its account is the signing ACCOUNT, compared +// lower-cased; under another account the line is a near miss, which the writers refuse. +// #N the OLD seat mark, a seat number from 1 (`domain:skills#2 · os-justin · session_01…`). No writer +// prints it as the shape to write any more; every reader accepts it for good. A seat is its lane AND +// its mark: `#N` reads as that numbered seat and `@ACCOUNT` as that account's — and a `#N` record +// reads as an account's seat only through the retired-number table (`seatMarkOf`, below). // ACCOUNT the login a claim's `Account:` line carries — GitHub's own login rule // SESSION the full id, in the relay envelope's shape (`SESSION_SHAPE`, fleet-write/ops.mjs, // mirrored here because this module may not import that one; the record-recognisers @@ -1323,7 +1326,8 @@ export const RELEASE_COMMENT_MARKER = /^\s*>?\s*Release\s*:/mi; /** The four parts' patterns, unanchored, in order — the ONE spelling every reader and writer composes from. */ const SIGNATURE_LANE_SOURCE = '(?:domain:[a-z][a-z0-9-]*|repo:[a-z][a-z0-9-]*|epic:#[1-9][0-9]*|triage|director|coordinator|security|l2-review|review|qa|eval|queue)'; -const SIGNATURE_ACCOUNT_SOURCE = '[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}'; +/** A GitHub login, capture-free and unanchored — the ONE spelling of a seat's account; every `@ACCOUNT` pattern composes from it. */ +export const SIGNATURE_ACCOUNT_SOURCE = '[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}'; /** The seat mark after the lane, capture-free: `#N`, or `@ACCOUNT` (the banner's second accepted mark). */ export const SEAT_MARK_SOURCE = `(?:#[1-9][0-9]*|@${SIGNATURE_ACCOUNT_SOURCE})`; /** The relay envelope's session shape without its anchors — `SESSION_SHAPE` in `fleet-write/ops.mjs`. */ @@ -1346,7 +1350,7 @@ export const SEAT_SIGNATURE_LINE = new RegExp( ); /** The shape, as a refusal prints it — placeholders only, so it survives a GitHub body unchanged. */ -export const SEAT_SIGNATURE_SHAPE = 'LANE#N · ACCOUNT · SESSION — e.g. `domain:skills#2 · os-justin · session_01…`'; +export const SEAT_SIGNATURE_SHAPE = 'LANE@ACCOUNT · ACCOUNT · SESSION — e.g. `repo:objectstack@os-justin · os-justin · session_01…`'; /** * A seat mark as every reader carries it: the NUMBER for `#N`, the string `@account` (lower-cased, GitHub logins @@ -1360,8 +1364,141 @@ export function seatMark(text) { return m[0].startsWith('#') ? Number(m[0].slice(1)) : m[0].toLowerCase(); } -/** A seat's id from its lane and its mark (`seatMark`'s reading): `LANE#N` or `LANE@account`. Pure. */ -export const seatIdOf = (lane, mark) => (typeof mark === 'string' ? `${lane}${mark}` : `${lane}#${mark}`); +/** The old spelling of the L2 lane. Seat numbers ran across both words, so a numbered seat keeps the word it signed with. */ +const REVIEW_LANE_OLD_WORD = 'review'; +const REVIEW_LANE_WORD = 'l2-review'; + +/** + * The lane a seat is keyed under. `review` and `l2-review` are one lane (ruling record 7249169754, Q2b A), and an + * account has one seat in it: a seat named by its account is keyed under `l2-review` whichever word it was written + * with. A numbered seat keeps its word, as every reader has always keyed it. Pure. + */ +export const seatLaneOf = (lane, mark) => (typeof mark === 'string' && String(lane).toLowerCase() === REVIEW_LANE_OLD_WORD ? REVIEW_LANE_WORD : lane); + +/** A seat's id from its lane and its mark (`seatMark`'s reading): `LANE#N` or `LANE@account` (`seatLaneOf`'s lane). Pure. */ +export const seatIdOf = (lane, mark) => (typeof mark === 'string' ? `${seatLaneOf(lane, mark)}${mark}` : `${lane}#${mark}`); + +// --------------------------------------------------------------------------- +// A retired seat number and the account seat it became — ONE reader of the table (`seat-numbers.mjs`, whose header +// says who writes a row and when). After a held post is renamed in place, the seat's earlier records still read +// `LANE#N`; they are that seat's, and are not re-issued (ruling record 7249169754, Q3 A). Every reader that +// compares two seats compares what `seatMarkOf` answers, on BOTH sides, so the two spellings of one seat meet. +// --------------------------------------------------------------------------- + +/** The table in force. ⛔ Only `withSeatNumbers` replaces it, and only for a self-test's rows. */ +let seatNumberRows = SEAT_NUMBER_ACCOUNTS; + +/** + * Run `fn` with `rows` as the retired-number table, then put the checked-in table back — the seam a self-test + * proves a reader's rows through, so no fixture seat is ever written into the real table. A promise is awaited + * before the table goes back. ⛔ Not for any other caller. + */ +export function withSeatNumbers(rows, fn) { + const saved = seatNumberRows; + seatNumberRows = rows; + let out; + try { + out = fn(); + } catch (error) { + seatNumberRows = saved; + throw error; + } + if (out && typeof out.then === 'function') return out.finally(() => { seatNumberRows = saved; }); + seatNumberRows = saved; + return out; +} + +/** A lane a table row may name, lower case: every lane a signature carries, and a repo lane as a claim's `Seat:` line spells one (`repo:www.objectos.ai`). */ +const SEAT_TABLE_LANE = /^(?:domain:[a-z][a-z0-9-]*|repo:[a-z0-9][a-z0-9._-]*|epic:#[1-9][0-9]*|triage|director|coordinator|security|l2-review|review|qa|eval|queue)$/u; + +/** Why a table row is malformed, or null: `{ lane, number, account }`, lane and account in lower case. Pure. */ +export function seatNumberRowProblem(row) { + if (row === null || typeof row !== 'object') return 'not an object'; + if (typeof row.lane !== 'string' || !SEAT_TABLE_LANE.test(row.lane)) return `lane ${JSON.stringify(row.lane)} is no seat lane in lower case`; + if (!Number.isInteger(row.number) || row.number < 1) return `number ${JSON.stringify(row.number)} is no seat number`; + if (typeof row.account !== 'string' || row.account !== row.account.toLowerCase() || !new RegExp(`^${SIGNATURE_ACCOUNT_SOURCE}$`, 'u').test(row.account)) return `account ${JSON.stringify(row.account)} is no login in lower case`; + return null; +} + +/** Every problem of a whole table: a malformed row, or one number of a lane named twice. `[]` when it is sound. Pure. */ +export function seatNumberTableProblems(rows) { + if (!Array.isArray(rows)) return ['the table is not a list']; + const problems = []; + const seen = new Set(); + rows.forEach((row, i) => { + const why = seatNumberRowProblem(row); + if (why) return void problems.push(`row ${i + 1}: ${why}`); + const key = `${row.lane}#${row.number}`; + if (seen.has(key)) problems.push(`row ${i + 1}: ${key} is named twice — a number names one account`); + seen.add(key); + }); + return problems; +} + +/** The account whose seat number `number` of `lane` became, or null when the table carries no row for it. Pure over the table in force. */ +export function seatNumberAccount(lane, number) { + const l = String(lane ?? '').toLowerCase(); + return seatNumberRows.find((row) => row.lane === l && row.number === number)?.account ?? null; +} + +/** The retired numbers of `lane` that became `account`'s seat (`@account` or bare, any case), ascending. Pure over the table in force. */ +export function seatNumbersOf(lane, account) { + const l = String(lane ?? '').toLowerCase(); + const a = String(account ?? '').replace(/^@/, '').toLowerCase(); + // `review` and `l2-review` are one lane: an account's seat there answers for its numbers under both words. + const lanes = l === REVIEW_LANE_OLD_WORD || l === REVIEW_LANE_WORD ? [REVIEW_LANE_OLD_WORD, REVIEW_LANE_WORD] : [l]; + return seatNumberRows.filter((row) => lanes.includes(row.lane) && row.account === a).map((row) => ({ lane: row.lane, number: row.number })).sort((x, y) => x.number - y.number); +} + +/** + * The seat mark a reader COMPARES — `mark` as `seatMark` reads it, a retired number answered as the account seat + * it became. Two callers, told apart by `account`: + * + * a seat's NAME (a flag, a post title, an addressee) — `account` omitted: the table alone decides; + * a signed RECORD (a claim, a comment, a trailer) — `account` is the login that signed it: the number reads as + * the account seat only when the table names THAT login for it. An earlier holder's record under the same + * number, a record whose signer is unread (`null`), and every number with no row stay the numbered seat's — + * so a vacated seat's claim is never read as a new account's. + * + * An `@account` mark is returned as it is. Pure over the table in force. + * + * @param {string} lane + * @param {number | string | null} mark + * @param {string | null} [account] + * @returns {number | string | null} + */ +export function seatMarkOf(lane, mark, account) { + if (typeof mark !== 'number') return mark; + const named = seatNumberAccount(lane, mark); + if (named === null) return mark; + if (account !== undefined && String(account ?? '').toLowerCase() !== named) return mark; + return `@${named}`; +} + +/** A seat NAME's id as readers compare it: `seatIdOf` over `seatMarkOf`, the table alone deciding. Pure over the table in force. */ +export const seatNameId = (lane, mark) => seatIdOf(lane, seatMarkOf(lane, mark)); + +/** The seat a SIGNATURE reading (`readSignatureLine`'s) speaks for, as readers compare it: its own account decides a retired number. */ +export const signedSeatId = (sig) => seatIdOf(sig.lane, seatMarkOf(sig.lane, sig.seat, sig.account)); + +/** A signature reading with its lane and seat as readers compare them (`seatLaneOf`, `seatMarkOf`), or null for null. Pure over the table in force. */ +export function comparedSignature(sig) { + if (!sig) return null; + const seat = seatMarkOf(sig.lane, sig.seat, sig.account); + return { ...sig, lane: seatLaneOf(sig.lane, seat), seat }; +} + +/** + * A seat id TEXT (`lane#n`, `lane@account`) as readers compare it, lower-cased; text that names no mark is + * returned lower-cased and unchanged. `account` as in `seatMarkOf`: omitted for a name, the signer for a record. + */ +export function comparedSeatId(id, account) { + const text = String(id ?? '').trim().toLowerCase(); + const m = new RegExp(`^(.+?)(${SEAT_MARK_SOURCE})$`, 'u').exec(text); + if (!m) return text; + const mark = seatMark(m[2]); + return seatIdOf(m[1], account === undefined ? seatMarkOf(m[1], mark) : seatMarkOf(m[1], mark, account)); +} /** The index of a line list's first non-blank line, or -1. */ function firstNonBlankIndex(lines) { @@ -1390,6 +1527,17 @@ export function readSignatureLine(body) { return { lane: m[1], seat, account: m[3], session: m[4], line }; } +/** + * A line SHAPED like a signature, read whether or not its `@ACCOUNT` seat is the signer's: `readSignatureLine`'s + * reading, or — for the near miss that reader refuses, `LANE@X` signed by account Y — the same four parts. For a + * fence that asks "did a seat write this line" and must not let the near miss pass as "no seat did". ⛔ Not a + * signature reader: no writer gate and no attribution asks it. Pure. + */ +export function signatureShapedLine(text) { + const m = SEAT_SIGNATURE_LINE.exec(String(text ?? '').trim()); + return m ? { lane: m[1], seat: seatMark(m[2]), account: m[3], session: m[4], line: m[0] } : null; +} + /** * The body a first-line recogniser reads: unchanged when its first non-empty line is not a * signature, else everything from the next non-empty line on — ONE signature line and the blank @@ -1421,7 +1569,7 @@ export function signatureRefusal(body) { return { line: line.length > 160 ? `${line.slice(0, 160)}…` : line, why: near - ? 'the first non-empty line reads like a signature and is not one — check the lane, the `#N` seat number (or an `@ACCOUNT` seat, which only that same account signs), the login, the full session id, and that each separator is exactly ` · `' + ? 'the first non-empty line reads like a signature and is not one — check the lane, the `@ACCOUNT` seat mark (only that same account signs its seat; an old `#N` seat number still reads), the login, the full session id, and that each separator is exactly ` · `' : 'the first non-empty line is not a signature — the reader cannot tell which lane, seat, account or session wrote this', }; } @@ -8139,12 +8287,28 @@ const SEAT_TITLE_ACCOUNT = new RegExp(`^([^\\s@]+)@(${SIGNATURE_ACCOUNT_SOURCE}) /** * The account a seat title's lane half names its seat by, or null: `{ lane, mark, rest }`, `mark` the seat mark * `@account` and `rest` the half with the account taken off, so every reader below sees the text a bare post - * carries. `domain:ui @ objectui` (a space before the `@`) names a board, not an account, and reads null. Pure. + * carries. `domain:ui @ objectui` (a space before the `@`) names a board, not an account, and reads null. A + * title carrying BOTH marks (`repo:NAME#5@ACCOUNT`) is the account's seat: the number is dropped from `lane` and + * `rest` here, so every title reader answers the same seat. Pure. */ export function seatTitleAccount(half) { const text = String(half ?? '').trim(); const m = SEAT_TITLE_ACCOUNT.exec(text); - return m ? { lane: m[1], mark: `@${m[2].toLowerCase()}`, rest: `${m[1]}${text.slice(m[0].length)}` } : null; + if (!m) return null; + const lane = m[1].replace(/#[1-9][0-9]*$/u, ''); + return { lane, mark: `@${m[2].toLowerCase()}`, rest: `${lane}${text.slice(m[0].length)}` }; +} + +/** + * The lane WORD a seat post's title opens with, lower-cased (`repo:objectstack`, `triage`), or null — the lane + * the retired-number table is asked under. Either mark, the `· seat N` suffix and a board suffix are left out. Pure. + */ +export function seatPostLaneWord(issue) { + const m = /^\[PM seat\]\s*(.*?)\s*—/u.exec(String(issue?.title ?? '')); + if (!m) return null; + const half = seatTitleAccount(m[1])?.rest ?? m[1].trim(); + const word = /^[^\s#@·(]+/u.exec(half); + return word ? word[0].toLowerCase() : null; } /** @@ -9600,7 +9764,10 @@ export function seatPostLastEventMs(seat, commentRows) { * * · ABSENT ⇒ 1. Every claim written before the line existed belongs to seat 1, * which is the only seat those lanes had, so the default is backward - * compatible with every existing claim rather than a guess. + * compatible with every existing claim rather than a guess. One exception: + * a claim SIGNED by a seat named by its account (`readSignatureLine`) is + * that seat's, `@account` — such a signature did not exist when the default + * was set, and seat 1 is never that account's seat. * · PRESENT but unreadable ⇒ null. It matches no seat, so the claim is * invisible to the seat filter below — the file's under-reporting direction * on every unrecognised spelling — and ⛔ never silently read as seat 1. @@ -9641,14 +9808,18 @@ const CLAIM_SEAT_KEY_LINE = /^[ \t]*(?:[-*+][ \t]+)?>?[ \t]*(?:\*\*)?`?Seat`?(?: * 1, which is the defect, so widen it on evidence rather than narrowing it. */ const CLAIM_SEAT_DECLARATION_ANYWHERE = /(?:\*\*)?`?Seat`?(?:\*\*)?[ \t]*:[ \t]*`?(?:domain:[a-z0-9_-]+|repo:[A-Za-z0-9._-]+|epic:#[1-9][0-9]*)(?:[ \t]*#\d|@[A-Za-z0-9])/; -/** A `Seat:` payload naming its seat by account: the lane, then `@ACCOUNT` attached. */ -const CLAIM_SEAT_ACCOUNT = new RegExp(`^\`?(?:epic:#[1-9][0-9]*|[A-Za-z][A-Za-z0-9:._-]*)@(${SIGNATURE_ACCOUNT_SOURCE})(?![A-Za-z0-9@-])`, 'u'); +/** A `Seat:` payload naming its seat by account: a lane of the closed set a seat can carry, then `@ACCOUNT` attached. */ +const CLAIM_SEAT_ACCOUNT = new RegExp(`^\`?(?:domain:[a-z0-9_-]+|repo:[a-z0-9._-]+|epic:#[1-9][0-9]*|triage|director|coordinator|security|l2-review|review|qa|eval|queue)@(${SIGNATURE_ACCOUNT_SOURCE})(?![A-Za-z0-9@-])`, 'iu'); /** @returns {number|string|null} the seat mark — the seat number, or `@account` for a seat named by its account; 1 when NO declaration is present at all, null when one is present but unreadable. */ export function claimSeatNumber(body) { const text = String(body ?? ''); const m = CLAIM_SEAT_KEY_LINE.exec(text); - if (!m) return CLAIM_SEAT_DECLARATION_ANYWHERE.test(text) ? null : 1; + if (!m) { + if (CLAIM_SEAT_DECLARATION_ANYWHERE.test(text)) return null; + const signedBy = readSignatureLine(text)?.seat; + return typeof signedBy === 'string' ? signedBy : 1; + } const payload = String(m[1] ?? ''); const named = CLAIM_SEAT_ACCOUNT.exec(payload); if (named) return `@${named[1].toLowerCase()}`; @@ -9695,12 +9866,18 @@ export function claimSeatNumber(body) { * @param {Iterable} issues — open cards this sweep already listed. * @param {Map} commentsByNumber — threads already in the cache. * @param {number|string} [seat=1] — the seat mark whose claims count (`seatLane(post).seat`): a number, or `@account`. + * @param {string|null} [lane] — the post's lane word (`seatPostLaneWord(post)`). Given, both sides are read through + * `seatMarkOf`: a renamed post's earlier `#N` claims, signed by its account, are still its claims. Omitted, the + * marks are compared as written. * @returns {{ number: number, at: number }|null} the newest claim, or null. */ -export function newestLaneClaim(intake, issues, commentsByNumber, seat = 1) { +export function newestLaneClaim(intake, issues, commentsByNumber, seat = 1, lane = null) { let best = null; const want = new Set((Array.isArray(intake) ? intake : [intake]).filter((k) => typeof k === 'string')); if (want.size === 0) return null; + const wanted = lane === null ? seat : seatMarkOf(lane, seat); + // A claim's own signer decides a retired number: an earlier holder's claim under it stays the numbered seat's. + const markOf = (body) => (lane === null ? claimSeatNumber(body) : seatMarkOf(lane, claimSeatNumber(body), readSignatureLine(body)?.account ?? null)); for (const issue of issues ?? []) { const labels = labelNames(issue ?? {}); // Both conditions intersected locally — see the OR/AND note above. @@ -9708,7 +9885,7 @@ export function newestLaneClaim(intake, issues, commentsByNumber, seat = 1) { const rows = commentsByNumber?.get?.(issue.number); if (!rows) continue; // Only this seat's claims: the filter runs on the rows, the predicate is reused. - const own = (Array.isArray(rows) ? rows : []).filter((row) => claimSeatNumber(row?.body) === seat); + const own = (Array.isArray(rows) ? rows : []).filter((row) => markOf(row?.body) === wanted); const claim = latestClaimComment(own); if (!claim) continue; const at = Date.parse(claim.createdAt ?? ''); @@ -25771,7 +25948,7 @@ async function sweepInto(findings, seen, seenPrs, seenMerged, seenUnscoped, seen const stale = h38SeatPostStale( issue, seatPostLastEventMs(issue, rows), - newestLaneClaim(intake, seen.values(), commentCache, seat), + newestLaneClaim(intake, seen.values(), commentCache, seat, seatPostLaneWord(issue)), ); if (stale) findings.push([issue, 'H38', stale]); } @@ -26769,6 +26946,10 @@ export const SELF_TEST_BATTERIES = Object.freeze({ // Registered with the premise-freshness row, pin just under the count: the measured timeline firing, its // before-open / open / local / unanchored controls, the UNJUDGED leg, the cap, the text and the band. 'H75 premise freshness': 15, + // Registered with the retired-number table (ruling record 7249169754), pin AT the count: the table's shape and + // its checked-in soundness, the name and record readings beside the earlier-holder and vacant-seat controls, the + // review-lane fold, the test seam, H38 on a renamed post both ways, and the carried nits N2, N3, N6 and N7. + 'retired seat numbers': 33, }); /** The floor on the ROSTER itself — how many batteries must be declared at all. */ @@ -33559,6 +33740,60 @@ async function selfTest() { t('H38 seat (account mark): ⛔ account X signing account Y\'s seat is no signature — `readSignatureLine` reads nothing, not Y\'s seat and not X\'s; the same line under its own account, any case, reads', J38([readSignatureLine('repo:objectstack@os-b · os-c · session_01QSeKYmhU5KEj1nukYhp1Tg'), readSignatureLine('repo:objectstack@OS-B · os-b · session_01QSeKYmhU5KEj1nukYhp1Tg')?.seat, readSignatureLine('repo:objectstack#1 · os-c · session_01QSeKYmhU5KEj1nukYhp1Tg')?.seat]), J38([null, '@os-b', 1])); t('H38 seat: a seat-2 post with no same-seat claim -> clean', h38SeatPostStale(seat38(seat2Area), SEAT_AT_38, newestLaneClaim('area:data', oneCard, seat1Claim, 2)), null); + // -- A retired seat number and the account seat it became (ruling record 7249169754, Q3 A; the seat's answer Q1 A) -- + // + // A renamed post keeps its old records under LANE#N. The table (seat-numbers.mjs) names the account each retired + // number became, and seatMarkOf is its one reader. The fixture table goes in through withSeatNumbers, so no + // fixture seat is ever written into the checked-in table. The three readings the rows hold: a renamed seat's old + // #N record reads as that seat's; an EARLIER holder's record under the same number does not; and a number with + // no row (a vacated seat) is nobody's account seat. + const BATTERY_NUMBERS = 'retired seat numbers'; + const LANE_T = `repo:${OWN_BOARD}`; + const TABLE = Object.freeze([{ lane: LANE_T, number: 5, account: 'os-b' }, { lane: LANE_T, number: 2, account: 'os-b' }, { lane: 'review', number: 2, account: 'os-r' }, { lane: 'l2-review', number: 3, account: 'os-r' }]); + const SESSION_T = 'session_01QSeKYmhU5KEj1nukYhp1Tg'; + const underTable = (fn) => withSeatNumbers(TABLE, fn); + const checkedIn = (lane, number) => SEAT_NUMBER_ACCOUNTS.find((row) => row.lane === lane && row.number === number)?.account ?? null; + b(BATTERY_NUMBERS, 'table: the checked-in table is sound — every row a lower-case lane, a seat number and a lower-case login, no number of a lane named twice', J38(seatNumberTableProblems(SEAT_NUMBER_ACCOUNTS)), J38([])); + b(BATTERY_NUMBERS, 'table: the fixture table is sound — two numbers of one lane may name one account', J38(seatNumberTableProblems(TABLE)), J38([])); + b(BATTERY_NUMBERS, 'table: ⛔ a malformed row is named — an upper-case lane, an upper-case login, a number that is none (twice), a lane no seat carries, a row that is no object', J38([{ lane: 'Repo:objectstack', number: 5, account: 'os-b' }, { lane: 'repo:objectstack', number: 5, account: 'OS-B' }, { lane: 'repo:objectstack', number: 0, account: 'os-b' }, { lane: 'repo:objectstack', number: '5', account: 'os-b' }, { lane: 'somewhere', number: 5, account: 'os-b' }, null].map((row) => seatNumberRowProblem(row) !== null)), J38([true, true, true, true, true, true])); + b(BATTERY_NUMBERS, 'table: ⛔ one number of a lane naming two accounts is a problem, and so is a table that is no list', J38([seatNumberTableProblems([...TABLE, { lane: LANE_T, number: 5, account: 'os-c' }]).length, seatNumberTableProblems({}).length]), J38([1, 1])); + b(BATTERY_NUMBERS, 'table: CONTROL — the same number in ANOTHER lane is no clash', J38(seatNumberTableProblems([...TABLE, { lane: 'repo:cloud', number: 5, account: 'os-c' }])), J38([])); + b(BATTERY_NUMBERS, 'name: a retired number reads as the account seat it became, the lane in any case', J38(underTable(() => [seatMarkOf(LANE_T, 5), seatMarkOf(LANE_T.toUpperCase(), 2), seatNameId(LANE_T, 5)])), J38(['@os-b', '@os-b', `${LANE_T}@os-b`])); + b(BATTERY_NUMBERS, 'record: ⭐ a renamed seat\'s old #N record, signed by its account in any case, reads as that seat\'s', J38(underTable(() => [seatMarkOf(LANE_T, 5, 'os-b'), seatMarkOf(LANE_T, 5, 'OS-B'), signedSeatId(readSignatureLine(`${LANE_T}#5 · os-b · ${SESSION_T}`))])), J38(['@os-b', '@os-b', `${LANE_T}@os-b`])); + b(BATTERY_NUMBERS, 'record: ⛔ an EARLIER holder\'s record under the same number stays the numbered seat\'s — and so does a record whose signer is unread', J38(underTable(() => [seatMarkOf(LANE_T, 5, 'os-a'), seatMarkOf(LANE_T, 5, null), signedSeatId(readSignatureLine(`${LANE_T}#5 · os-a · ${SESSION_T}`))])), J38([5, 5, `${LANE_T}#5`])); + b(BATTERY_NUMBERS, 'vacant: ⛔ a number with NO row is nobody\'s account seat — as a name, and as a record signed by any account, the lane\'s seated one included', J38(underTable(() => [seatMarkOf(LANE_T, 1), seatMarkOf(LANE_T, 1, 'os-b'), seatMarkOf(LANE_T, 1, 'os-c'), seatNameId(LANE_T, 1)])), J38([1, 1, 1, `${LANE_T}#1`])); + b(BATTERY_NUMBERS, 'lane: ⛔ a row speaks for its own lane only — the same number of another lane, or of the lane\'s other word, is unmoved', J38(underTable(() => [seatMarkOf('repo:cloud', 5), seatMarkOf('repo:cloud', 5, 'os-b'), seatMarkOf('l2-review', 2), seatMarkOf('review', 3)])), J38([5, 5, 2, 3])); + b(BATTERY_NUMBERS, 'mark: an account mark and an unread mark come back as they are', J38(underTable(() => [seatMarkOf(LANE_T, '@os-c'), seatMarkOf(LANE_T, '@os-c', 'os-b'), seatMarkOf(LANE_T, null)])), J38(['@os-c', '@os-c', null])); + b(BATTERY_NUMBERS, 'table: CONTROL — with NO row every number reads as it always has, a signer or none', J38(withSeatNumbers([], () => [seatMarkOf(LANE_T, 5), seatMarkOf(LANE_T, 5, 'os-b'), seatNameId(LANE_T, 5)])), J38([5, 5, `${LANE_T}#5`])); + b(BATTERY_NUMBERS, 'seam: the fixture table is in force inside the call and gone when it returns', J38([underTable(() => seatNumberAccount(LANE_T, 5)), seatNumberAccount(LANE_T, 5) === checkedIn(LANE_T, 5)]), J38(['os-b', true])); + b(BATTERY_NUMBERS, 'seam: …gone when the call throws', (() => { try { underTable(() => { throw new Error('the fixture'); }); } catch { /* the throw is the fixture */ } return seatNumberAccount(LANE_T, 2) === checkedIn(LANE_T, 2); })(), true); + b(BATTERY_NUMBERS, 'seam: …and gone once a promise it returned settles, not before', J38([await underTable(async () => { await null; return seatNumberAccount(LANE_T, 5); }), seatNumberAccount(LANE_T, 5) === checkedIn(LANE_T, 5)]), J38(['os-b', true])); + b(BATTERY_NUMBERS, 'numbers: an account seat answers for every number it retired, ascending, `@account` or bare, any case — another account for none', J38(underTable(() => [seatNumbersOf(LANE_T, '@OS-B').map((row) => row.number), seatNumbersOf(LANE_T, 'os-b').length, seatNumbersOf(LANE_T, 'os-c')])), J38([[2, 5], 2, []])); + b(BATTERY_NUMBERS, 'review lane: `review` and `l2-review` are one lane — an account seat is keyed `l2-review@account` under either word, and answers for its numbers under both', J38(underTable(() => [seatIdOf('review', '@os-r'), seatIdOf('l2-review', '@os-r'), seatLaneOf('Review', '@os-r'), seatNumbersOf('l2-review', 'os-r'), signedSeatId(readSignatureLine(`review#2 · os-r · ${SESSION_T}`)), signedSeatId(readSignatureLine(`l2-review#3 · os-r · ${SESSION_T}`))])), J38(['l2-review@os-r', 'l2-review@os-r', 'l2-review', [{ lane: 'review', number: 2 }, { lane: 'l2-review', number: 3 }], 'l2-review@os-r', 'l2-review@os-r'])); + b(BATTERY_NUMBERS, 'review lane: CONTROL — a NUMBERED seat keeps the word it signed with, and no other lane is folded', J38([seatIdOf('review', 2), seatIdOf('l2-review', 2), seatLaneOf('review', 2), seatLaneOf('repo:review', '@os-r'), seatIdOf('qa', '@os-r')]), J38(['review#2', 'l2-review#2', 'review', 'repo:review', 'qa@os-r'])); + b(BATTERY_NUMBERS, 'compared signature: the lane and the seat a reader compares — the renamed seat\'s old line meets its new one, an earlier holder\'s does not, null stays null', J38(underTable(() => [comparedSignature(readSignatureLine(`${LANE_T}#5 · os-b · ${SESSION_T}`)).seat, comparedSignature(readSignatureLine(`${LANE_T}@os-b · os-b · ${SESSION_T}`)).seat, comparedSignature(readSignatureLine(`${LANE_T}#5 · os-a · ${SESSION_T}`)).seat, comparedSignature(readSignatureLine(`review#2 · os-r · ${SESSION_T}`)).lane, comparedSignature(null)])), J38(['@os-b', '@os-b', 5, 'l2-review', null])); + b(BATTERY_NUMBERS, 'compared id: a seat id text, lower-cased — a name by the table alone, a record by its signer, text that names no mark unchanged', J38(underTable(() => [comparedSeatId(`${LANE_T}#5`), comparedSeatId(`${LANE_T.toUpperCase()}#5`, 'os-b'), comparedSeatId(`${LANE_T}#5`, 'os-a'), comparedSeatId(`${LANE_T}#1`), comparedSeatId('Review@OS-R'), comparedSeatId(' Triage '), comparedSeatId(null)])), J38([`${LANE_T}@os-b`, `${LANE_T}@os-b`, `${LANE_T}#5`, `${LANE_T}#1`, 'l2-review@os-r', 'triage', ''])); + // H38 on a renamed post: the post's title carries the account, its earlier claims the number. + const signedClaim = (signature, seatLine, iso) => [{ body: `${signature}\n\nClaim: PM loop round 1\nSession: \`session_x\`\n${seatLine}`, created_at: iso }]; + const oldOwn = new Map([[1, signedClaim(`${LANE_T}#5 · os-b · ${SESSION_T}`, `Seat: \`${LANE_T}#5\``, '2026-08-30T00:00:00Z')]]); + const oldEarlier = new Map([[1, signedClaim(`${LANE_T}#5 · os-a · ${SESSION_T}`, `Seat: \`${LANE_T}#5\``, '2026-08-30T00:00:00Z')]]); + const oldVacant = new Map([[1, signedClaim(`${LANE_T}#1 · os-b · ${SESSION_T}`, `Seat: \`${LANE_T}#1\``, '2026-08-30T00:00:00Z')]]); + const newOwn = new Map([[1, signedClaim(`${LANE_T}@os-b · os-b · ${SESSION_T}`, `Seat: \`${LANE_T}@os-b\``, '2026-08-30T00:00:00Z')]]); + b(BATTERY_NUMBERS, 'H38: ⭐ a renamed post sees its own earlier #N claim — the row is not silenced by the rename', underTable(() => newestLaneClaim('area:data', oneCard, oldOwn, '@os-b', LANE_T))?.number ?? null, 1); + b(BATTERY_NUMBERS, 'H38: …and a post still titled by its number sees the claim its account now signs — the row lands before the rename', underTable(() => newestLaneClaim('area:data', oneCard, newOwn, 5, LANE_T))?.number ?? null, 1); + b(BATTERY_NUMBERS, 'H38: ⛔ an earlier holder\'s #N claim is not the renamed account\'s, so its post is not rowed over it', underTable(() => newestLaneClaim('area:data', oneCard, oldEarlier, '@os-b', LANE_T)), null); + b(BATTERY_NUMBERS, 'H38: ⛔ a vacant seat\'s #N claim is not a new account\'s — even one the same account signed under a number with no row', underTable(() => newestLaneClaim('area:data', oneCard, oldVacant, '@os-b', LANE_T)), null); + b(BATTERY_NUMBERS, 'H38: CONTROL — …while the numbered post it was written under still sees it', underTable(() => newestLaneClaim('area:data', oneCard, oldVacant, 1, LANE_T))?.number ?? null, 1); + b(BATTERY_NUMBERS, 'H38: CONTROL — with no row, or asked under no lane, the renamed post does NOT see the old claim: the table is what joins the two spellings', J38([withSeatNumbers([], () => newestLaneClaim('area:data', oneCard, oldOwn, '@os-b', LANE_T)), underTable(() => newestLaneClaim('area:data', oneCard, oldOwn, '@os-b'))]), J38([null, null])); + b(BATTERY_NUMBERS, 'H38: the lane word the table is asked under is read off the post\'s title — either mark, the seat suffix, an area and a board suffix left out', J38([seatPostLaneWord(seat38(acctArea)), seatPostLaneWord(seat38(seat2Area)), seatPostLaneWord(seat38('[PM seat] Triage (objectstack-wide) — 🟢 Routine')), seatPostLaneWord(seat38('[PM seat] domain:ui @ objectui — 🟢 os-b')), seatPostLaneWord(seat38(`[PM seat] repo:${OWN_BOARD}#5@os-b — 🟢 os-b`)), seatPostLaneWord(seat38('devx seat registry'))]), J38([LANE_T, LANE_T, 'triage', 'domain:ui', LANE_T, null])); + // The carried nits of contract review 7251011180 that live in this file. + b(BATTERY_NUMBERS, 'N2: a claim with NO `Seat:` line, signed by an account seat, is that seat\'s — ⛔ not seat 1\'s', J38([claimSeatNumber(`${LANE_T}@os-b · os-b · ${SESSION_T}\n\nClaim: x\nBranch: \`claude/issue-1-a\``), newestLaneClaim('area:data', oneCard, new Map([[1, signedClaim(`${LANE_T}@os-b · os-b · ${SESSION_T}`, 'Branch: `claude/issue-1-a`', '2026-08-30T00:00:00Z')]]), 1), newestLaneClaim('area:data', oneCard, new Map([[1, signedClaim(`${LANE_T}@os-b · os-b · ${SESSION_T}`, 'Branch: `claude/issue-1-a`', '2026-08-30T00:00:00Z')]]), '@os-b')?.number ?? null]), J38(['@os-b', null, 1])); + b(BATTERY_NUMBERS, 'N2: CONTROL — signed by a numbered seat, or by nobody, the absent line is still seat 1; a declared line still wins over the signature', J38([claimSeatNumber(`${LANE_T}#5 · os-b · ${SESSION_T}\n\nClaim: x`), claimSeatNumber('Claim: x'), claimSeatNumber(`${LANE_T}@os-b · os-b · ${SESSION_T}\n\nClaim: x\nSeat: ${LANE_T}#3`)]), J38([1, 1, 3])); + b(BATTERY_NUMBERS, 'N3: a `Seat:` line names a seat by account only under a lane a seat can carry — every lane word, any case', J38(['triage', 'director', 'coordinator', 'security', 'L2-review', 'review', 'qa', 'eval', 'queue', 'domain:ui', 'epic:#31527'].map((lane) => claimSeatNumber(`Claim: x\nSeat: ${lane}@os-b`))), J38(Array(11).fill('@os-b'))); + b(BATTERY_NUMBERS, 'N3: ⛔ …and under a word that is no lane it is unreadable — not an account seat, and not seat 1', J38([claimSeatNumber('Claim: x\nSeat: anything@os-b'), claimSeatNumber('Claim: x\nSeat: mail@os-b'), claimSeatNumber('Claim: x\nSeat: repo:triage-x@os-b')]), J38([null, null, '@os-b'])); + b(BATTERY_NUMBERS, 'N7: a title carrying BOTH marks is the account\'s seat, the number dropped from the lane and the rest — every title reader answers one seat', J38([seatTitleAccount('repo:objectstack#5@os-b · area:data'), J38(seatLane(seat38(`[PM seat] repo:${OWN_BOARD}#5@os-b — 🟢 os-b · area:data`))) === J38(seatLane(seat38(acctArea))), seatIntakeKeys(seat38(`[PM seat] repo:${OWN_BOARD}#5@os-b — 🟢 os-b · area:data`), `objectstack-ai/${OWN_BOARD}`)]), J38([{ lane: 'repo:objectstack', mark: '@os-b', rest: 'repo:objectstack · area:data' }, true, ['area:data']])); + b(BATTERY_NUMBERS, 'N6: a line SHAPED like a signature is read with its four parts even when `LANE@X` is signed by account Y — the near miss `readSignatureLine` refuses', J38([signatureShapedLine(`${LANE_T}@os-b · os-c · ${SESSION_T}`)?.account, readSignatureLine(`${LANE_T}@os-b · os-c · ${SESSION_T}`), signatureShapedLine(` ${LANE_T}#5 · os-b · ${SESSION_T} `)?.seat, signatureShapedLine('just a sentence · with · dots'), signatureShapedLine(null)]), J38(['os-c', null, 5, null, null])); + // -- Lane label aliases — the domain:server merge (maintainer ruling 2026-10-22, letter 乙) -- // // Three lane labels retired INTO `domain:server` keep circulating for a while diff --git a/scripts/pm/check-handover.mjs b/scripts/pm/check-handover.mjs index e083c2af4bf..a44bc20a660 100644 --- a/scripts/pm/check-handover.mjs +++ b/scripts/pm/check-handover.mjs @@ -181,9 +181,10 @@ import { proxyRearmPlan, readSignatureLine, resolveSweepRepo, - seatIdOf, + signedSeatId, stripMarkdownCode, stripSignatureLine, + withSeatNumbers, } from './check-half-states.mjs'; import { enqueuerFromTimeline } from './check-governed-queue-guard.mjs'; import { classifyRulingComment } from './check-prior-rulings.mjs'; @@ -873,7 +874,7 @@ export function inflightSurface(issue, comments) { const paths = [...current]; const excluded = [...excludedAll]; const sig = readSignatureLine(String(claim?.body ?? '')); - return { verdict: 'held', claim, session: claimSession(claim?.body), seat: sig ? seatIdOf(sig.lane, sig.seat) : null, declared, paths, excluded }; + return { verdict: 'held', claim, session: claimSession(claim?.body), seat: sig ? signedSeatId(sig) : null, declared, paths, excluded }; } /** `--paths=a,b` → the dispatch's surface entries (code-span backticks tolerated), or the usage error. */ @@ -1581,6 +1582,8 @@ export function selfTest() { t('inflight: ⭐ a held claim names its session (the `Session:` line), its seat (the signature) and its paths', heldIf.verdict === 'held' && heldIf.session === 'session_01L9qibyUSf2nKJWW6qBemSU' && heldIf.seat === 'repo:objectstack#3' && heldIf.paths.join() === 'scripts/pm/dispatch-gates.mjs,scripts/pm/dispatch-gates.data.mjs'); const acctClaim = (sig) => inflightSurface(IF_CARD(), [comment(40, 0, `${sig}\n\nClaim: PM loop round 1 · 2026-11-27T07:39Z\nSession: \`session_01L9qibyUSf2nKJWW6qBemSU\`\nFile surface: \`scripts/pm/dispatch-gates.mjs\``)]); t('inflight: ⭐ a held claim signed by a seat named by its account names that seat `lane@account` (ruling record 7249169754); ⛔ a `#N` claim stays the numbered seat\'s, and a line signed for another account\'s seat names no seat', acctClaim('repo:objectstack@os-tesla · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat === 'repo:objectstack@os-tesla' && acctClaim('repo:objectstack@Os-Tesla · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat === 'repo:objectstack@os-tesla' && heldIf.seat === 'repo:objectstack#3' && acctClaim('repo:objectstack@os-bill · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat === null); + const T3 = [{ lane: 'repo:objectstack', number: 3, account: 'os-tesla' }]; + t('inflight: ⭐ after a rename the seat\'s old `#3` claim, signed by its account, names the account seat (`seat-numbers.mjs`); ⛔ an EARLIER holder\'s `#3` claim and a vacant seat\'s `#1` claim stay numbered, and with no row so does the old claim', withSeatNumbers(T3, () => acctClaim('repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat) === 'repo:objectstack@os-tesla' && withSeatNumbers(T3, () => acctClaim('repo:objectstack#3 · os-old · session_01L9qibyUSf2nKJWW6qBemSU').seat) === 'repo:objectstack#3' && withSeatNumbers(T3, () => acctClaim('repo:objectstack#1 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat) === 'repo:objectstack#1' && withSeatNumbers([], () => acctClaim('repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat) === 'repo:objectstack#3'); const amended = inflightSurface(IF_CARD(), [IF_CLAIM('File surface: `scripts/pm/card-pick.mjs`'), comment(41, 60, `${IF_SIG}\n\nClaim amendment: slice 2 · 2026-11-19T15:06Z\nFile surface: slice 2 only: \`scripts/pm/landing-k.mjs\` (new). Not \`card-pick.mjs\`.`)]); t('inflight: a later `Claim amendment` re-declares the surface — its paths join the claim\'s, its fence (a bare name too) removes from the union', amended.paths.join() === 'scripts/pm/landing-k.mjs' && amended.excluded.join() === 'card-pick.mjs' && inflightSurface(IF_CARD(), [IF_CLAIM('File surface: `scripts/pm/card-pick.mjs`'), comment(41, 60, `${IF_SIG}\n\nClaim amendment: rider\nFile surface: \`package.json\` added.`)]).paths.join() === 'scripts/pm/card-pick.mjs,package.json'); t('inflight: ⛔ not in flight — a `Release:` newer than the claim (whoever wrote it), no claim, another state, a closed card', inflightSurface(IF_CARD(), [IF_CLAIM('File surface: `a/b.mjs`'), comment(42, 90, 'Release: back to the queue')]).verdict === 'released' && inflightSurface(IF_CARD(), [comment(43, 0, 'a note')]).verdict === 'unclaimed' && inflightSurface(IF_CARD(['pm:queue']), [IF_CLAIM('File surface: `a/b.mjs`')]).verdict === 'out' && inflightSurface(IF_CARD(undefined, { state: 'closed' }), [IF_CLAIM('File surface: `a/b.mjs`')]).verdict === 'out'); diff --git a/scripts/pm/check-owed-reviews.mjs b/scripts/pm/check-owed-reviews.mjs index 82a46d6d0ff..a35ce8f7f3b 100644 --- a/scripts/pm/check-owed-reviews.mjs +++ b/scripts/pm/check-owed-reviews.mjs @@ -110,7 +110,7 @@ import process from 'node:process'; import { isEntrypoint } from '../invoked-as.mjs'; -import { cardIntakeKeys, CONTRACT_REVIEW_HEADING_MARKER, contractReviewVerdictLines, latestMarkedComment, readSignatureLine, seatIdOf, seatIntakeKeys } from './check-half-states.mjs'; +import { cardIntakeKeys, CONTRACT_REVIEW_HEADING_MARKER, contractReviewVerdictLines, latestMarkedComment, readSignatureLine, seatNameId, seatIntakeKeys, signedSeatId, withSeatNumbers } from './check-half-states.mjs'; import { repoIdForSlug } from './check-governed-merges.mjs'; import { GOVERNED_APPROVERS, NARROWING_FACE_LINE, narrowingDeclarationsIn, recordAuthorTrusted, recordTrustedAuthors } from './check-governed-queue-guard.mjs'; import { FLEET_BOT_LOGIN } from './check-handover.mjs'; @@ -285,11 +285,12 @@ export function recordReading(pull, trusted = RECORD_AUTHORS) { /** * The seat that signed a record — its first line's seat signature (`readSignatureLine`), as `lane#N` (or * `lane@account` for a seat named by its account), the spelling `reviewSeatsOf` names a seat with — or null when - * it carries none. Pure. + * it carries none. A retired number its signer's row carries reads as the account seat it became (`signedSeatId`), + * the name `reviewSeatsOf` gives that seat's renamed post. */ export function signerSeatOf(body) { const sig = readSignatureLine(body); - return sig === null ? null : seatIdOf(sig.lane, sig.seat); + return sig === null ? null : signedSeatId(sig); } /** The limbs owe on the declaration face ALONE (`Clause-②: yes`, no schema and no governed path): `TIER_DEFAULT`. Pure. */ @@ -325,7 +326,8 @@ export function reviewSeatsOf(seats) { if (!Array.isArray(seats)) return { state: 'unknown', seated: [] }; const rows = seats.filter((s) => isL2ReviewLane(s?.lane)); // A seat named by its account (`seat` is `@account`, fleet-roster's `parseSeat`) keeps that name: ⛔ never seat 1. - const name = (s) => (typeof s.seat === 'string' && s.seat.startsWith('@') ? seatIdOf(String(s.lane).trim().toLowerCase(), s.seat) : `${String(s.lane).trim().toLowerCase()}#${Number(s.seat) > 0 ? Number(s.seat) : 1}`); + // Named as readers compare it (`seatNameId`): `review@X` and `l2-review@X` are one seat, and a numbered post the table carries is its account's. + const name = (s) => seatNameId(String(s.lane).trim().toLowerCase(), typeof s.seat === 'string' && s.seat.startsWith('@') ? s.seat : Number(s.seat) > 0 ? Number(s.seat) : 1); // `lanes/l2-review.md` 独立性: the pair is two SESSIONS, ⛔ never two accounts (ruling A on #33258) — // a seat's account is not read, so one on the PR's own implementing or dispatching account is seated like any other. const seated = rows.filter((s) => s.status === 'seated').map(name).sort(); @@ -637,7 +639,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ // 24 → 18 (#34400, ruling A on #33258): the account bar is gone — its eight cases (S2, S4, the area-lease note, the // own delta of a now-barred signer) retire with it; one case pins same account, different session ⇒ seated and named, // and one keeps the unread-card-thread reading (the record unjudged, no own delta), which never needed the bar. - 'the L2 seat is the fallback: named by a hand-off or on its own delta, never on (b), (c), the label or the TIER_DEFAULT face': 21, + 'the L2 seat is the fallback: named by a hand-off or on its own delta, never on (b), (c), the label or the TIER_DEFAULT face': 23, 'a live claim holds the head and a record settles it; a lapsed claim holds nothing': 6, 'the live instance: two Tier H drafts with a hand-off on the current head list as TAKE under (a)': 4, 'the live read: every read through one reader; a failed read is INCOMPLETE, never clean': 6, @@ -779,7 +781,11 @@ export function selfTest() { const ACCT_REVIEW = [...SEATED, { lane: 'l2-review', seat: '@os-mickey', status: 'seated' }, { lane: 'review', seat: 1, status: 'seated' }]; t('⭐ a seat named by its account (ruling record 7249169754): the roster names it `lane@account` beside the numbered one, never as seat 1; a hand-off naming it names it and is an L2 seat on the TIER_DEFAULT face', (() => { const s = reviewSeatsOf(ACCT_REVIEW); const h = rv({ headCommittedAt: fresh, comments: [handoff(HEAD, '2026-10-28T12:40:00Z', 'l2-review@os-mickey')] }, ACCT_REVIEW); const d = rv({ ...DECLARED, headCommittedAt: fresh, comments: [handoff(HEAD, '2026-10-28T12:40:00Z', 'l2-review@os-mickey')] }, ACCT_REVIEW); return s.state === 'seated' && s.seated.join() === 'l2-review@os-mickey,review#1' && h.status === 'TAKE' && h.taker === 'l2-review@os-mickey' && d.taker === `the area:ux seat (${TIER_DEFAULT_FACE_NOTE})`; })()); t('⭐ its own delta by either mark: a record signed `l2-review@os-mickey · os-mickey` is that seat\'s and it takes the head; the signer is read off the first line in both forms', (() => { const r = rv({ comments: [signed(HEAD2, `l2-review@os-mickey · os-mickey · ${REVIEWER}`)] }, ACCT_REVIEW); return r.record.seat === 'l2-review@os-mickey' && r.taker === 'l2-review@os-mickey (the delta of its own record 6911000001)' && signerSeatOf(signed(HEAD2, `l2-review@Os-Mickey · os-mickey · ${REVIEWER}`).body) === 'l2-review@os-mickey' && signerSeatOf(signed(HEAD2, MICKEY).body) === 'review#1'; })()); - t('⛔ control — neither mark reads as the other: a `review#1` record stays the numbered seat\'s when only an account seat is seated (the lane takes), an `l2-review@os-mickey` record is not `l2-review@os-bill`\'s, and a line signed for another account\'s seat names nobody', (() => { const ONLY_ACCT = [...SEATED, { lane: 'review', seat: '@os-mickey', status: 'seated' }]; const BILL = [...SEATED, { lane: 'l2-review', seat: '@os-bill', status: 'seated' }]; return rv({ comments: [signed(HEAD2, MICKEY)] }, ONLY_ACCT).taker === LANE_TAKES && reviewSeatsOf(ONLY_ACCT).seated.join() === 'review@os-mickey' && rv({ comments: [signed(HEAD2, `l2-review@os-mickey · os-mickey · ${REVIEWER}`)] }, BILL).taker === LANE_TAKES && signerSeatOf(signed(HEAD2, `l2-review@os-bill · os-mickey · ${REVIEWER}`).body) === null; })()); + t('⛔ control — neither mark reads as the other: a `review#1` record stays the numbered seat\'s when only an account seat is seated (the lane takes; that seat, posted under the old word `review`, is named `l2-review@os-mickey`), an `l2-review@os-mickey` record is not `l2-review@os-bill`\'s, and a line signed for another account\'s seat names nobody', (() => { const ONLY_ACCT = [...SEATED, { lane: 'review', seat: '@os-mickey', status: 'seated' }]; const BILL = [...SEATED, { lane: 'l2-review', seat: '@os-bill', status: 'seated' }]; return rv({ comments: [signed(HEAD2, MICKEY)] }, ONLY_ACCT).taker === LANE_TAKES && reviewSeatsOf(ONLY_ACCT).seated.join() === 'l2-review@os-mickey' && rv({ comments: [signed(HEAD2, `l2-review@os-mickey · os-mickey · ${REVIEWER}`)] }, BILL).taker === LANE_TAKES && signerSeatOf(signed(HEAD2, `l2-review@os-bill · os-mickey · ${REVIEWER}`).body) === null; })()); + // A retired number and the account seat it became (`seat-numbers.mjs`): `review#1` is renamed to os-mickey's seat. + const T1 = [{ lane: 'review', number: 1, account: 'os-mickey' }]; + t('⭐ after a rename the seat\'s old `review#1` record, signed by its account, is the account seat\'s own: it takes the delta, and a roster row still numbered names the same seat', withSeatNumbers(T1, () => { const ONLY_ACCT = [...SEATED, { lane: 'l2-review', seat: '@os-mickey', status: 'seated' }]; const r = rv({ comments: [signed(HEAD2, MICKEY)] }, ONLY_ACCT); return r.record.seat === 'l2-review@os-mickey' && r.taker === 'l2-review@os-mickey (the delta of its own record 6911000001)' && signerSeatOf(signed(HEAD2, MICKEY).body) === 'l2-review@os-mickey' && reviewSeatsOf([...SEATED, { lane: 'review', seat: 1, status: 'seated' }]).seated.join() === 'l2-review@os-mickey'; })); + t('⛔ …an EARLIER holder\'s `review#1` record is not the renamed account\'s, a vacant `review#2` record is no account\'s, and with no row the old record stays the numbered seat\'s — the lane takes each', (() => { const ONLY_ACCT = [...SEATED, { lane: 'l2-review', seat: '@os-mickey', status: 'seated' }]; return withSeatNumbers(T1, () => signerSeatOf(signed(HEAD2, `review#1 · os-zhuang · ${REVIEWER}`).body) === 'review#1' && rv({ comments: [signed(HEAD2, `review#1 · os-zhuang · ${REVIEWER}`)] }, ONLY_ACCT).taker === LANE_TAKES && signerSeatOf(signed(HEAD2, `review#2 · os-mickey · ${REVIEWER}`).body) === 'review#2' && rv({ comments: [signed(HEAD2, `review#2 · os-mickey · ${REVIEWER}`)] }, ONLY_ACCT).taker === LANE_TAKES) && withSeatNumbers([], () => rv({ comments: [signed(HEAD2, MICKEY)] }, ONLY_ACCT).taker === LANE_TAKES); })()); t('a record on THIS head is DONE — no taker at all, the signer\'s or anyone\'s', (() => { const r = rv({ comments: [signed(HEAD, MICKEY)] }); return r.status === 'DONE' && r.taker === null && r.record.seat === 'review#1'; })()); const ATTR = '\n_Requested by **Y**_\n\nPart of #25922\n\nClause-②: no\nMetadata-protocol: none'; const CLAIMED = [{ id: 7, created_at: '2026-10-28T09:00:00Z', body: 'domain:skills#3 · os-zhuang · session_01Abcdefgh\n\nClaim: PM loop round 1 · 2026-10-28T09:00Z\nBranch: `claude/x`' }]; diff --git a/scripts/pm/check-skill-line-ratchet.mjs b/scripts/pm/check-skill-line-ratchet.mjs index 296f0c41dd8..1da08697ef2 100644 --- a/scripts/pm/check-skill-line-ratchet.mjs +++ b/scripts/pm/check-skill-line-ratchet.mjs @@ -81,10 +81,10 @@ const REPO_ROOT = new URL('../../', import.meta.url); // moves a row later says why in its body; the row carries a one-line comment // only when a reader needs the ruling at the row. export const CEILINGS = new Map([ - ['.claude/skills/pm-dispatch/SKILL.md', 33351], // lowered 33919 → 33351 by the entry-file slimming PR: five recommendation-order lines moved to references/decision-analysis.md (the declared cross-file move below); before that: lowered 33934 → 33872 by the re-basing PR's own edit; raised 33872 → 33881 (+9) by ruling record 7076338827, the addendum to 7076315104 (the simple-question exception is said on each of the three lines of 升级与决策 it qualifies: 「不一定要写成文件吧?简单的问题是不是直接和我沟通就可以」); raised 33881 → 33919 (+38) by ruling record 7076338827 (the simple-question exception on the decision-thread line; that it names seats and triage only is the seat's reading, the ruling's words do not say who asks) + ['.claude/skills/pm-dispatch/SKILL.md', 33327], // lowered 33919 → 33351 by the entry-file slimming PR: five recommendation-order lines moved to references/decision-analysis.md (the declared cross-file move below); before that: lowered 33934 → 33872 by the re-basing PR's own edit; raised 33872 → 33881 (+9) by ruling record 7076338827, the addendum to 7076315104 (the simple-question exception is said on each of the three lines of 升级与决策 it qualifies: 「不一定要写成文件吧?简单的问题是不是直接和我沟通就可以」); raised 33881 → 33919 (+38) by ruling record 7076338827 (the simple-question exception on the decision-thread line; that it names seats and triage only is the seat's reading, the ruling's words do not say who asks) ['.claude/skills/pm-dispatch/references/dispatch-runbook.md', 20483], // raised 20070 → 20354 (+284) by ruling record 7075909669 (#36203 items 1-5: 「同意五条都改」): a card thread confirms Actions started after each push; the seat reads pr-state of every in-flight card PR; lowered 20354 → 20344 by the PR that moved the tier and effort values to the one home; raised 20344 → 20483 (+139) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」): the thread's first report carries the served tier and the seat writes it into the claim ['.claude/skills/pm-dispatch/references/state-machine.md', 4189], - ['.claude/skills/pm-dispatch/references/contract-review.md', 6419], + ['.claude/skills/pm-dispatch/references/contract-review.md', 6420], // raised 6419 → 6420 (+1) by ruling record 7249169754 (Q1 A: 「同意,立卡派发」): the hand-off line names its target seat `LANE@ACCOUNT`, the template `record-recognisers.mjs` holds verbatim ['.claude/skills/pm-dispatch/references/decision-analysis.md', 5580], // lowered 5589 → 5580 by the decision-analysis tier-line PR (its worked 速读 example deleted to pay for the `Served-tier:` / `Analysed-by:` lines); before that: raised 5023 → 5589 (+566) by the declared cross-file move from SKILL.md (CROSS_FILE_MOVES below); before that: raised 4892 → 5023 (+131) by ruling record 7076338827, the addendum to 7076315104 (a simple question goes to the maintainer in chat after the at-tier analysis: 「不一定要写成文件吧?简单的问题是不是直接和我沟通就可以」) ['.claude/skills/pm-dispatch/references/platform-readings.md', 1082], ['.claude/skills/pm-dispatch/references/readings-queue.md', 9074], @@ -101,41 +101,41 @@ export const CEILINGS = new Map([ ['.claude/skills/pm-dispatch/references/review-checklist.md', 79], ['.claude/skills/pm-dispatch/references/landing-operations.md', 10705], ['.claude/skills/pm-dispatch/references/release-aftercare.md', 3526], - ['.claude/skills/pm-dispatch/references/seat-post-protocol.md', 7716], // lowered 7720 → 7716 by the #38415 seat-mark readers PR (the signature line names `LANE@ACCOUNT` as a reading, paid by the checklist heading's aside; the file's landed size, headroom 0) + ['.claude/skills/pm-dispatch/references/seat-post-protocol.md', 7974], // raised 7716 → 7974 (+258) by ruling record 7249169754 (Q1 A, Q2 A, Q3 A: 「同意,立卡派发」) and the seat's answers inside it (seat check 7251742592, item 5): the seat is named `LANE@ACCOUNT` and does not change hands, old `#N` records stay readable, a rename waits for its row in `seat-numbers.mjs`; before that: lowered 7720 → 7716 by the #38415 seat-mark readers PR (the signature line names `LANE@ACCOUNT` as a reading, paid by the checklist heading's aside; the file's landed size, headroom 0) ['.claude/skills/pm-dispatch/references/true-green.md', 2068], ['.claude/skills/pm-dispatch/references/compile-surfaces.md', 2488], - ['.claude/skills/pm-dispatch/references/seat-lifecycle.md', 9070], // raised 9070 → 9076 (+6) by ruling record 7075909669 (#36203 items 1-5: 「同意五条都改」): card-pick --why every patrol round; lowered 9076 → 9070 by the PR that moved the tier and effort values to the one home - ['.claude/skills/pm-dispatch/references/area-lease.md', 6986], // lowered 6990 → 6986 by the decision-analysis tier-line PR (its pointer paid by two deletions in the same file); before that: raised 6401 → 6586 by the ruled text (one seat per lane by default; a new `area:*` is a partition of that seat), ruling record 7030459053; raised 6586 → 6990 (+404, the landed bytes) by the ruled text (a zone boundary change is the seat's routing call, and a card outside the lease goes to the seat, which picks one of three routes), the maintainer's ruling quoted in the body of the rule card and recorded by triage record 7247665159 (「座位可以自己决定,立卡更新skills」) - ['.claude/skills/pm-dispatch/references/coordinator.md', 4427], // raised 3781 → 4265 by the ruled text (one seat per lane by default; a new `area:*` is a partition of that seat), ruling record 7030459053; lowered 4265 → 4230 by the PR that moved the tier and effort values to the one home; raised 4230 → 4427 (+197) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」): the coordinator returns an underived ceiling order before a thread opens + ['.claude/skills/pm-dispatch/references/seat-lifecycle.md', 8901], // raised 9070 → 9076 (+6) by ruling record 7075909669 (#36203 items 1-5: 「同意五条都改」): card-pick --why every patrol round; lowered 9076 → 9070 by the PR that moved the tier and effort values to the one home + ['.claude/skills/pm-dispatch/references/area-lease.md', 6957], // lowered 6990 → 6986 by the decision-analysis tier-line PR (its pointer paid by two deletions in the same file); before that: raised 6401 → 6586 by the ruled text (one seat per lane by default; a new `area:*` is a partition of that seat), ruling record 7030459053; raised 6586 → 6990 (+404, the landed bytes) by the ruled text (a zone boundary change is the seat's routing call, and a card outside the lease goes to the seat, which picks one of three routes), the maintainer's ruling quoted in the body of the rule card and recorded by triage record 7247665159 (「座位可以自己决定,立卡更新skills」) + ['.claude/skills/pm-dispatch/references/coordinator.md', 4363], // raised 3781 → 4265 by the ruled text (one seat per lane by default; a new `area:*` is a partition of that seat), ruling record 7030459053; lowered 4265 → 4230 by the PR that moved the tier and effort values to the one home; raised 4230 → 4427 (+197) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」): the coordinator returns an underived ceiling order before a thread opens ['.claude/skills/pm-dispatch/references/untrusted-text.md', 3280], - ['.claude/skills/pm-dispatch/references/security-findings.md', 3934], + ['.claude/skills/pm-dispatch/references/security-findings.md', 3917], ['.claude/skills/pm-dispatch/references/external-contributions.md', 2006], ['.claude/skills/pm-dispatch/references/reading-discipline.md', 3822], - ['.claude/skills/pm-dispatch/references/cross-repo-coordination.md', 4936], // raised 4920 → 4936 (+16, the landed bytes) by the ruled text (a new repository's charter lives in that repository; objectstack keeps a pointer file under `lanes/`), the maintainer's ruling quoted in the body of card #35238, step 7 (「包括 hotcrm 每个仓库的规则都在自己仓库」, 2026-11-18) + ['.claude/skills/pm-dispatch/references/cross-repo-coordination.md', 4922], // lowered 4936 → 4922 by the #38415 seat-rule text (-14 in this file; the landed size, headroom 0); before that: raised 4920 → 4936 (+16, the landed bytes) by the ruled text (a new repository's charter lives in that repository; objectstack keeps a pointer file under `lanes/`), the maintainer's ruling quoted in the body of card #35238, step 7 (「包括 hotcrm 每个仓库的规则都在自己仓库」, 2026-11-18) ['.claude/skills/pm-dispatch/references/triage-duties.md', 13692], // lowered 13709 → 13692 by the decision-analysis tier-line PR (its pointer to the deleted worked 速读 example dropped); before that: edited byte-neutral by the re-basing PR (12399 → 12399); raised 12399 → 13559 (+1160, the landed bytes) by the rulings whose rows are written in it: ruling records 7031931263 (rows 2–5: 「adr接受你的建议」, 「只考虑合并没人认领的,没开始开发的,你负责处理」, 「影响评测的卡不能关,这个会影响到AI的开发效果」, 「adr和skills修改相对是重要的」), 7032145340 (row 6: 「同意」) and 7032418455 (row 7: 「你分诊的时候是不是应该同时评估大概的卡大小作为参考」); review record 7038100802 triggered the part of rows 2, 3 and 6 added in fix round 1 (one close reason, the sweep roll-over, the never-fold list of standing exclusions) and is a trigger, not a ruling; lowered 13559 → 13544 by the PR that moved the tier and effort values to the one home; raised 13544 → 13709 (+165, the landed bytes) by ruling record 7135874506 (items B4, B7 and C1: 「照推荐:采纳 5 条」) ['.claude/skills/pm-dispatch/references/execution-duties.md', 22249], // raised 19810 → 20148 (+338) by ruling records 7031931263 (row 2, the weekly ADR card: 「adr接受你的建议」) and 7032145340 (row 6, the lane seat claims the weekly sweep card: 「同意」); 20148 → 20154 (+6) by ruling record 7073679594 (the L2 review effort line moves to `high` on the review sweep's readings: 「C」, under ruling 7073045669 point 4); 20154 → 20277 (+123) by ruling record 7075909669 (#36203 items 1-5: 「同意五条都改」): a hold is Blocked-by + pm:blocked on the card, the probe covers card threads; 20277 → 22158 (+1881) by ruling record 7076315104 (the one home for tier and effort, the 定档 section: 「要把规则文字同统一整理一下,避免散落在各处,避免ai犯错」); raised 22158 → 22316 (+158) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」) (the coordinator session, the area thread and the director's effort); lowered 22316 → 22307 by the PR that drops the triage suggestion line (item C1 of ruling record 7135874506); lowered 22307 → 22249 to its landed size by the #35237 slice-12 pointer PR ['.claude/skills/pm-dispatch/references/filing-gate.md', 9124], // raised 9096 → 9101 (+5) by ruling record 7075909669 (#36203 items 1-5: 「同意五条都改」): same-epic order is the later card's Blocked-by; raised 8386 → 9096 (+710, the landed bytes) by the rulings whose rows are written in it: the rule card's body ruling (row 1, a dedupe hit on an open same-mechanism card ends in a comment: 「感觉你的第二种方案也很好啊」) and ruling record 7032145340 (row 6, the weekly sweep card entry rule and triage's move at first touch: 「同意」); review record 7038100802 triggered the quota line's pointer to row 1 (fix round 1) and is a trigger, not a ruling; lowered 9101 → 9089 by the PR that moved the tier and effort values to the one home; raised 9089 → 9124 (+35, the landed bytes) by ruling record 7135874506 (item A1: 「照推荐:采纳 5 条」) - ['.claude/skills/pm-dispatch/references/project-forms.md', 4889], // raised 4669 → 4889 (+220 B, the two project-memory lines less 48 B of restatement cuts) by ruling record 7046610679 「同意,立卡派发」 under ruling record 6184799323, letter B + ['.claude/skills/pm-dispatch/references/project-forms.md', 4875], // raised 4669 → 4889 (+220 B, the two project-memory lines less 48 B of restatement cuts) by ruling record 7046610679 「同意,立卡派发」 under ruling record 6184799323, letter B ['.claude/skills/pm-dispatch/references/app-platform-boundary.md', 3928], ['.claude/skills/pm-dispatch/references/dev-traps.md', 2627], // new row, landed size, headroom 0: three one-path blocks of .claude/agents/os-dev.md moved here verbatim by the entry-file slimming PR, which lowers that row by more ['.claude/skills/pm-dispatch/references/dev-ablation.md', 3555], // new row, landed size, headroom 0: the reverse-verification and ablation procedure of .claude/agents/os-dev.md moved here verbatim by the same PR ['.claude/skills/pm-dispatch/references/domains/server.md', 4830], ['.claude/skills/pm-dispatch/references/domains/devx.md', 2533], - ['.claude/skills/pm-dispatch/references/domains/skills.md', 2656], // lowered 2682 → 2666 by the re-basing PR's own edit; lowered 2666 → 2656 by the PR that moved the tier and effort values to the one home + ['.claude/skills/pm-dispatch/references/domains/skills.md', 2655], // lowered 2682 → 2666 by the re-basing PR's own edit; lowered 2666 → 2656 by the PR that moved the tier and effort values to the one home ['.claude/skills/pm-dispatch/references/domains/spec.md', 3299], ['.claude/skills/pm-dispatch/references/domains/ui.md', 1041], ['.claude/skills/pm-dispatch/references/lanes/hotcrm.md', 181], ['.claude/skills/pm-dispatch/references/lanes/mobile.md', 3990], ['.claude/skills/pm-dispatch/references/lanes/security.md', 4241], // raised 4194 → 4241 (+47) by ruling record 7121202500 (N4 → B: 「以上都同意」): the low-severity advisory batch is not counted against the default fold's ≤5 cap and is bounded by the release-line and PR-size line alone - ['.claude/skills/pm-dispatch/references/lanes/director.md', 6958], + ['.claude/skills/pm-dispatch/references/lanes/director.md', 6951], ['.claude/skills/pm-dispatch/references/lanes/triage.md', 2637], // lowered 2530 → 2526 by the fold/sweep/size rule PR's own edit; raised 2526 → 2637 (+111) by ruling record 7107018094 (the topic board in the repo: 「看板代码要放进仓库,立卡派发」, 「接,按普通顺序派」): the 3-hourly board rebuild line - ['.claude/skills/pm-dispatch/references/lanes/l2-review.md', 1460], - ['.claude/skills/pm-dispatch/references/lanes/review.md', 120], - ['.claude/skills/pm-dispatch/references/lanes/qa.md', 2235], - ['.claude/skills/pm-dispatch/references/lanes/eval.md', 2694], - ['.claude/skills/pm-dispatch/references/lanes/queue.md', 2003], - ['.claude/skills/pm-dispatch/references/lanes/cloud.md', 1232], - ['.claude/skills/pm-dispatch/references/lanes/objectstack.md', 2540], // raised 2270 → 2540 by the ruled text (one seat per lane by default; a new `area:*` is a partition of that seat), ruling record 7030459053 + ['.claude/skills/pm-dispatch/references/lanes/l2-review.md', 1444], + ['.claude/skills/pm-dispatch/references/lanes/review.md', 115], + ['.claude/skills/pm-dispatch/references/lanes/qa.md', 2227], + ['.claude/skills/pm-dispatch/references/lanes/eval.md', 2684], + ['.claude/skills/pm-dispatch/references/lanes/queue.md', 1992], + ['.claude/skills/pm-dispatch/references/lanes/cloud.md', 1230], + ['.claude/skills/pm-dispatch/references/lanes/objectstack.md', 2493], // raised 2270 → 2540 by the ruled text (one seat per lane by default; a new `area:*` is a partition of that seat), ruling record 7030459053 ['.claude/agents/os-dev.md', 33491], // lowered 33492 → 33491 by the #38415 seat-mark readers PR (the trailer line names `LANE@ACCOUNT` as a reading, paid by the lock entry's second copy of the slot rule; the file's landed size, headroom 0); before that: lowered 33500 → 33492 by the #35237 slice-13 PR (rule 1's probe line spells its --branch; the file's landed size, headroom 0); before that: lowered 33504 → 33500 by the #35237 slice-10 entry-pointers PR (the file's landed size, headroom 0); before that: lowered 38986 → 33504 by the entry-file slimming PR (four one-path blocks moved verbatim to references/dev-traps.md and references/dev-ablation.md, one pointer line left for each); before that: lowered 39008 → 38848 by the re-basing PR's own edit; raised 38848 → 38986 (+138) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」): a card thread's first step reads the tier it is served and compares it with the order ['.claude/skills/checklist-test/SKILL.md', 14209], // lowered 19558 → 14209 by the entry-file slimming PR (the bodies of §5 and §6 moved verbatim to the two reference files below, one pointer line left in each section) ['.claude/skills/checklist-test/references/closure.md', 4553], // new row, landed size, headroom 0 diff --git a/scripts/pm/fleet-roster.mjs b/scripts/pm/fleet-roster.mjs index f977729dbfd..345e89cb5f1 100644 --- a/scripts/pm/fleet-roster.mjs +++ b/scripts/pm/fleet-roster.mjs @@ -176,7 +176,7 @@ import { isL2ReviewLane, L2_REVIEW_LANE, LEDGER_EXCLUSION, MAILBOX_BRANCH_PREFIX // re-spells it. The relay that imports `ROSTER_MARKER` from here (`fleet-write/dispatch.mjs`) already imports // check-half-states itself, so this import loads nothing new there. The opener's lane-word lists cannot import it // (the patrol loads the opener lazily, so that edge would be a cycle); the self-test holds the two equal. -import { GOVERNED_PR_AWAITING_MERGE_LABEL, readSignatureLine, SEAT_SIGNATURE_LINE, seatIdOf, seatTitleAccount } from './check-half-states.mjs'; +import { GOVERNED_PR_AWAITING_MERGE_LABEL, readSignatureLine, SEAT_SIGNATURE_LINE, seatIdOf, seatMarkOf, seatNameId, seatNumbersOf, seatTitleAccount, signedSeatId, withSeatNumbers } from './check-half-states.mjs'; // `--health`'s reverse read and the inbox label: the shared `Blocked-by:` reader (body and thread, cross-repo keyed) // and the decision label, imported, never re-spelled. import { blockerTargetsFor, DECISION_INBOX_LABEL } from './check-half-states.mjs'; @@ -363,10 +363,14 @@ export function epicSeatsHeld(lane, mailboxes) { } const isEpicLane = (lane) => lane.startsWith(`${SEAT_EPIC_KIND}:`); -/** The seat a body is signed by — its FIRST non-empty line, `readSignatureLine`'s reading — as `LANE#N` or `LANE@account`, or null. Pure. */ +/** + * The seat a body is signed by — its FIRST non-empty line, `readSignatureLine`'s reading — as `LANE#N` or + * `LANE@account`, or null. Answered as readers compare it (`signedSeatId`): a retired number signed by the account + * the table names for it is that account's seat, the key its renamed post's row is looked up by (`seatNameId`). + */ export function signedSeatOf(body) { const signed = readSignatureLine(body); - return signed ? seatIdOf(signed.lane, signed.seat) : null; + return signed ? signedSeatId(signed) : null; } /** A seat id's lane: everything before its mark, `#N` or `@account`. */ const laneOfSeatId = (id) => id.slice(0, Math.max(id.lastIndexOf('#'), id.lastIndexOf('@'))); @@ -417,8 +421,25 @@ export function reviewClaims(snapshot, { now }) { /** Where the signed-comment read starts: `STALE_HOURS` before `now` — no older comment can lift a flag. Pure. */ export const activitySince = (now) => new Date(Date.parse(now) - STALE_HOURS * 3_600_000).toISOString().replace(/\.\d{3}Z$/, 'Z'); -/** A seat row's mailbox slug — its `LANE#N` as the opener spells it in a ref — or null. Pure. */ +/** A seat row's mailbox slug — its seat id as the opener spells it in a ref — or null. Pure. */ const seatSlugOf = (row) => seatKey(seatIdOf(row.lane, row.seat))?.slug ?? null; +/** + * Every slug a mailbox of this row's seat may carry: its own, and — for a seat named by its account — the slug of + * each retired number the table names that account for, so a mailbox opened before the rename stays on its row. + * Pure over the retired-number table. + */ +function seatSlugsOf(row) { + const mark = seatMarkOf(row.lane, row.seat); + const ids = [seatIdOf(row.lane, row.seat), seatIdOf(row.lane, mark)]; + if (typeof mark === 'string') for (const old of seatNumbersOf(row.lane, mark)) ids.push(`${old.lane}#${old.number}`); + return [...new Set(ids.map((id) => seatKey(id)?.slug).filter(Boolean))]; +} +/** + * Whether a mailbox (`readMailboxes`'s row) is this seat row's. Per seat, never per account: its own slug whoever + * opened it; a retired number's slug only while the opener is the row's own account — an earlier holder's mailbox + * under that number is not the renamed seat's. Pure over the retired-number table. + */ +const rowReadsMailbox = (row, m) => m.slug !== null && (m.slug === seatSlugOf(row) || (seatSlugsOf(row).includes(m.slug) && lc(m.login) === lc(row.account))); /** Every open `pm:mailbox` pull in the snapshot, with whose it is (`mailboxOwner`), ordered by ref. Pure. */ export function readMailboxes(snapshot) { @@ -437,9 +458,8 @@ export function readMailboxes(snapshot) { * (it names no seat, and its login holds several), or a per-seat one whose seat no seat post carries. Pure. */ export function unassignedMailboxes(snapshot, rows) { - const read = new Set(rows.map(seatSlugOf).filter(Boolean)); return readMailboxes(snapshot) - .filter((m) => m.slug === null || !read.has(m.slug)) + .filter((m) => !rows.some((row) => rowReadsMailbox(row, m))) .map((m) => ({ ...m, why: m.slug === null ? 'legacy per-login, names no seat' : 'no seat post or epic parent carries this seat' })); } @@ -515,17 +535,16 @@ export function buildRows(snapshot, { now }) { const out = rows.map((row) => { const acct = lc(row.account); // An L2 seat's claims are signed per seat, so it never shares: its in-flight is the pulls its live claims hold. - const claims = isL2ReviewLane(row.lane) ? (claimed.get(seatIdOf(row.lane, row.seat)) ?? []).sort(byRef) : null; + const claims = isL2ReviewLane(row.lane) ? (claimed.get(seatNameId(row.lane, row.seat)) ?? []).sort(byRef) : null; // One account on two seats of one lane: the cards cannot say which seat, so the lowest seat shows them once. const first = row.account && claims === null ? rows.find((r) => r.repo === row.repo && r.lane === row.lane && lc(r.account) === acct) : row; const sharesWith = first !== row ? first.seat : null; const inFlight = row.account && sharesWith === null && claims === null ? cards.filter((c) => cardLaneMatch(c, row) && c.assignees.includes(acct)) : []; const awaitingLanding = inFlight.flatMap((c) => landing.get(keyOf(c)) ?? []); const awaitingMerge = inFlight.flatMap((c) => merging.get(keyOf(c)) ?? []); - // Per seat, never per account: one account holds several seats, and each seat opens its own. - const mailbox = mailboxes.filter((m) => m.slug !== null && m.slug === seatSlugOf(row)).map((m) => m.ref); + const mailbox = mailboxes.filter((m) => rowReadsMailbox(row, m)).map((m) => m.ref); // The seat's own traces: a seat sharing its lane's account with a lower seat has no in-flight cards of its own. - const times = [row.updatedAt, ...inFlight.map((c) => c.updatedAt), ...(claims ?? []).map((m) => pullUpdatedAt.get(keyOf(m))), ...mailbox.map((m) => pullUpdatedAt.get(keyOf(m))), signed.get(seatIdOf(row.lane, row.seat))].filter(Boolean).sort(); + const times = [row.updatedAt, ...inFlight.map((c) => c.updatedAt), ...(claims ?? []).map((m) => pullUpdatedAt.get(keyOf(m))), ...mailbox.map((m) => pullUpdatedAt.get(keyOf(m))), signed.get(seatNameId(row.lane, row.seat))].filter(Boolean).sort(); const lastActivity = times.at(-1) ?? null; const ageHours = lastActivity && Number.isFinite(nowMs) ? (nowMs - Date.parse(lastActivity)) / 3_600_000 : null; return { @@ -1107,7 +1126,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ 'a repo-lane seat owns its repo\'s cards by account: in flight, landing, merge, ruling': 7, // 13 → 14: the lane-grammar pin (the signature alternation equals the opener's lane-word lists, `coordinator` aside). 'one account on two seats of a lane: the second seat reads its own traces': 14, - 'a seat named by its account: `LANE@ACCOUNT` is a row of its own, read by lane AND account beside `LANE#N` (ruling record 7249169754)':10, + 'a seat named by its account: `LANE@ACCOUNT` is a row of its own, read by lane AND account beside `LANE#N` (ruling record 7249169754)': 13, 'the rendered body: marker, columns, footer, determinism': 11, 'refusing to overwrite what is not the roster': 6, 'the CLI: fixture runs offline, usage errors are exit 2': 6, @@ -1301,7 +1320,7 @@ async function selfTest() { return [line.includes('| = seat 1 |'), line.includes(SUSPECTED_WALL)]; })(), [true, false]); t('the comment read starts STALE_HOURS before now, and the footer names it', [activitySince(NOW), readsFor([R]).some((q) => q.startsWith(`GET /repos/${R}/issues/comments?since=`))], ['2026-11-01T22:00:00Z', true]); - t('the signature pattern is check-half-states\' SEAT_SIGNATURE_LINE, imported — no second spelling of the lane alternation in this file (and the awaiting-merge label rides the same import, no second spelling of it either)', [/^import \{ GOVERNED_PR_AWAITING_MERGE_LABEL, readSignatureLine, SEAT_SIGNATURE_LINE, seatIdOf, seatTitleAccount \} from '\.\/check-half-states\.mjs';$/mu.test(readFileSync(SELF_PATH, 'utf8')), readFileSync(SELF_PATH, 'utf8').includes(['triage', 'director', 'coordinator'].join('|')), readFileSync(SELF_PATH, 'utf8').includes(["'pm:", 'awaiting-merge', "'"].join(''))], [true, false, false]); + t('the signature pattern is check-half-states\' SEAT_SIGNATURE_LINE, imported — no second spelling of the lane alternation in this file (and the awaiting-merge label rides the same import, no second spelling of it either)', [/^import \{ GOVERNED_PR_AWAITING_MERGE_LABEL, readSignatureLine, SEAT_SIGNATURE_LINE, seatIdOf, seatMarkOf, seatNameId, seatNumbersOf, seatTitleAccount, signedSeatId, withSeatNumbers \} from '\.\/check-half-states\.mjs';$/mu.test(readFileSync(SELF_PATH, 'utf8')), readFileSync(SELF_PATH, 'utf8').includes(['triage', 'director', 'coordinator'].join('|')), readFileSync(SELF_PATH, 'utf8').includes(["'pm:", 'awaiting-merge', "'"].join(''))], [true, false, false]); // The lane grammar's two remaining owners, held equal here (the only file that imports both): the signature's // alternation and the opener's lane-word lists. `coordinator` is the one lane that signs and has no mailbox. const signatureLanes = (/^\^\(\(\?:([^()]*)\)\)\(/u.exec(SEAT_SIGNATURE_LINE.source)?.[1] ?? '').split('|'); @@ -1332,7 +1351,12 @@ async function selfTest() { t('⛔ account X signing account Y\'s seat signs nothing: no seat reads the trace', (() => { const s = snap([{ body: sig('repo:objectstack@os-bill', 'os-elon'), updated_at: fresh }]); return [rowOf(s, 400).lastActivity, rowOf(s, 500).lastActivity]; })(), ['2026-10-30T00:00:00Z', '2026-10-30T00:00:00Z']); t('⭐ CONTROL — a `#1` comment by the vacant seat still reads as seat 1\'s, whoever signed it: ⛔ not as that login\'s account seat', (() => { const s = snap([{ body: sig('repo:objectstack#1', 'os-elon'), updated_at: fresh }]); return [rowOf(s, 100).lastActivity, rowOf(s, 500).lastActivity, signedSeatOf(sig('repo:objectstack#1', 'os-elon')), signedSeatOf(sig('repo:objectstack@os-elon', 'os-elon'))]; })(), [fresh, '2026-10-30T00:00:00Z', 'repo:objectstack#1', 'repo:objectstack@os-elon']); t('⭐ the mailbox column by lane AND account: the account seat\'s own mailbox, read off the body line or the head, and never seat 1\'s nor another account\'s', (() => { const s = snap([], [{ number: 601, state: 'open', head: { ref: 'claude/project-thread-1' }, body: 'Mailbox-of: repo:objectstack@os-bill · os-bill', labels: ['pm:mailbox'], updated_at: fresh }, { number: 602, state: 'open', head: { ref: 'mailbox/os-elon/repo-objectstack_os-elon-0' }, body: '', labels: ['pm:mailbox'], updated_at: fresh }, { number: 603, state: 'open', head: { ref: 'mailbox/os-old/repo-objectstack-1' }, body: 'Mailbox-of: repo:objectstack#1 · os-old', labels: ['pm:mailbox'], updated_at: fresh }]); return [400, 500, 100, 200].map((post) => rowOf(s, post).mailbox.map((m) => m.number)); })(), [[601], [602], [603], []]); - t('⭐ an L2 seat named by its account holds its own claims\' pulls, under either lane word — keyed `LANE@account`, ⛔ never a numbered review seat\'s', [...reviewClaims({ repos: { r: { pulls: [{ number: 1, state: 'open', head: { sha: 'a'.repeat(40) } }], recentComments: ['l2-review@os-bill', 'review@os-bill', 'l2-review#2'].map((laneSeat) => ({ issue_url: 'x/issues/1', created_at: NOW, body: `${sig(laneSeat, 'os-bill')}\n\nContract-review-claim: session_01AccountSeatSess · head ${'a'.repeat(40)} · ${NOW}` })) } } }, { now: NOW }).entries()].map(([k, v]) => `${k}=${v.map((x) => x.number)}`), ['l2-review@os-bill=1', 'review@os-bill=1', 'l2-review#2=1']); + t('⭐ an L2 seat named by its account holds its own claims\' pulls, under either lane word — ONE seat, keyed `l2-review@account` (`review` and `l2-review` are one lane), ⛔ never a numbered review seat\'s', [...reviewClaims({ repos: { r: { pulls: [{ number: 1, state: 'open', head: { sha: 'a'.repeat(40) } }], recentComments: ['l2-review@os-bill', 'review@os-bill', 'l2-review#2'].map((laneSeat) => ({ issue_url: 'x/issues/1', created_at: NOW, body: `${sig(laneSeat, 'os-bill')}\n\nContract-review-claim: session_01AccountSeatSess · head ${'a'.repeat(40)} · ${NOW}` })) } } }, { now: NOW }).entries()].map(([k, v]) => `${k}=${v.map((x) => x.number)}`), ['l2-review@os-bill=1,1', 'l2-review#2=1']); + // A retired number and the account seat it became (`seat-numbers.mjs`): os-bill's post was seat 7 before its rename. + const T7 = [{ lane: 'repo:objectstack', number: 7, account: 'os-bill' }, { lane: 'review', number: 2, account: 'os-bill' }]; + t('⭐ after a rename the seat\'s old `#7` comment, signed by its account, is its own trace; ⛔ an EARLIER holder\'s `#7` comment is not, and a vacant seat\'s `#1` comment by the same account stays seat 1\'s — with no row the old comment lifts nothing', (() => { const own = snap([{ body: sig('repo:objectstack#7', 'os-bill'), updated_at: fresh }]); const earlier = snap([{ body: sig('repo:objectstack#7', 'os-old'), updated_at: fresh }]); const vacant = snap([{ body: sig('repo:objectstack#1', 'os-bill'), updated_at: fresh }]); return [withSeatNumbers(T7, () => rowOf(own, 400).lastActivity), withSeatNumbers(T7, () => rowOf(earlier, 400).lastActivity), withSeatNumbers(T7, () => [rowOf(vacant, 400).lastActivity, rowOf(vacant, 100).lastActivity]), withSeatNumbers([], () => rowOf(own, 400).lastActivity)]; })(), [fresh, '2026-10-30T00:00:00Z', ['2026-10-30T00:00:00Z', fresh], '2026-10-30T00:00:00Z']); + t('⭐ the mailbox it opened as seat 7 stays on its row; ⛔ an EARLIER holder\'s seat-7 mailbox does not — it is flagged on no row, never hidden — and with no row neither is read', (() => { const s = snap([], [{ number: 611, state: 'open', head: { ref: 'mailbox/os-bill/repo-objectstack-7' }, body: 'Mailbox-of: repo:objectstack#7 · os-bill', labels: ['pm:mailbox'], updated_at: fresh }, { number: 612, state: 'open', head: { ref: 'mailbox/os-old/repo-objectstack-7' }, body: 'Mailbox-of: repo:objectstack#7 · os-old', labels: ['pm:mailbox'], updated_at: fresh }]); const flagged = () => unassignedMailboxes(s, buildRows(s, { now: NOW })).map((m) => m.ref.number); return [withSeatNumbers(T7, () => rowOf(s, 400).mailbox.map((m) => m.number)), withSeatNumbers(T7, flagged), withSeatNumbers([], () => rowOf(s, 400).mailbox.map((m) => m.number)), withSeatNumbers([], flagged)]; })(), [[611], [612], [], [611, 612]]); + t('⭐ an L2 seat\'s old `review#2` claim, signed by its account, is held by its account seat; ⛔ signed by an earlier holder it stays seat 2\'s', withSeatNumbers(T7, () => [...reviewClaims({ repos: { r: { pulls: [{ number: 1, state: 'open', head: { sha: 'a'.repeat(40) } }], recentComments: [['review#2', 'os-bill'], ['review#2', 'os-old']].map(([laneSeat, account]) => ({ issue_url: 'x/issues/1', created_at: NOW, body: `${sig(laneSeat, account)}\n\nContract-review-claim: session_01AccountSeatSess · head ${'a'.repeat(40)} · ${NOW}` })) } } }, { now: NOW }).entries()].map(([k, v]) => `${k}=${v.map((x) => x.number)}`)), ['l2-review@os-bill=1', 'review#2=1']); t('⭐ an epic seat named by its account is that epic\'s seat, matched by its own slug under its own login; the numbered epic seat reads as before', [...epicSeatsHeld(`${SEAT_EPIC_KIND}:#27293`, [{ slug: 'epic-27293_sunhaolin-0', login: 'sunhaolin' }, { slug: 'epic-27293-2', login: 'os-x' }, { slug: 'epic-27293_other-0', login: 'sunhaolin' }])], [['@sunhaolin', 'sunhaolin'], [2, 'os-x']]); t('the rendered seat cell prints an account mark in a code span — ⛔ never a loose `@login`, which an issue body turns into a mention', (() => { const line = renderBody(buildRows(snap(), { now: NOW }), { now: NOW, repos: [R] }).split('\n').find((l) => l.includes('/issues/400)')); return [line.includes('[`@os-bill`](https://github.com/objectstack-ai/objectstack/issues/400)'), / @os-/.test(line)]; })(), [true, false]); } diff --git a/scripts/pm/fleet-write/dispatch.mjs b/scripts/pm/fleet-write/dispatch.mjs index 19fc658f7d1..d2ae07d96e2 100644 --- a/scripts/pm/fleet-write/dispatch.mjs +++ b/scripts/pm/fleet-write/dispatch.mjs @@ -492,7 +492,7 @@ * * The relay writes as one bot login, so the text is the only place a reader learns who wrote it. The * seat-authored writers refuse a body whose first non-empty line is not the seat's signature, - * `LANE#N · ACCOUNT · SESSION` (`readSignatureLine`, `check-half-states.mjs`, whose banner carries the shape and + * `LANE@ACCOUNT · ACCOUNT · SESSION` (`readSignatureLine`, `check-half-states.mjs`, whose banner carries the shape and * the ruling). This door owns the half no other writer covers: a `comment_edit` or an `issue_patch` carrying a * `body` in an actions file a seat hands it (`unsignedEditBodies`) — refused as usage (2) before anything is * packed or sent, a dry run included. Three things it deliberately leaves alone: @@ -513,7 +513,7 @@ * the seat's, through an `issue_patch` on the pull's number. Its line 1 belongs to the attribution comment and * the `Fixes #n` line, as at `pr_create`, so that body joins `pr_create` outside the first-line rule — the same * scope the ruling above draws, extended from the create to the edit — and carries the signature at its other - * end instead: the LAST non-empty line is the trailer `` + * end instead: the LAST non-empty line is the trailer `` * (`PR_BODY_TRAILER_SHAPE`), whose inside parses with the same `readSignatureLine` (`readPrBodyTrailer`). An * HTML comment because the body is rendered: a visible signature line would sit under the prose a maintainer * reads. Three rules, in the order `main` applies them: @@ -901,7 +901,7 @@ export const GENERATED_BODY_MARKERS = Object.freeze([ROSTER_MARKER]); export const PR_BODY_EDIT_OP = 'issue_patch'; /** The trailer a seat's pull request body ends with, as a refusal prints it — placeholders only (header). */ -export const PR_BODY_TRAILER_SHAPE = ''; +export const PR_BODY_TRAILER_SHAPE = ''; /** ONE trimmed line is the trailer's comment; its inside is captured for `readSignatureLine`, never re-spelled here. */ const PR_BODY_TRAILER_LINE = /^$/u; @@ -941,7 +941,7 @@ function trailerWhy(body) { if (read === null) return { line: '(the body is empty)', why: 'there is no last line to carry the trailer' }; const line = read.line.length > 160 ? `${read.line.slice(0, 160)}…` : read.line; return read.shaped - ? { line, why: "the last non-empty line is the trailer's comment, but its inside is not a signature — check the lane, the `#N` seat number (or an `@ACCOUNT` seat, which only that same account signs), the login, the full session id, and that each separator is exactly ` · `" } + ? { line, why: "the last non-empty line is the trailer's comment, but its inside is not a signature — check the lane, the `@ACCOUNT` seat mark (only that same account signs its seat; an old `#N` seat number still reads), the login, the full session id, and that each separator is exactly ` · `" } : { line, why: 'the last non-empty line is not the trailer' }; } @@ -2784,7 +2784,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ "the release.yml refresh at the seat: the stroke packs with inputs refresh_version_pr true and travels in ONE dispatch; its started run is read back from release.yml's own run list; force, false, absent or any other input is refused before anything is sent, exit 2": 6, "the batch gap at the seat: content creation read off the op table; a stroke at or above write-pace's threshold is batched through its last content-creating write and waited for exactly that much longer; a stroke whose pacing the relay job cannot hold is refused before anything is sent, naming the per-op doors; the job's timeout mirrors the workflow's": 13, "the signature at the seat's door: a comment_edit or issue_patch body opens with the seat's signature line or the file is usage (2), nothing packed; generated, body-less and the other doors' ops are left alone": 15, - "the pull request body at the seat's door: an issue_patch body signed only by its LAST-line trailer passes when the platform answers its target is a pull request, before the dry-run exit; an issue, an unread target and a trailer-less body are refused; comment_edit takes no trailer": 20, + "the pull request body at the seat's door: an issue_patch body signed only by its LAST-line trailer passes when the platform answers its target is a pull request, before the dry-run exit; an issue, an unread target and a trailer-less body are refused; comment_edit takes no trailer": 21, "the kind rule at the relay's adding doors: a pm state on pr_create or on a labels_add whose target READS as a pull request, and pm:awaiting-merge on issue_create or on a labels_add whose target reads as an issue, are refused before the dry-run exit with label-write's own sentence, case-insensitively and for the whole file; an unread kind is never a pass; labels_remove and an ungoverned labels_add read nothing": 18, "the run_rerun_failed stroke at the seat: it packs as ONE action carrying run_id alone and travels in ONE dispatch; beside any other action, or with a key that widens it, it is refused before anything is sent; it creates no content, carries no body and names no workflow, so nothing is read back here — a success run is the executor's confirmation; a run that failed at the relay's fence is exit 5 after ONE dispatch, never re-sent": 6, "the hierarchy link at the seat: an epic's children pack as sub_issue_add actions carrying the parent and the child by number alone, beside other issue ops in ONE dispatch; a self-link, an id or a replace_parent is refused before anything is sent; neither row creates content, carries a body or names a workflow, so the stroke is paced at rule ①'s gap and nothing is read back here — a success run is the executor's confirmation; a run that failed at the relay's fence is exit 5 after ONE dispatch, never re-sent": 5, @@ -4514,7 +4514,7 @@ export async function selfTest() { t('…each row carries the line it read and why', unsignedEditBodies([{ op: 'comment_edit', comment_id: 7, body: '\n\nEdited.' }])[0]?.line, 'Edited.'); t('signed bodies pass, blank lines above the signature included', ROWS([{ op: 'comment_edit', comment_id: 7, body: `${SIG}\nEdited.` }, { op: 'issue_patch', issue: 3, body: `\n${SIG}\n\nSeat post` }]), []); t('⛔ a signature on a LATER line is not one: the first non-empty line decides', ROWS([{ op: 'issue_patch', issue: 3, body: `Seat post\n${SIG}` }]), ['1:issue_patch']); - // The second seat mark (ruling record 7249169754): `LANE@ACCOUNT` is read beside `LANE#N`; the shape the refusal prints is still `#N`. + // The seat mark (ruling record 7249169754): the refusal prints `LANE@ACCOUNT` as the shape to write; an old `LANE#N` body still reads. t('⭐ both seat marks open an edit body: one signed `LANE@ACCOUNT` passes as the `LANE#N` one does', ROWS([{ op: 'comment_edit', comment_id: 7, body: `repo:objectstack@os-justin · os-justin · ${SESSION}\nEdited.` }, { op: 'issue_patch', issue: 3, body: `repo:objectstack#5 · os-justin · ${SESSION}\nSeat post` }]), []); t('⛔ account X signing account Y\'s seat is refused, named a near miss — the body is never packed as Y\'s seat', (() => { const rows = unsignedEditBodies([{ op: 'issue_patch', issue: 3, body: `repo:objectstack@os-justin · os-elon · ${SESSION}\nSeat post` }]); return [rows.map((r) => `${r.action}:${r.op}`), rows[0]?.why.includes('only that same account signs')]; })(), [['1:issue_patch'], true]); t('an issue_patch that carries no body (a close) is not judged', ROWS([{ op: 'issue_patch', issue: 3, state: 'closed', state_reason: 'completed' }]), []); @@ -4527,7 +4527,7 @@ export async function selfTest() { const env = (extra) => ({ ...process.env, GITHUB_TOKEN: TOKEN, GH_TOKEN: '', HTTPS_PROXY: '', https_proxy: '', OS_PM_WRITE_PACE_FILE: join(dir, 'sig-pace.jsonl'), [SESSION_ENV]: SESSION, [CONTAINER_SESSION_ENV]: '', ...extra }); const spawn = (args, extra = {}) => spawnSync(process.execPath, [SELF_PATH, ...args], { encoding: 'utf8', env: env(extra) }); const refused = spawn(['--repo', 'objectstack-ai/objectstack', '--actions-file', join(dir, 'sig-unsigned.json'), '--dry-run']); - t('⭐ the CLI refuses the unsigned file on a DRY RUN: usage (2), the refusal names action 2 and the shape, and no payload is printed', [refused.status, refused.stderr.includes("action 2 (issue_patch)'s body opens with no signature line") && refused.stderr.includes('LANE#N · ACCOUNT · SESSION'), refused.stdout.includes('"event_type"')], [EXIT_USAGE, true, false], refused.stderr.slice(-300)); + t('⭐ the CLI refuses the unsigned file on a DRY RUN: usage (2), the refusal names action 2 and the shape, and no payload is printed', [refused.status, refused.stderr.includes("action 2 (issue_patch)'s body opens with no signature line") && refused.stderr.includes('LANE@ACCOUNT · ACCOUNT · SESSION'), refused.stdout.includes('"event_type"')], [EXIT_USAGE, true, false], refused.stderr.slice(-300)); const noSession = spawn(['--repo', 'objectstack-ai/objectstack', '--actions-file', join(dir, 'sig-unsigned.json'), '--dry-run'], { [SESSION_ENV]: '' }); t('…judged on the file as handed, before the session: the same refusal with no session in the environment', [noSession.status, noSession.stderr.includes('no signature line')], [EXIT_USAGE, true]); const signed = spawn(['--repo', 'objectstack-ai/objectstack', '--actions-file', join(dir, 'sig-signed.json'), '--dry-run']); @@ -4627,7 +4627,8 @@ export async function selfTest() { t('⛔ comment_edit takes no trailer: still refused, never a candidate', [CANDS([{ op: 'comment_edit', comment_id: 7, body: `Edited.\n${TRAILER}` }]), ROWS([{ op: 'comment_edit', comment_id: 7, body: `Edited.\n${TRAILER}` }])], [[], ['1:comment_edit']]); t('a first-line-signed issue_patch body needs no read — the trailer beside it changes nothing', [CANDS([{ op: 'issue_patch', issue: 3, body: `${SIG}\nSeat post\n${TRAILER}` }]), ROWS([{ op: 'issue_patch', issue: 3, body: `${SIG}\nSeat post\n${TRAILER}` }])], [[], []]); const unsignedRow = unsignedEditBodies([{ op: 'issue_patch', issue: 29200, body: `${ATTRIBUTION}\nFixes #29145\n\nProse.\n` }])[0]; - t('a body with neither is refused without a read, and its refusal names BOTH shapes — the first line and the trailer', [unsignedRow?.trailer?.why, editBodyRefusalText(unsignedRow).includes('LANE#N · ACCOUNT · SESSION'), editBodyRefusalText(unsignedRow).includes(PR_BODY_TRAILER_SHAPE), editBodyRefusalText(unsignedRow).includes('as the LAST non-empty line')], ['the last non-empty line is not the trailer', true, true, true]); + t('a body with neither is refused without a read, and its refusal names BOTH shapes — the first line and the trailer', [unsignedRow?.trailer?.why, editBodyRefusalText(unsignedRow).includes('LANE@ACCOUNT · ACCOUNT · SESSION'), editBodyRefusalText(unsignedRow).includes(PR_BODY_TRAILER_SHAPE), editBodyRefusalText(unsignedRow).includes('as the LAST non-empty line')], ['the last non-empty line is not the trailer', true, true, true]); + t('…and the near-miss reason names the `@ACCOUNT` seat mark as the one to write, with the old `#N` as a reading — for a numbered near miss and for another account\'s seat alike', [unsignedEditBodies([{ op: 'issue_patch', issue: 1, body: 'x\n' }])[0]?.trailer?.why, unsignedEditBodies([{ op: 'issue_patch', issue: 1, body: `x\n` }])[0]?.trailer?.why].map((why) => [why?.includes('the `@ACCOUNT` seat mark'), why?.includes('an old `#N` seat number still reads')]), [[true, true], [true, true]]); t("…a near-miss trailer is named as one; a comment_edit row carries no trailer alternative", [unsignedEditBodies([{ op: 'issue_patch', issue: 1, body: 'x\n' }])[0]?.trailer?.why.startsWith("the last non-empty line is the trailer's comment"), editBodyRefusalText(unsignedEditBodies([{ op: 'comment_edit', comment_id: 7, body: 'Edited.' }])[0]).includes(PR_BODY_TRAILER_SHAPE)], [true, false]); // The platform, faked at fetch: GET /repos/{repo}/issues/{n} answers from `store`, and every request is recorded. const readFake = (store) => { @@ -4673,7 +4674,7 @@ export async function selfTest() { const signedPr = await cliRead([{ op: 'issue_patch', issue: 29200, body: PR_BODY }], { [`/repos/${REPO}/issues/29200`]: PULL }); t('⭐ a signed pull request body passes on a DRY RUN: the target read once, exit 0, the payload printed with the body exactly as written', [signedPr.code, signedPr.seen, signedPr.code === EXIT_OK ? JSON.parse(signedPr.out).client_payload.actions[0].body : null], [EXIT_OK, [`GET /repos/${REPO}/issues/29200`], PR_BODY], signedPr.err.slice(-300)); const trailerIssue = await cliRead([{ op: 'issue_patch', issue: 29145, body: `Card prose\n${TRAILER}` }], { [`/repos/${REPO}/issues/29145`]: ISSUE }); - t('⭐ an ISSUE body with only the trailer is still refused: usage (2), the refusal naming the issue and the first-line shape, no payload', [trailerIssue.code, trailerIssue.err.includes('is an issue') && trailerIssue.err.includes('LANE#N · ACCOUNT · SESSION'), trailerIssue.out.includes('"event_type"')], [EXIT_USAGE, true, false], trailerIssue.err.slice(-300)); + t('⭐ an ISSUE body with only the trailer is still refused: usage (2), the refusal naming the issue and the first-line shape, no payload', [trailerIssue.code, trailerIssue.err.includes('is an issue') && trailerIssue.err.includes('LANE@ACCOUNT · ACCOUNT · SESSION'), trailerIssue.out.includes('"event_type"')], [EXIT_USAGE, true, false], trailerIssue.err.slice(-300)); const unreadable = await cliRead([{ op: 'issue_patch', issue: 29200, body: PR_BODY }], { [`/repos/${REPO}/issues/29200`]: { status: 503, json: { message: 'down' } } }); t('⭐ an unreadable target refuses: PREREQUISITE NOT MET (3) naming the status, no payload — never a pass', [unreadable.code, unreadable.err.includes('HTTP 503') && unreadable.err.includes('PREREQUISITE NOT MET'), unreadable.out.includes('"event_type"')], [EXIT_PREREQUISITE, true, false], unreadable.err.slice(-300)); const noToken = await cliRead([{ op: 'issue_patch', issue: 29200, body: PR_BODY }], { [`/repos/${REPO}/issues/29200`]: PULL }, { GITHUB_TOKEN: '', GH_TOKEN: '' }); @@ -5031,7 +5032,7 @@ const USAGE = [ ` ${CONTAINER_SESSION_ENV} (cse_ → session_); ${SESSION_ENV} overrides the container (a local checkout, a test).`, ` ⛔ Never as a prefix on the command line: the seats' allow rules are literal command prefixes. The dispatch always`, ` goes to ${RELAY_REPO}; --repo names the target.`, - ' A comment_edit or issue_patch body opens with the seat\'s signature line, LANE#N · ACCOUNT · SESSION, or the file is', + ' A comment_edit or issue_patch body opens with the seat\'s signature line, LANE@ACCOUNT · ACCOUNT · SESSION, or the file is', ' refused (2) before anything is packed; the fleet roster\'s generated body is the one exemption. A pull request\'s', ` issue_patch body may instead end with ${PR_BODY_TRAILER_SHAPE} on its last non-empty line: the target is then`, ' read from the platform, a dry run included — an issue refused (2), an unread target refused (3).', diff --git a/scripts/pm/fleet-write/execute.mjs b/scripts/pm/fleet-write/execute.mjs index 5eae3d4f9fb..bddf22656f3 100644 --- a/scripts/pm/fleet-write/execute.mjs +++ b/scripts/pm/fleet-write/execute.mjs @@ -677,7 +677,7 @@ import { readLowRiskRecordStage, unreadableApproval, } from '../check-governed-queue-guard.mjs'; -import { readSignatureLine } from '../check-half-states.mjs'; +import { comparedSignature, readSignatureLine, signatureShapedLine, withSeatNumbers } from '../check-half-states.mjs'; import { scrub } from '../fleet-token.mjs'; import { classifyHttp } from '../label-write.mjs'; import { announceBatch, EXIT_WRITE_PACE_REFUSED, fmtDuration, isWriteMethod, noteResponse, paceFilePath, paceWrite, releaseWriteLease, unrecordableText } from '../write-pace.mjs'; @@ -1546,7 +1546,7 @@ async function readSizeLift(req, payload, pull, api, t) { const onHead = Array.isArray(verdict.approvals) && verdict.approvals.some((a) => typeof headSha === 'string' && a.commitId === headSha.toLowerCase()); const id = req.enqueueFront.approvalComment; const comment = !onHead && Number.isInteger(id) ? await rest(api, `/repos/${payload.repo}/issues/comments/${id}`, {}, t) : null; - return enqueueFrontSizeLift({ verdict, headSha, comment, pull: number, approvers: GOVERNED_APPROVERS, signatureOf: readSignatureLine }); + return enqueueFrontSizeLift({ verdict, headSha, comment, pull: number, approvers: GOVERNED_APPROVERS, signatureOf: signatureShapedLine }); } /** @@ -1591,13 +1591,14 @@ export const DEQUEUE_COMMENTS_PAGE_CAP = 5; * `{ fail }` — the sentence — for a page that did not answer 200 with an array or a walk past the cap: an unread * list is never `false`. A comment counts only when its author is the relay itself (`RELAY_COMMENT_AUTHOR`) and * its first non-empty line is a seat signature naming `session` and `landing`'s seat and account - * (`signedByLandingSeat`). Never throws. + * (`signedByLandingSeat`), both read as readers compare a seat (`comparedSignature`): a seat that signed the + * trailer under its old number and asks under its account name is one seat. Never throws. */ async function landingSeatSignedOn(repo, pull, landing, session, api, t) { for (let page = 1; page <= DEQUEUE_COMMENTS_PAGE_CAP; page++) { const r = await rest(api, `/repos/${repo}/issues/${pull}/comments?per_page=${DEQUEUE_COMMENTS_PAGE_SIZE}&page=${page}`, {}, t); if (r.status !== 200 || !Array.isArray(r.json)) return { fail: `GET /repos/${repo}/issues/${pull}/comments -> HTTP ${r.status}${r.detail ? ` (${r.detail})` : ''}: #${pull}'s comments could not be read` }; - if (r.json.some((c) => c?.user?.login === RELAY_COMMENT_AUTHOR && signedByLandingSeat(readSignatureLine(c?.body), landing, session))) return true; + if (r.json.some((c) => c?.user?.login === RELAY_COMMENT_AUTHOR && signedByLandingSeat(comparedSignature(readSignatureLine(c?.body)), comparedSignature(landing), session))) return true; if (r.json.length < DEQUEUE_COMMENTS_PAGE_SIZE) return false; } return { fail: `#${pull}'s comments ran past the ${DEQUEUE_COMMENTS_PAGE_CAP}-page cap without a comment signed by ${session} — a truncated list is a SUBSET, never read as unsigned` }; @@ -2928,12 +2929,12 @@ const SELF_TEST_BATTERIES = Object.freeze({ "the pr_enqueue_front: the pull's own GET, its whole file list and its base's queue read immediately before ONE enqueuePullRequest mutation with jump true and the expected head — open, ready, its head, not Version Packages, no governed path, at most the human-merge line count, a queue read whole with no jumped entry; each fence refused with the mutation not sent; GraphQL errors FAILED naming the missing grant; the 200 confirmed only by reading the queue back with the pull jumped and nothing ahead; queued without the jump or behind another is FAILED, never re-sent; the queue read unpaced; no annotation": 20, // 9 → 12 with a carrying comment that opens with a seat signature refused, its other way, and no reader carrying nothing; // the other way flipped (still 12) when a signature on ANY line refused the carry, not only the first. - "the pr_enqueue_front SIZE lift: a pull over the human-merge line is jumped only on an authorised APPROVED review on its current head, or an earlier one carried to the head by an authorised comment on the pull naming it — the reviews read only over the line, a full page or an unread list lifting nothing, a non-approver, an approval elsewhere, a comment naming another head or pull or holding a seat signature on any line refused with the mutation not sent": 13, + "the pr_enqueue_front SIZE lift: a pull over the human-merge line is jumped only on an authorised APPROVED review on its current head, or an earlier one carried to the head by an authorised comment on the pull naming it — the reviews read only over the line, a full page or an unread list lifting nothing, a non-approver, an approval elsewhere, a comment naming another head or pull or holding a seat signature on any line refused with the mutation not sent": 14, // 16 → 27 with seat-asks bound to the landing seat (another seat, the relay's own audit, no trailer, the pure match), // the pull read back open and unmerged (merged, closed, a late read, the pure reading) and the node id from the first read; // 27 → 28 with the second pull read one interval later, a merge that shows only there refused; // 28 → 29 with a failed second pull read starting the pair over. - "the pr_dequeue: the pull's own GET, its base's queue with each entry's merge-group rollup and, for seat-asks alone, its comments read before ONE audit comment and ONE dequeuePullRequest mutation — open, its head, not Version Packages, a queue read whole that lists it, and the cause holding on those reads (conflict: dirty; own-failure: UNMERGEABLE or a failing rollup, never an unread one; seat-asks: a relay comment signed by the landing seat its body's trailer names, under the dispatching session — another seat's comment refused); each fence refused with nothing written; no audit comment, no mutation; GraphQL errors FAILED naming the grant; the 200 confirmed only by reading the queue back without the pull and the pull still open and unmerged on two reads one interval apart, a merge or close inside the window FAILED, UNCONFIRMED after the window": 30, + "the pr_dequeue: the pull's own GET, its base's queue with each entry's merge-group rollup and, for seat-asks alone, its comments read before ONE audit comment and ONE dequeuePullRequest mutation — open, its head, not Version Packages, a queue read whole that lists it, and the cause holding on those reads (conflict: dirty; own-failure: UNMERGEABLE or a failing rollup, never an unread one; seat-asks: a relay comment signed by the landing seat its body's trailer names, under the dispatching session — another seat's comment refused); each fence refused with nothing written; no audit comment, no mutation; GraphQL errors FAILED naming the grant; the 200 confirmed only by reading the queue back without the pull and the pull still open and unmerged on two reads one interval apart, a merge or close inside the window FAILED, UNCONFIRMED after the window": 32, "the hierarchy link: sub_issue_add and sub_issue_remove read the parent's and the child's own answers, then the child's parent (add) or the parent's whole list (remove), immediately before ONE write whose body is the child's REST id from its own answer — never its number, never replace_parent; a pull, a transferred or unread card, a child under another parent, one the parent does not list, or a read that is neither answer is zero writes; a child already under this parent is a no-op landed on the list; the answer confirmed only when the parent's list reads the child back (or no longer does) inside the window; a refused write, a list that never settles or never reads whole is FAILED; no annotation, and the rows ride a stroke beside other ops": 20, "the advisory rows: advisory_report and advisory_create are ONE POST of their body each, landed on a 2xx carrying an id — a draft's reading state draft — that the row and a notice annotation name; advisory_collaborators_add, advisory_versions and advisory_state read the advisory first and send ONE PATCH — every existing login kept with the missing ones added, an all-present list a no-op, the versions entries alone, or the one state a legal transition reaches, the reopen and the publish among them — or nothing at all on a fence: an unread, other or wrong-state advisory, an illegal move, a list the versions may not replace or a publish whose versions are not set; each lands only when its answer shows the result, a publish only read back as published with the versions it was sent, and a landed publish alone is annotated with its id; ⛔ the marker in a report's or a draft's summary, description and packages and in every advisory answer's summary, description and vulnerabilities reaches no log line, row, step summary or annotation": 46, "the mailbox branch delete: the pull's own answer, the open pulls on its head and the ref read immediately before ONE DELETE of the ref under the App token — an open, unlabelled, other-headed or forked pull, an open pull on that head, a ref moved off the pull's head, or a read that does not answer is zero writes with every failing fence named; the DELETE lands only when the ref reads back absent, a ref already gone an idempotent landing and one still there FAILED; and mailbox-open's close stroke — comment, close, delete — leaves no branch, while a head outside claude/mailbox-* sends no DELETE": 7, @@ -3951,6 +3952,8 @@ export async function selfTest() { t('⛔ CARRIED, refused on ANY line: the same approver\'s comment with the seat signature further down, not first, carries nothing either — the reading naming the seat', [await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: signedLower }, { approval_comment: 71 }), (await run(stroke({ approval_comment: 71 }), { ...happy, [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: signedLower })).rows[0]?.result.includes('holds the seat signature triage#1')], [refused, true]); const signedNamed = commentOf({ body: `The approval carries to ${HEAD.slice(0, 9)}.\n\nrepo:objectstack@${APPROVER} · ${APPROVER} · session_01ABCDEFGHJKMNPQRSTVWXYZ` }); t('⛔ CARRIED, refused under the second seat mark too: a comment holding a `LANE@ACCOUNT` signature is a seat\'s comment — the reading naming that seat', [await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: signedNamed }, { approval_comment: 71 }), (await run(stroke({ approval_comment: 71 }), { ...happy, [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: signedNamed })).rows[0]?.result.includes(`holds the seat signature repo:objectstack@${APPROVER.toLowerCase()} · ${APPROVER}`)], [refused, true]); + const nearMiss = commentOf({ body: `The approval carries to ${HEAD.slice(0, 9)}.\n\nrepo:objectstack@os-someone · ${APPROVER} · session_01ABCDEFGHJKMNPQRSTVWXYZ` }); + t('⛔ CARRIED, refused on the NEAR MISS too (N6): a line shaped like a signature whose `LANE@X` seat another account signs is still a seat\'s line — it carries nothing, though `readSignatureLine` reads no signature there', [await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: nearMiss }, { approval_comment: 71 }), readSignatureLine(`repo:objectstack@os-someone · ${APPROVER} · session_01ABCDEFGHJKMNPQRSTVWXYZ`)], [refused, null]); const pastApproval = { state: 'approved', approvals: [{ login: APPROVER, commitId: EARLIER }] }; t('enqueueFrontSizeLift with no signature reader carries nothing — the opening line unjudged is never a pass', [enqueueFrontSizeLift({ verdict: pastApproval, headSha: HEAD, comment: commentOf(), pull: PULL, approvers: GOVERNED_APPROVERS }).lifts, enqueueFrontSizeLift({ verdict: pastApproval, headSha: HEAD, comment: commentOf(), pull: PULL, approvers: GOVERNED_APPROVERS, signatureOf: () => null }).lifts], [false, true]); t('⛔ an approval by an account outside GOVERNED_APPROVERS, or one the approver later dismissed, lifts nothing even on the head', [await verdict({ [REVIEWS]: reviewsOf(review('os-support-ai', HEAD)) }), await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, HEAD), review(APPROVER, HEAD, 'DISMISSED')) })], [refused, refused]); @@ -4017,6 +4020,14 @@ export async function selfTest() { t('⛔ seat-asks, refused: a pull body whose last line is no signed trailer names no landing seat — refused unread, its comments never walked, the sentence naming the trailer', [noTrailer.exit, writes(noTrailer.seen).filter((x) => x.call !== GQL).length, noTrailer.seen.filter((x) => x.call === COMMENTS).length, noTrailer.rows[0]?.result.includes("signed trailer names no seat")], [EXIT_ACTION_FAILED, 0, 0, true]); t('signedByLandingSeat: one seat, account and session holds; any one of the four parts different, or either reading missing, does not', [signedByLandingSeat({ lane: 'domain:server', seat: 5, account: 'a', session: 's' }, { lane: 'domain:server', seat: 5, account: 'a', session: 'other' }, 's'), ...[{ lane: 'queue' }, { seat: 6 }, { account: 'b' }, { session: 't' }].map((d) => signedByLandingSeat({ lane: 'domain:server', seat: 5, account: 'a', session: 's', ...d }, { lane: 'domain:server', seat: 5, account: 'a' }, 's')), signedByLandingSeat(null, { lane: 'x', seat: 1, account: 'a' }, 's'), signedByLandingSeat({ lane: 'x', seat: 1, account: 'a', session: 's' }, null, 's')], [true, false, false, false, false, false, false]); t('⭐ signedByLandingSeat reads both seat marks, by lane AND mark: an account seat\'s signature is its own landing seat\'s; ⛔ never a numbered seat\'s of the lane (CONTROL: a `#5` signature stays seat 5\'s, whoever signed it), nor another account\'s', (() => { const acct = readSignatureLine('repo:objectstack@os-a · os-a · session_01ABCDEF'); const num = readSignatureLine('repo:objectstack#5 · os-a · session_01ABCDEF'); const other = readSignatureLine('repo:objectstack@os-b · os-b · session_01ABCDEF'); return [signedByLandingSeat(acct, acct, 'session_01ABCDEF'), signedByLandingSeat(num, num, 'session_01ABCDEF'), signedByLandingSeat(num, acct, 'session_01ABCDEF'), signedByLandingSeat(acct, num, 'session_01ABCDEF'), signedByLandingSeat(other, acct, 'session_01ABCDEF'), readSignatureLine('repo:objectstack@os-a · os-b · session_01ABCDEF')]; })(), [true, true, false, false, false, null]); + // A retired number and the account seat it became (`seat-numbers.mjs`): the pull's trailer was signed as seat 5, + // and the seat, renamed since, asks under its account name. One seat — the table joins the two spellings. + const T5 = [{ lane: 'domain:server', number: 5, account: 'os-project-manager' }]; + const RENAMED = 'domain:server@os-project-manager · os-project-manager'; + const askRenamed = (comment, trailer = LANDING) => () => fenced({ ...asks(comment), [PULL_GET]: pullAt({ mergeable: true, mergeable_state: 'blocked', body: prBody.replaceAll(LANDING, trailer) }) }, { cause: 'seat-asks' }); + const heldRenamed = await withSeatNumbers(T5, async () => (await run(stroke({ cause: 'seat-asks' }), { ...happy, ...asks(signed(RELAY_COMMENT_AUTHOR, SESSION, RENAMED)) }, timing)).exit); + t('⭐ seat-asks after a rename: the trailer signed `LANE#5`, the ask signed `LANE@ACCOUNT` by the same account — ONE seat once the table carries the number, and the other way round; with no row the two spellings are two seats and the ask is refused', [heldRenamed, (await withSeatNumbers(T5, askRenamed(signed(RELAY_COMMENT_AUTHOR, SESSION), RENAMED))).slice(0, 2), await withSeatNumbers([], askRenamed(signed(RELAY_COMMENT_AUTHOR, SESSION, RENAMED)))], [EXIT_OK, [EXIT_OK, 1], refused]); + t('⛔ seat-asks after a rename, refused: a trailer an EARLIER holder signed as seat 5 is not the renamed account\'s, and a vacant seat\'s `#1` trailer is no account\'s', [await withSeatNumbers(T5, askRenamed(signed(RELAY_COMMENT_AUTHOR, SESSION, RENAMED), 'domain:server#5 · os-earlier')), await withSeatNumbers(T5, askRenamed(signed(RELAY_COMMENT_AUTHOR, SESSION, RENAMED), 'domain:server#1 · os-project-manager'))], [refused, refused]); const unreadComments = await run(stroke({ cause: 'seat-asks' }), { ...happy, ...asks({ status: 502, json: { message: 'Bad Gateway' } }) }); t('⛔ seat-asks with the comments unread: nothing written, the read named — an unread list is never unsigned', [unreadComments.exit, writes(unreadComments.seen).filter((x) => x.call !== GQL).length, mutations(unreadComments.seen).length, unreadComments.rows[0]?.result.includes('comments could not be read')], [EXIT_ACTION_FAILED, 0, 0, true]); const noAudit = await run(stroke(), { ...happy, [AUDIT]: { status: 403, json: { message: 'Resource not accessible by integration' } } }); diff --git a/scripts/pm/fleet-write/ops.mjs b/scripts/pm/fleet-write/ops.mjs index 5c21491f9b0..666872e57fe 100644 --- a/scripts/pm/fleet-write/ops.mjs +++ b/scripts/pm/fleet-write/ops.mjs @@ -370,7 +370,7 @@ * the approval carries to this head. The comment is read by its own GET * (`/repos/{repo}/issues/comments/{id}`); a comment on another pull, by * another author, or naming another head lifts nothing. Nor does one with - * a seat signature (`LANE#N · ACCOUNT · SESSION`) on ANY line, not only the first: + * a seat signature (`LANE@ACCOUNT · ACCOUNT · SESSION`, or an old `LANE#N` one) on ANY line, not only the first: * an authorised account is agent-operated too (AGENTS.md Prime Directive * #14), and a seat's knock or record quoting the head is no confirmation * by the maintainer's own hand. @@ -399,7 +399,7 @@ * here can run: the seat states it in `reason`, and the audit comment * carries it; * - `seat-asks`: the pull's LANDING seat asks. The landing seat is the one - * the pull's own body names in its signed trailer (`` on its last non-empty line, `readPrBodyTrailer`); * a body whose trailer names no seat is refused. The proof is a fleet * comment on the pull whose first non-empty line is a seat signature @@ -1712,7 +1712,9 @@ function seatOf(sig) { /** * Is `signature` (a `readSignatureLine` reading) the pull's landing seat — the same lane, seat mark (the number, or * `@account` for a seat named by its account: the two never match each other) and account as `landing`, the - * reading of the pull body's signed trailer — under `session`? The `seat-asks` proof (header). Pure. + * reading of the pull body's signed trailer — under `session`? The `seat-asks` proof (header). The executor hands + * in both readings as readers compare them (`comparedSignature`, `check-half-states.mjs`), so a seat renamed + * after it signed the trailer under its old number is still that pull's landing seat. Pure. */ export function signedByLandingSeat(signature, landing, session) { return Boolean(signature && landing) && signature.session === session && signature.lane === landing.lane && signature.seat === landing.seat && signature.account === landing.account; @@ -2247,8 +2249,8 @@ const publishes = (c) => c.to === ADVISORY_PUBLISHED_STATE; export const ADVISORY_NOTE_STAMP_SHAPE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/; /** - * A seat signature line in ANY lane — `LANE#N · ACCOUNT · SESSION`, or `LANE@ACCOUNT` as its seat (the second - * accepted seat mark), the lane any word without a space. A superset of + * A seat signature line in ANY lane — `LANE@ACCOUNT · ACCOUNT · SESSION`, or the old seat mark `LANE#N` as its + * seat, the lane any word without a space. A superset of * `SEAT_SIGNATURE_LINE` (`check-half-states.mjs`): every line that check accepts, this one does too * (`validate.mjs --self-test` pins it). Looser on purpose: retiring a lane word from that list would let notes already * signed under it pass a fence that read the live list, so lane words are only ever added there, and this shape does diff --git a/scripts/pm/issue-create.mjs b/scripts/pm/issue-create.mjs index ad166e34a1a..d51b2a50d38 100644 --- a/scripts/pm/issue-create.mjs +++ b/scripts/pm/issue-create.mjs @@ -36,7 +36,7 @@ * - a body carrying `{{NOW}}` / `{{WAS:…}}` — those are `post-stamped.mjs`'s * contract for comments and body EDITS; a new card is dated by the platform; * - a body whose first non-empty line is not the seat's signature, - * `LANE#N · ACCOUNT · SESSION` (#27113) — read by `signatureRefusal` + * `LANE@ACCOUNT · ACCOUNT · SESSION` (#27113) — read by `signatureRefusal` * (`check-half-states.mjs`, whose banner carries the shape and the ruling), * listed beside the token refusal when both apply. Every card this door * creates is seat-authored: the workflow-generated cards are written by @@ -540,7 +540,7 @@ export async function selfTest() { const plan = (file) => planFrom(parseArgs(['--title', 'x', '--body-file', file]), { read, env }); const unsigned = plan('unsigned.md'); t('an unsigned body is refused — the plan is not ok', unsigned.ok, false); - t('…and the refusal names the shape to write and the line it read', unsigned.errors.some((e) => e.includes('no signature line') && e.includes('LANE#N · ACCOUNT · SESSION') && e.includes('`Evidence: a repro.`'))); + t('…and the refusal names the shape to write and the line it read', unsigned.errors.some((e) => e.includes('no signature line') && e.includes('LANE@ACCOUNT · ACCOUNT · SESSION') && e.includes('`Evidence: a repro.`'))); t('a signed body plans, and the signature is SENT as written — nothing stripped, nothing inserted', [plan('body.md').ok, plan('body.md').payload.body.split('\n')[0]], [true, SIG]); t('a near miss (hyphens for the ` · ` separator) is refused, and named as one', plan('near-miss.md').errors.some((e) => e.includes('reads like a signature and is not one'))); t('⭐ both seat marks are accepted: a body signed `LANE@ACCOUNT` plans as one signed `LANE#N` does, sent as written', [plan('account-seat.md').ok, plan('account-seat.md').payload.body.split('\n')[0], plan('body.md').ok], [true, 'repo:objectstack@os-justin · os-justin · session_01ABCDEFGHJKMNPQRSTVWXYZ', true]); diff --git a/scripts/pm/mailbox-open.mjs b/scripts/pm/mailbox-open.mjs index 0cda3fa773c..3fe29214934 100644 --- a/scripts/pm/mailbox-open.mjs +++ b/scripts/pm/mailbox-open.mjs @@ -41,8 +41,8 @@ * was a per-seat one; the board falsified that premise, and nothing here reads * a login as a seat any more. * - * A seat is spelled `LANE#N` — `domain:ui#4`, `repo:cloud#1`, `triage`, - * `epic:#27293#1` — its lane one of the ten a seat post's title names + * A seat is spelled `LANE@ACCOUNT` (below), and its old spelling `LANE#N` still reads — `domain:ui#4`, + * `repo:cloud#1`, `triage`, `epic:#27293#1` — its lane one of the ten a seat post's title names * (`domain:`, `repo:`, `triage`, `director`, `security`, `l2-review` and its old spelling `review`, `qa`, `eval`, `queue`) or the epic lane * `epic:#`, the seat signature's spelling for the PM delegated a * `pm:epic` parent card (pm-dispatch `seat-lifecycle.md` 〈Epic 子树车道〉), so a @@ -55,9 +55,10 @@ * lane may be named `triage`, `director`, `security`, `l2-review`, `review`, `qa`, `eval`, `queue`, `repo-…` or `epic-…` — `seatKey` * refuses one — which keeps the slug one-to-one. * - * `LANE@ACCOUNT` is the second accepted spelling (ruling record 7249169754; the + * `LANE@ACCOUNT` is the spelling every new seat is opened under (ruling record 7249169754; the * grammar's banner is `check-half-states.mjs`'s): a seat named by the account - * that holds it, `repo:objectstack@os-bill`. Its key keeps that spelling, + * that holds it, `repo:objectstack@os-bill`, one seat per account per lane — so `review@X` and `l2-review@X`, + * one lane under two words, are ONE key and slug, `l2-review@x`. Its key keeps that spelling, * lower-cased, and is its own seat: never the numbered seat its account sits, * and never another account's. Its slug is the lane's, `_`, the account, then * `-0` (`repo-objectstack_os-bill-0`): a login carries no `_`, so the last one @@ -216,14 +217,23 @@ export const L2_REVIEW_LANE = 'l2-review'; /** * Every lane word that reads as the L2 seat: the name new writes use, then the old spelling `review`, accepted as an * alias so the seats seated under it, their mailboxes (`mailbox//review-N`), their signatures and the records - * that name them keep reading. ⛔ The two are NOT folded into one key: `review#1` and `l2-review#1` are two seats. + * that name them keep reading. ⛔ The two NUMBERED spellings are not folded into one key: `review#1` and + * `l2-review#1` are two seats. A seat named by its account is one seat under either word (`seatKey`). */ export const L2_REVIEW_LANE_WORDS = Object.freeze([L2_REVIEW_LANE, 'review']); /** Whether a lane word (a seat post's, a signature's) names the L2 seat, under either spelling. Pure. */ export const isL2ReviewLane = (lane) => L2_REVIEW_LANE_WORDS.includes(String(lane ?? '').trim().toLowerCase()); /** The epic lane's kind: `epic:#` names the `pm:epic` parent card's number, never a word (`epic:#27293#1`). */ export const SEAT_EPIC_KIND = 'epic'; -const SEAT_SHAPE = new RegExp(`^((?:${SEAT_LANE_KINDS.join('|')}):[a-z0-9._-]+|${SEAT_EPIC_KIND}:#[1-9][0-9]*|${SEAT_BARE_LANES.join('|')})(?:#([1-9][0-9]*)|@(${LOGIN_SHAPE.source.slice(1, -1).replace(/A-Z/g, '')}))?$`); +/** + * A seat's account as `seatKey` reads it — a GitHub login, lower case (the key is read lower-cased), unanchored. It + * is `SIGNATURE_ACCOUNT_SOURCE` (`check-half-states.mjs`, which this file cannot import — the lane lists above say + * why) with its upper-case range taken out; `record-recognisers.mjs --self-test`, which imports both, holds that. + */ +export const SEAT_ACCOUNT_SOURCE = '[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}'; +const SEAT_SHAPE = new RegExp(`^((?:${SEAT_LANE_KINDS.join('|')}):[a-z0-9._-]+|${SEAT_EPIC_KIND}:#[1-9][0-9]*|${SEAT_BARE_LANES.join('|')})(?:#([1-9][0-9]*)|@(${SEAT_ACCOUNT_SOURCE}))?$`); +/** A head-only mailbox slug of a seat named by its account: the lane's slug, `_`, the account, `-0`. */ +const ACCOUNT_SEAT_SLUG = new RegExp(`^.+_(${SEAT_ACCOUNT_SOURCE})-0$`); // What a `domain:` lane may NOT be named, so the slug stays one-to-one (header): a bare lane word (`domain:triage` // would slug to `triage-1`, the triage seat's), or another kind's name with its colon turned into the hyphen the slug // uses (`domain:repo-cloud` would slug to `repo-cloud-1`, `repo:cloud#1`'s; `domain:epic-12` to `epic-12-1`, `epic:#12#1`'s). @@ -239,14 +249,18 @@ const LEGACY_OWNER_LINE = /^(?:To|Mailbox-of):[ \t]*(\S+)$/; * named after a reserved lane word (`domain:triage`, `domain:repo-cloud`) is not a seat either: its slug would be * another seat's, and the header's one-to-one promise is kept here, not assumed. This is the fleet's ONE seat * grammar — the mailbox `To:` line and the doorbell keys' `LANE#N` fields read with it, never a second shape. A - * seat spelled `LANE@ACCOUNT` (header) reads `{ key, slug, account }`, the account lower-cased. Pure. + * seat spelled `LANE@ACCOUNT` (header) reads `{ key, slug, account }`, the account lower-cased, and under the + * L2 lane's old word `review` it is keyed and slugged as `l2-review` — one seat per account in that one lane. Pure. */ export function seatKey(text) { const m = SEAT_SHAPE.exec(String(text ?? '').trim().toLowerCase()); if (!m) return null; if (m[1].startsWith('domain:') && RESERVED_DOMAIN_LANE.test(m[1].slice('domain:'.length))) return null; + if (m[3] !== undefined) { + const word = m[1] === 'review' ? L2_REVIEW_LANE : m[1]; + return { key: `${word}@${m[3]}`, slug: `${word.replace(/^domain:/, '').replace(/:#?/g, '-')}_${m[3]}-0`, account: m[3] }; + } const lane = m[1].replace(/^domain:/, '').replace(/:#?/g, '-'); - if (m[3] !== undefined) return { key: `${m[1]}@${m[3]}`, slug: `${lane}_${m[3]}-0`, account: m[3] }; const n = m[2] ?? '1'; return { key: `${m[1]}#${n}`, slug: `${lane}-${n}` }; } @@ -295,7 +309,7 @@ export function parseArgs(argv) { } else { const seat = opts.seat === null ? null : seatKey(opts.seat); if (!opts.seat) opts.errors.push('--seat is required to open a mailbox — the mailbox is the seat\'s, never the login\'s'); - else if (!seat) opts.errors.push(`--seat ${JSON.stringify(opts.seat)} is not a seat — spell it LANE#N, e.g. domain:ui#4 or epic:#27293#1`); + else if (!seat) opts.errors.push(`--seat ${JSON.stringify(opts.seat)} is not a seat — spell it LANE@ACCOUNT, e.g. repo:objectstack@os-bill or epic:#27293@os-bill (an old LANE#N still reads)`); if (!opts.login) opts.errors.push('--login is required to open a mailbox'); else if (!LOGIN_SHAPE.test(opts.login)) opts.errors.push(`--login ${JSON.stringify(opts.login)} is not a GitHub login`); else if (seat?.account !== undefined && seat.account !== opts.login.toLowerCase()) opts.errors.push(`--seat ${JSON.stringify(opts.seat)} is named by another account than --login ${JSON.stringify(opts.login)} — a seat named by an account opens under that account only`); @@ -383,7 +397,9 @@ const firstLine = (text) => String(text ?? '').split(/\r?\n/).find((l) => l.trim * only by its head `mailbox//` (`seat` null, `slug` set). A legacy per-login mailbox — head * `mailbox/`, or a first line `To: ` / `Mailbox-of: ` — names a login and NO seat, so its * `slug` is null: unassigned to a seat, ⛔ never attributed to the login's seats. A `pm:mailbox` pull that names - * neither reads `{ seat: null, slug: null, login: null }`. The body outranks the head. The one reading of a + * neither reads `{ seat: null, slug: null, login: null }`. The body outranks the head. A head whose slug is a + * seat named by an account (`…_ACCOUNT-0`) under ANOTHER login names that login and no seat, as the body line does: + * such a seat is its account's alone. The one reading of a * mailbox's owner: `fleet-roster.mjs` imports it, never re-spells it. Pure. */ export function mailboxOwner(pr) { @@ -396,7 +412,11 @@ export function mailboxOwner(pr) { if (seat) return { seat: seat.key, slug: seat.slug, login: perSeat[2] }; const ref = String(pr?.head?.ref ?? ''); const parts = ref.startsWith(MAILBOX_BRANCH_PREFIX) ? ref.slice(MAILBOX_BRANCH_PREFIX.length).split('/') : []; - if (parts.length === 2 && LOGIN_SHAPE.test(parts[0]) && parts[1] !== '') return { seat: null, slug: parts[1].toLowerCase(), login: parts[0] }; + if (parts.length === 2 && LOGIN_SHAPE.test(parts[0]) && parts[1] !== '') { + const slug = parts[1].toLowerCase(); + const named = ACCOUNT_SEAT_SLUG.exec(slug)?.[1]; + return { seat: null, slug: named !== undefined && named !== parts[0].toLowerCase() ? null : slug, login: parts[0] }; + } const legacy = LEGACY_OWNER_LINE.exec(first)?.[1] ?? (parts.length === 1 ? parts[0] : null); return { seat: null, slug: null, login: legacy !== null && LOGIN_SHAPE.test(legacy) ? legacy : null }; } @@ -543,7 +563,7 @@ async function closeLive(plan, opts) { const USAGE = [ 'usage:', - ' node scripts/pm/mailbox-open.mjs --repo owner/name --seat --login [--head ] [--base main] [--dry-run] [--json]', + ' node scripts/pm/mailbox-open.mjs --repo owner/name --seat --login [--head ] [--base main] [--dry-run] [--json]', ' node scripts/pm/mailbox-open.mjs --repo owner/name --close [--dry-run]', ' node scripts/pm/mailbox-open.mjs --self-test', ` Exits: ${EXIT_OK} done · ${EXIT_USAGE} usage or refused stroke · ${EXIT_PREREQUISITE} prerequisite · ${EXIT_REFUSED} refused on board state · 5+ the relay's own exit`, @@ -590,7 +610,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ 'the close plan: comment then close, then the delete of a claude/mailbox-* head, judged by the validator': 7, 'whose mailbox a pull is: the seat on the body line or the head, a legacy login, neither': 8, "finding a seat's open mailbox: by seat, never by login": 10, - 'a seat named by its account: `LANE@ACCOUNT` is its own key and slug beside `LANE#N` (ruling record 7249169754)': 9, + 'a seat named by its account: `LANE@ACCOUNT` is its own key and slug beside `LANE#N` (ruling record 7249169754)': 11, 'refusing to close what is not an open mailbox': 4, 'the ledger exclusion and the footer': 4, 'the CLI: dry run prints the actions file and sends nothing': 8, @@ -729,6 +749,8 @@ async function selfTest() { const BOXES = [opened('repo:objectstack@os-bill', 'os-bill', 21), opened('repo:objectstack#1', 'os-elon', 22)]; t('⭐ found by lane AND account: os-bill\'s seat finds its own mailbox, and neither another account\'s seat of the lane nor a numbered seat finds it', [openMailboxesOf(BOXES, seatKey('repo:objectstack@os-bill')).map((x) => x.number), openMailboxesOf(BOXES, seatKey('repo:objectstack@os-elon')).length, openMailboxesOf(BOXES, seatKey('repo:objectstack#5')).length, openMailboxesOf([pr({ head: { ref: ACC.branch } })], seatKey('repo:objectstack@os-bill')).length], [[21], 0, 0, 1]); t('⭐ CONTROL — vacant seat 1\'s `#1` mailbox still reads as seat 1\'s, whoever opened it: found by `repo:objectstack#1` (and the bare lane), ⛔ not by the account seat of the login on it', [openMailboxesOf(BOXES, seatKey('repo:objectstack#1')).map((x) => x.number), openMailboxesOf(BOXES, seatKey('repo:objectstack')).map((x) => x.number), openMailboxesOf(BOXES, seatKey('repo:objectstack@os-elon')).length, mailboxOwner(BOXES[1]).seat], [[22], [22], 0, 'repo:objectstack#1']); + t('N4 — `review` and `l2-review` are ONE lane: an account seat written under either word is the one key `l2-review@account`, with one slug, and finds one mailbox; a NUMBERED seat keeps the word it was written with', [seatKey('Review@OS-Bill'), seatKey('l2-review@os-bill'), openMailboxesOf([opened('l2-review@os-bill', 'os-bill', 31)], seatKey('review@os-bill')).map((x) => x.number), seatKey('review#2')?.key, seatKey('l2-review#2')?.key], [{ key: 'l2-review@os-bill', slug: 'l2-review_os-bill-0', account: 'os-bill' }, { key: 'l2-review@os-bill', slug: 'l2-review_os-bill-0', account: 'os-bill' }, [31], 'review#2', 'l2-review#2']); + t('⛔ N5 — a head-only mailbox whose slug is account Y\'s seat under login X names login X and NO seat, as the body line does; under its own login (any case), and for a numbered slug under any login, the head reads as before', [mailboxOwner(pr({ body: '', head: { ref: 'mailbox/os-elon/repo-objectstack_os-bill-0' } })), mailboxOwner(pr({ body: '', head: { ref: 'mailbox/OS-Bill/repo-objectstack_os-bill-0' } })), mailboxOwner(pr({ body: '', head: { ref: 'mailbox/os-elon/repo-objectstack-5' } }))], [{ seat: null, slug: null, login: 'os-elon' }, { seat: null, slug: 'repo-objectstack_os-bill-0', login: 'OS-Bill' }, { seat: null, slug: 'repo-objectstack-5', login: 'os-elon' }]); battery('refusing to close what is not an open mailbox'); t('an open pm:mailbox PR may be closed', closeRefusal(pr({}), 1), null); diff --git a/scripts/pm/post-stamped.mjs b/scripts/pm/post-stamped.mjs index d8f056505f8..359f076c827 100644 --- a/scripts/pm/post-stamped.mjs +++ b/scripts/pm/post-stamped.mjs @@ -474,7 +474,7 @@ * ## The first line is the seat's signature, or the body is refused (#27113) * * Every write here lands under one bot login, so the TEXT is the only place a reader learns who wrote it. The first - * non-empty line of every body this tool writes — `--comment` and `--body` alike — is `LANE#N · ACCOUNT · SESSION`, + * non-empty line of every body this tool writes — `--comment` and `--body` alike — is `LANE@ACCOUNT · ACCOUNT · SESSION`, * read by `readSignatureLine` (`check-half-states.mjs`, whose banner carries the shape and the ruling); a body whose * first line is not one is `EXIT_REFUSED` before any request, a dry run included. It is judged beside the stamp * contract, not behind it, so a body missing both hears both. ⛔ Nothing inserts the line: a `--sign-from` that @@ -971,15 +971,18 @@ import { markerMatches, protocolStamps, proxyRearmPlan, + readSignatureLine, resolveSweepRepo, signatureRefusal, signatureRefusalText, SEAT_SIGNATURE_SHAPE, + seatMarkOf, stampDriftMinutes, stampSpan, stripMarkdownCode, stripSignatureLine, threadReadField, + withSeatNumbers, } from './check-half-states.mjs'; import { readClause2Line } from './clause2-line.mjs'; import { fileSurfaceValue, surfaceTokens } from './check-handover.mjs'; @@ -2006,7 +2009,7 @@ export function substitutionSummary({ substituted = 0, quoted = 0, verbatim = 0 /** What each owning reader accepts, printed BY the refusal so the fix is one line away. */ export const CLAIM_KEY_SPELLINGS = Object.freeze({ - Seat: '`Seat: domain:LANE#N` at the START of a line, lane and number both — e.g. `Seat: domain:skills#2`', + Seat: '`Seat: LANE@ACCOUNT` at the START of a line, the lane and the SIGNING account attached, no space — e.g. `Seat: repo:objectstack@os-justin`. A seat whose rename has not landed writes its old `LANE#N` name here, the name its signature carries', 'Thread-read': '`Thread-read: ID` at the START of a line — ONE comment id, or `none`, and nothing after it', 'Clause-②': '`Clause-②: yes` or `Clause-②: no` at the START of a line — reasoning after the value is fine, a quotation around it is not', 'File surface': '`File surface: `PATH`, `PATH` (stop on breach; explain in the report)` at the START of a line — every path in its own code span (a qualifier is the same key: `File surface (PR 1): …`); a path outside a code span, or a value of prose alone, names no path to `check-handover --inflight`', @@ -2080,8 +2083,14 @@ export function claimKeyedLineRefusals(body) { const text = String(body ?? ''); if (!markerMatches(CLAIM_COMMENT_MARKER, text)) return []; const rows = []; - if (claimSeatNumber(text) === null) + const declaredSeat = claimSeatNumber(text); + const signer = readSignatureLine(text); + if (declaredSeat === null) rows.push({ key: 'Seat', line: keyLine(text, 'Seat'), why: '`claimSeatNumber` reads `null` here — the declaration is present and names no seat. The claim lands on NO seat, and H38 rows another seat\'s post over it.' }); + // A seat named by an account is that account's alone and does not change hands (ruling record 7249169754, Q2 A): + // the signature already holds it to its signer (`readSignatureLine`), and the `Seat:` line is held to it here. + else if (typeof declaredSeat === 'string' && signer !== null && declaredSeat !== `@${signer.account.toLowerCase()}`) + rows.push({ key: 'Seat', line: keyLine(text, 'Seat'), why: `the \`Seat:\` line names the seat of account \`${declaredSeat.slice(1)}\`, and this claim is signed by \`${signer.account}\` — a seat named by an account is that account's alone. Half the readers would put this claim on that account's seat and half on the signer's.` }); const thread = threadReadField(text); if (!thread.present && THREAD_READ_DECLARATION_ANYWHERE.test(text)) rows.push({ key: 'Thread-read', line: keyLine(text, 'Thread-read'), why: '`threadReadField` sees NO line: the key is off the line start, so H50 reads this claim as carrying no `Thread-read:` at all.' }); @@ -2710,7 +2719,7 @@ export function triageContractReviewKnockText(knock) { return ( `post-stamped: REFUSED — a \`Request: contract-review\` knock addressed to triage (\`To: ${knock.to}\`). Nothing was written.\n` + ' A lane that cannot take CONTRACT_REVIEW_TIER (the account cannot reach it, a 429 refusal, or the maintainer\n' + - ' rationed it) knocks a seated L2 seat\'s mailbox — `To: l2-review#N`, the PR its seat post\'s `Mailbox:` line\n' + + ' rationed it) knocks a seated L2 seat\'s mailbox — `To: l2-review@ACCOUNT`, the PR its seat post\'s `Mailbox:` line\n' + ' names — and, while no L2 seat is seated, a sibling lane seat that can take the tier; with neither, the PR\n' + ' waits on the owed-review list (`scripts/pm/check-owed-reviews.mjs`). ⛔ Never triage. The route is\n' + ' `references/contract-review.md` 〈L2 归属与资格〉. ⛔ No flag turns it off.' @@ -4368,8 +4377,8 @@ const SELF_TEST_BATTERIES = Object.freeze({ 'the decision facets: a decision analysis carries its marker, and a delta, a record or a quotation is not one': 22, 'the relay transport: the same act as one op, the comment found on the board, the exit register kept apart': 13, "the size route: over the relay's body cap under auto THIS write goes direct with one line naming bytes, cap and identity; at or under it the relay; explicit dispatch refuses naming the bytes; nothing else re-routes": 13, - 'the signature: every body opens with LANE#N · ACCOUNT · SESSION or is refused, beside the stamp contract; one leading signature changes no reading': 11, - 'the one judge: every body refusal on ONE path — `main` and `label-write.mjs --comment-file` call `judgeBody`, never a copy': 11, + 'the signature: every body opens with LANE@ACCOUNT · ACCOUNT · SESSION or is refused, beside the stamp contract; one leading signature changes no reading': 11, + 'the one judge: every body refusal on ONE path — `main` and `label-write.mjs --comment-file` call `judgeBody`, never a copy': 14, 'the review route: a `Request: contract-review` knock addressed to triage is refused; to a review or sibling seat, and every other key to triage, it passes': 13, 'the record tier: a record naming `CONTRACT_REVIEW_TIER` is written only on a transcript `verify-review-tier.mjs` passes; another tier and a non-record comment are untouched': 16, 'the claim stroke: a comment opening `Claim:` is refused on every route but `direct`, pointing at the `label-write` fold; the same body through that fold passes': 21, @@ -5880,11 +5889,11 @@ export function selfTest() { } // ── the signature (#27113) ───────────────────────────────────────────────── - battery('the signature: every body opens with LANE#N · ACCOUNT · SESSION or is refused, beside the stamp contract; one leading signature changes no reading'); + battery('the signature: every body opens with LANE@ACCOUNT · ACCOUNT · SESSION or is refused, beside the stamp contract; one leading signature changes no reading'); { const SIG = 'domain:skills#2 · os-justin · session_01QSeKYmhU5KEj1nukYhp1Tg'; t('a signed body has no refusal row; an unsigned one has one naming the line it read', signatureRefusal(`${SIG}\nbody`) === null && signatureRefusal('Hello\nbody')?.line === 'Hello'); - t('the refusal text prints the shape to write and says nothing was written', signatureRefusalText(signatureRefusal('Hello'), { tool: 'post-stamped' }).includes('LANE#N · ACCOUNT · SESSION') && signatureRefusalText(signatureRefusal('Hello'), { tool: 'post-stamped' }).includes('Nothing was written')); + t('the refusal text prints the shape to write and says nothing was written', signatureRefusalText(signatureRefusal('Hello'), { tool: 'post-stamped' }).includes('LANE@ACCOUNT · ACCOUNT · SESSION') && signatureRefusalText(signatureRefusal('Hello'), { tool: 'post-stamped' }).includes('Nothing was written')); t('⛔ the positional stamp rule still reads the ACT\'s line: a bare stamp on the claim line under a signature is refused', kinds(`${SIG}\nClaim: seat 2026-09-10T06:37Z`, NOW_MS).join() === 'positional'); t('…and `{{NOW}}` there is accepted, the signature sent as written above it', renderBody(`${SIG}\nClaim: seat {{NOW}}`, NOW_MS).ok && renderBody(`${SIG}\nClaim: seat {{NOW}}`, NOW_MS).body.split('\n')[0] === SIG); const PLAIN = ['Decision record: who lands the gate', '', '- **A**: the seat lands it', '- **B**: the maintainer lands it', '', 'This seat recommends **A**.'].join('\n'); @@ -5920,13 +5929,21 @@ export function selfTest() { const SIG = 'domain:skills#2 · os-justin · session_01QSeKYmhU5KEj1nukYhp1Tg'; const ok = judgeBody(`${SIG}\nClaim: PM loop round 1 · {{NOW}}\nSeat: \`domain:skills#2\`\nContainer & model: \`S\`, \`mode:subagent\`, \`model: ${TIER_DEFAULT}\`, \`effort: medium\``, { mode: 'comment' }, NOW_MS); t('⭐ a signed, stamped claim passes and comes back RENDERED — the clock this act read is in it', ok.ok && ok.rendered.substituted === 1 && ok.rendered.body.includes(ok.rendered.stamp) && !ok.rendered.body.includes(STAMP_TOKEN)); - // The second seat mark (ruling record 7249169754): readers take `LANE@ACCOUNT` beside `LANE#N`; the writers' printed shape is still `#N`. + // The seat mark (ruling record 7249169754): the writers print `LANE@ACCOUNT` as the shape to write; readers take an old `LANE#N` beside it for good. const ACC = 'repo:objectstack@os-justin · os-justin · session_01QSeKYmhU5KEj1nukYhp1Tg'; const claimOf = (sig, seat) => `${sig}\nClaim: PM loop round 1 · {{NOW}}\nSeat: \`${seat}\`\nContainer & model: \`S\`, \`mode:subagent\`, \`model: ${TIER_DEFAULT}\`, \`effort: medium\``; t('⭐ both seat marks pass the one judge: a claim signed `LANE@ACCOUNT` whose `Seat:` line names that seat is accepted exactly as the `LANE#N` one is — signature and keyed line both read', [judgeBody(claimOf(ACC, 'repo:objectstack@os-justin'), { mode: 'comment' }, NOW_MS).ok, judgeBody(claimOf(ACC, 'repo:objectstack@os-justin'), { mode: 'body' }, NOW_MS).ok, claimKeyedLineRefusals(claimOf(ACC, 'repo:objectstack@os-justin')).length, claimSeatNumber(claimOf(ACC, 'repo:objectstack@os-justin')), claimSeatNumber(claimOf(SIG, 'domain:skills#2'))].join() === [true, true, 0, '@os-justin', 2].join()); const other = judgeBody(claimOf('repo:objectstack@os-justin · os-elon · session_01QSeKYmhU5KEj1nukYhp1Tg', 'repo:objectstack@os-justin'), { mode: 'comment' }, NOW_MS); t('⛔ account X signing account Y\'s seat is REFUSED before the write, as a near miss — it is never posted as Y\'s seat', !other.ok && other.text.includes('reads like a signature and is not one') && other.text.includes('only that same account signs')); t('⛔ a `Seat:` line naming an account seat off the line start is still refused by its owner — present, unreadable, ⛔ never seat 1', claimKeyedLineRefusals(`${ACC}\nClaim: PM loop round 1 — dispatched. Seat: repo:objectstack@os-justin — R1.`).some((r) => r.key === 'Seat') && !claimKeyedLineRefusals(claimOf(ACC, 'repo:objectstack@os-justin')).some((r) => r.key === 'Seat')); + t('⛔ N1 — a claim\'s `Seat:` line is held to its signer: signed by one account\'s seat and declaring ANOTHER account\'s is refused on the `Seat` key before the write, under an account signature and under a numbered one', [claimOf(ACC, 'repo:objectstack@os-elon'), claimOf('repo:objectstack#5 · os-justin · session_01QSeKYmhU5KEj1nukYhp1Tg', 'repo:objectstack@os-elon')].map((body) => [judgeBody(body, { mode: 'comment' }, NOW_MS).ok, claimKeyedLineRefusals(body).map((r) => r.key).join()]).join(';') === 'false,Seat;false,Seat'); + t('N1 CONTROL — its OWN account on the line reads, in any case and under the old numbered signature too; a numbered `Seat:` line is held to nothing new', [claimOf(ACC, 'repo:objectstack@OS-Justin'), claimOf('repo:objectstack#5 · os-justin · session_01QSeKYmhU5KEj1nukYhp1Tg', 'repo:objectstack@os-justin'), claimOf(SIG, 'domain:skills#3'), claimOf(ACC, 'repo:objectstack#5')].map((body) => claimKeyedLineRefusals(body).length).join() === '0,0,0,0'); + // Before its rename lands a seat writes its OLD name on the signature AND on the `Seat:` line (seat-post-protocol.md): + // that claim is one seat to every reader. The mixed claim — old signature, new `Seat:` name — is still accepted (no + // new refusal), and is one seat only once the seat's row is in the retired-number table; the hint names both forms. + const OLD5 = 'repo:objectstack#5 · os-justin · session_01QSeKYmhU5KEj1nukYhp1Tg'; + const seatsOf = (body) => [claimSeatNumber(body), readSignatureLine(body)?.seat].map((mark) => seatMarkOf('repo:objectstack', mark, 'os-justin')); + t('S1 — an unrenamed seat\'s claim keeps the old name on the signature and on the `Seat:` line and reads as ONE seat; the mixed claim is accepted as before and is one seat only through the seat\'s table row; the `Seat` hint names both forms', [judgeBody(claimOf(OLD5, 'repo:objectstack#5'), { mode: 'comment' }, NOW_MS).ok, seatsOf(claimOf(OLD5, 'repo:objectstack#5')).join(), claimKeyedLineRefusals(claimOf(OLD5, 'repo:objectstack@os-justin')).length, seatsOf(claimOf(OLD5, 'repo:objectstack@os-justin')).join(), withSeatNumbers([{ lane: 'repo:objectstack', number: 5, account: 'os-justin' }], () => seatsOf(claimOf(OLD5, 'repo:objectstack@os-justin')).join()), CLAIM_KEY_SPELLINGS.Seat.includes('LANE@ACCOUNT') && CLAIM_KEY_SPELLINGS.Seat.includes('LANE#N')].join(';') === 'true;5,5;0;@os-justin,5;@os-justin,@os-justin;true'); const unsigned = judgeBody('Claim: PM loop round 1 · {{NOW}}', { mode: 'comment' }, NOW_MS, 'label-write'); t('⭐ an unsigned comment is refused, and the refusal names the SENDER it was handed', !unsigned.ok && unsigned.text.startsWith('label-write: REFUSED') && unsigned.text.includes('opens with no signature line')); const typed = judgeBody(`${SIG}\nClaim: PM loop round 1 · 2026-09-10T06:37Z`, { mode: 'comment' }, NOW_MS); @@ -6014,12 +6031,12 @@ export function selfTest() { const judged = (to, key) => judgeBody(KNOCK(to, key), { mode: 'comment' }, NOW_MS); const refused = judged('triage#1'); t('⭐ a contract-review knock addressed to `triage#1` is refused, and the refusal names the seat it was addressed to', !refused.ok && refused.text.startsWith('post-stamped: REFUSED') && refused.text.includes('`To: triage#1`')); - t('⭐ …and the refusal names the L2 seat\'s mailbox, the sibling fallback, the owed-review list and the rule\'s home', refused.text.includes('`To: l2-review#N`') && refused.text.includes('`Mailbox:`') && refused.text.includes('sibling lane seat') && refused.text.includes('check-owed-reviews.mjs') && refused.text.includes('references/contract-review.md') && refused.text.includes('Nothing was written')); + t('⭐ …and the refusal names the L2 seat\'s mailbox, the sibling fallback, the owed-review list and the rule\'s home', refused.text.includes('`To: l2-review@ACCOUNT`') && refused.text.includes('`Mailbox:`') && refused.text.includes('sibling lane seat') && refused.text.includes('check-owed-reviews.mjs') && refused.text.includes('references/contract-review.md') && refused.text.includes('Nothing was written')); t('⭐ a MALFORMED knock to triage is refused too — no reason, a bare PR number, a second line: the reader\'s unreadable reading still names the key and the seat', [`Request: contract-review · PR #26766 · head ${HEAD}`, 'Request: contract-review · 26766 · rationed', `Request: contract-review · PR #26766 · head ${HEAD} · rationed\nbecause fable is short today`].every((key) => { const r = judged('triage#1', key); return !r.ok && r.text.includes('`To: triage#1`'); }) && judged('review#1', `Request: contract-review · PR #26766 · head ${HEAD}`).ok); t('a bare `To: triage` reads as `triage#1` (the doorbell reader\'s seat spelling) and is refused the same way', !judged('triage').ok && !judged('Triage#2').ok); t('⭐ both seat marks: the same knock addressed to a triage seat named by its account (`triage@ACCOUNT`) is refused exactly as `triage#1` is, whatever the case of the account, and the refusal names the seat as addressed', (() => { const r = judged('triage@os-help'); return !r.ok && r.text.startsWith('post-stamped: REFUSED') && r.text.includes('`To: triage@os-help`') && !judged('Triage@OS-Help').ok && !judged('triage#1').ok; })()); t('⭐ …a MALFORMED knock to it is refused too, and every other key to it passes, as for the numbered seat', !judged('triage@os-help', `Request: contract-review · PR #26766 · head ${HEAD}`).ok && judged('triage@os-help', 'Request: urgent-triage · #26766 · main red on Test Core').ok && judged('triage@os-help', 'Request: triage · #26766 · which lane takes it').ok); - t('⛔ control — the lane word is what is judged, not the mark: an L2 or a sibling lane seat named by its account passes as its numbered seat does, and a lane that only starts with the word is not triage', judged('l2-review@os-bill').ok && judged('review@os-bill').ok && judged('domain:server@os-bill').ok && judged('repo:objectstack@os-help').ok && ['triage#1', 'triage@os-help'].every((to) => triageContractReviewKnock(KNOCK(to))?.to === to) && [KNOCK('l2-review@os-help'), KNOCK('repo:triage@os-help'), KNOCK('repo:triage#1')].every((b) => triageContractReviewKnock(b) === null)); + t('⛔ control — the lane word is what is judged, not the mark: an L2 or a sibling lane seat named by its account passes as its numbered seat does, and a lane that only ends with the word (`repo:triage`) is not the triage lane', judged('l2-review@os-bill').ok && judged('review@os-bill').ok && judged('domain:server@os-bill').ok && judged('repo:objectstack@os-help').ok && ['triage#1', 'triage@os-help'].every((to) => triageContractReviewKnock(KNOCK(to))?.to === to) && [KNOCK('l2-review@os-help'), KNOCK('repo:triage@os-help'), KNOCK('repo:triage#1')].every((b) => triageContractReviewKnock(b) === null)); t('⭐ the same knock addressed to an L2 seat passes — under its lane word `l2-review` and under the old spelling `review`', judged('l2-review#1').ok && judged('l2-review#2').ok && judged('review#1').ok && judged('review#2').ok); t('…and to a sibling lane seat, the fallback while no L2 seat is seated', judged('domain:server#2').ok); t('⛔ every other key to triage is untouched: `Request: urgent-triage` and `Request: triage` pass', judged('triage#1', 'Request: urgent-triage · #26766 · main red on Test Core').ok && judged('triage#1', 'Request: triage · #26766 · which lane takes it').ok); diff --git a/scripts/pm/record-recognisers.mjs b/scripts/pm/record-recognisers.mjs index 8a7d3204248..4b24c739588 100644 --- a/scripts/pm/record-recognisers.mjs +++ b/scripts/pm/record-recognisers.mjs @@ -102,7 +102,9 @@ import { directiveValues, labelNames, readSignatureLine, - seatIdOf, + comparedSeatId, + SIGNATURE_ACCOUNT_SOURCE, + signedSeatId, refsTargets, RELEASE_COMMENT_MARKER, releaseAnswersClaim, @@ -151,7 +153,7 @@ import { quoteLine, readClause2Line } from './clause2-line.mjs'; // A mailbox message's `To:` line names a SEAT, spelled as the mailbox opener spells a seat — its // `seatKey`, imported, ⛔ never a second seat shape. That file imports nothing of this graph's // top-level-await half (only the relay validator and `gh-pages.mjs`), so the edge adds no cycle. -import { MAILBOX_LABEL, isL2ReviewLane, L2_REVIEW_LANE_WORDS, mailboxBody, mailboxOwner, seatKey } from './mailbox-open.mjs'; +import { MAILBOX_LABEL, isL2ReviewLane, L2_REVIEW_LANE_WORDS, mailboxBody, mailboxOwner, SEAT_ACCOUNT_SOURCE, seatKey } from './mailbox-open.mjs'; // Who may ring a mailbox: the relay's identity (`RELAY_COMMENT_AUTHOR`, the op table's — that file is already // in this graph through `mailbox-open.mjs`) and the maintainers (`GOVERNED_APPROVERS`), judged by the queue // guard's own author predicate, ⛔ never a second list of logins. The guard imports nothing of this graph at @@ -873,12 +875,12 @@ export function localRunsStand(reading) { * lower tier -- and the hand-off is one PR comment carrying this line beside * the existing `needs:contract-review` label: * - * Contract-review-handoff: l2-review#1 — CONTRACT_REVIEW_TIER unavailable (HTTP 429, 2026-10-27T13:00Z) · head 1b03a9c3 + * Contract-review-handoff: l2-review@os-bill — CONTRACT_REVIEW_TIER unavailable (HTTP 429, 2026-10-27T13:00Z) · head 1b03a9c3 * - * Three facts, each required: the TARGET (an L2 seat `l2-review#N` -- old spelling `review#N`, still read -- or a - * sibling seat while no L2 seat is seated: a repo seat `repo:#N` or an epic seat `epic:##`, the - * seat spellings a live seat signs with since the domain seats retired, and a retired domain seat's - * `domain:#N`, still read -- a closed set of seat shapes; ⛔ never `triage`, which takes no contract + * Three facts, each required: the TARGET (an L2 seat `l2-review@ACCOUNT` -- or a sibling seat while no L2 seat is + * seated: a repo seat `repo:@ACCOUNT` or an epic seat `epic:#@ACCOUNT`, the spellings a seat signs with + * (ruling record 7249169754); the old numbered spellings `l2-review#N`, `review#N`, `repo:#N`, + * `epic:##` and a retired domain seat's `domain:#N` are still read -- a closed set of seat shapes; ⛔ never `triage`, which takes no contract * review, so a line naming it is unreadable), the TIER that was unavailable -- the constant's NAME, exactly as `Served-tier:` * spells it, ⛔ never a model id -- with its reason and UTC time in the * parentheses, and the HEAD the hand-off is for, 7 to 40 hex. A line missing @@ -894,11 +896,11 @@ export const CONTRACT_REVIEW_HANDOFF_KEY = 'Contract-review-handoff'; /** * The line exactly as the rule text prints it, placeholders included. This file's self-test pins it * VERBATIM in `references/contract-review.md`, so the rule text cannot drift from this constant. The - * placeholder names the LIVE target spellings only -- an L2 seat, a repo seat, an epic seat; the old - * `review#N` and a retired `domain:#N` stay READ by `HANDOFF_TARGET` but are not offered to a - * writer -- and the self-test reads each placeholder shape, filled, through `HANDOFF_TARGET`. + * placeholder names the LIVE target spellings only -- an L2 seat, a repo seat, an epic seat, each named by its + * account; every numbered spelling and a retired `domain:#N` stay READ by `HANDOFF_TARGET` but are not + * offered to a writer -- and the self-test reads each placeholder shape, filled, through `HANDOFF_TARGET`. */ -export const CONTRACT_REVIEW_HANDOFF_TEMPLATE = `${CONTRACT_REVIEW_HANDOFF_KEY}: — CONTRACT_REVIEW_TIER unavailable (, ) · head `; +export const CONTRACT_REVIEW_HANDOFF_TEMPLATE = `${CONTRACT_REVIEW_HANDOFF_KEY}: — CONTRACT_REVIEW_TIER unavailable (, ) · head `; const CONTRACT_REVIEW_HANDOFF_LINE = keyLineRegex(CONTRACT_REVIEW_HANDOFF_KEY); /** The same key as a MARKER over a whole comment body -- `latestMarkedComment`'s convention (multiline, `g`-less). */ const CONTRACT_REVIEW_HANDOFF_MARKER = new RegExp(CONTRACT_REVIEW_HANDOFF_LINE.source, 'm'); @@ -907,10 +909,11 @@ const CONTRACT_REVIEW_HANDOFF_MARKER = new RegExp(CONTRACT_REVIEW_HANDOFF_LINE.s * `repo:#N` (a repo name may carry `.` and `-`, `repo:www.objectos.ai#2`), an epic seat `epic:##` (seat * k of epic N, both numbers required) or a retired domain seat `domain:#N`, the seat number required -- a * separator (an em dash, a hyphen pair, a hyphen or a colon), then the rest. `triage` and every other seat word - * match nothing. Each lane also reads with the second seat mark, `@ACCOUNT` in place of `#N` (`l2-review@os-bill`, + * match nothing. Each lane reads with either seat mark, `@ACCOUNT` or the old `#N` (`l2-review@os-bill`, * `repo:objectstack@os-bill`; `check-half-states.mjs`'s banner): that account's seat, lower-cased like the rest. + * The account is the grammar's own spelling (`SIGNATURE_ACCOUNT_SOURCE`), composed and never typed again. */ -const HANDOFF_SEAT_MARK = '(?:#[1-9][0-9]*(?![0-9])|@[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}(?![A-Za-z0-9]))'; +const HANDOFF_SEAT_MARK = `(?:#[1-9][0-9]*(?![0-9])|@${SIGNATURE_ACCOUNT_SOURCE}(?![A-Za-z0-9]))`; const HANDOFF_TARGET = new RegExp(`^((?:${L2_REVIEW_LANE_WORDS.join('|')}|repo:[a-z0-9][a-z0-9._-]*|domain:[a-z][a-z0-9._-]*|epic:#[1-9][0-9]*)${HANDOFF_SEAT_MARK})[ \\t]*(?:—|--|-|:)?[ \\t]*(.*)$`, 'i'); /** `(reason, UTC time)` then ` · head SHA` -- the time is the LAST comma-separated item in the parentheses. */ const HANDOFF_TAIL = /^\(([^()]*?)[ \t]*,[ \t]*([^,()]+)\)[ \t]*·[ \t]*head[ \t]+`?([0-9a-fA-F]{7,40})`?[ \t]*$/; @@ -921,7 +924,9 @@ const HANDOFF_TAIL = /^\(([^()]*?)[ \t]*,[ \t]*([^,()]+)\)[ \t]*·[ \t]*head[ \t * @returns {{ state: 'missing' } * | { state: 'unreadable', line: string } * | { state: 'read', to: string, tier: string, reason: string, at: string, head: string }} - * `to` is the target seat, lower-cased (`l2-review#1`, `review#1`, `repo:objectstack#2`, `epic:#35205#1`). + * `to` is the target seat as readers compare it (`comparedSeatId`): lower-cased (`l2-review@os-bill`, + * `l2-review#1`, `review#1`, `repo:objectstack#2`, `epic:#35205#1`), `review@X` as `l2-review@X`, and a + * retired number the table carries as the account seat it became. */ export function readContractReviewHandoff(text) { for (const line of String(text ?? '').split(/\r?\n/)) { @@ -939,7 +944,7 @@ export function readContractReviewHandoff(text) { const tail = /^unavailable\b[ \t]*(.*)$/i.exec(rest); const parts = tail ? HANDOFF_TAIL.exec(tail[1].trim()) : null; if (!parts || parts[1].trim() === '') return unreadable; - return { state: 'read', to: target[1].toLowerCase(), tier: tier[1], reason: parts[1].trim(), at: parts[2].trim(), head: parts[3] }; + return { state: 'read', to: comparedSeatId(target[1]), tier: tier[1], reason: parts[1].trim(), at: parts[2].trim(), head: parts[3] }; } return { state: 'missing' }; } @@ -1365,7 +1370,7 @@ export function contractReviewHold(rows, headSha, { now } = {}) { * or a patrol takes; nothing here changes an exit. */ export const MAILBOX_KEYS = Object.freeze([ - { id: 'request:contract-review', kind: 'Request', key: 'contract-review', from: 'lane', to: 'an L2 seat (`l2-review#N`; a seat seated under the old spelling keeps `review#N`), or a sibling seat of the lane while none is seated', when: 'in the same stroke as the PR\'s `Contract-review-handoff:` line (the seat\'s own review tier is unavailable)', template: 'Request: contract-review · PR #n · head SHA · REASON' }, + { id: 'request:contract-review', kind: 'Request', key: 'contract-review', from: 'lane', to: 'an L2 seat (`l2-review@ACCOUNT`; an old `l2-review#N` or `review#N` still reads), or a sibling seat of the lane while none is seated', when: 'in the same stroke as the PR\'s `Contract-review-handoff:` line (the seat\'s own review tier is unavailable)', template: 'Request: contract-review · PR #n · head SHA · REASON' }, { id: 'request:triage', kind: 'Request', key: 'triage', from: 'lane', to: 'triage', when: 'a question about a card\'s fate, route or grade', template: 'Request: triage · #n · ONE-LINE-QUESTION' }, { id: 'request:urgent-triage', kind: 'Request', key: 'urgent-triage', from: 'any seat', to: 'triage', when: 'a p0 suspect, main red, a deterministic queue red', template: 'Request: urgent-triage · #n · ONE-LINE-CRITERION' }, { id: 'request:main-red', kind: 'Request', key: 'main-red', from: 'the seat that files the main-red anchor card', to: 'triage, or the director when triage is absent', when: 'the anchor card is filed', template: 'Request: main-red · CHECK-NAME · anchor #n · suggested lane X' }, @@ -1377,10 +1382,10 @@ export const MAILBOX_KEYS = Object.freeze([ { id: 'notify:ruling', kind: 'Notify', key: 'ruling', from: 'the seat that recorded a maintainer ruling', to: 'the seat whose card or draft it changes', when: 'the ruling is recorded', template: 'Notify: ruling · #n · LETTER · record ID' }, { id: 'notify:serial', kind: 'Notify', key: 'serial', from: 'a seat', to: 'a sibling seat or another lane', when: 'claimed file surfaces overlap, or one card must land first', template: 'Notify: serial · #a behind #b' }, { id: 'notify:landed', kind: 'Notify', key: 'landed', from: 'the seat whose card landed first', to: 'the seat a `serial` held behind it', when: 'the card a `serial` named lands', template: 'Notify: landed · #b' }, - { id: 'notify:seat-online', kind: 'Notify', key: 'seat-online', from: 'the seating session (or a forced takeover, for the walled account)', to: 'the lane\'s sibling seats and triage', when: 'at seating', template: 'Notify: seat-online · LANE#N · LOGIN · mailbox #m · patrol TRIGGER_ID · takes: #a #b …' }, - { id: 'notify:seat-offline', kind: 'Notify', key: 'seat-offline', from: 'the signing-off session', to: 'the lane\'s sibling seats and triage', when: 'at sign-off', template: 'Notify: seat-offline · LANE#N · in-flight: … · stay-behind: … · brief ID' }, - { id: 'notify:split', kind: 'Notify', key: 'split', from: 'a seat of a multi-seat lane', to: 'its sibling seats', when: 'at round open, only when the list changed', template: 'Notify: split · LANE#N · takes: … · leaves: …' }, - { id: 'notify:security', kind: 'Notify', key: 'security', from: 'the seat holding the finding (a dev\'s or a QA runner\'s reaches its PM session privately first); triage, for a public card it labelled `security`', to: 'security#1', when: 'the seat\'s relay `advisory_create` draft landed: the opaque advisory id ALONE; or triage labelled a public card `security`: its number ALONE — never a mechanism, a path or an object name, and never a PRIVATE repository\'s card (that repository\'s own lane holds it)', template: 'Notify: security · GHSA-ID or #n' }, + { id: 'notify:seat-online', kind: 'Notify', key: 'seat-online', from: 'the seating session', to: 'the lane\'s sibling seats and triage', when: 'at seating', template: 'Notify: seat-online · LANE@ACCOUNT · LOGIN · mailbox #m · patrol TRIGGER_ID · takes: #a #b …' }, + { id: 'notify:seat-offline', kind: 'Notify', key: 'seat-offline', from: 'the signing-off session', to: 'the lane\'s sibling seats and triage', when: 'at sign-off', template: 'Notify: seat-offline · LANE@ACCOUNT · in-flight: … · stay-behind: … · brief ID' }, + { id: 'notify:split', kind: 'Notify', key: 'split', from: 'a seat of a multi-seat lane', to: 'its sibling seats', when: 'at round open, only when the list changed', template: 'Notify: split · LANE@ACCOUNT · takes: … · leaves: …' }, + { id: 'notify:security', kind: 'Notify', key: 'security', from: 'the seat holding the finding (a dev\'s or a QA runner\'s reaches its PM session privately first); triage, for a public card it labelled `security`', to: 'the security seat that owns the advisories (its seat post names it)', when: 'the seat\'s relay `advisory_create` draft landed: the opaque advisory id ALONE; or triage labelled a public card `security`: its number ALONE — never a mechanism, a path or an object name, and never a PRIVATE repository\'s card (that repository\'s own lane holds it)', template: 'Notify: security · GHSA-ID or #n' }, { id: 'request:progress', kind: 'Request', key: 'progress', from: 'triage', to: 'the claiming seat (or the online sibling an off-shift seat\'s items went to)', when: 'a claimed card or an open PR whose last PROGRESS (its head commit, any non-triage comment, a label change by its seat — never `updated_at`) is 3 h old: at most one per item per 60 min; none while an answered ETA stands, or while the item is parked (`Blocked-by:` / `Resume-from:`) or waits on a decision card; two unanswered ⇒ the round record lists it and the seat reads as possibly down', template: 'Request: progress · #n · idle since TIME' }, { id: 'request:cloud-confirm', kind: 'Request', key: 'cloud-confirm', from: 'the lane seat holding a card whose fix and acceptance both land in this repository', to: 'a `repo:cloud` seat', when: 'the card\'s only cloud tie is a fact, a reading or a confirmation, so it stays in its lane — in flight too, instead of a `Release:` (a card that reads or changes cloud code, or carries a cloud half, still routes whole to the cloud PM)', template: 'Request: cloud-confirm · #n · ONE-LINE-QUESTION' }, { id: 'notify:cloud-confirm', kind: 'Notify', key: 'cloud-confirm', from: 'the `repo:cloud` seat that answered', to: 'the asking lane seat', when: 'answering a cloud-confirm ring — the record is a comment on #n giving the fact, the reading or the confirmation', template: 'Notify: cloud-confirm · #n · record ID' }, @@ -1678,7 +1683,7 @@ export function readMailboxLine(text) { const toLine = MAILBOX_TO_LINE.exec(lines[toAt]); if (!toLine) return { state: 'refused', reason: 'the first line is not `To: ` — a message names the seat it is for, then its key', line: quoteLine(lines[toAt]) }; const to = seatKey(stripValueDecoration(toLine[1]).replace(/(?:[ \t]|\*\*|`)+$/, '')); - if (!to) return { state: 'refused', reason: '`To:` names no seat — spell it LANE#N, e.g. domain:ui#4; a login is not a seat', line: quoteLine(lines[toAt]) }; + if (!to) return { state: 'refused', reason: '`To:` names no seat — spell it LANE@ACCOUNT, e.g. repo:objectstack@os-bill (an old LANE#N still reads); a login alone is not a seat', line: quoteLine(lines[toAt]) }; const at = lines.findIndex((l, i) => i > toAt && l.trim() !== ''); if (at < 0) return { state: 'refused', reason: 'no key line under `To:`', line: quoteLine(lines[toAt]) }; const first = lines[at]; @@ -1850,7 +1855,7 @@ function claimDelegate(card, rows) { const { row, index } = live[newest.index]; if (releaseAnswersClaim(latestMarkedComment(rows, RELEASE_COMMENT_MARKER), { ...newest, index })) return null; const signed = readSignatureLine(row?.body); - const seat = signed ? seatKey(seatIdOf(signed.lane, signed.seat)) : null; + const seat = signed ? seatKey(signedSeatId(signed)) : null; const session = claimThreadSession(row?.body); if (!seat || !session) return null; return { seat: seat.key, session, where: `claim on #${card.number} (comment ${row?.id ?? '?'}) Thread session` }; @@ -1886,7 +1891,10 @@ function claimDelegate(card, rows) { * one of its threads not an array — reads `{ state: 'unreadable', gaps }`, never a smaller roster, and a row * lists only when its `state` reads `open` — a closed row, or one with no `state` at all, lists nobody. * Rows in, `{ state: 'read', seats }` out — `seats` a Map from a seat's canonical key (`seatKey`) to a Map of each - * session it lists to where it is listed. Pure. + * session it lists to where it is listed. Every source is keyed by the seat as readers compare it (`signedSeatId`; + * a mailbox by its opener's login, `comparedSeatId`): a renamed seat's post, its mailbox opened under the old + * number and its earlier `#N` claims list under ONE key, so its sessions are not split across two seats. Pure + * over the retired-number table. * * @param {{ posts?: object[], mailboxes?: object[], claims?: { card: object, rows: object[] }[] }} listings — the * open `pm:seat` issues, the open pulls, and the open claimed cards with their whole threads @@ -1905,7 +1913,7 @@ export function seatSessionRoster({ posts, mailboxes, claims = [] } = {}) { for (const post of posts) { if (!post || post.state !== 'open' || post.pull_request || !labelNames(post).includes('pm:seat') || !seatOnDuty(post)) continue; const signed = readSignatureLine(post.body); - const seat = signed ? seatKey(seatIdOf(signed.lane, signed.seat)) : null; + const seat = signed ? seatKey(signedSeatId(signed)) : null; if (!seat) continue; list(seat.key, signed.session, `seat post #${post.number}`); for (const value of directiveValues(post.body, 'Successor-of')) { @@ -1915,7 +1923,8 @@ export function seatSessionRoster({ posts, mailboxes, claims = [] } = {}) { } for (const pr of mailboxes) { if (!pr || pr.state !== 'open') continue; - const seat = mailboxOwner(pr)?.seat ?? null; + const owner = mailboxOwner(pr); + const seat = owner?.seat ? comparedSeatId(owner.seat, owner.login) : null; const session = seat ? mailboxOpeningSession(pr.body) : null; if (session) list(seat, session, `mailbox opening #${pr.number}`); } @@ -1943,8 +1952,8 @@ export function knockSignature(body, roster) { } const signed = readSignatureLine(body); if (!signed) return unlisted('the knock opens with no seat signature line'); - const seat = seatKey(seatIdOf(signed.lane, signed.seat))?.key ?? null; - if (!seat) return unlisted(`\`${seatIdOf(signed.lane, signed.seat)}\` names no seat a mailbox serves`); + const seat = seatKey(signedSeatId(signed))?.key ?? null; + if (!seat) return unlisted(`\`${signedSeatId(signed)}\` names no seat a mailbox serves`); const listed = roster.seats.get(seat); if (!listed || listed.size === 0) return unlisted(`${seat} lists no session (no held seat post signed by it, no open mailbox opening, no open claim naming its card thread)`); if (!listed.has(signed.session)) return unlisted(`${signed.session} is not a session ${seat} lists`); @@ -1960,10 +1969,10 @@ export function knockSignature(body, roster) { */ export function mailboxKeyLines() { return [ - `Mailbox doorbell — the comment's first line is \`To: \` (LANE#N), the next is ONE of these ${MAILBOX_KEYS.length} keys:`, + `Mailbox doorbell — the comment's first line is \`To: \` (LANE@ACCOUNT; an old LANE#N still reads), the next is ONE of these ${MAILBOX_KEYS.length} keys:`, `one event, one line of at most ${MAILBOX_LINE_MAX_BYTES} bytes, keys and numbers only; anything else is a half-state.`, `A knock counts only from ${MAILBOX_KNOCK_AUTHORS.join(', ')}; any other author is ${MAILBOX_IGNORED_AUTHOR.replace(/^ignored: /, 'ignored — ')}, its body never read.`, - `A relay knock opens with its seat signature (LANE#N · ACCOUNT · SESSION), from a session that seat lists — its held seat post (Successor-of: included), its open mailbox opening, or the Thread session: line of its open claim on a card (a card thread, as the seat's delegate; a claim counts only from an author the knock fence trusts); any other is ${MAILBOX_UNVERIFIED_SIGNATURE}, not acted on. Listed is consistency, not proof: a copied signature line also reads listed.`, + `A relay knock opens with its seat signature (LANE@ACCOUNT · ACCOUNT · SESSION), from a session that seat lists — its held seat post (Successor-of: included), its open mailbox opening, or the Thread session: line of its open claim on a card (a card thread, as the seat's delegate; a claim counts only from an author the knock fence trusts); any other is ${MAILBOX_UNVERIFIED_SIGNATURE}, not acted on. Listed is consistency, not proof: a copied signature line also reads listed.`, '', ...MAILBOX_KEYS.flatMap((k) => [k.template, ` ${k.from} → ${k.to}; ${k.when}`]), '', @@ -2920,7 +2929,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ '⭐ the card-thread delegate: the session an open claim names on its `Thread session:` line joins the roster of the seat that signed it — one spelling, dropped when released, superseded or closed': 17, '⭐ the signature line: the reader reads LANE#N · ACCOUNT · SESSION exactly, and one leading signature changes no first-line reading': 22, // Readers first: every writer's default is still `#N`. - '⭐ the seat mark: `LANE@ACCOUNT` reads beside `LANE#N` (ruling record 7249169754) — a seat is its lane AND its mark, and neither mark reads as the other': 16, + '⭐ the seat mark: `LANE@ACCOUNT` reads beside `LANE#N` (ruling record 7249169754) — a seat is its lane AND its mark, and neither mark reads as the other': 21, '⭐ the `Contract-review-claim:` line — session, FULL head, time; lapses on a moved head or after two hours; the earliest live claim holds': 24, '⭐ the `Contract-review-hold:` line — session, head, reason, until; a new head clears it; at 24 hours it reads overdue and still holds': 23, // The tie relation: the cards a fold's equal closing keywords deliver, for the `--land` dogfood gate, which reads @@ -3419,7 +3428,7 @@ export async function selfTest() { t('⛔ the target is the closed set of two shapes and the tier is the constant\'s NAME — `triage`, `director`, a seat with no number, the default tier or a model id is unreadable', [`${CONTRACT_REVIEW_HANDOFF_KEY}: triage — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`, `${CONTRACT_REVIEW_HANDOFF_KEY}: director — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`, `${CONTRACT_REVIEW_HANDOFF_KEY}: review — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`, `${CONTRACT_REVIEW_HANDOFF_KEY}: domain:ui — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`, `${CONTRACT_REVIEW_HANDOFF_KEY}: review#1 — ${TIER_DEFAULT_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`, `${CONTRACT_REVIEW_HANDOFF_KEY}: review#1 — ${CONTRACT_REVIEW_TIER} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`].every((l) => readContractReviewHandoff(l).state === 'unreadable')); t('⭐ the line is spelled VERBATIM, in a code span, in the rule text (`references/contract-review.md`) — the rule text cannot drift from the template constant (that `HANDOFF_TARGET` reads each shape it offers is the "every target shape" case)', (() => { const rules = readFileSync(new URL('../../.claude/skills/pm-dispatch/references/contract-review.md', import.meta.url), 'utf8'); return rules.includes(`\`${CONTRACT_REVIEW_HANDOFF_TEMPLATE}\``) && CONTRACT_REVIEW_HANDOFF_TEMPLATE.startsWith(`${CONTRACT_REVIEW_HANDOFF_KEY}: `); })()); t('⛔ the TEMPLATE sent verbatim is unreadable — a placeholder names no seat and no head', readContractReviewHandoff(CONTRACT_REVIEW_HANDOFF_TEMPLATE).state === 'unreadable' && contractReviewHandoff([HO_ROW(CONTRACT_REVIEW_HANDOFF_TEMPLATE, 4407)], HO_HEAD).state === 'unreadable'); - t('⭐ every target shape the TEMPLATE offers, filled in, READS — the placeholder names exactly the live spellings (an L2 seat, a repo seat, an epic seat) and no retired `domain:` seat', (() => { const m = /: <(.*)> — /.exec(CONTRACT_REVIEW_HANDOFF_TEMPLATE); if (!m) return false; const shapes = m[1].split('|'); const fill = (shape) => shape.replace('NAME', 'objectstack').replace('#N#k', '#35205#1').replace(/#N$/, '#2'); const filled = (to) => CONTRACT_REVIEW_HANDOFF_TEMPLATE.replace(`<${m[1]}>`, to).replace('', 'HTTP 429').replace('', '2026-10-27T13:00Z').replace('', HO_HEAD); return shapes.join() === 'l2-review#N,repo:NAME#N,epic:#N#k' && shapes.every((sh) => { const r = readContractReviewHandoff(filled(fill(sh))); return r.state === 'read' && r.to === fill(sh) && r.head === HO_HEAD; }) && !m[1].includes('domain:'); })()); + t('⭐ every target shape the TEMPLATE offers, filled in, READS — the placeholder names exactly the live spellings (an L2 seat, a repo seat, an epic seat) and no retired `domain:` seat', (() => { const m = /: <(.*)> — /.exec(CONTRACT_REVIEW_HANDOFF_TEMPLATE); if (!m) return false; const shapes = m[1].split('|'); const fill = (shape) => shape.replace('NAME', 'objectstack').replace('#N@', '#35205@').replace('ACCOUNT', 'os-bill'); const filled = (to) => CONTRACT_REVIEW_HANDOFF_TEMPLATE.replace(`<${m[1]}>`, to).replace('', 'HTTP 429').replace('', '2026-10-27T13:00Z').replace('', HO_HEAD); return shapes.join() === 'l2-review@ACCOUNT,repo:NAME@ACCOUNT,epic:#N@ACCOUNT' && shapes.every((sh) => { const r = readContractReviewHandoff(filled(fill(sh))); return r.state === 'read' && r.to === fill(sh) && r.head === HO_HEAD; }) && !m[1].includes('domain:'); })()); t('⭐ the L2 seat is a target under its new word and under the old one: `l2-review#N` reads, lower-cased, and hands the head to it; `review#N` still reads; `l2-review` with no number, `l2#1` and `l1-review#1` are unreadable', (() => { const line = (to) => `${CONTRACT_REVIEW_HANDOFF_KEY}: ${to} — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`; const r = contractReviewHandoff([HO_ROW(line('L2-Review#2'))], HO_HEAD); return r.state === 'handed' && r.to === 'l2-review#2' && readContractReviewHandoff(line('l2-review#12')).to === 'l2-review#12' && readContractReviewHandoff(line('review#1')).to === 'review#1' && ['l2-review', 'l2#1', 'l1-review#1'].every((to) => readContractReviewHandoff(line(to)).state === 'unreadable'); })()); t('⭐ a sibling seat of the lane is a target while no L2 seat is seated: `domain:#N` reads, lower-cased, and hands the head to it', (() => { const line = `${CONTRACT_REVIEW_HANDOFF_KEY}: Domain:UI#2 — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`; const r = contractReviewHandoff([HO_ROW(line)], HO_HEAD); return readContractReviewHandoff(line).to === 'domain:ui#2' && r.state === 'handed' && r.to === 'domain:ui#2' && readContractReviewHandoff(`${CONTRACT_REVIEW_HANDOFF_KEY}: review#12 — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`).to === 'review#12'; })()); t('⭐ a sibling REPO seat is a target — the spelling a live seat signs with since the domain seats retired: `repo:#N` reads, lower-cased, a dotted repo name included, and hands the head to it; `repo:` with no number is unreadable', (() => { const line = (to) => `${CONTRACT_REVIEW_HANDOFF_KEY}: ${to} — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-10-27T13:00Z) · head ${HO_HEAD}`; const r = contractReviewHandoff([HO_ROW(line('Repo:ObjectStack#2'))], HO_HEAD); return r.state === 'handed' && r.to === 'repo:objectstack#2' && readContractReviewHandoff(line('repo:www.objectos.ai#12')).to === 'repo:www.objectos.ai#12' && ['repo:objectstack', 'repo:#2', 'repo:objectstack#0'].every((to) => readContractReviewHandoff(line(to)).state === 'unreadable'); })()); @@ -3839,7 +3848,7 @@ export async function selfTest() { const ACC = `repo:objectstack@os-justin · os-justin · ${SESS}`; const J = (v) => JSON.stringify(v); t('⭐ both forms read: `#N` gives the seat number, `@ACCOUNT` the mark `@account`, lower-cased — lane, account and session as before', J([hs.readSignatureLine(NUM), hs.readSignatureLine(ACC), hs.readSignatureLine(`repo:objectstack@OS-Justin · os-justin · ${SESS}`)?.seat]) === J([{ lane: 'repo:objectstack', seat: 1, account: 'os-elon', session: SESS, line: NUM }, { lane: 'repo:objectstack', seat: '@os-justin', account: 'os-justin', session: SESS, line: ACC }, '@os-justin'])); - t('every lane a signature carries reads with the account mark — a hyphenated lane, an epic (its `#N` is the epic, never a seat), triage, the L2 seat under both words, coordinator', ['domain:engine-core', 'repo:cloud', 'epic:#26000', 'triage', 'l2-review', 'review', 'coordinator'].every((lane) => { const r = hs.readSignatureLine(`${lane}@os-zhuang · os-zhuang · ${SESS}`); return r?.lane === lane && r.seat === '@os-zhuang' && hs.seatIdOf(r.lane, r.seat) === `${lane}@os-zhuang`; })); + t('every lane a signature carries reads with the account mark — a hyphenated lane, an epic (its `#N` is the epic, never a seat), triage, the L2 seat under both words (ONE seat: the old word `review` is keyed as `l2-review`), coordinator', ['domain:engine-core', 'repo:cloud', 'epic:#26000', 'triage', 'l2-review', 'review', 'coordinator'].every((lane) => { const r = hs.readSignatureLine(`${lane}@os-zhuang · os-zhuang · ${SESS}`); return r?.lane === lane && r.seat === '@os-zhuang' && hs.seatIdOf(r.lane, r.seat) === `${lane === 'review' ? 'l2-review' : lane}@os-zhuang`; })); t('⛔ account X signing account Y\'s seat is NOT a signature — never read as Y\'s seat, nor as X\'s — and the writers\' refusal names the cause', hs.readSignatureLine(`repo:objectstack@os-justin · os-elon · ${SESS}`) === null && hs.signatureRefusal(`repo:objectstack@os-justin · os-elon · ${SESS}\nbody`)?.why.includes('only that same account signs') === true && hs.signatureRefusal(`${ACC}\nbody`) === null); t('⛔ the near misses of the account mark: no account, a space around the `@`, a doubled or trailing hyphen, both marks at once', [`repo:objectstack@ · os-justin · ${SESS}`, `repo:objectstack @os-justin · os-justin · ${SESS}`, `repo:objectstack@ os-justin · os-justin · ${SESS}`, `repo:objectstack@os--justin · os--justin · ${SESS}`, `repo:objectstack@os-justin- · os-justin · ${SESS}`, `repo:objectstack#1@os-justin · os-justin · ${SESS}`].every((line) => hs.readSignatureLine(line) === null)); t('⭐ CONTROL — a `#N` signature keeps reading as that numbered seat: seat 1\'s line is `repo:objectstack#1`, whoever signed it, and is no account\'s seat; the two ids of one lane differ', hs.seatIdOf('repo:objectstack', hs.readSignatureLine(NUM).seat) === 'repo:objectstack#1' && hs.seatIdOf('repo:objectstack', hs.readSignatureLine(`repo:objectstack#1 · os-justin · ${SESS}`).seat) === 'repo:objectstack#1' && hs.seatIdOf('repo:objectstack', hs.readSignatureLine(ACC).seat) === 'repo:objectstack@os-justin' && hs.seatMark('#1') !== hs.seatMark('@1')); @@ -3852,7 +3861,7 @@ export async function selfTest() { t('⭐ `To: LANE@ACCOUNT` addresses that seat, and a key\'s seat field reads it: no number, the account named', (() => { const r = readMailboxLine(MSG('Notify: split · repo:objectstack@os-bill · takes: #27077 · leaves: none', 'repo:objectstack@os-bill')); return r.state === 'read' && r.to === 'repo:objectstack@os-bill' && SAME(r.seat, { key: 'repo:objectstack@os-bill', lane: 'repo:objectstack', n: null, account: 'os-bill' }); })()); t('⛔ `Notify: seat-online` of an account seat reads under that account only — another login on the line is unreadable', [readMailboxLine(MSG('Notify: seat-online · repo:objectstack@os-bill · OS-Bill · mailbox #27120 · patrol none · takes: none')).state, readMailboxLine(MSG('Notify: seat-online · repo:objectstack@os-bill · os-elon · mailbox #27120 · patrol none · takes: none')).state].join() === 'read,unreadable'); const HO = (to) => readContractReviewHandoff(`${CONTRACT_REVIEW_HANDOFF_KEY}: ${to} — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-11-29T03:00Z) · head 1b03a9c3`); - t('⭐ a hand-off target reads with either mark, lower-cased: an L2 seat, a repo seat and an epic seat named by account — and `triage@ACCOUNT` stays unreadable, as `triage#1` is', J([HO('l2-review@OS-Bill').to, HO('review@os-bill').to, HO('repo:objectstack@os-bill').to, HO('epic:#35205@os-bill').to, HO('l2-review#2').to, HO('triage@os-bill').state, HO('l2-review@').state]) === J(['l2-review@os-bill', 'review@os-bill', 'repo:objectstack@os-bill', 'epic:#35205@os-bill', 'l2-review#2', 'unreadable', 'unreadable'])); + t('⭐ a hand-off target reads with either mark, lower-cased: an L2 seat (under either lane word it is the ONE seat `l2-review@ACCOUNT`), a repo seat and an epic seat named by account — and `triage@ACCOUNT` stays unreadable, as `triage#1` is', J([HO('l2-review@OS-Bill').to, HO('review@os-bill').to, HO('repo:objectstack@os-bill').to, HO('epic:#35205@os-bill').to, HO('l2-review#2').to, HO('triage@os-bill').state, HO('l2-review@').state]) === J(['l2-review@os-bill', 'l2-review@os-bill', 'repo:objectstack@os-bill', 'epic:#35205@os-bill', 'l2-review#2', 'unreadable', 'unreadable'])); // The knock roster: seat 1 is vacant with its old `#1` record standing; os-bill's seat is named by its account. const S_OLD = 'session_01SeatOneVacantAaaaaaaa'; const S_NEW = 'session_01AccountSeatBbbbbbbbbb'; @@ -3863,6 +3872,18 @@ export async function selfTest() { t('⭐ the roster keys each post by the seat its signature names: the account seat lists its session under `LANE@account`, the numbered seat under `LANE#1`', J([...roster.seats.keys()].sort()) === J(['repo:objectstack#1', 'repo:objectstack@os-bill']) && knock('repo:objectstack@os-bill', 'os-bill', S_NEW).state === 'listed' && knock('repo:objectstack@os-bill', 'os-bill', S_NEW).seat === 'repo:objectstack@os-bill'); t('⭐ CONTROL — seat 1\'s `#1` record still reads as seat 1\'s: its session is listed by `repo:objectstack#1` alone, and ⛔ not by the account seat of the same lane', knock('repo:objectstack#1', 'os-elon', S_OLD).state === 'listed' && knock('repo:objectstack#1', 'os-elon', S_OLD).seat === 'repo:objectstack#1' && roster.seats.get('repo:objectstack@os-bill').has(S_OLD) === false); t('⛔ account X\'s knock is never read as account Y\'s seat: os-elon signing `@os-bill` is no signature at all, and os-elon\'s OWN account seat — a different seat of the same lane — lists nothing', knock('repo:objectstack@os-bill', 'os-elon', S_NEW).reason?.includes('opens with no seat signature line') === true && knock('repo:objectstack@os-elon', 'os-elon', S_NEW).reason?.includes('repo:objectstack@os-elon lists no session') === true); + // A retired number and the account seat it became (`seat-numbers.mjs`): os-bill's post was seat 5 before its rename. + const T5 = [{ lane: 'repo:objectstack', number: 5, account: 'os-bill' }]; + const S_MB = 'session_01MailboxOpenedAsFiveCc'; + const S_EARLIER = 'session_01EarlierHolderOfFiveDd'; + const BOX = (number, seat, login, session) => ({ number, state: 'open', labels: [{ name: MAILBOX_LABEL }], head: { ref: 'claude/project-thread-x' }, body: mailboxBody({ seat, login, session }) }); + const renamed = () => seatSessionRoster({ posts: [POST(35217, '[PM seat] repo:objectstack@os-bill — 🟢 os-bill', `${SIGN('repo:objectstack@os-bill', 'os-bill', S_NEW)}\n`)], mailboxes: [BOX(35300, 'repo:objectstack#5', 'os-bill', S_MB), BOX(35301, 'repo:objectstack#5', 'os-old', S_EARLIER)] }); + const knockOn = (r, seat, account, session) => readMailboxComment(DB_ROW(`${SIGN(seat, account, session)}\n${MSG('Notify: landed · #28562', 'repo:objectstack#1')}`), r).signature; + t('⭐ after a rename ONE key lists the seat\'s sessions: its post, signed by account, and the mailbox it opened as seat 5 — so a knock it still signs `#5` reads listed, as the account seat\'s', hs.withSeatNumbers(T5, () => { const r = renamed(); const k = knockOn(r, 'repo:objectstack#5', 'os-bill', S_MB); return J([...r.seats.get('repo:objectstack@os-bill').keys()].sort()) === J([S_NEW, S_MB].sort()) && k.state === 'listed' && k.seat === 'repo:objectstack@os-bill' && k.via === 'mailbox opening #35300'; })); + t('⛔ …an EARLIER holder\'s seat-5 mailbox lists under the numbered seat, never the account\'s: its session is no session of the renamed seat, and its knock is seat 5\'s', hs.withSeatNumbers(T5, () => { const r = renamed(); const k = knockOn(r, 'repo:objectstack#5', 'os-old', S_EARLIER); return r.seats.get('repo:objectstack@os-bill').has(S_EARLIER) === false && J([...r.seats.get('repo:objectstack#5').keys()]) === J([S_EARLIER]) && k.state === 'listed' && k.seat === 'repo:objectstack#5'; })); + t('⭐ CONTROL — with no row the two spellings are two seats, as before the table: the mailbox opened as seat 5 lists under `#5`, and the account seat does not list its session', hs.withSeatNumbers([], () => { const r = renamed(); return J([...r.seats.get('repo:objectstack@os-bill').keys()]) === J([S_NEW]) && r.seats.get('repo:objectstack#5').has(S_MB); })); + t('a hand-off naming a retired number names the account seat it became — the name alone decides, and a number with no row is named as written', J([hs.withSeatNumbers(T5, () => HO('repo:objectstack#5').to), hs.withSeatNumbers(T5, () => HO('repo:objectstack#1').to), hs.withSeatNumbers([], () => HO('repo:objectstack#5').to)]) === J(['repo:objectstack@os-bill', 'repo:objectstack#1', 'repo:objectstack#5'])); + t('N3 — one account pattern: the opener\'s `SEAT_ACCOUNT_SOURCE` (a literal there: that file cannot import the grammar\'s home) is the signature\'s account pattern in lower case, and the hand-off mark is built from the grammar\'s own', SEAT_ACCOUNT_SOURCE === hs.SIGNATURE_ACCOUNT_SOURCE.replaceAll('A-Za-z0-9', 'a-z0-9') && hs.SIGNATURE_ACCOUNT_SOURCE.includes('A-Za-z0-9') && HANDOFF_SEAT_MARK.includes(hs.SIGNATURE_ACCOUNT_SOURCE)); } // -- #18042: the copyable record TEMPLATE ---------------------------------- diff --git a/scripts/pm/round-open.mjs b/scripts/pm/round-open.mjs index 389a7635b99..22a23c2f2cc 100644 --- a/scripts/pm/round-open.mjs +++ b/scripts/pm/round-open.mjs @@ -5,7 +5,7 @@ * round-open — the round-open mutex: before the first write of a fire, does any activity of THIS seat that no * stand-down brief closed, less than one round old, belong to another session? Read-only. * - * node scripts/pm/round-open.mjs --seat repo:objectstack#8 --session session_01… [--own session_01…,…] + * node scripts/pm/round-open.mjs --seat repo:objectstack@ACCOUNT --session session_01… [--own session_01…,…] * [--post N] [--intake area:fleet,epic:#N] [--round-minutes 60] [--repo OWNER/NAME] * [--json] [--fixture FILE] [--now ISO] * node scripts/pm/round-open.mjs --self-test # offline, no network at all @@ -23,7 +23,7 @@ * ## The readings — the rule text on `main`, pinned by the self-test (`LIFECYCLE_PHRASES`) * * 1. the seat post's NEWEST stand-down brief (`standDownBrief`: its headline, one of the measured spellings); - * 2. the NEWEST comment after it signed by this seat (`LANE#N · ACCOUNT · SESSION`, `readSignatureLine`) — the + * 2. the NEWEST comment after it signed by this seat (`LANE@ACCOUNT · ACCOUNT · SESSION`, `readSignatureLine`) — the * round-open marker is the one trace a running session leaves on the post, and any seat-signed comment is that * session's trace, so the headline is printed, never required; * 3. every open `pm:dispatched` ∪ `pm:queue` card updated inside the window, on the intake or off it (a p0 or p1 @@ -75,16 +75,18 @@ import { DEFAULT_SWEEP_REPO, SEAT_SESSION_ID, cardIntakeKeys, + comparedSeatId, h44IsRoundOpenMarker, h65Headline, labelNames, markerMatches, readSignatureLine, SEAT_MARK_SOURCE, - seatIdOf, seatMark, seatTitleAccount, seatIntakeKeys, + signedSeatId, + withSeatNumbers, } from './check-half-states.mjs'; import { ghApi, readAllPages } from './gh-pages.mjs'; @@ -106,7 +108,7 @@ export const LIFECYCLE_PATH = '.claude/skills/pm-dispatch/references/seat-lifecy export const LIFECYCLE_PHRASES = Object.freeze([ '未收班活动任一未满一轮 ⇒ 自退', '读数一、二:最近的收班简报,与晚于它的最新开轮标记', - '读数三:本车道 `pm:dispatched` ∪ `pm:queue` 卡最新非本 session 同席号的 `Claim:` 评论', + '读数三:本车道 `pm:dispatched` ∪ `pm:queue` 卡最新非本 session 同席的 `Claim:` 评论', '推即认领', '读数四:本车道 `state=CLOSED`', '简报即最新事件 ⇒ 立即坐席', @@ -132,16 +134,24 @@ export const UNREAD_LEGS = Object.freeze([ /** * `LANE#N`: an executing seat — `repo:NAME#N`, `epic:#N#k` or a retired `domain:LANE#N` — or the same lane with the - * second seat mark, `LANE@ACCOUNT`, a seat named by its account (`seat` is then `@account`). `null` otherwise. Pure. + * second seat mark, `LANE@ACCOUNT`, a seat named by its account (`seat` is then `@account`). `null` otherwise. + * `name` is the seat as every reading below compares it (`comparedSeatId`): a retired number the table carries is + * named by the account seat it became, so a seat asked for under either spelling takes the same readings. */ export function parseSeat(text) { const v = String(text ?? '').trim().toLowerCase(); const m = new RegExp(`^(repo:[a-z0-9][a-z0-9._-]*|epic:#[1-9][0-9]*|domain:[a-z][a-z0-9-]*)(${SEAT_MARK_SOURCE})$`, 'u').exec(v); - return m ? { lane: m[1], seat: seatMark(m[2]), name: `${m[1]}${m[2]}` } : null; + return m ? { lane: m[1], seat: seatMark(m[2]), name: comparedSeatId(`${m[1]}${m[2]}`) } : null; } -/** The seat a `[PM seat] …` title names — `LANE@ACCOUNT`, `LANE · seat N`, `LANE#N`, or bare `LANE` for seat 1. Pure. */ +/** The seat a `[PM seat] …` title names — `LANE@ACCOUNT`, `LANE · seat N`, `LANE#N`, or bare `LANE` for seat 1 — as readers compare it (`comparedSeatId`). */ export function seatOfPostTitle(title) { + const named = seatWrittenInPostTitle(title); + return named === null ? null : comparedSeatId(named); +} + +/** The seat a title names, as written and lower-cased. Pure. */ +function seatWrittenInPostTitle(title) { const m = /^\[PM seat\]\s*(.*?)\s*—/u.exec(String(title ?? '')); if (!m) return null; const half = m[1].trim(); @@ -171,13 +181,17 @@ const stampOf = (row) => { return Number.isFinite(ms) ? ms : null; }; -/** The seat a claim declares: its `Seat:` line, else its signature's `LANE#N` or `LANE@ACCOUNT`; `null` when neither reads. Pure. */ +/** + * The seat a claim declares: its `Seat:` line, else its signature's `LANE#N` or `LANE@ACCOUNT`; `null` when neither + * reads. Answered as readers compare it: a retired number is the account seat it became only when that account + * signed the claim (`comparedSeatId`, `signedSeatId`) — an earlier holder's claim stays the numbered seat's. + */ export function claimSeat(body) { const text = String(body ?? ''); const keyed = new RegExp(`^[ \\t]*(?:[-*+][ \\t]+)?>?[ \\t]*(?:\\*\\*)?\`?Seat\`?(?:\\*\\*)?[ \\t]*:[ \\t]*\`?((?:repo:[A-Za-z0-9._-]+|epic:#[1-9][0-9]*|domain:[a-z0-9_-]+)${SEAT_MARK_SOURCE})`, 'imu').exec(text); - if (keyed) return keyed[1].toLowerCase(); const sig = readSignatureLine(text); - return sig ? seatIdOf(sig.lane, sig.seat).toLowerCase() : null; + if (keyed) return comparedSeatId(keyed[1], sig?.account ?? null); + return sig ? signedSeatId(sig).toLowerCase() : null; } /** The session a comment speaks for: a `Session:` line, else its signature's, else the first session id; or null. */ @@ -202,7 +216,7 @@ export function postReadings(rows, seatName, own = new Set()) { for (const row of list) { if (row === brief || !after(row)) continue; const sig = readSignatureLine(String(row?.body ?? '')); - if (!sig || seatIdOf(sig.lane, sig.seat).toLowerCase() !== seatName || own.has(sig.session)) continue; + if (!sig || signedSeatId(sig).toLowerCase() !== seatName || own.has(sig.session)) continue; if (marker === null || (stampOf(row) ?? 0) >= (stampOf(marker) ?? 0)) marker = row; } return { brief, marker }; @@ -480,14 +494,14 @@ export function fixtureGet(fixture, repo) { const USAGE = [ 'round-open — the round-open mutex at fire start, before the first write (read-only).', '', - ' node scripts/pm/round-open.mjs --seat LANE#N|LANE@ACCOUNT --session SESSION [--own SESSION,…] [--post N]', + ' node scripts/pm/round-open.mjs --seat LANE@ACCOUNT --session SESSION [--own SESSION,…] [--post N] (an old LANE#N still reads)', ' [--intake area:NAME,epic:#N] [--round-minutes N] [--repo OWNER/NAME]', ' [--json] [--fixture FILE] [--now ISO]', ' node scripts/pm/round-open.mjs --self-test', '', - ' --seat this executing seat (repo:NAME#N, epic:#N#k); the director and the review chains hold no round mutex.', + ' --seat this executing seat (repo:NAME@ACCOUNT, epic:#N@ACCOUNT; an old repo:NAME#N or epic:#N#k still reads); the director and the review chains hold no round mutex.', ' --own sessions that are this seat\'s own — the lease table\'s area sessions, the PM session (from an area), a card thread\'s or a remote dev\'s session.', - ' --post the seat post, when its title does not name the seat as `LANE · seat N`.', + ' --post the seat post, when its title does not name the seat as `LANE@ACCOUNT` (or, on an old post, `LANE · seat N`).', ' --intake the lane, when the post title names no `area:*` / `epic #N`.', ` Exits: ${EXIT_CLEAR} CLEAR · ${EXIT_USAGE} usage · ${EXIT_PREREQUISITE} prerequisite (no seat post read) · ${EXIT_INCOMPLETE} INCOMPLETE (a gap, named) · ${EXIT_YIELD} YIELD (自退).`, ].join('\n'); @@ -509,7 +523,7 @@ export function parseArgs(argv) { } else if (flag === '--seat') { const v = take(); opts.seat = parseSeat(v); - if (!opts.seat) return { error: `--seat must be an executing seat, repo:NAME#N or epic:#N#k, or either lane with @ACCOUNT in place of the number (the director and the review chains hold no round mutex), got \`${v}\`` }; + if (!opts.seat) return { error: `--seat must be an executing seat, repo:NAME@ACCOUNT or epic:#N@ACCOUNT, or either lane with an old #N seat number in place of @ACCOUNT (the director and the review chains hold no round mutex), got \`${v}\`` }; } else if (flag === '--session') { const v = String(take() ?? ''); if (!SESSION_ONLY.test(v)) return { error: `--session must be ONE session id, got \`${v}\`` }; @@ -589,11 +603,11 @@ export function main(argv, deps = {}) { const SELF_TEST_BATTERIES = Object.freeze({ // 3 → 4 (#35237 item 21c): the exported ROUND_RULE is stateless — no `g`, so repeated `.test()` answers the same. 'the rule text: every phrase this file is built from is in the file that writes it': 4, - 'readings 1 and 2: the newest stand-down brief, the newest seat-signed comment after it': 10, - 'reading 3: the newest claim of this seat by another session, and a push on a lane branch': 12, + 'readings 1 and 2: the newest stand-down brief, the newest seat-signed comment after it': 12, + 'reading 3: the newest claim of this seat by another session, and a push on a lane branch': 15, 'reading 4: the first closed lane card with a claim of this seat, timed by its session': 4, 'the verdict: foreign, un-clocked-out and under a round yields; own, clocked-out or older does not; a gap is never clear': 8, - 'the CLI: usage, exits and the footer': 8, + 'the CLI: usage, exits and the footer': 9, }); const SELF_TEST_BATTERY_FLOOR = 6; const UNATTRIBUTED_BATTERY = '(unattributed)'; @@ -682,6 +696,11 @@ export function selfTest() { const amark = c(`${sig(OTHER, ASEAT)}\n\n## Seated`, 30); t('⭐ reading 2 by lane AND account: the account seat reads its own signed comment; ⛔ account X\'s seat does not read account Y\'s, and seat 8 does not read either', [postReadings([BRIEF, amark], ASEAT).marker?.id, postReadings([BRIEF, amark], 'repo:objectstack@os-other').marker, postReadings([BRIEF, amark], 'repo:objectstack#8').marker, postReadings([BRIEF, c(`${sig(OTHER, ASEAT, 'os-other')}\n\n## Seated`, 20)], ASEAT).marker], [amark.id, null, null, null]); t('⭐ CONTROL — a `#8` comment keeps reading as seat 8\'s: ⛔ not as the account seat of the login that signed it', [postReadings([BRIEF, late], 'repo:objectstack#8').marker?.id, postReadings([BRIEF, late], ASEAT).marker], [late.id, null]); + // A retired number and the account seat it became (`seat-numbers.mjs`, read through `seatMarkOf`): seat 8's post is + // renamed in place, and what it signed as `#8` is still its own. An earlier holder's `#8` and a vacant `#3` are not. + const T8 = [{ lane: 'repo:objectstack', number: 8, account: 'os-mickey' }]; + t('⭐ a renamed seat is ONE seat under both spellings: `--seat LANE#8` and the numbered post title name the account seat once the table carries the number — ⛔ a number with no row stays numbered', withSeatNumbers(T8, () => [parseSeat('repo:objectstack#8')?.name, parseSeat(ASEAT)?.name, seatOfPostTitle(POST.title), parseSeat('repo:objectstack#3')?.name, seatOfPostTitle('[PM seat] repo:objectstack · seat 3 — 🟢 os-mickey')]), [ASEAT, ASEAT, ASEAT, 'repo:objectstack#3', 'repo:objectstack#3']); + t('⭐ reading 2 after a rename: the account seat reads the comment it signed as `#8`; ⛔ an EARLIER holder\'s `#8` comment and a vacant `#3` comment by the same account are not its own — and with no row the old comment is not read at all', [withSeatNumbers(T8, () => postReadings([BRIEF, late], ASEAT).marker?.id), withSeatNumbers(T8, () => postReadings([BRIEF, c(`${sig(OTHER, 'repo:objectstack#8', 'os-old')}\n\n## Seated`, 20)], ASEAT).marker), withSeatNumbers(T8, () => postReadings([BRIEF, c(`${sig(OTHER, 'repo:objectstack#3')}\n\n## Seated`, 20)], ASEAT).marker), withSeatNumbers([], () => postReadings([BRIEF, late], ASEAT).marker)], [late.id, null, null, null]); } battery('reading 3: the newest claim of this seat by another session, and a push on a lane branch'); @@ -692,6 +711,17 @@ export function selfTest() { t('⭐ CONTROL — reading 3 by lane AND mark: a `#8` claim by another session is seat 8\'s activity and ⛔ not the account seat\'s; the account seat\'s claim is its own and ⛔ not seat 8\'s nor another account\'s', [claimReadings([claim(OTHER, 30)], 'repo:objectstack#8', own).foreign?.created_at, claimReadings([claim(OTHER, 30)], 'repo:objectstack@os-mickey', own).foreign ?? null, claimReadings([claim(OTHER, 20, 'repo:objectstack@os-mickey')], 'repo:objectstack@os-mickey', own).foreign?.created_at, claimReadings([claim(OTHER, 20, 'repo:objectstack@os-mickey')], 'repo:objectstack#8', own).foreign ?? null, claimReadings([claim(OTHER, 20, 'repo:objectstack@os-mickey')], 'repo:objectstack@os-other', own).foreign ?? null], [ago(30), null, ago(20), null, null]); const cr = claimReadings([claim(OTHER, 30), claim(ME, 10), claim(OTHER, 5, 'repo:objectstack#3')], 'repo:objectstack#8', own); t('⭐ the newest claim of THIS seat by ANOTHER session — the own session\'s and another seat\'s are not it', cr.foreign?.created_at, ago(30)); + // The mutex after a rename: a second session of the renamed seat still claims as `#8`, and the seat must see it. + const T8 = [{ lane: 'repo:objectstack', number: 8, account: 'os-mickey' }]; + const ASEAT = 'repo:objectstack@os-mickey'; + const oldHolder = c(`${sig(OTHER, 'repo:objectstack#8', 'os-old')}\n\nClaim: PM loop round 1\nSession: \`${OTHER}\`\nSeat: \`repo:objectstack#8\``, 30); + t('⭐ a claim\'s seat after a rename: `Seat: LANE#8` signed by the renamed account is the account seat\'s, from the line or the signature; ⛔ signed by an earlier holder, or by nobody, it stays seat 8\'s', withSeatNumbers(T8, () => [claimSeat(claim(OTHER, 5).body), claimSeat(`${sig(OTHER)}\n\nClaim: x`), claimSeat(oldHolder.body), claimSeat('Claim: x\nSeat: `repo:objectstack#8`')]), [ASEAT, ASEAT, 'repo:objectstack#8', 'repo:objectstack#8']); + t('⭐ reading 3 after a rename: another session\'s `#8` claim signed by the renamed account is the account seat\'s activity; ⛔ an earlier holder\'s `#8` claim and a vacant `#3` claim are not', withSeatNumbers(T8, () => [claimReadings([claim(OTHER, 30)], ASEAT, own).foreign?.created_at, claimReadings([oldHolder], ASEAT, own).foreign ?? null, claimReadings([claim(OTHER, 30, 'repo:objectstack#3')], ASEAT, own).foreign ?? null]), [ago(30), null, null]); + const RENAMED = { ...POST, title: '[PM seat] repo:objectstack@os-mickey — 🟢 os-mickey · area:fleet (p1/p2)' }; + const second = card(['pm:dispatched', 'area:fleet'], 20); + const fxr = { issues: [RENAMED, second], comments: { 37865: [], [second.number]: [claim(OTHER, 20)] } }; + const asRenamed = () => { const r = readMutex({ repo: REPO, seat: parseSeat(ASEAT), session: ME, own: [], post: null, intake: null, nowMs: NOW, get: fixtureGet(fxr, REPO), lsRemote: () => ({ ok: true, value: [] }) }); return r.prerequisite ? 'prerequisite' : mutexVerdict({ activities: r.activities, own: r.own, briefAt: r.briefAt, nowMs: NOW, gaps: r.gaps }).exit; }; + t('⭐ THE MUTEX AFTER A RENAME — a second session of the renamed seat, still claiming as `#8`: YIELD with the row; with no row the same board reads CLEAR, which is the defect the table closes', [withSeatNumbers(T8, asRenamed), withSeatNumbers([], asRenamed)], [EXIT_YIELD, EXIT_CLEAR]); const live = card(['pm:dispatched', 'area:fleet'], 20); const off = card(['pm:dispatched', 'area:ui'], 20); const fx = { issues: [POST, live, off], comments: { 37865: [], [live.number]: [claim(OTHER, 20)], [off.number]: [claim(OTHER, 15)] } }; @@ -752,6 +782,7 @@ export function selfTest() { battery('the CLI: usage, exits and the footer'); { t('--seat and --session are required; the director and a review chain are refused by name', [Boolean(parseArgs([]).error), Boolean(parseArgs(['--seat', 'director#1', '--session', ME]).error), Boolean(parseArgs(['--seat', 'l2-review#1', '--session', ME]).error), parseArgs(['--seat', 'epic:#35205#1', '--session', ME]).opts?.seat.name], [true, true, true, 'epic:#35205#1']); + t('the usage and the --seat refusal name the seat by its account as the form to write, and say the old number still reads', [USAGE.includes('repo:NAME@ACCOUNT, epic:#N@ACCOUNT'), USAGE.includes('`LANE@ACCOUNT`'), parseArgs(['--seat', 'director#1', '--session', ME]).error.includes('repo:NAME@ACCOUNT or epic:#N@ACCOUNT'), parseArgs(['--seat', 'director#1', '--session', ME]).error.includes('old #N'), parseArgs(['--seat', 'repo:objectstack#8', '--session', ME]).opts?.seat.name, parseArgs(['--seat', 'repo:objectstack@os-mickey', '--session', ME]).opts?.seat.name], [true, true, true, true, 'repo:objectstack#8', 'repo:objectstack@os-mickey']); t('a bad --session, --own, --post, --intake or flag is a usage error, never a default', ['--session=x', '--own=x', '--post=x', '--intake=ux', '--bogus'].map((a) => Boolean(parseArgs(['--seat=repo:objectstack#8', `--session=${ME}`, a]).error)), [true, true, true, true, true]); const busy = card(['pm:dispatched', 'area:fleet'], 10); const fx = { issues: [POST, busy], comments: { 37865: [c(`${sig(OTHER)}\n\n## Clock-out · seat 8`, 120)], [busy.number]: [claim(OTHER, 10)] } }; diff --git a/scripts/pm/seat-numbers.mjs b/scripts/pm/seat-numbers.mjs new file mode 100644 index 00000000000..fb1d4a7387d --- /dev/null +++ b/scripts/pm/seat-numbers.mjs @@ -0,0 +1,43 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * seat-numbers — the per-lane table from a RETIRED seat number to the account whose seat it became. + * + * ## Why it exists + * + * A seat is named by its account, `LANE@ACCOUNT` (ruling record 7249169754, Q1 A): one seat per account per lane, + * and a seat does not change hands (Q2 A). A held seat post is renamed in place, and the claims, records and + * signatures it wrote as `LANE#N` are not re-issued (Q3 A). So after a rename one seat has two spellings on the + * board: `LANE@ACCOUNT` on everything new, `LANE#N` on everything older. A reader that compares the two as text + * reads the seat's own earlier work as another seat's: the round-open mutex reads clear while a second session of + * the seat is at work, the stale-seat-post row (H38) goes quiet for the renamed post, and a dequeue the landing + * seat asks for under its new name is refused while the pull's trailer still carries the number. + * + * This table is what joins the two spellings. It is read through `seatMarkOf` in `check-half-states.mjs`, the one + * reader, and no tool reads it any other way. + * + * ## What a row says, and what it does not + * + * `{ lane, number, account }`: in `lane`, the seat that signed as `#number` under `account` is that account's + * seat, `lane@account`. A `#number` record reads as the account seat's ONLY when it is signed by that account. A + * record an earlier holder of the number signed stays the numbered seat's, and so does every record of a number + * with no row: a seat that was vacated, never renamed, has no row, and its old claims are nobody's account seat. + * They leave through the per-card `Release:` route. + * + * Several numbers of one lane may name one account (an account that sat two numbered seats of a lane has one seat + * there now). A number names one account. `review` and `l2-review` are one lane under two words; a row keeps the + * word its records were signed with. + * + * ## Who writes it, and when + * + * The seat that renames its post adds its row here FIRST, by an ordinary pull request, and renames only once the + * row is on `main`: a rename the table does not carry is the defect above. Rows are added, never changed or + * removed: old `#N` records stay readable for good, and they are attributed through this table. `lane` and + * `account` are lower case, as every reader folds them. + * + * ⛔ No imports, no I/O: a leaf every reader can import. `check-half-states.mjs --self-test` holds every row to + * the shape above. + */ + +/** @type {ReadonlyArray>} */ +export const SEAT_NUMBER_ACCOUNTS = Object.freeze([]);