teamsmith 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +13 -1
- package/skills/teamsmith/SKILL.md +1 -1
- package/skills/teamsmith/extension/team-bg.ts +7 -8
- package/skills/teamsmith/extension/team-inbox-watch.ts +136 -3
- package/skills/teamsmith/references/protocol.md +2 -3
- package/skills/teamsmith/references/reminders.md +55 -12
- package/skills/teamsmith/references/workflows.md +1 -3
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +18 -1
- package/skills/teamsmith/scripts/lib/cmd-project.sh +12 -9
- package/skills/teamsmith/scripts/lib/cmd-remind.sh +49 -10
- package/skills/teamsmith/scripts/lib/cmd-update.sh +90 -88
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +281 -155
- package/skills/teamsmith/scripts/lib/common.sh +74 -14
- package/skills/teamsmith/scripts/panel/panel.js +134 -134
- package/skills/teamsmith/scripts/panel/src/data.ts +51 -0
- package/skills/teamsmith/scripts/panel/src/layout.ts +10 -0
- package/skills/teamsmith/scripts/panel/src/main.tsx +27 -0
- package/skills/teamsmith/scripts/remind-store.mjs +362 -6
- package/skills/teamsmith/scripts/remind-tick.mjs +102 -0
- package/skills/teamsmith/scripts/reminder-delivery.mjs +76 -0
- package/skills/teamsmith/scripts/state-authority.mjs +265 -17
- package/skills/teamsmith/scripts/strings/commands.tsv +3 -3
- package/skills/teamsmith/scripts/strings/help.en.tsv +12 -12
- package/skills/teamsmith/scripts/strings/help.zh.tsv +12 -12
- package/skills/teamsmith/scripts/team +3 -3
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +2 -3
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +11 -5
- package/skills/teamsmith/tests/death-cause.sh +5 -0
- package/skills/teamsmith/tests/help-surface.sh +15 -150
- package/skills/teamsmith/tests/isolation-ledger.sh +85 -0
- package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +17 -1
- package/skills/teamsmith/tests/live-capture-probe.sh +12 -2
- package/skills/teamsmith/tests/pulse-nudge-key.sh +5 -0
- package/skills/teamsmith/tests/remind-delivery-node.mjs +176 -0
- package/skills/teamsmith/tests/remind-delivery.sh +611 -0
- package/skills/teamsmith/tests/section-paths.tsv +6 -6
- package/skills/teamsmith/tests/smoke.sh +397 -107
- package/skills/teamsmith/tests/state-authority.sh +246 -26
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +58 -8
- package/skills/teamsmith/tests/tmux-identity-leak.sh +12 -16
- package/skills/teamsmith-init/SKILL.md +1 -1
|
@@ -349,7 +349,7 @@ cmd.watch.arg.--once run a single tick and exit.
|
|
|
349
349
|
cmd.watch.arg.--interval repeat every this many seconds instead of running once.
|
|
350
350
|
cmd.watch.arg.--ui show the interactive panel instead of the text output.
|
|
351
351
|
cmd.standby.title tell the patrol that no one is needed
|
|
352
|
-
cmd.standby.what Records that the PM stands down: the patrol stops waking it, while everything that arrives is still written to the patrol log. A human turns it back on, so an agent cannot silently wake itself up again.
|
|
352
|
+
cmd.standby.what Records that the PM stands down: the patrol stops waking it, while everything that arrives is still written to the patrol log. A human turns it back on, so an agent cannot silently wake itself up again. `standby migrate` carries a stand-down recorded by an older version into the current record; running it twice changes nothing.
|
|
353
353
|
cmd.standby.when Use it when the work is blocked on a person, or when the backlog should wait for a human rather than for the PM.
|
|
354
354
|
cmd.standby.example team standby on --reason "waiting for the user to pick an interface"
|
|
355
355
|
cmd.standby.read the state directory and the patrol log
|
|
@@ -357,7 +357,7 @@ cmd.standby.write the state directory
|
|
|
357
357
|
cmd.standby.see `team pulse`, `team digest`
|
|
358
358
|
cmd.standby.arg.--reason why the PM is standing down; it is written down so the next session knows.
|
|
359
359
|
cmd.remind.title record a one-shot reminder for this project
|
|
360
|
-
cmd.remind.what Records a reminder for the project PM in the same versioned project state as the rest of teamsmith: its full text, when it is due and who created it. `list` prints what is waiting and when it is due, `show` prints one record in full, `cancel` stops a reminder that has not been frozen
|
|
360
|
+
cmd.remind.what Records a reminder for the project PM in the same versioned project state as the rest of teamsmith: its full text, when it is due and who created it. `list` prints what is waiting and when it is due, `show` prints one record in full, `cancel` stops a reminder that has not been frozen into a batch, and `resolve` acknowledges a whole batch whose delivery cannot be proven (it needs an explicit `--ack-unknown` and never resends). The patrol queues a reminder when it comes due and the PM session receives it as one complete message; Standby is left once, and only by an actual wake. Every status you see is derived from that one record on each read, never a second copy.
|
|
361
361
|
cmd.remind.when Use it to park something for a later time instead of holding a session open or retrying from memory.
|
|
362
362
|
cmd.remind.example team remind add --after 20m --message "check the build"
|
|
363
363
|
cmd.remind.read the project state snapshot and the state-root locator
|
|
@@ -371,6 +371,7 @@ cmd.remind.arg.--key a name for this logical reminder. While a live reminder hol
|
|
|
371
371
|
cmd.remind.arg.--task the task or brief this reminder belongs to, so the record says what it is about.
|
|
372
372
|
cmd.remind.arg.--all also print the reminders that already ended (the retained history), newest first.
|
|
373
373
|
cmd.remind.arg.--json print the record(s) as JSON instead of the table.
|
|
374
|
+
cmd.remind.arg.--ack-unknown acknowledge that this batch cannot be proven delivered: close every member, burn its one automatic Standby exit and do not resend. Without it `resolve` is refused.
|
|
374
375
|
cmd.up.title build the stage and start the PM
|
|
375
376
|
cmd.up.what Creates the project's session and windows if they are missing and starts the PM in its own window, continuing the project's previous conversation unless a fresh one is asked for. It starts the PM only; the seats are not touched.
|
|
376
377
|
cmd.up.when Use it after a restart, or when the session was lost and the team should keep working in the same project.
|
|
@@ -483,21 +484,20 @@ cmd.gl.example team gl
|
|
|
483
484
|
cmd.gl.read nothing
|
|
484
485
|
cmd.gl.write nothing
|
|
485
486
|
cmd.gl.see `team gh`, `team pr`
|
|
486
|
-
cmd.mark-loaded.title
|
|
487
|
-
cmd.mark-loaded.what
|
|
488
|
-
cmd.mark-loaded.when
|
|
489
|
-
cmd.mark-loaded.example team mark-loaded
|
|
490
|
-
cmd.mark-loaded.read
|
|
491
|
-
cmd.mark-loaded.write
|
|
492
|
-
cmd.mark-loaded.see `team version`, `team
|
|
493
|
-
cmd.mark-loaded.arg.--version record this version instead of the one found on disk.
|
|
487
|
+
cmd.mark-loaded.title the removed version record
|
|
488
|
+
cmd.mark-loaded.what This name used to write down which skill version the session had loaded. The record was only ever written by hand, so it went stale, and the staleness it reported was usually wrong. It is now refused, and the same question is answered from facts the tool already has.
|
|
489
|
+
cmd.mark-loaded.when Run it only to read the replacement: the PM process start time compared with the newest skill file mtime.
|
|
490
|
+
cmd.mark-loaded.example team mark-loaded
|
|
491
|
+
cmd.mark-loaded.read nothing
|
|
492
|
+
cmd.mark-loaded.write nothing
|
|
493
|
+
cmd.mark-loaded.see `team version --check`, `team doctor`
|
|
494
494
|
cmd.version.title which version is on disk, in the skill and in this session
|
|
495
495
|
cmd.version.what Prints the version of the installed skill, the version written in the skill file, the changelog's head and the version this session loaded. With the check argument it gives a verdict instead of a list.
|
|
496
496
|
cmd.version.when Use it when a command behaves differently from what this session's skill describes, or at the start of a long session.
|
|
497
497
|
cmd.version.example team version --check
|
|
498
498
|
cmd.version.read the installed skill, the changelog and the session record
|
|
499
499
|
cmd.version.write nothing
|
|
500
|
-
cmd.version.see `team changelog`, `team reload
|
|
500
|
+
cmd.version.see `team changelog`, `team reload`
|
|
501
501
|
cmd.version.arg.--check answer whether this session's skill is current instead of printing every version.
|
|
502
502
|
cmd.changelog.title what changed in the skill
|
|
503
503
|
cmd.changelog.what Prints the skill's change history, newest first, optionally only what came after a given version.
|
|
@@ -513,5 +513,5 @@ cmd.reload.when Use it after the skill was upgraded, when you want the current s
|
|
|
513
513
|
cmd.reload.example team reload
|
|
514
514
|
cmd.reload.read the reload request record
|
|
515
515
|
cmd.reload.write the reload request record
|
|
516
|
-
cmd.reload.see `team version
|
|
516
|
+
cmd.reload.see `team version`
|
|
517
517
|
cmd.reload.arg.--done mark the request as handled, after the reload really happened.
|
|
@@ -335,7 +335,7 @@ cmd.watch.arg.--once 只跑一拍就退出。
|
|
|
335
335
|
cmd.watch.arg.--interval 每隔这么多秒跑一次,而不是只跑一次。
|
|
336
336
|
cmd.watch.arg.--ui 显示可交互面板,而不是文本输出。
|
|
337
337
|
cmd.standby.title 告诉巡检"暂时不需要人"
|
|
338
|
-
cmd.standby.what 记下"PM 停工"这件事:巡检不再叫醒它,期间到达的一切照旧写进巡检日志。只有人能把它关掉,所以 agent
|
|
338
|
+
cmd.standby.what 记下"PM 停工"这件事:巡检不再叫醒它,期间到达的一切照旧写进巡检日志。只有人能把它关掉,所以 agent 不能自己悄悄醒来。`standby migrate` 把旧版本记下的停工搬进现在的记录;重跑一遍不会改变什么。
|
|
339
339
|
cmd.standby.when 工作卡在一个人身上时用它,或者你希望积压等一个人而不是等 PM 时用它。
|
|
340
340
|
cmd.standby.example team standby on --reason "等用户定接口"
|
|
341
341
|
cmd.standby.read 状态目录与巡检日志
|
|
@@ -343,7 +343,7 @@ cmd.standby.write 状态目录
|
|
|
343
343
|
cmd.standby.see `team pulse`、`team digest`
|
|
344
344
|
cmd.standby.arg.--reason PM 为什么停工;写下来,下一个会话才知道。
|
|
345
345
|
cmd.remind.title 给本项目记一条定时提醒
|
|
346
|
-
cmd.remind.what 把一条提醒记进 teamsmith 的项目状态:完整正文、什么时候到期、谁创建的。`list` 打印还在等的提醒和它们的到期时间,`show` 打印一条的全部内容,`cancel`
|
|
346
|
+
cmd.remind.what 把一条提醒记进 teamsmith 的项目状态:完整正文、什么时候到期、谁创建的。`list` 打印还在等的提醒和它们的到期时间,`show` 打印一条的全部内容,`cancel` 取消一条还没被冻结成批次的提醒,`resolve` 确认一整批无法证实送达的提醒(必须显式给 `--ack-unknown`;它不重发)。巡检到点把提醒入队,PM 会话把它作为一条完整消息收到;真的被叫醒时才退出待命一次。你看到的状态都是每次读取时从那条记录派生出来的,不另存一份。
|
|
347
347
|
cmd.remind.when 要把一件事留到以后再处理、又不想一直挂着会话或靠记性重来时用它。
|
|
348
348
|
cmd.remind.example team remind add --after 20m --message "看一下构建"
|
|
349
349
|
cmd.remind.read 项目状态快照与状态根定位器
|
|
@@ -357,6 +357,7 @@ cmd.remind.arg.--key 这条逻辑提醒的名字。只要还有一条未结束
|
|
|
357
357
|
cmd.remind.arg.--task 这条提醒属于哪个任务或任务书,记录里因此能看出它是关于什么的。
|
|
358
358
|
cmd.remind.arg.--all 连已经结束的提醒(保留的历史)一起打印,最新的在前。
|
|
359
359
|
cmd.remind.arg.--json 把记录按 JSON 打印,不打印表格。
|
|
360
|
+
cmd.remind.arg.--ack-unknown 确认这一批提醒无法证实是否送达:关闭整批、烧掉它那一次自动退出待命的权利,并且不重发。没有这个参数 `resolve` 一律拒绝。
|
|
360
361
|
cmd.up.title 搭好台子并把 PM 拉起来
|
|
361
362
|
cmd.up.what 缺什么就建什么:项目的 session 与窗口,然后在它自己的窗口里启动 PM,默认接着这个项目上一场会话,除非你要一场新的。它只负责 PM,不动席位。
|
|
362
363
|
cmd.up.when 重启之后用它,或者在 session 丢了、团队该在同一个项目里继续干活时用它。
|
|
@@ -469,21 +470,20 @@ cmd.gl.example team gl
|
|
|
469
470
|
cmd.gl.read 不读任何东西
|
|
470
471
|
cmd.gl.write 不写任何东西
|
|
471
472
|
cmd.gl.see `team gh`、`team pr`
|
|
472
|
-
cmd.mark-loaded.title
|
|
473
|
-
cmd.mark-loaded.what
|
|
474
|
-
cmd.mark-loaded.when
|
|
475
|
-
cmd.mark-loaded.example team mark-loaded
|
|
476
|
-
cmd.mark-loaded.read
|
|
477
|
-
cmd.mark-loaded.write
|
|
478
|
-
cmd.mark-loaded.see `team version`、`team
|
|
479
|
-
cmd.mark-loaded.arg.--version 记这个版本,而不是磁盘上找到的那个。
|
|
473
|
+
cmd.mark-loaded.title 已移除的版本记录
|
|
474
|
+
cmd.mark-loaded.what 这个命令以前把「本会话加载的是哪个 skill 版本」写进 state。那份记录只有人手动写,没人写就停在上一版,它报出来的旧会话多数是误报。现在它被拒绝,同一个问题由工具已有的事实回答。
|
|
475
|
+
cmd.mark-loaded.when 只在想看替代做法时跑:PM 进程启动时刻与 skill 文件最近改动时刻的比较。
|
|
476
|
+
cmd.mark-loaded.example team mark-loaded
|
|
477
|
+
cmd.mark-loaded.read 不读任何东西
|
|
478
|
+
cmd.mark-loaded.write 不写任何东西
|
|
479
|
+
cmd.mark-loaded.see `team version --check`、`team doctor`
|
|
480
480
|
cmd.version.title 磁盘上、skill 里和本会话各是什么版本
|
|
481
481
|
cmd.version.what 打印装在机器上的 skill 版本、skill 文件里写的版本、变更史的开头,以及本会话加载的版本。带 check 参数时它给结论,而不是列清单。
|
|
482
482
|
cmd.version.when 某个命令的行为跟本会话 skill 描述的不一样时用它,长会话开头也用它。
|
|
483
483
|
cmd.version.example team version --check
|
|
484
484
|
cmd.version.read 装在机器上的 skill、变更史与会话记录
|
|
485
485
|
cmd.version.write 不写任何东西
|
|
486
|
-
cmd.version.see `team changelog`、`team reload
|
|
486
|
+
cmd.version.see `team changelog`、`team reload`
|
|
487
487
|
cmd.version.arg.--check 只回答"本会话的 skill 是不是最新的",而不是把每个版本都打出来。
|
|
488
488
|
cmd.changelog.title skill 改了什么
|
|
489
489
|
cmd.changelog.what 打印 skill 的变更史,最新的在前;可以只看某个版本之后的部分。
|
|
@@ -499,5 +499,5 @@ cmd.reload.when skill 升级之后、想让当前会话看到新文件时用它
|
|
|
499
499
|
cmd.reload.example team reload
|
|
500
500
|
cmd.reload.read 重载请求的记录
|
|
501
501
|
cmd.reload.write 重载请求的记录
|
|
502
|
-
cmd.reload.see `team version
|
|
502
|
+
cmd.reload.see `team version`
|
|
503
503
|
cmd.reload.arg.--done 重载真的发生之后,把这个请求标记成已处理。
|
|
@@ -133,7 +133,7 @@ case "$CMD" in
|
|
|
133
133
|
remind) team_cmd_remind "$@" ;;
|
|
134
134
|
meeting) team_cmd_meeting "$@" ;;
|
|
135
135
|
version) if [ "${1:-}" = "--check" ] || [ "${1:-}" = "check" ]; then team_cmd_version_check "$@"; else team_cmd_version_brief "$@"; fi ;;
|
|
136
|
-
mark-loaded)
|
|
136
|
+
mark-loaded) team_err "mark-loaded 已移除:会话新旧由推导得出——PM 进程启动时刻 vs skill 文件的最近改动时刻,跑 $TEAM_CLI version --check 或 $TEAM_CLI doctor"; exit 2 ;;
|
|
137
137
|
reload) team_cmd_reload "$@" ;;
|
|
138
138
|
changelog) team_cmd_changelog "$@" ;;
|
|
139
139
|
smoke|test) team_cmd_smoke "$@" ;;
|
|
@@ -146,8 +146,8 @@ case "$CMD" in
|
|
|
146
146
|
team_dim " 有 PR:先 gh pr merge --squash --delete-branch <PR>,再 git -C $TEAM_MAIN_ROOT fetch origin $TEAM_PROTECTED_BRANCH && git -C $TEAM_MAIN_ROOT merge --ff-only FETCH_HEAD"
|
|
147
147
|
team_dim " 收尾:代码确认进 $TEAM_PROTECTED_BRANCH 之后再 $TEAM_CLI board set <ID> done"
|
|
148
148
|
team_dim " 步骤全文:$TEAM_SKILL_DIR/SKILL.md「git 与 forge」一节"
|
|
149
|
-
if [ -n "$(
|
|
150
|
-
team_dim "
|
|
149
|
+
if [ -n "$(team_skill_stale_line 2>/dev/null || true)" ]; then
|
|
150
|
+
team_dim " $(team_skill_stale_line):在 Pi 里输入 /reload 刷新 skill 描述"
|
|
151
151
|
fi
|
|
152
152
|
exit 2 ;;
|
|
153
153
|
gh|gl)
|
|
@@ -54,9 +54,8 @@ last three take `--force` + one audited line). `team change status <id>` shows t
|
|
|
54
54
|
+ report written + branch settled), **hard-blocked** (notify the PM + `BLOCKED:` in the report), or
|
|
55
55
|
**suspended on background jobs** (this session's jobs still running, every step that does not depend on them
|
|
56
56
|
done; the turn's last line names every awaited job id). The lane rule is the suspend default: `team_bg_run`
|
|
57
|
-
starts a long job and the turn ends
|
|
58
|
-
|
|
59
|
-
step and nothing else can advance. A previous session's wake-ups died with its process: find its jobs on disk
|
|
57
|
+
starts a long job and the turn ends; the completion wake-up is the normal harvest point. Do not wait inside the
|
|
58
|
+
turn (`sleep`, `team wait`, a blocking harvest): the user cannot type while the PM waits. A previous session's wake-ups died with its process: find its jobs on disk
|
|
60
59
|
(`state/bg.log`, `team bg list`) before awaiting or re-running them (`{{SKILL_DIR}}/references/workflows.md` §E2).
|
|
61
60
|
- **Never claim tests passed without having run them.** The PM re-runs in an independent worktree; a false report
|
|
62
61
|
fails the task.
|
|
@@ -97,11 +97,17 @@ exists (`{{SKILL_DIR}}/references/openspec.md`).
|
|
|
97
97
|
|
|
98
98
|
**Background jobs and turn endings.** A turn ends in one of three states: **delivered**, **hard-blocked** (blocked on
|
|
99
99
|
a human: record it and stand down), or **suspended on background jobs** with every awaited id named on its last line.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
Do not run long work in your own session — not a full gate, not a long test matrix, not a bulk refactor. A seat
|
|
101
|
+
does that work, or `team_bg_run` does it in the background; your session does routing, judgement and acceptance.
|
|
102
|
+
Guidance, not a limit: nothing stops you, but a busy PM cannot answer the user and cannot be steered.
|
|
103
|
+
|
|
104
|
+
Long commands run in the background -- the full gate, a container gate, a mutation matrix, a project build, a long
|
|
105
|
+
test suite. Do not wait inline (`sleep`, `team wait`, a blocking harvest): end the turn and come back on the
|
|
106
|
+
completion wake-up or a reminder.
|
|
107
|
+
|
|
108
|
+
`team_bg_run` starts a long job (a gate, a build) and you **let the turn end**; the completion wake-up is the normal
|
|
109
|
+
harvest point, and `team_bg_wait <id>` then brings back the exit code and the log tail. Harvest after the wake rather
|
|
110
|
+
than polling it.
|
|
105
111
|
|
|
106
112
|
The pulse is a metronome that wakes you only when there is work, not a daemon. If there is genuinely nothing to push,
|
|
107
113
|
or you are blocked on a human (authorization, a decision, external information), write the conclusion into
|
|
@@ -61,8 +61,13 @@ td_not_has() { # <名字> <文本> <子串>
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
# ---------------------------------------------------------------- 夹具仓库(只写 $TMP 里)
|
|
64
|
+
# 夹具的“主工作树”必须是个**真 git 仓库**,而且脚本要在它里面跑:待命自 1.3 起住在项目状态
|
|
65
|
+
# 权威的快照里,权威按“当前目录所属项目”钉住状态根(继承的 TEAM_MAIN_ROOT 与目录不一致会被拒)。
|
|
64
66
|
T="$TMP/repo"
|
|
65
67
|
mkdir -p "$T/state" "$T/worktrees/dev" "$T/worktrees/dev2" "$T/docs/team" "$T/pi"
|
|
68
|
+
git -C "$T" init -q -b main &&
|
|
69
|
+
git -C "$T" -c user.email=td@fixture -c user.name=td commit -q --allow-empty -m init || exit 3
|
|
70
|
+
cd "$T" || exit 3
|
|
66
71
|
for _a in dev dev2; do
|
|
67
72
|
git -C "$T/worktrees/$_a" init -q -b "task/TD-$_a" 2>/dev/null || true
|
|
68
73
|
git -C "$T/worktrees/$_a" -c user.email=td@fixture -c user.name=td commit -q --allow-empty -m init 2>/dev/null || true
|
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
# surface wraps to (the fixture's own locale-independent counter, not the renderer's)
|
|
17
17
|
# claims the declared effect / authorization / reversibility values: closed vocabularies,
|
|
18
18
|
# one probe per value, and each probe run against a real fixture asserting the effect.
|
|
19
|
-
# For `idempotent` the probe
|
|
20
|
-
# (
|
|
21
|
-
#
|
|
22
|
-
# record-without-that-field shape: a missing timestamp is not an error (V46 F1)
|
|
19
|
+
# For `idempotent` the probe runs the command twice with a wall-clock gap between
|
|
20
|
+
# the runs (so a same-second clock rewrite cannot hide) and requires every byte,
|
|
21
|
+
# and the second run's exit code, to be unchanged (P290, V46 F1)
|
|
23
22
|
# invariants command names, flag names and the literals other specs name: unchanged; the
|
|
24
23
|
# pre-change (command, flag) set is still printed; the retired --model is not
|
|
25
24
|
# route the three levels, byte-identical entries, unknown tokens exit 2 and are named, the
|
|
@@ -352,59 +351,6 @@ fp_all() { # <dir> → every face's fingerprint
|
|
|
352
351
|
for f in state docs config worktree skills meetings; do printf '%s %s\n' "$f" "$(fp_face "$1" "$f")"; done
|
|
353
352
|
}
|
|
354
353
|
|
|
355
|
-
# ---------------------------------------------------------------- recorded-time fields (P290)
|
|
356
|
-
# A command whose manifest row declares `idempotent` must leave the state byte-identical after a
|
|
357
|
-
# second identical run. One field shape is legitimately *about* time: the record of when the command
|
|
358
|
-
# ran (`AT=` in `.pi/team/state/pm-loaded.env`). It is not exempt from the assertion — it is *named* here, and
|
|
359
|
-
# the probe turns it into a canary: after the first run the fixture overwrites the named field with a
|
|
360
|
-
# sentinel value no clock produces, runs the command again, and requires every byte (sentinel
|
|
361
|
-
# included) to survive. Without the sentinel the verdict would depend on the wall clock — a rewrite
|
|
362
|
-
# inside the same second is invisible — and that is the host-green/container-red flake this table
|
|
363
|
-
# exists to remove (P290). A second run that rewrites a clock field is a defect for *every* command
|
|
364
|
-
# that declares `idempotent`, so a field must be named here rather than silently excused; a line
|
|
365
|
-
# naming a field the first run did not write is itself a finding, so a stale entry cannot sit here.
|
|
366
|
-
# An exclusion-only comparison was rejected on purpose: it would make this probe blind to exactly
|
|
367
|
-
# the rewrite the declaration forbids.
|
|
368
|
-
declare -A IDEMPOTENT_TIME_FIELDS=(
|
|
369
|
-
[mark-loaded]=".pi/team/state/pm-loaded.env:AT"
|
|
370
|
-
)
|
|
371
|
-
IDEMPOTENT_SENTINEL="sentinel-not-a-clock"
|
|
372
|
-
|
|
373
|
-
idem_fields() { # <cmd> → one `relpath:field` per line (nothing when the command declares none)
|
|
374
|
-
case "${IDEMPOTENT_TIME_FIELDS[$1]+x}" in x) printf '%s\n' ${IDEMPOTENT_TIME_FIELDS[$1]} ;; esac
|
|
375
|
-
return 0
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
idem_stamp() { # <cmd> <dir> <outfile> — overwrite each declared recorded-time field with the sentinel
|
|
379
|
-
local cmd="$1" d="$2" out="$3" spec rel field f
|
|
380
|
-
while IFS= read -r spec; do
|
|
381
|
-
[ -n "$spec" ] || continue
|
|
382
|
-
rel="${spec%%:*}"; field="${spec#*:}"
|
|
383
|
-
f="$d/$rel"
|
|
384
|
-
if [ ! -f "$f" ] || ! grep -q "^$field=" "$f" 2>/dev/null; then
|
|
385
|
-
finding "claims: $cmd 声明的记录时间字段 $field 不在 $rel 里(声明过期:不静默通过,见 IDEMPOTENT_TIME_FIELDS)"
|
|
386
|
-
continue
|
|
387
|
-
fi
|
|
388
|
-
if awk -v k="$field" -v v="$IDEMPOTENT_SENTINEL" 'index($0, k"=") == 1 { print k"="v; next } { print }' "$f" > "$f.p290"; then
|
|
389
|
-
mv "$f.p290" "$f"
|
|
390
|
-
printf '%s\n' "$spec" >> "$out"
|
|
391
|
-
else
|
|
392
|
-
rm -f "$f.p290"
|
|
393
|
-
finding "claims: $cmd 声明的记录时间字段 $field 没盖上哨兵(夹具写入失败)"
|
|
394
|
-
fi
|
|
395
|
-
done < <(idem_fields "$cmd")
|
|
396
|
-
return 0
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
idem_names() { # <stamped-file> → ` AT(.pi/team/state/pm-loaded.env)` — names the fields in the result line
|
|
400
|
-
local s out=""
|
|
401
|
-
while IFS= read -r s; do
|
|
402
|
-
[ -n "$s" ] || continue
|
|
403
|
-
out="$out ${s#*:}(${s%%:*})"
|
|
404
|
-
done < "$1"
|
|
405
|
-
printf '%s' "$out"
|
|
406
|
-
}
|
|
407
|
-
|
|
408
354
|
new_repo() { # <name> → a fresh git repository
|
|
409
355
|
local d="$tmp/fx/$1"
|
|
410
356
|
rm -rf "$d"; mkdir -p "$d"
|
|
@@ -528,7 +474,7 @@ probe_recipe() {
|
|
|
528
474
|
pr) printf 'proj|pr\n' ;;
|
|
529
475
|
gh) printf 'proj|gh\n' ;;
|
|
530
476
|
gl) printf 'proj|gl\n' ;;
|
|
531
|
-
mark-loaded) printf 'proj|mark-loaded
|
|
477
|
+
mark-loaded) printf 'proj|mark-loaded\n' ;;
|
|
532
478
|
version) printf 'proj|version\n' ;;
|
|
533
479
|
changelog) printf 'proj|changelog\n' ;;
|
|
534
480
|
reload) printf 'proj|reload\n' ;;
|
|
@@ -1182,26 +1128,16 @@ run_probe() { # <cmd> → ok/finding
|
|
|
1182
1128
|
# undo
|
|
1183
1129
|
case "${MG_UNDO[$cmd]}" in
|
|
1184
1130
|
idempotent)
|
|
1185
|
-
#
|
|
1186
|
-
#
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
if [ -n "$(idem_fields "$cmd")" ]; then
|
|
1190
|
-
idem_stamp "$cmd" "$d" "$stamped"
|
|
1191
|
-
n_stamped="$(grep -c . "$stamped" 2>/dev/null || true)"
|
|
1192
|
-
fi
|
|
1131
|
+
# P417:`mark-loaded`(唯一「会合法改写记录时间字段」的命令)删掉了,所以幂等的判据不再需要
|
|
1132
|
+
# 哨兵:第二次跑必须逐字节不变。中间隔 1.1s 仍然要睡 —— 同一秒内的改写会写出同样的字节,
|
|
1133
|
+
# 那条 P290 的时钟缺陷正是躲在这个缝里(宿主绿、慢一档的容器红)。
|
|
1134
|
+
local base again rc2
|
|
1193
1135
|
base="$(fp_all "$d")"
|
|
1194
|
-
# The sentinel above covers the fields somebody *declared*. A clock-derived value nobody declared
|
|
1195
|
-
# is still invisible inside one second: run 1 and run 2 write the same bytes. Sleeping past a
|
|
1196
|
-
# second boundary makes the probe judge "a later run changed nothing" instead of "a run inside
|
|
1197
|
-
# the same second changed nothing" — the verdict stops depending on how fast the machine is,
|
|
1198
|
-
# which is exactly the clock the P290 flake hid behind (host green, container red). Cost: ~1.1s
|
|
1199
|
-
# per idempotent command, and only in the full gate (FAST does not run `claims`).
|
|
1200
1136
|
sleep 1.1
|
|
1201
1137
|
env_run "$d" $argv >/dev/null 2>&1
|
|
1202
1138
|
rc2="$HS_RC"
|
|
1203
1139
|
again="$(fp_all "$d")"
|
|
1204
|
-
# O1(V46
|
|
1140
|
+
# O1(V46):第二次跑的退出码也要判 ——「第二次失败、不写盘」若只看字节会被当成幂等(假绿)。
|
|
1205
1141
|
# 判据是「与第一次一致」而不是「必须为 0」:夹具里 gh/gl/pr 这类命令在没有远端时本来就以非零
|
|
1206
1142
|
# 退出(只读拒绝),要求全部为 0 会把它们判红。rc 打进输出,红时点名两次的数。
|
|
1207
1143
|
printf ' \033[2m·\033[0m 幂等 %-11s rc=%s → %s\n' "$cmd" "$rc" "$rc2"
|
|
@@ -1211,40 +1147,9 @@ run_probe() { # <cmd> → ok/finding
|
|
|
1211
1147
|
finding "claims: $cmd 声明幂等,但两次跑的退出码不同(rc $rc → $rc2):第二次跑失败不算「什么都没变」"
|
|
1212
1148
|
fi
|
|
1213
1149
|
if [ "$base" = "$again" ]; then
|
|
1214
|
-
|
|
1215
|
-
ok "claims: $cmd 幂等(第二次跑逐字节不变)"
|
|
1216
|
-
else
|
|
1217
|
-
ok "claims: $cmd 幂等(第二次跑逐字节不变;指名的记录时间字段$(idem_names "$stamped") 经哨兵验证未被重写)"
|
|
1218
|
-
fi
|
|
1150
|
+
ok "claims: $cmd 幂等(第二次跑逐字节不变)"
|
|
1219
1151
|
else
|
|
1220
|
-
|
|
1221
|
-
[ -n "$s" ] || continue
|
|
1222
|
-
grep -q "^${s#*:}=$IDEMPOTENT_SENTINEL$" "$d/${s%%:*}" 2>/dev/null || lost="$lost ${s#*:}(${s%%:*})"
|
|
1223
|
-
done < "$stamped"
|
|
1224
|
-
if [ -n "$lost" ]; then
|
|
1225
|
-
finding "claims: $cmd 声明幂等,但第二次跑重写了指名的记录时间字段$lost:哨兵值被覆盖"
|
|
1226
|
-
else
|
|
1227
|
-
finding "claims: $cmd 声明幂等,但第二次跑改了状态"
|
|
1228
|
-
fi
|
|
1229
|
-
fi
|
|
1230
|
-
# F1(V46 返修轮次 1):记录在、但没有指名的记录时间字段时,「没有可保留的时间」等于
|
|
1231
|
-
# 「没有记录」——命令必须照旧把字段补全并 rc=0。守卫若用裸赋值接一个没命中的 grep,在
|
|
1232
|
-
# set -e 下会把整个 CLI 带走(rc=1、一字不写):既有的 smoke §17 用的就是这个形状。
|
|
1233
|
-
if [ "$n_stamped" != "0" ]; then
|
|
1234
|
-
while IFS= read -r s; do
|
|
1235
|
-
[ -n "$s" ] || continue
|
|
1236
|
-
f="$d/${s%%:*}"; field="${s#*:}"
|
|
1237
|
-
grep -v "^$field=" "$f" > "$f.p290m" 2>/dev/null || true
|
|
1238
|
-
mv "$f.p290m" "$f"
|
|
1239
|
-
env_run "$d" $argv >/dev/null 2>&1
|
|
1240
|
-
rc_missing="$HS_RC"; wrote=no
|
|
1241
|
-
grep -q "^$field=" "$f" 2>/dev/null && wrote=yes
|
|
1242
|
-
if [ "$rc_missing" = "0" ] && [ "$wrote" = "yes" ]; then
|
|
1243
|
-
ok "claims: $cmd 记录里缺指名的记录时间字段 $field 时补全并 rc=0(缺时间戳不是错误)"
|
|
1244
|
-
else
|
|
1245
|
-
finding "claims: $cmd 记录里缺指名的记录时间字段 $field 时 rc=$rc_missing、字段写回=$wrote(静默失败与不补全都算缺陷)"
|
|
1246
|
-
fi
|
|
1247
|
-
done < "$stamped"
|
|
1152
|
+
finding "claims: $cmd 声明幂等,但第二次跑改了状态"
|
|
1248
1153
|
fi ;;
|
|
1249
1154
|
undo-by-*)
|
|
1250
1155
|
local undo_cmd="${MG_UNDO[$cmd]#undo-by-}"
|
|
@@ -1338,7 +1243,6 @@ changelog --since
|
|
|
1338
1243
|
change --json
|
|
1339
1244
|
dispatch --allow-overflow --branch --fresh --model --print
|
|
1340
1245
|
draft --now
|
|
1341
|
-
mark-loaded --version
|
|
1342
1246
|
meeting --all --intent --knock --note --peek --since --topic --ttl --with --yes
|
|
1343
1247
|
monitor --events --height --interval --json --no-pulse --once --print --width
|
|
1344
1248
|
notify --from
|
|
@@ -1608,8 +1512,11 @@ if [ "$_TEAM_HELP_REQ" = "1" ]; then""", 1)' \
|
|
|
1608
1512
|
coverage "__probe-x"
|
|
1609
1513
|
|
|
1610
1514
|
# O2b: the declared internal set names one entry that is no longer a dispatcher label
|
|
1515
|
+
# P417: 这里的字面量以前跟丢了声明本身(声明是三个名字 `__inbox-write __notify-settle __panel-data`,
|
|
1516
|
+
# 而变异找的是中间没有 `__notify-settle` 的两词子串)——替换静默空转,⑪ 于是长期「没有红」:
|
|
1517
|
+
# 一条自己什么都没测的红侧。字面量改成声明的原三词串;改完这条翻转必须变红。
|
|
1611
1518
|
flip_case "internal-list-short" "⑪声明清单里删一个内部名" "tests/help-surface.sh" \
|
|
1612
|
-
's = s.replace("__inbox-write __panel-data", "__panel-data", 1)' \
|
|
1519
|
+
's = s.replace("__inbox-write __notify-settle __panel-data", "__notify-settle __panel-data", 1)' \
|
|
1613
1520
|
coverage "__inbox-write"
|
|
1614
1521
|
|
|
1615
1522
|
# O6a: a declared group disappears from the manifest while its commands still name it
|
|
@@ -1634,48 +1541,6 @@ if [ "$_TEAM_HELP_REQ" = "1" ]; then""", 1)' \
|
|
|
1634
1541
|
's = s.replace("""team_cmd_status() {\n team_require_docs""", """team_cmd_status() {\n team_require_docs\n mkdir -p \"$TEAM_STATE_DIR\"; printf \x27%s\\n\x27 \"$(wc -l < \"$TEAM_STATE_DIR/probe-idem.txt\" 2>/dev/null || true)\" >> \"$TEAM_STATE_DIR/probe-idem.txt\"""", 1)' \
|
|
1635
1542
|
claims "声明幂等,但第二次跑改了状态" status
|
|
1636
1543
|
|
|
1637
|
-
# ②the recorded-time field is rewritten on every run again — the P290 flake's exact shape; the
|
|
1638
|
-
# sentinel makes this red no matter how fast the two runs are (no clock, no sleep)
|
|
1639
|
-
flip_case "mark-loaded-rewrites" "⑯去掉「无变化不重写」的守卫(P290 的时钟缺陷回退)" "scripts/lib/cmd-update.sh" \
|
|
1640
|
-
's = s.replace(""" if [ -n "$stored_at" ] && [ "$stored_core" = "$core" ]; then""", " if false; then", 1)' \
|
|
1641
|
-
claims "重写了指名的记录时间字段" mark-loaded
|
|
1642
|
-
|
|
1643
|
-
# ③the declared field is no longer written at all: the table's entry must be a finding, not a
|
|
1644
|
-
# silently passing no-op
|
|
1645
|
-
flip_case "time-field-gone" "⑰声明的记录时间字段不再被写(声明过期必红)" "scripts/lib/cmd-update.sh" \
|
|
1646
|
-
's = s.replace(""" printf \x27AT=%s\\n\x27 \"$(team_timestamp)\"\n""", "", 1)' \
|
|
1647
|
-
claims "声明过期" mark-loaded
|
|
1648
|
-
|
|
1649
|
-
# ⑱ a clock field nobody declared, with the declaration table emptied for mark-loaded: the sentinel
|
|
1650
|
-
# cannot see that pair, so the only thing that makes the rewrite visible is the 1.1s gap — this is
|
|
1651
|
-
# the red side that shows the gap is load-bearing rather than decoration, and it is the exact shape
|
|
1652
|
-
# of the P290 defect (an undeclared clock field, invisible on a fast same-second host)
|
|
1653
|
-
if flip_wanted "clock-undeclared"; then
|
|
1654
|
-
local c18
|
|
1655
|
-
c18="$(flip_copy "flip-clock-undeclared")"
|
|
1656
|
-
if flip_edit "$c18/skills/teamsmith/scripts/lib/cmd-update.sh" \
|
|
1657
|
-
's = s.replace(""" if [ -n "$stored_at" ] && [ "$stored_core" = "$core" ]; then""", " if false; then", 1)' 2>"$tmp/flip-18a.err" \
|
|
1658
|
-
&& flip_edit "$c18/skills/teamsmith/tests/help-surface.sh" \
|
|
1659
|
-
's = s.replace(" [mark-loaded]=\".pi/team/state/pm-loaded.env:AT\"\n", "", 1)' 2>"$tmp/flip-18b.err"; then
|
|
1660
|
-
flip_run "⑱未指名的时钟字段(只有 1.1s 间隔抓得住)" "$c18" claims "第二次跑改了状态" mark-loaded
|
|
1661
|
-
else
|
|
1662
|
-
finding "翻转 ⑱:变异没落地(夹具缺陷)—— $(head -1 "$tmp/flip-18b.err" 2>/dev/null || head -1 "$tmp/flip-18a.err")"
|
|
1663
|
-
rm -rf "$c18"
|
|
1664
|
-
fi
|
|
1665
|
-
fi
|
|
1666
|
-
|
|
1667
|
-
# ── P290 · 返修轮次 1(V46 的 F1 与 O1)─────────────────────────────────────
|
|
1668
|
-
# ⑲ F1 的形状回退:守卫改回裸赋值接一个没命中的 grep,set -e 把 CLI 带走。记录里没有指名的
|
|
1669
|
-
# 时间字段时必须补全并 rc=0——这条红侧证明夹具里那条新臂是承重的(V46 F1 的真实形状)。
|
|
1670
|
-
flip_case "missing-time-field" "⑲记录缺 AT= 行时静默失败(V46 F1 的回退)" "scripts/lib/cmd-update.sh" \
|
|
1671
|
-
's = s.replace(""" stored_at="$(grep -s -m1 \x27^AT=\x27 "$f" 2>/dev/null || true)"\n fi""", """ stored_at="$(grep -s \x27^AT=\x27 "$f" | head -1)"\n fi""", 1)' \
|
|
1672
|
-
claims "记录里缺指名的记录时间字段 AT" mark-loaded
|
|
1673
|
-
|
|
1674
|
-
# ⑳ O1:第二次跑以非零退出、且不写盘(V46 的 m3)——只看字节会判绿,退出码断言是唯一抓手。
|
|
1675
|
-
flip_case "second-run-fails" "⑳第二次跑失败但不写盘(退出码盲区)" "scripts/lib/cmd-update.sh" \
|
|
1676
|
-
's = s.replace(""" team_ok "本会话 skill 版本未变化:$ver(指纹 $hash;保留 $(basename "$f") 里记录的时间)"\n return 0""", """ team_ok "本会话 skill 版本未变化:$ver(指纹 $hash;保留 $(basename "$f") 里记录的时间)"\n return 1""", 1)' \
|
|
1677
|
-
claims "两次跑的退出码不同" mark-loaded
|
|
1678
|
-
|
|
1679
1544
|
# ── P292 · 返修轮次 1(V52 的 F1)────────────────────────────────────────────────────────────
|
|
1680
1545
|
# ㉑ 少声明:interrupt 的 `faces` 删掉 docs。旧探针只判「声明的面都动了」,这一改照样全绿(V52 §2.5);
|
|
1681
1546
|
# 反向判据必须红并点名那个没被声明的面。
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# P426: exercise the actual isolation predicates without starting tmux or writing to a live team.
|
|
3
|
+
# --ref <commit> runs the same expectations against the old predicates (expected red).
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
SELF_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
ROOT="$(cd "$SELF_DIR/../../.." && pwd)"
|
|
7
|
+
REF=""
|
|
8
|
+
if [ "${1:-}" = --ref ] && [ "$#" = 2 ]; then REF="$2"
|
|
9
|
+
elif [ "$#" != 0 ]; then printf 'usage: isolation-ledger.sh [--ref <commit>]\n' >&2; exit 2; fi
|
|
10
|
+
TMP="$(mktemp -d -p /var/tmp p426-isolation.XXXXXX)"
|
|
11
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
12
|
+
for file in smoke.sh tmux-identity-leak.sh; do
|
|
13
|
+
if [ -n "$REF" ]; then git -C "$ROOT" show "$REF:skills/teamsmith/tests/$file" > "$TMP/$file"
|
|
14
|
+
else cp "$SELF_DIR/$file" "$TMP/$file"; fi
|
|
15
|
+
done
|
|
16
|
+
# Extract the checked-in functions and the actual closing verdict, not a second implementation.
|
|
17
|
+
python3 - "$TMP" <<'PY'
|
|
18
|
+
import pathlib, re, sys
|
|
19
|
+
root = pathlib.Path(sys.argv[1])
|
|
20
|
+
for file, name in [('smoke.sh', 'real_ledger_hits'), ('tmux-identity-leak.sh', 'ledger_manifest')]:
|
|
21
|
+
text = (root / file).read_text()
|
|
22
|
+
body = re.search(r'^' + name + r'\(\).*?^}', text, re.M | re.S)
|
|
23
|
+
if not body:
|
|
24
|
+
raise SystemExit('missing predicate: ' + name)
|
|
25
|
+
(root / (name + '.sh')).write_text(body[0] + '\n')
|
|
26
|
+
text = (root / 'tmux-identity-leak.sh').read_text()
|
|
27
|
+
start = text.index('LEDGER_AFTER=')
|
|
28
|
+
end = text.index('ROOTS_AFTER=', start)
|
|
29
|
+
(root / 'verdict.sh').write_text(text[start:end])
|
|
30
|
+
PY
|
|
31
|
+
. "$SELF_DIR/lib/main-team-fingerprint.sh"
|
|
32
|
+
. "$TMP/real_ledger_hits.sh"
|
|
33
|
+
. "$TMP/ledger_manifest.sh"
|
|
34
|
+
PASS=0; FAIL=0
|
|
35
|
+
ok() { printf 'ok: %s\n' "$1"; PASS=$((PASS + 1)); }
|
|
36
|
+
bad() { printf 'bad: %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
|
37
|
+
expect() { if [ "$2" = "$3" ]; then ok "$1"; else bad "$1 (expected=$3 actual=$2)"; fi; }
|
|
38
|
+
|
|
39
|
+
SCAN="$TMP/scan"
|
|
40
|
+
mkdir -p "$SCAN/docs/team/inbox" "$SCAN/.pi/team/state"
|
|
41
|
+
# Reports may quote old sessions, old temp roots, family prefixes and fixture aliases in any file.
|
|
42
|
+
printf '%s\n' 'Old incident: teamsmith-smoke-758714; teamsmith-smoke-p10-1; teamsmith-smoke-m16-2; teamsmith-smoke-m98-3; teamsmith-smoke-pm_skills-deb708fe.OLDROOT' \
|
|
43
|
+
'P10 夹具阻塞行 / P10Z / $P10SESS / M16A / M98G / never lands / held body / OB-EXT-KNOCK' \
|
|
44
|
+
> "$SCAN/docs/team/inbox/history.md"
|
|
45
|
+
cp "$SCAN/docs/team/inbox/history.md" "$SCAN/.pi/team/state/notify.log"
|
|
46
|
+
cp "$SCAN/docs/team/inbox/history.md" "$SCAN/.pi/team/state/history.env"
|
|
47
|
+
for session in "teamsmith-smoke-$$" "teamsmith-smoke-p10-$$" "teamsmith-smoke-m16-$$" "teamsmith-smoke-m98-$$"; do
|
|
48
|
+
pats="$(printf '%s\n' "$session" "${TMP##*/}")"
|
|
49
|
+
expect "scanner [$session]: historical messages and old aliases are not this run's leakage" \
|
|
50
|
+
"$(real_ledger_hits "$pats" "$SCAN" | wc -l | tr -d ' ')" 0
|
|
51
|
+
printf 'fixture session: %s:dev\n' "$session" > "$SCAN/docs/team/inbox/current.md"
|
|
52
|
+
current_hits="$(real_ledger_hits "$pats" "$SCAN")"
|
|
53
|
+
printf 'current-session hits: %s\n' "$current_hits"
|
|
54
|
+
expect "scanner [$session]: this run's session written into inbox must be caught" \
|
|
55
|
+
"$(printf '%s\n' "$current_hits" | grep -c 'inbox/current.md$')" 1
|
|
56
|
+
rm "$SCAN/docs/team/inbox/current.md"
|
|
57
|
+
printf 'fixture root: %s/fixture\n' "$TMP" > "$SCAN/.pi/team/state/current.env"
|
|
58
|
+
cp "$SCAN/.pi/team/state/current.env" "$SCAN/.pi/team/state/notify-current.log"
|
|
59
|
+
expect "scanner [$session]: this run's temp root in state and notify must be caught" \
|
|
60
|
+
"$(real_ledger_hits "$pats" "$SCAN" | wc -l | tr -d ' ')" 2
|
|
61
|
+
rm "$SCAN/.pi/team/state/current.env" "$SCAN/.pi/team/state/notify-current.log"
|
|
62
|
+
done
|
|
63
|
+
|
|
64
|
+
# Same before/after manifest and closing branch used by the identity fixture, on a nonempty live shape.
|
|
65
|
+
for mode in telemetry inbox unknown-state; do
|
|
66
|
+
REPO_ROOT="$TMP/$mode"
|
|
67
|
+
REAL_INBOX="$REPO_ROOT/docs/team/inbox"; REAL_STATE="$REPO_ROOT/.pi/team/state"
|
|
68
|
+
mkdir -p "$REAL_INBOX" "$REAL_STATE"
|
|
69
|
+
printf 'original\n' > "$REAL_INBOX/dev.md"
|
|
70
|
+
printf 'tick\n' > "$REAL_STATE/watchdog.log"
|
|
71
|
+
printf 'delivery\n' > "$REAL_STATE/notify.log"
|
|
72
|
+
LEDGER_BEFORE="$(ledger_manifest "$REAL_INBOX" "$REAL_STATE")"
|
|
73
|
+
LEDGER_N="$(printf '%s\n' "$LEDGER_BEFORE" | wc -l)"
|
|
74
|
+
case "$mode" in
|
|
75
|
+
telemetry) printf 'next tick\n' >> "$REAL_STATE/watchdog.log"; printf 'next delivery\n' >> "$REAL_STATE/notify.log"; expected=0 ;;
|
|
76
|
+
inbox) printf 'unintended write\n' >> "$REAL_INBOX/dev.md"; expected=1 ;;
|
|
77
|
+
unknown-state) mkdir "$REAL_STATE/unregistered"; printf 'unintended write\n' > "$REAL_STATE/unregistered/new.log"; expected=1 ;;
|
|
78
|
+
esac
|
|
79
|
+
# The verdict functions print their real lines, while this subshell's result counts rejected writes.
|
|
80
|
+
actual="$(FAIL=0; . "$TMP/verdict.sh"; printf '\nrejected=%s\n' "$FAIL")"
|
|
81
|
+
printf '%s\n' "$actual"
|
|
82
|
+
expect "identity ledger: $mode" "${actual##*rejected=}" "$expected"
|
|
83
|
+
done
|
|
84
|
+
printf 'isolation-ledger: pass=%s fail=%s\n' "$PASS" "$FAIL"
|
|
85
|
+
[ "$FAIL" = 0 ]
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
# main_team_volatile <./relpath> → 0 = the shape is allowed to move
|
|
17
17
|
# main_team_violations <before> <after> → one path per non-whitelisted change
|
|
18
18
|
# main_team_volatile_changes <b> <a> → count of whitelisted changes (proves the check sees motion)
|
|
19
|
+
# main_team_touched <b> <a> <./prefix> → one path per file under the prefix that appeared, vanished
|
|
20
|
+
# or changed (the accident-shape probe: "this run must not
|
|
21
|
+
# have written it", which stays true when the path is a
|
|
22
|
+
# legitimate runtime file the real team owns)
|
|
19
23
|
#
|
|
20
24
|
# MAIN_TEAM_BREAK=skip-state is the fixtures' own red side: it restores the old "skip state/" shape so
|
|
21
25
|
# a stray file there stops being reported. Product code never reads it.
|
|
@@ -59,7 +63,7 @@ main_team_volatile() { # <relative path, starting with ./ >
|
|
|
59
63
|
inbox-*|pm-*|pm.*|dispatch-*|draft-*|held) return 0 ;;
|
|
60
64
|
notify*|nudge*|watchdog*|capacity*|digest-*|deaths.*|bg.log|panel*) return 0 ;;
|
|
61
65
|
changes.json|refs|pane|_watch.*|reload-requested|interrupt.*|update-check.*|config.*) return 0 ;;
|
|
62
|
-
summary-*|prompt-*|pm-
|
|
66
|
+
summary-*|prompt-*|pm-launch*) return 0 ;;
|
|
63
67
|
esac
|
|
64
68
|
return 1 ;;
|
|
65
69
|
esac
|
|
@@ -94,6 +98,18 @@ main_team_volatile_changes() { # <before> <after> → number of whitelisted path
|
|
|
94
98
|
printf '%s\n' "$n"
|
|
95
99
|
}
|
|
96
100
|
|
|
101
|
+
# The accident-shape probe. "This path must not exist" is the wrong judgement for a live project: the
|
|
102
|
+
# team legitimately owns e.g. state/standby until it migrates. The judgement that stays true is "this
|
|
103
|
+
# run did not create, change or remove it", which covers a file that was never there and one that was.
|
|
104
|
+
main_team_touched() { # <before> <after> <./prefix> → one path per file under the prefix that moved
|
|
105
|
+
local before="$1" after="$2" prefix="$3" path b a
|
|
106
|
+
join -t "$(printf '\t')" -a1 -a2 -e MISSING -o '0,1.2,2.2' "$before" "$after" |
|
|
107
|
+
while IFS="$(printf '\t')" read -r path b a; do
|
|
108
|
+
[ "$b" = "$a" ] && continue
|
|
109
|
+
case "$path" in "$prefix"|"$prefix"/*) printf '%s\n' "$path" ;; esac
|
|
110
|
+
done
|
|
111
|
+
}
|
|
112
|
+
|
|
97
113
|
# The proof target is this project's **main checkout**, never this worktree: the fixture runs from a
|
|
98
114
|
# worktree while the authority must never land in the main checkout.
|
|
99
115
|
main_team_project_root() { # <skill-dir> → the main checkout (empty when this checkout has none)
|
|
@@ -25,9 +25,19 @@ bash "$team" init --no-skills --session probe --agents dev --pm-model "$model" \
|
|
|
25
25
|
--task-models "code=$model verify=$model analysis=$model" >/dev/null
|
|
26
26
|
bash "$team" up >/dev/null
|
|
27
27
|
sleep 35
|
|
28
|
+
# team up creates the session on the caller's tmux server; point the probe at that same server
|
|
29
|
+
# (the PM session lives there), while every probe-issued call goes through its own socket below.
|
|
28
30
|
|
|
29
31
|
session=probe
|
|
30
|
-
|
|
32
|
+
# The probe owns a private tmux server: every call goes through tmux_probe (isolated socket),
|
|
33
|
+
# so it never disturbs a caller's session and the tmux isolation lint can verify that.
|
|
34
|
+
probe_socket="$probe/tmux-private"
|
|
35
|
+
mkdir -p "$probe_socket"
|
|
36
|
+
tmux_probe() { env -u TMUX TMUX_TMPDIR="$probe_socket" tmux -S "$probe_socket/tmux.sock" "$@"; }
|
|
37
|
+
# The probe owns a private tmux server: all mutating calls go through tmux_probe (isolated socket),
|
|
38
|
+
# and the caller's server is never touched. team up uses its own session; send the model prompt the
|
|
39
|
+
# same way the probe owns, via that private socket.
|
|
40
|
+
tmux_probe send-keys -t "$session:pm" '正文一句。最后一行单独写 [[team-reply]]' Enter
|
|
31
41
|
sleep 55
|
|
32
42
|
|
|
33
43
|
journal=$(ls .pi/team/state/reply-capture/*.json | grep -v runtime | head -1)
|
|
@@ -49,5 +59,5 @@ sys.exit(0 if saved and not marker_left and size > 0 else 1)
|
|
|
49
59
|
PY
|
|
50
60
|
|
|
51
61
|
status=$?
|
|
52
|
-
|
|
62
|
+
tmux_probe kill-server 2>/dev/null || true
|
|
53
63
|
exit $status
|
|
@@ -63,6 +63,11 @@ PK_COUNTS_MODE='stub' # stub | real(policy 档用真读者)
|
|
|
63
63
|
PK_PM_STATE='running:fixture'
|
|
64
64
|
PK_NOW=100000
|
|
65
65
|
mkdir -p "$PK_STATE" "$PK_PROJ/docs/team" "$PK_PROJ/worktrees"
|
|
66
|
+
# 夹具的“项目主工作树”得是真 git 仓库,而且脚本要在它里面跑:待命自 1.3 起住在项目状态权威的
|
|
67
|
+
# 快照里,权威按“当前目录所属项目”钉住状态根(继承的 TEAM_MAIN_ROOT 与目录不一致会被拒)。
|
|
68
|
+
git -C "$PK_PROJ" init -q -b main &&
|
|
69
|
+
git -C "$PK_PROJ" -c user.email=pk@fixture -c user.name=pk commit -q --allow-empty -m init || exit 3
|
|
70
|
+
cd "$PK_PROJ" || exit 3
|
|
66
71
|
|
|
67
72
|
export TEAM_ROOT="$PK_PURE" TEAM_MAIN_ROOT="$PK_PROJ" TEAM_STATE_DIR="$PK_STATE" \
|
|
68
73
|
TEAM_DOCS_ABS="$PK_PROJ/docs/team" TEAM_DOCS_DIR="docs/team" TEAM_SESSION="pk-fixture-session" \
|