teamsmith 0.4.5 → 0.4.7
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 +6 -6
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +37 -1
- package/skills/teamsmith/SKILL.md +32 -23
- package/skills/teamsmith/extension/team-bg.ts +12 -11
- package/skills/teamsmith/extension/team-inbox-watch.ts +149 -5
- package/skills/teamsmith/extension/team-notify.ts +20 -13
- package/skills/teamsmith/extension/team-remind.ts +189 -0
- package/skills/teamsmith/extension/team-reply.ts +4 -7
- package/skills/teamsmith/references/migration.md +101 -0
- package/skills/teamsmith/references/openspec.md +43 -27
- package/skills/teamsmith/references/protocol.md +28 -18
- package/skills/teamsmith/references/reminders.md +133 -98
- package/skills/teamsmith/references/troubleshooting.md +12 -7
- package/skills/teamsmith/references/workflows.md +85 -34
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +28 -5
- package/skills/teamsmith/scripts/lib/cmd-project.sh +100 -15
- package/skills/teamsmith/scripts/lib/cmd-remind.sh +135 -10
- package/skills/teamsmith/scripts/lib/cmd-review.sh +42 -4
- package/skills/teamsmith/scripts/lib/cmd-update.sh +90 -88
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +322 -159
- package/skills/teamsmith/scripts/lib/common.sh +156 -26
- package/skills/teamsmith/scripts/panel/panel.js +182 -182
- package/skills/teamsmith/scripts/panel/src/data.ts +113 -6
- package/skills/teamsmith/scripts/panel/src/layout.ts +26 -4
- package/skills/teamsmith/scripts/panel/src/main.tsx +103 -14
- package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
- package/skills/teamsmith/scripts/remind-store.mjs +404 -17
- package/skills/teamsmith/scripts/remind-tick.mjs +105 -0
- package/skills/teamsmith/scripts/reminder-delivery.mjs +76 -0
- package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
- package/skills/teamsmith/scripts/state-authority.mjs +334 -20
- 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 +4 -3
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +13 -11
- package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
- package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +36 -18
- package/skills/teamsmith/templates/report.md.tmpl +33 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
- package/skills/teamsmith/tests/bg-ledger.sh +24 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
- package/skills/teamsmith/tests/death-cause.sh +5 -0
- package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
- package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
- package/skills/teamsmith/tests/help-surface.sh +14 -151
- package/skills/teamsmith/tests/isolation-ledger.sh +89 -0
- package/skills/teamsmith/tests/key-replies-ui.sh +53 -0
- package/skills/teamsmith/tests/key-replies.sh +307 -106
- package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +17 -1
- package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
- package/skills/teamsmith/tests/live-capture-probe.sh +12 -2
- package/skills/teamsmith/tests/loop-inventory.tsv +1 -0
- package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
- package/skills/teamsmith/tests/pulse-nudge-key.sh +5 -0
- package/skills/teamsmith/tests/remind-adversarial-faults.mjs +163 -0
- package/skills/teamsmith/tests/remind-adversarial-faults.sh +26 -0
- package/skills/teamsmith/tests/remind-adversarial-real.sh +27 -0
- package/skills/teamsmith/tests/remind-cli.sh +108 -3
- package/skills/teamsmith/tests/remind-delivery-node.mjs +189 -0
- package/skills/teamsmith/tests/remind-delivery.sh +699 -0
- package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
- package/skills/teamsmith/tests/remind-pulse.sh +199 -0
- package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
- package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
- package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
- package/skills/teamsmith/tests/remind-tool-real.mjs +754 -0
- package/skills/teamsmith/tests/remind-tool-real.sh +5 -0
- package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
- package/skills/teamsmith/tests/routes.sh +213 -293
- package/skills/teamsmith/tests/section-paths.tsv +14 -12
- package/skills/teamsmith/tests/smoke.sh +876 -130
- package/skills/teamsmith/tests/state-authority.sh +392 -28
- 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 +5 -5
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
|
@@ -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' ;;
|
|
@@ -813,7 +759,7 @@ check_coverage() {
|
|
|
813
759
|
[ "$aw" = "0" ] && ok "每个别名都打印主命令的页并点名该别名"
|
|
814
760
|
|
|
815
761
|
# O2 · the dispatcher's internal entries are a closed set, declared in one place (here)
|
|
816
|
-
local internal="__inbox-write __notify-settle __panel-data"
|
|
762
|
+
local internal="__inbox-write __notify-settle __panel-data __remind-recover"
|
|
817
763
|
local found want nm extra="" miss="" n
|
|
818
764
|
found="$(team_internal_labels)"
|
|
819
765
|
want="$(printf '%s\n' $internal | sort -u)"
|
|
@@ -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,9 @@ 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: 变异必须点名声明的完整当前值;替换静默空转会让这条红侧什么都没测。
|
|
1611
1516
|
flip_case "internal-list-short" "⑪声明清单里删一个内部名" "tests/help-surface.sh" \
|
|
1612
|
-
's = s.replace("__inbox-write __panel-data", "__panel-data", 1)' \
|
|
1517
|
+
's = s.replace("__inbox-write __notify-settle __panel-data __remind-recover", "__notify-settle __panel-data __remind-recover", 1)' \
|
|
1613
1518
|
coverage "__inbox-write"
|
|
1614
1519
|
|
|
1615
1520
|
# O6a: a declared group disappears from the manifest while its commands still name it
|
|
@@ -1634,48 +1539,6 @@ if [ "$_TEAM_HELP_REQ" = "1" ]; then""", 1)' \
|
|
|
1634
1539
|
'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
1540
|
claims "声明幂等,但第二次跑改了状态" status
|
|
1636
1541
|
|
|
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
1542
|
# ── P292 · 返修轮次 1(V52 的 F1)────────────────────────────────────────────────────────────
|
|
1680
1543
|
# ㉑ 少声明:interrupt 的 `faces` 删掉 docs。旧探针只判「声明的面都动了」,这一改照样全绿(V52 §2.5);
|
|
1681
1544
|
# 反向判据必须红并点名那个没被声明的面。
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
# P427:临时根走夹具的**唯一创建者**(tests/lib/tmp-root.sh:owned 家族 + 项目 ns + 落盘台账 + 退出回收)。
|
|
11
|
+
# 不自己算基准、也不写死 /var/tmp —— section 40 的临时根 lint 对这两件事都会点名(旧写法是
|
|
12
|
+
# `mktemp -d -p /var/tmp p426-isolation.XXXXXX`)。
|
|
13
|
+
. "$SELF_DIR/lib/tmp-root.sh"
|
|
14
|
+
TMP="$(tmp_root_create isolation)" || { printf 'isolation-ledger: 建不了临时根\n' >&2; exit 2; }
|
|
15
|
+
trap 'tmp_root_reap_all' EXIT
|
|
16
|
+
for file in smoke.sh tmux-identity-leak.sh; do
|
|
17
|
+
if [ -n "$REF" ]; then git -C "$ROOT" show "$REF:skills/teamsmith/tests/$file" > "$TMP/$file"
|
|
18
|
+
else cp "$SELF_DIR/$file" "$TMP/$file"; fi
|
|
19
|
+
done
|
|
20
|
+
# Extract the checked-in functions and the actual closing verdict, not a second implementation.
|
|
21
|
+
python3 - "$TMP" <<'PY'
|
|
22
|
+
import pathlib, re, sys
|
|
23
|
+
root = pathlib.Path(sys.argv[1])
|
|
24
|
+
for file, name in [('smoke.sh', 'real_ledger_hits'), ('tmux-identity-leak.sh', 'ledger_manifest')]:
|
|
25
|
+
text = (root / file).read_text()
|
|
26
|
+
body = re.search(r'^' + name + r'\(\).*?^}', text, re.M | re.S)
|
|
27
|
+
if not body:
|
|
28
|
+
raise SystemExit('missing predicate: ' + name)
|
|
29
|
+
(root / (name + '.sh')).write_text(body[0] + '\n')
|
|
30
|
+
text = (root / 'tmux-identity-leak.sh').read_text()
|
|
31
|
+
start = text.index('LEDGER_AFTER=')
|
|
32
|
+
end = text.index('ROOTS_AFTER=', start)
|
|
33
|
+
(root / 'verdict.sh').write_text(text[start:end])
|
|
34
|
+
PY
|
|
35
|
+
. "$SELF_DIR/lib/main-team-fingerprint.sh"
|
|
36
|
+
. "$TMP/real_ledger_hits.sh"
|
|
37
|
+
. "$TMP/ledger_manifest.sh"
|
|
38
|
+
PASS=0; FAIL=0
|
|
39
|
+
ok() { printf 'ok: %s\n' "$1"; PASS=$((PASS + 1)); }
|
|
40
|
+
bad() { printf 'bad: %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
|
41
|
+
expect() { if [ "$2" = "$3" ]; then ok "$1"; else bad "$1 (expected=$3 actual=$2)"; fi; }
|
|
42
|
+
|
|
43
|
+
SCAN="$TMP/scan"
|
|
44
|
+
mkdir -p "$SCAN/docs/team/inbox" "$SCAN/.pi/team/state"
|
|
45
|
+
# Reports may quote old sessions, old temp roots, family prefixes and fixture aliases in any file.
|
|
46
|
+
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' \
|
|
47
|
+
'P10 夹具阻塞行 / P10Z / $P10SESS / M16A / M98G / never lands / held body / OB-EXT-KNOCK' \
|
|
48
|
+
> "$SCAN/docs/team/inbox/history.md"
|
|
49
|
+
cp "$SCAN/docs/team/inbox/history.md" "$SCAN/.pi/team/state/notify.log"
|
|
50
|
+
cp "$SCAN/docs/team/inbox/history.md" "$SCAN/.pi/team/state/history.env"
|
|
51
|
+
for session in "teamsmith-smoke-$$" "teamsmith-smoke-p10-$$" "teamsmith-smoke-m16-$$" "teamsmith-smoke-m98-$$"; do
|
|
52
|
+
pats="$(printf '%s\n' "$session" "${TMP##*/}")"
|
|
53
|
+
expect "scanner [$session]: historical messages and old aliases are not this run's leakage" \
|
|
54
|
+
"$(real_ledger_hits "$pats" "$SCAN" | wc -l | tr -d ' ')" 0
|
|
55
|
+
printf 'fixture session: %s:dev\n' "$session" > "$SCAN/docs/team/inbox/current.md"
|
|
56
|
+
current_hits="$(real_ledger_hits "$pats" "$SCAN")"
|
|
57
|
+
printf 'current-session hits: %s\n' "$current_hits"
|
|
58
|
+
expect "scanner [$session]: this run's session written into inbox must be caught" \
|
|
59
|
+
"$(printf '%s\n' "$current_hits" | grep -c 'inbox/current.md$')" 1
|
|
60
|
+
rm "$SCAN/docs/team/inbox/current.md"
|
|
61
|
+
printf 'fixture root: %s/fixture\n' "$TMP" > "$SCAN/.pi/team/state/current.env"
|
|
62
|
+
cp "$SCAN/.pi/team/state/current.env" "$SCAN/.pi/team/state/notify-current.log"
|
|
63
|
+
expect "scanner [$session]: this run's temp root in state and notify must be caught" \
|
|
64
|
+
"$(real_ledger_hits "$pats" "$SCAN" | wc -l | tr -d ' ')" 2
|
|
65
|
+
rm "$SCAN/.pi/team/state/current.env" "$SCAN/.pi/team/state/notify-current.log"
|
|
66
|
+
done
|
|
67
|
+
|
|
68
|
+
# Same before/after manifest and closing branch used by the identity fixture, on a nonempty live shape.
|
|
69
|
+
for mode in telemetry inbox unknown-state; do
|
|
70
|
+
REPO_ROOT="$TMP/$mode"
|
|
71
|
+
REAL_INBOX="$REPO_ROOT/docs/team/inbox"; REAL_STATE="$REPO_ROOT/.pi/team/state"
|
|
72
|
+
mkdir -p "$REAL_INBOX" "$REAL_STATE"
|
|
73
|
+
printf 'original\n' > "$REAL_INBOX/dev.md"
|
|
74
|
+
printf 'tick\n' > "$REAL_STATE/watchdog.log"
|
|
75
|
+
printf 'delivery\n' > "$REAL_STATE/notify.log"
|
|
76
|
+
LEDGER_BEFORE="$(ledger_manifest "$REAL_INBOX" "$REAL_STATE")"
|
|
77
|
+
LEDGER_N="$(printf '%s\n' "$LEDGER_BEFORE" | wc -l)"
|
|
78
|
+
case "$mode" in
|
|
79
|
+
telemetry) printf 'next tick\n' >> "$REAL_STATE/watchdog.log"; printf 'next delivery\n' >> "$REAL_STATE/notify.log"; expected=0 ;;
|
|
80
|
+
inbox) printf 'unintended write\n' >> "$REAL_INBOX/dev.md"; expected=1 ;;
|
|
81
|
+
unknown-state) mkdir "$REAL_STATE/unregistered"; printf 'unintended write\n' > "$REAL_STATE/unregistered/new.log"; expected=1 ;;
|
|
82
|
+
esac
|
|
83
|
+
# The verdict functions print their real lines, while this subshell's result counts rejected writes.
|
|
84
|
+
actual="$(FAIL=0; . "$TMP/verdict.sh"; printf '\nrejected=%s\n' "$FAIL")"
|
|
85
|
+
printf '%s\n' "$actual"
|
|
86
|
+
expect "identity ledger: $mode" "${actual##*rejected=}" "$expected"
|
|
87
|
+
done
|
|
88
|
+
printf 'isolation-ledger: pass=%s fail=%s\n' "$PASS" "$FAIL"
|
|
89
|
+
[ "$FAIL" = 0 ]
|
|
@@ -47,6 +47,13 @@ kr_panel_snapshot() { # <页> <额外参数…> → stdout
|
|
|
47
47
|
| sed -e 's/\x1b\[[0-9;]*m//g'
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
kr_reply_time_snapshot() { # <输出> <TZ> <at|-> <省略 0|1> <页> <额外参数…>
|
|
51
|
+
local out="$1" tz="$2" at="$3" omit="$4" page="$5"; shift 5
|
|
52
|
+
"${clean_env[@]}" TZ="$tz" B3_STUB_REPLY=ok B3_STUB_REPLY_AT="$at" B3_STUB_REPLY_AT_OMIT="$omit" \
|
|
53
|
+
node "$panel" --root "$ROOT" --team-cli "$SELF_DIR/panel-b3-stub.sh" --snapshot --page "$page" \
|
|
54
|
+
--width 160 --height 30 --lang zh "$@" 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$out"
|
|
55
|
+
}
|
|
56
|
+
|
|
50
57
|
# ---------------------------------------------------------------- 组:blocks
|
|
51
58
|
kr_group_blocks() {
|
|
52
59
|
section "blocks · 三个需求块的装配契约(3.3)"
|
|
@@ -73,6 +80,52 @@ kr_group_blocks() {
|
|
|
73
80
|
assert_match "$(kr_argv)" 'reply_body.*--no 1' "blocks:视窗形态出现在 argv(--no 1)"
|
|
74
81
|
assert_eq "blocks:打开视窗时不调度 list(视窗取代列表)" "$(block_calls reply_list)" "0"
|
|
75
82
|
assert_has "$tmp/bl-body.txt" "块夹具正文" "blocks:正文块渲染出原文"
|
|
83
|
+
|
|
84
|
+
# P436:同一 UTC 输入在两个阅读者时区下,列表/摘要保持紧凑本地时间,详情带实际偏移。
|
|
85
|
+
# 用固定 stub 而非真实发布时间,避免测试依赖运行时钟;KR_PANEL 可指向变异 bundle 做红侧。
|
|
86
|
+
local time_at='2026-09-16T09:59:00Z' zone tz compact full surface page f
|
|
87
|
+
for zone in shanghai new-york; do
|
|
88
|
+
if [ "$zone" = shanghai ]; then
|
|
89
|
+
tz='Asia/Shanghai'; compact='09-16 17:59'; full='2026-09-16 17:59 +08:00'
|
|
90
|
+
else
|
|
91
|
+
tz='America/New_York'; compact='09-16 05:59'; full='2026-09-16 05:59 -04:00'
|
|
92
|
+
fi
|
|
93
|
+
for surface in summary list body; do
|
|
94
|
+
f="$tmp/bl-time-$zone-$surface.txt"
|
|
95
|
+
page=5
|
|
96
|
+
[ "$surface" = summary ] && page=1
|
|
97
|
+
if [ "$surface" = body ]; then
|
|
98
|
+
kr_reply_time_snapshot "$f" "$tz" "$time_at" 0 "$page" --reply-no 1
|
|
99
|
+
else
|
|
100
|
+
kr_reply_time_snapshot "$f" "$tz" "$time_at" 0 "$page"
|
|
101
|
+
fi
|
|
102
|
+
assert_has "$f" "$compact" "blocks:$zone 的 $surface 与列表使用同一紧凑本地时刻"
|
|
103
|
+
assert_not "$f" "$time_at" "blocks:$zone 的 $surface 不直接显示原始 UTC"
|
|
104
|
+
assert_not "$f" 'Invalid Date' "blocks:$zone 的 $surface 没有 Invalid Date"
|
|
105
|
+
if [ "$surface" = body ]; then
|
|
106
|
+
assert_has "$f" "$full" "blocks:$zone 的详情显示完整本地时间与实际偏移"
|
|
107
|
+
fi
|
|
108
|
+
done
|
|
109
|
+
done
|
|
110
|
+
# 非法/缺失时间沿用无时间的降级:保留回复与发布者,不显示原始坏值或 Invalid Date。
|
|
111
|
+
local mode omit shown_at
|
|
112
|
+
for mode in invalid missing; do
|
|
113
|
+
if [ "$mode" = invalid ]; then shown_at='not-a-time'; omit=0; else shown_at='-'; omit=1; fi
|
|
114
|
+
for surface in summary list body; do
|
|
115
|
+
f="$tmp/bl-time-$mode-$surface.txt"
|
|
116
|
+
page=5
|
|
117
|
+
[ "$surface" = summary ] && page=1
|
|
118
|
+
if [ "$surface" = body ]; then
|
|
119
|
+
kr_reply_time_snapshot "$f" 'Asia/Shanghai' "$shown_at" "$omit" "$page" --reply-no 1
|
|
120
|
+
else
|
|
121
|
+
kr_reply_time_snapshot "$f" 'Asia/Shanghai' "$shown_at" "$omit" "$page"
|
|
122
|
+
fi
|
|
123
|
+
assert_not "$f" 'Invalid Date' "blocks:$mode 的 $surface 不显示 Invalid Date"
|
|
124
|
+
assert_not "$f" 'not-a-time' "blocks:$mode 的 $surface 不显示非法原始时间"
|
|
125
|
+
assert_has "$f" 'dev2' "blocks:$mode 的 $surface 仍保留回复与发布者"
|
|
126
|
+
done
|
|
127
|
+
done
|
|
128
|
+
|
|
76
129
|
# ⑤ 慢块:子进程超时被杀(timeoutMs 10s)→ 只降级本块,其余块照常
|
|
77
130
|
kr_shim_set_slow reply_list 30
|
|
78
131
|
reset_argv
|