teamsmith 0.3.0 → 0.3.1
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 +41 -0
- package/skills/teamsmith/SKILL.md +7 -7
- package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
- package/skills/teamsmith/references/protocol.md +33 -19
- package/skills/teamsmith/references/troubleshooting.md +6 -3
- package/skills/teamsmith/scripts/lib/cmd-review.sh +15 -10
- package/skills/teamsmith/scripts/lib/cmd-status.sh +8 -4
- package/skills/teamsmith/scripts/lib/common.sh +301 -267
- package/skills/teamsmith/scripts/lib/gate-lock.sh +66 -28
- package/skills/teamsmith/scripts/panel/panel.js +64 -64
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +2 -1
- package/skills/teamsmith/scripts/panel/src/data.ts +40 -2
- package/skills/teamsmith/scripts/panel/src/main.tsx +5 -1
- package/skills/teamsmith/scripts/shim/killall +10 -0
- package/skills/teamsmith/scripts/shim/pgrep +10 -0
- package/skills/teamsmith/scripts/shim/pidof +10 -0
- package/skills/teamsmith/scripts/shim/pkill +10 -0
- package/skills/teamsmith/scripts/shim/signal-gate +108 -31
- package/skills/teamsmith/tests/README.md +31 -0
- package/skills/teamsmith/tests/checkout-shape-probe.sh +80 -53
- package/skills/teamsmith/tests/config-cli.sh +28 -22
- package/skills/teamsmith/tests/flip-p310-lock.sh +3 -9
- package/skills/teamsmith/tests/gate-guard.sh +52 -79
- package/skills/teamsmith/tests/help-surface.sh +2 -2
- package/skills/teamsmith/tests/install-shape.sh +80 -2
- package/skills/teamsmith/tests/key-replies-ui.sh +2 -1
- package/skills/teamsmith/tests/key-replies.sh +41 -27
- package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
- package/skills/teamsmith/tests/lib/section-guard.sh +104 -197
- package/skills/teamsmith/tests/loop-inventory.tsv +83 -89
- package/skills/teamsmith/tests/panel-b2.sh +351 -376
- package/skills/teamsmith/tests/panel-b3.sh +139 -43
- package/skills/teamsmith/tests/panel-cpu.sh +41 -129
- package/skills/teamsmith/tests/panel-p21.sh +96 -193
- package/skills/teamsmith/tests/perf.sh +83 -383
- package/skills/teamsmith/tests/routes.sh +115 -26
- package/skills/teamsmith/tests/seat-interrupt.sh +20 -10
- package/skills/teamsmith/tests/seat-visibility.sh +1 -1
- package/skills/teamsmith/tests/section-guard.sh +7 -101
- package/skills/teamsmith/tests/section-paths.tsv +15 -7
- package/skills/teamsmith/tests/section-select.sh +363 -18
- package/skills/teamsmith/tests/signal-gate.sh +249 -27
- package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
- package/skills/teamsmith/tests/slash-team-e2e.sh +4 -4
- package/skills/teamsmith/tests/slice-coverage.sh +206 -0
- package/skills/teamsmith/tests/smoke.sh +856 -581
- package/skills/teamsmith/tests/task-model-routing.sh +25 -7
- package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
- package/skills/teamsmith/tests/workflow-entry.sh +207 -0
- package/skills/teamsmith-init/SKILL.md +1 -1
- package/skills/teamsmith/tests/flip-glue.sh +0 -162
- package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
- package/skills/teamsmith/tests/flip-m12.sh +0 -185
- package/skills/teamsmith/tests/flip-m16.sh +0 -166
- package/skills/teamsmith/tests/flip-m17.sh +0 -204
- package/skills/teamsmith/tests/flip-m34.sh +0 -96
- package/skills/teamsmith/tests/flip-m37.sh +0 -188
- package/skills/teamsmith/tests/flip-m4.3.sh +0 -378
- package/skills/teamsmith/tests/flip-m43.sh +0 -128
- package/skills/teamsmith/tests/flip-m45.sh +0 -244
- package/skills/teamsmith/tests/flip-m46.sh +0 -238
- package/skills/teamsmith/tests/flip-m48.sh +0 -304
- package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
- package/skills/teamsmith/tests/flip-m6.3.sh +0 -286
- package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
- package/skills/teamsmith/tests/flip-m6.5.sh +0 -116
- package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
- package/skills/teamsmith/tests/flip-m7.2.sh +0 -324
- package/skills/teamsmith/tests/flip-p144.sh +0 -112
- package/skills/teamsmith/tests/flip-p156.sh +0 -133
- package/skills/teamsmith/tests/flip-p160.sh +0 -182
- package/skills/teamsmith/tests/flip-p171.sh +0 -249
- package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
- package/skills/teamsmith/tests/flip-p20.sh +0 -286
- package/skills/teamsmith/tests/flip-p201.sh +0 -249
- package/skills/teamsmith/tests/flip-p210.sh +0 -242
- package/skills/teamsmith/tests/flip-p211.sh +0 -152
- package/skills/teamsmith/tests/flip-p217.sh +0 -291
- package/skills/teamsmith/tests/flip-p22.sh +0 -123
- package/skills/teamsmith/tests/flip-p23.sh +0 -239
- package/skills/teamsmith/tests/flip-p25.sh +0 -165
- package/skills/teamsmith/tests/flip-p287-lock.sh +0 -342
- package/skills/teamsmith/tests/flip-p287-name.sh +0 -279
- package/skills/teamsmith/tests/flip-p304-read-side.sh +0 -98
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +0 -122
- package/skills/teamsmith/tests/flip-p71.sh +0 -184
- package/skills/teamsmith/tests/flip-p72.sh +0 -202
- package/skills/teamsmith/tests/load-experiment.sh +0 -290
- package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
- package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
- package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
- package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
- package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
- package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
- package/skills/teamsmith/tests/panel-knobs.sh +0 -89
- package/skills/teamsmith/tests/section-budgets.tsv +0 -164
- package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
|
@@ -484,7 +484,77 @@ chk_prefix_install() { # <tree>:npm 私有 prefix 安装后与 bash 入口一
|
|
|
484
484
|
if ! diff <("$prefix/bin/team" help 2>&1) <(bash "$t/skills/teamsmith/scripts/team" help 2>&1) >/dev/null; then
|
|
485
485
|
printf 'prefix 的 help 与 bash 入口不一致\n'; return 1
|
|
486
486
|
fi
|
|
487
|
-
|
|
487
|
+
# P321:安装物还得带上信号闸门的四个入口。npm 的 tarball **不携带 120000 软链** —— 0.3.0 的包里
|
|
488
|
+
# pkill/killall/pgrep/pidof 四个名字全部缺失,装完全部落到 /usr/bin(docs/team/reviews/release-0.3.0.md)。
|
|
489
|
+
# 判据不看名字在不在:在**安装物**的 gated PATH 里用同名 argv 记录桩验拒绝/放行(不发任何信号)。
|
|
490
|
+
chk_prefix_signal_entries "$prefix" || return 1
|
|
491
|
+
printf '私有 prefix 安装后 version/help 与 bash 入口一致,四个信号入口在且判定生效(%s/bin/team)\n' "$prefix"
|
|
492
|
+
return 0
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
chk_prefix_signal_entries() { # <prefix>:安装物的 pkill/killall/pgrep/pidof 在、解析到安装目录、判定生效
|
|
496
|
+
local prefix="$1" shim backends stub wlog log t form out rc line fargs missing=""
|
|
497
|
+
shim="$prefix/lib/node_modules/teamsmith/skills/teamsmith/scripts/shim"
|
|
498
|
+
backends="$tmp/prefix-signal-backends"; rm -rf "$backends"; mkdir -p "$backends"
|
|
499
|
+
stub="$backends/.witness"
|
|
500
|
+
cat > "$stub" <<'WITNESS'
|
|
501
|
+
#!/usr/bin/env bash
|
|
502
|
+
printf 'WITNESS tool=%s argc=%s argv=%s\n' "$(basename "$0")" "$#" "$*" >> "${WITNESS_LOG:?}"
|
|
503
|
+
[ -n "${WITNESS_OUT:-}" ] && printf '%s\n' "$WITNESS_OUT"
|
|
504
|
+
[ -n "${WITNESS_ERR:-}" ] && printf '%s\n' "$WITNESS_ERR" >&2
|
|
505
|
+
exit "${WITNESS_EXIT:-0}"
|
|
506
|
+
WITNESS
|
|
507
|
+
chmod +x "$stub"
|
|
508
|
+
for t in pkill killall pgrep pidof; do ln -sf .witness "$backends/$t"; done
|
|
509
|
+
for t in pkill killall pgrep pidof; do
|
|
510
|
+
[ -f "$shim/$t" ] && [ -x "$shim/$t" ] || missing="${missing:+$missing }$t"
|
|
511
|
+
done
|
|
512
|
+
if [ -n "$missing" ]; then
|
|
513
|
+
printf '安装包没有携带信号闸门入口(npm 丢 120000 软链的历史形状):%s\n' "$missing"; return 1
|
|
514
|
+
fi
|
|
515
|
+
for t in pkill killall pgrep pidof; do
|
|
516
|
+
line="$(PATH="$shim:$backends:/usr/bin:/bin" command -v "$t" 2>/dev/null)"
|
|
517
|
+
if [ "$line" != "$shim/$t" ]; then
|
|
518
|
+
printf 'gated PATH 里 %s 解析到 [%s],不是安装包的入口\n' "$t" "$line"; return 1
|
|
519
|
+
fi
|
|
520
|
+
done
|
|
521
|
+
log="$tmp/prefix-signal-calls.log"; rm -f "$log" "$log.forensics"
|
|
522
|
+
wlog="$tmp/prefix-signal-witness.log"; rm -f "$wlog"
|
|
523
|
+
# 拒绝:exit 64、stdout 留空、同名后端一次也没被执行
|
|
524
|
+
for form in "pkill -f marker" "killall sleep" "pgrep -f marker" "pgrep sleep" "pidof sleep"; do
|
|
525
|
+
read -r -a fargs <<< "$form"
|
|
526
|
+
out="$(env -u TEAM_SIGNAL_REAL PATH="$shim:$backends:/usr/bin:/bin" TEAM_SIGNAL_CALLS_LOG="$log" \
|
|
527
|
+
WITNESS_LOG="$wlog" "$shim/${fargs[0]}" "${fargs[@]:1}" 2>/dev/null)"; rc=$?
|
|
528
|
+
if [ "$rc" != "64" ] || [ -n "$out" ]; then
|
|
529
|
+
printf '安装包入口 [%s] 应拒绝(64 + 空 stdout),实际 rc=%s stdout=[%s]\n' "$form" "$rc" "$out"; return 1
|
|
530
|
+
fi
|
|
531
|
+
unset fargs
|
|
532
|
+
done
|
|
533
|
+
if [ -s "$wlog" ]; then
|
|
534
|
+
printf '拒绝路径执行了同名后端:%s\n' "$(head -2 "$wlog" | tr '\n' ' ')"; return 1
|
|
535
|
+
fi
|
|
536
|
+
# 放行:--help 与显式 -P 的原样 argv / stdout / stderr / 非零状态都来自同名后端
|
|
537
|
+
out="$(env -u TEAM_SIGNAL_REAL PATH="$shim:$backends:/usr/bin:/bin" TEAM_SIGNAL_CALLS_LOG="$log" \
|
|
538
|
+
WITNESS_LOG="$wlog" WITNESS_EXIT=3 WITNESS_OUT=sel-out WITNESS_ERR=sel-err \
|
|
539
|
+
"$shim/pgrep" --help 2>"$tmp/prefix-signal.err")"; rc=$?
|
|
540
|
+
if [ "$rc" != "3" ] || [ "$out" != "sel-out" ] || [ "$(cat "$tmp/prefix-signal.err")" != "sel-err" ]; then
|
|
541
|
+
printf 'pgrep --help 没有原样透传:rc=%s stdout=[%s] stderr=[%s]\n' "$rc" "$out" "$(cat "$tmp/prefix-signal.err")"
|
|
542
|
+
return 1
|
|
543
|
+
fi
|
|
544
|
+
grep -qF 'WITNESS tool=pgrep argc=1 argv=--help' "$wlog" \
|
|
545
|
+
|| { printf 'pgrep --help 的 argv 没落到同名后端:[%s]\n' "$(cat "$wlog")"; return 1; }
|
|
546
|
+
out="$(env -u TEAM_SIGNAL_REAL PATH="$shim:$backends:/usr/bin:/bin" TEAM_SIGNAL_CALLS_LOG="$log" \
|
|
547
|
+
WITNESS_LOG="$wlog" WITNESS_EXIT=0 WITNESS_OUT=42 \
|
|
548
|
+
"$shim/pgrep" -P 12 2>/dev/null)"; rc=$?
|
|
549
|
+
if [ "$rc" != "0" ] || [ "$out" != "42" ]; then
|
|
550
|
+
printf 'pgrep -P 12 没有原样透传:rc=%s stdout=[%s]\n' "$rc" "$out"; return 1
|
|
551
|
+
fi
|
|
552
|
+
grep -qF 'WITNESS tool=pgrep argc=2 argv=-P 12' "$wlog" \
|
|
553
|
+
|| { printf 'pgrep -P 12 的 argv 没落到 pgrep 后端:[%s]\n' "$(cat "$wlog")"; return 1; }
|
|
554
|
+
grep -qF 'act=pass · tool=pgrep' "$log" \
|
|
555
|
+
|| { printf '安装包入口的日志没有 act=pass · tool=pgrep:[%s]\n' "$(cat "$log")"; return 1; }
|
|
556
|
+
grep -qF 'act=refused · tool=pidof' "$log" \
|
|
557
|
+
|| { printf '安装包入口的拒绝日志没有 tool=pidof:[%s]\n' "$(cat "$log")"; return 1; }
|
|
488
558
|
return 0
|
|
489
559
|
}
|
|
490
560
|
|
|
@@ -694,7 +764,7 @@ if want pack; then
|
|
|
694
764
|
else
|
|
695
765
|
check_holds "声明面:一个 bin 键(team → bin/team.mjs)+ files 带 bin/" chk_pack_manifest "$tree"
|
|
696
766
|
check_holds "打包清单:bin/team.mjs + 两个 SKILL.md + install.sh,不含账本" chk_pack_walk "$tree"
|
|
697
|
-
check_holds "私有 prefix 安装:version/help
|
|
767
|
+
check_holds "私有 prefix 安装:version/help 与四个信号入口都来自安装物" chk_prefix_install "$tree"
|
|
698
768
|
fi
|
|
699
769
|
fi
|
|
700
770
|
|
|
@@ -883,6 +953,14 @@ PYPACKF
|
|
|
883
953
|
ft="$tmp/f-pack2"; scratch_tree "$ft"; rm -f "$ft/bin/team.mjs"
|
|
884
954
|
check_holds "⑤b 对照:真实树打包清单齐全" chk_pack_walk "$tree"
|
|
885
955
|
check_breaks "⑤b 翻转:bin 目标文件不在(package 不完整)" chk_pack_walk "$ft"
|
|
956
|
+
# ⑥ P321:把四个信号入口改回 0.3.0 的软链形状 —— npm 的 tarball 丢掉它们,安装判据必须红
|
|
957
|
+
ft="$tmp/f-pack-symlink"; scratch_tree "$ft"
|
|
958
|
+
for _fs in pkill killall pgrep pidof; do
|
|
959
|
+
rm -f "$ft/skills/teamsmith/scripts/shim/$_fs"
|
|
960
|
+
ln -s signal-gate "$ft/skills/teamsmith/scripts/shim/$_fs"
|
|
961
|
+
done
|
|
962
|
+
check_holds "⑥ 对照:真实树的私有 prefix 安装带四个可执行信号入口" chk_prefix_install "$tree"
|
|
963
|
+
check_breaks "⑥ 翻转:入口退回 0.3.0 的软链形状(npm 的 tarball 不携带软链)" chk_prefix_install "$ft"
|
|
886
964
|
fi
|
|
887
965
|
# ⑦ P59:安装步的信任提示行 —— 去掉它 → 判据红;让它在 --no-skills 下出现 → 判据红
|
|
888
966
|
ft="$tmp/f-trustline"; scratch_tree "$ft"
|
|
@@ -80,7 +80,8 @@ kr_group_blocks() {
|
|
|
80
80
|
t0="$(date +%s)"
|
|
81
81
|
kr_panel_snapshot 5 --width 120 --height 28 --lang zh >"$tmp/bl-slow.txt"
|
|
82
82
|
t1="$(date +%s)"
|
|
83
|
-
|
|
83
|
+
# P316:不判耗时;超时杀块的行为由下一行「慢 list 只降级本块」守。
|
|
84
|
+
printf ' \033[2m· 参考 blocks:慢 list 快照用时 %ss(不判快慢)\033[0m\n' "$((t1 - t0))"
|
|
84
85
|
assert_has "$tmp/bl-slow.txt" "更早" "blocks:慢 list 只降级本块(页面的导航/其它内容仍在)"
|
|
85
86
|
kr_shim_set_slow -
|
|
86
87
|
# ⑥ 输出泛滥:块 stdout 超过上限 → 该块判失败而不是把巨量内容塞进帧
|
|
@@ -213,8 +213,8 @@ kr_group_input() {
|
|
|
213
213
|
# 相同的合法输入再发一次 → 两条不同编号
|
|
214
214
|
kr_post "$p" dev2 '完整结论与取舍' "$B" >/dev/null; rc=$?
|
|
215
215
|
local lst; lst="$(kr_cli "$p" reply list --json)"
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
# P348 合并(两条 → 一条):"两条记录"与"编号递增到 2"是同一份快照的两个面,合成一个谓词不会少判什么。
|
|
217
|
+
jok "$lst" 'len(d["entries"])==2 and d["entries"][0]["no"]==2' && ok "input:重复提交不合并(两条)、编号严格递增(最新 = 2)" || bad "input:重复提交/编号不对($lst)"
|
|
218
218
|
# label 边界
|
|
219
219
|
printf 'x\n' >"$B"
|
|
220
220
|
kr_post "$p" '' 'T' "$B" >/dev/null 2>&1; eq "input:缺 --from → rc2" "$?" "2"
|
|
@@ -267,11 +267,9 @@ kr_group_paths() {
|
|
|
267
267
|
rm -f "$KR/index.v1"; mv "$KR/index.real" "$KR/index.v1"
|
|
268
268
|
# 2) writer.lock 是 FIFO → post 拒绝且不阻塞
|
|
269
269
|
rm -f "$KR/writer.lock"; mkfifo "$KR/writer.lock"
|
|
270
|
-
local t0 t1; t0=$(date +%s)
|
|
271
270
|
kr_post "$p" dev2 'T-fifo' "$B" >/dev/null 2>&1; rc=$?
|
|
272
|
-
t1=$(date +%s)
|
|
273
271
|
eq "paths:writer.lock 是 FIFO → rc4" "$rc" "4"
|
|
274
|
-
|
|
272
|
+
# P316:不判耗时;rc4 证明它没有阻塞到超时,下面清掉 FIFO 继续。
|
|
275
273
|
rm -f "$KR/writer.lock"
|
|
276
274
|
# 3) bodies/<id>.md 被换成目录 / 软链 → show 拒绝,目标不动
|
|
277
275
|
local bid; bid="$(kr_cli "$p" reply list --json | jget /dev/stdin 'd["entries"][0]["sha256"]' >/dev/null; ls "$KR/bodies" | head -1)"
|
|
@@ -380,8 +378,8 @@ kr_group_original() {
|
|
|
380
378
|
kr_cli "$p" reply show 1 --raw >"$TMP/orig-out.md" 2>"$TMP/orig-raw.err"; rc=$?
|
|
381
379
|
eq "original:raw 导出 rc=0" "$rc" "0"
|
|
382
380
|
if cmp -s "$B" "$TMP/orig-out.md"; then ok "original:raw 与输入逐字节相同(CRLF/尾换行)"; else bad "original:raw 与输入不同"; fi
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
# P348 删:原来这里还有一条「两份 sha256 一致」——`cmp -s` 已经比过每一个字节,sha 只是同一事实的另一种数法;
|
|
382
|
+
# 字节相同 ⇒ sha 相同,没有一种破坏能让 sha 红而 cmp 绿。
|
|
385
383
|
local js; js="$(kr_cli "$p" reply show 1 --json)"
|
|
386
384
|
jok "$js" 'd["text_kind"]=="safe-display" and d["bytes"]>0 and len(d["sha256"])==64' && ok "original:JSON 标明显示表示并带原文长度/哈希" || bad "original:JSON 结构不对($js)"
|
|
387
385
|
not_has "original:JSON 的显示文本不含 OSC" "$(jget "$js" 'd["display_text"]')" "$(printf '\033]0;t\007')"
|
|
@@ -448,8 +446,9 @@ kr_group_concurrency() {
|
|
|
448
446
|
wait "$w1" 2>/dev/null; wait "$w2" 2>/dev/null
|
|
449
447
|
eq "concurrency:两个真进程都 rc=0" "$(cat "$TMP/c1.rc")/$(cat "$TMP/c2.rc")" "0/0"
|
|
450
448
|
local lst; lst="$(kr_cli "$p" reply list --json)"
|
|
451
|
-
|
|
452
|
-
|
|
449
|
+
# P348 合并(两条 → 一条):同一次快照的条数与编号集合。
|
|
450
|
+
jok "$lst" 'len(d["entries"])==2 and sorted(e["no"] for e in d["entries"])==[1, 2]' \
|
|
451
|
+
&& ok "concurrency:两条记录、编号互不相同且连续([1, 2])" || bad "concurrency:条数/编号不对($lst)"
|
|
453
452
|
eq "concurrency:并发读快照数 >0" "$([ "$reads" -gt 0 ] && echo yes || echo no)" "yes"
|
|
454
453
|
eq "concurrency:并发读没看到未提交的半条" "$partial" "0"
|
|
455
454
|
# 两份原文都能取回
|
|
@@ -507,18 +506,29 @@ kr_group_receipts() {
|
|
|
507
506
|
else
|
|
508
507
|
bad "receipts:以 root 跑,不可写目录这条没法测(不许静默跳过)"
|
|
509
508
|
fi
|
|
510
|
-
# 锁竞争:另一个活 publisher 持锁
|
|
509
|
+
# 锁竞争:另一个活 publisher 持锁 → rc5,且没有新发布;list/show 照常
|
|
511
510
|
kr_hold_lock "$KR" || bad "receipts:夹具没能持住写锁"
|
|
512
|
-
local t0 t1; t0="$(date +%s%N)"
|
|
513
511
|
kr_post "$p" dev2 'R3' "$B" >"$TMP/r-busy.out" 2>&1; rc=$?
|
|
514
|
-
t1="$(date +%s%N)"
|
|
515
512
|
eq "receipts:锁竞争 → rc5" "$rc" "5"
|
|
516
|
-
local waited=$(( (t1 - t0) / 1000000 ))
|
|
517
|
-
if [ "$waited" -ge 1500 ] && [ "$waited" -le 6000 ]; then ok "receipts:等锁区间 ${waited}ms(≤2000ms 等待 + 启动)"; else bad "receipts:等锁区间异常 ${waited}ms"; fi
|
|
518
513
|
eq "receipts:竞争失败没有发布" "$(kr_cli "$p" reply list --json | jget /dev/stdin 'd["total_slots"]')" "1"
|
|
519
|
-
kr_cli "$p" reply show 1 >/dev/null 2>&1;
|
|
520
|
-
kr_cli "$p" reply list >/dev/null 2>&1;
|
|
514
|
+
kr_cli "$p" reply show 1 >/dev/null 2>&1; local busy_show=$?
|
|
515
|
+
kr_cli "$p" reply list >/dev/null 2>&1; local busy_list=$?
|
|
516
|
+
# P348 合并(两条 → 一条):两个命令两个退出码一起比,任一半走样都红。
|
|
517
|
+
eq "receipts:锁被占时 show/list 照常(都 rc=0)" "$busy_show/$busy_list" "0/0"
|
|
521
518
|
kr_release_lock
|
|
519
|
+
# P316 · V61 F3:spec 承诺「writer-lock contention 最多等 2000 ms 后返回 5」(scripts/replies.mjs 的
|
|
520
|
+
# LOCK_WAIT_SEC=2)。这条**不改回秒表**:把 `flock` 换成"记下 argv 就以忙退出"的桩,断言工具交给
|
|
521
|
+
# 限时 flock 的**就是它自己的那个界**(`-w 2`)——把 LOCK_WAIT_SEC 改成 30,这里立刻红。
|
|
522
|
+
# 只守「-w 2」这一段:后面的 fd 是实现细节,不是锁契约(V63)。
|
|
523
|
+
local krstub="$TMP/kr-flock-stub" krlog="$TMP/kr-flock-argv"
|
|
524
|
+
mkdir -p "$krstub"; : > "$krlog"
|
|
525
|
+
printf '#!/usr/bin/env bash\nprintf "%%s\\n" "$*" >> "%s"\nexit 1\n' "$krlog" > "$krstub/flock"
|
|
526
|
+
chmod +x "$krstub/flock"
|
|
527
|
+
kr_post "$p" dev2 'R5' "$B" PATH="$krstub:$PATH" >"$TMP/r-lockbound.out" 2>&1; rc=$?
|
|
528
|
+
eq "receipts:限时 flock 报到界了(忙) → rc5" "$rc" "5"
|
|
529
|
+
has "receipts:传给 flock 的是产品自己的界(-w 2)" "$(cat "$krlog")" "-w 2 "
|
|
530
|
+
has "receipts:忙时的诊断报出同一个界(2000ms)" "$(cat "$TMP/r-lockbound.out")" "2000ms"
|
|
531
|
+
eq "receipts:限时 flock 放弃时同样没有发布" "$(kr_cli "$p" reply list --json | jget /dev/stdin 'd["total_slots"]')" "1"
|
|
522
532
|
# unconfirmed(最终 fsync 失败):rc6 + candidate_no,不自动重发
|
|
523
533
|
kr_post "$p" dev2 'R4' "$B" TEAM_REPLY_FAULT=fail:index-fsync >"$TMP/r-unc.out" 2>&1; rc=$?
|
|
524
534
|
eq "receipts:最终 fsync 失败 → rc6" "$rc" "6"
|
|
@@ -576,7 +586,7 @@ kr_group_interrupt() {
|
|
|
576
586
|
kr_post "$p" dev2 'K4' "$B" >/dev/null 2>&1; rc=$?
|
|
577
587
|
eq "interrupt:完整坏槽时 post 拒绝(rc4)而不是截断" "$rc" "4"
|
|
578
588
|
eq "interrupt:坏槽字节未被改写(sha 不变)" "$(sha256sum "$KR/index.v1" | cut -d' ' -f1)" "$bad_hash"
|
|
579
|
-
|
|
589
|
+
# P348 删:原来还断言「坏槽尺寸未变」—— 整文件 sha 未变已经蕴含尺寸未变(截断一定改 sha)。
|
|
580
590
|
kr_ev_note "interrupt baseline_hash=$before_hash corrupt_hash=$bad_hash"
|
|
581
591
|
}
|
|
582
592
|
|
|
@@ -609,12 +619,13 @@ kr_group_paging() {
|
|
|
609
619
|
[ "$cursor" = "None" ] && break
|
|
610
620
|
if [ "$pages" -gt 10 ]; then bad "paging:cursor 链没在 10 页内结束"; break; fi
|
|
611
621
|
done
|
|
612
|
-
local norm; norm="$(printf '%s' "$seen" | tr ' ' '\n' | grep -E '^[0-9]+$' | tr '\n' ' ')"
|
|
622
|
+
local norm; norm="$(printf '%s' "$seen" | tr ' ' '\n' | grep -E '^[0-9]+$' | tr '\n' ' ' | sed -e 's/ */ /g' -e 's/^ //' -e 's/ $//')"
|
|
623
|
+
local want_chain; want_chain="$(seq 123 -1 1 | tr '\n' ' ' | sed 's/ $//')"
|
|
613
624
|
eq "paging:3 页覆盖 123→1" "$pages" "3"
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
eq "paging
|
|
625
|
+
# P348 合并(四条 → 一条):原来说「条数 123」「起点 123」「终点 1」「去重后仍 123」四条,
|
|
626
|
+
# 合起来才等于「恰好一遍」;直接与期望链 123 122 … 1 逐字比一次,四条的事实全在里面(而且更强:
|
|
627
|
+
# 顺带钉住降序与无跳号,四条里任何一条独有的破坏都会让这一条红)。
|
|
628
|
+
eq "paging:链恰好是 123 122 … 1(无重复、无缺失、降序)" "$norm" "$want_chain"
|
|
618
629
|
# 坏页仍前进:把某一整页(编号 24..73 是第 2 页)打坏
|
|
619
630
|
local KR="$p/.pi/team/state/key-replies" n
|
|
620
631
|
for n in $(seq 74 123); do :; done
|
|
@@ -665,8 +676,9 @@ kr_group_bounded() {
|
|
|
665
676
|
local KR="$p/.pi/team/state/key-replies"
|
|
666
677
|
printf 'ZZZZ' | dd of="$KR/index.v1" bs=1 seek=$((100000 * 4096 - 100)) conv=notrunc status=none
|
|
667
678
|
local sj; sj="$(kr_cli "$p" __panel-data --block reply_summary)"
|
|
668
|
-
|
|
669
|
-
|
|
679
|
+
# P348 合并(两条 → 一条):同一次机器出口的两个面(状态 + 没有退回旧标题)。
|
|
680
|
+
jok "$sj" 'd["state"]=="unavailable" and d.get("entry") is None' \
|
|
681
|
+
&& ok "bounded:坏最新槽 summary=unavailable 且不退回旧标题" || bad "bounded:坏最新槽的处理不对($sj)"
|
|
670
682
|
# 读取量的观测器:内核自述的 /proc/<pid>/io(rchar/syscr)+ /proc/<pid>/fd{,info}(进程真正打开过
|
|
671
683
|
# 哪些路径、以什么 flags 打开)。无编译器依赖 —— 门禁镜像按 M47 故意 purge 掉 build-essential,
|
|
672
684
|
# 所以旧版 LD_PRELOAD shim 在那里永远编不出来(V27 的 M3)。观测器不可用(hidepid 等)时**点名跳过**。
|
|
@@ -984,7 +996,7 @@ kr_group_flip() {
|
|
|
984
996
|
kr_post "$p" dev2 'base' "$b" >/dev/null 2>&1 || return 1
|
|
985
997
|
rm -f "$KR/index.v1"; mkfifo "$KR/index.v1"
|
|
986
998
|
local rc
|
|
987
|
-
timeout
|
|
999
|
+
timeout 300 bash -c "cd '$p' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$p" reply list --json >/dev/null 2>&1
|
|
988
1000
|
rc=$?
|
|
989
1001
|
rm -f "$KR/index.v1"
|
|
990
1002
|
printf 'flip/fifo_block:list 对 FIFO 索引 rc=%s\n' "$rc" >>"$TMP/flip-fifo.log"
|
|
@@ -1019,7 +1031,9 @@ kr_group_skip_path() {
|
|
|
1019
1031
|
fi
|
|
1020
1032
|
# 子进程里跑 bounded + flip:必须点名跳过、没有 ✗、退出 0(可见跳过 ≠ 静默通过,也 ≠ 红)
|
|
1021
1033
|
local out="$TMP/skip-path.out" rc
|
|
1022
|
-
|
|
1034
|
+
# P357/P324:嵌套子进程跑的是**用完就扔**的隔离基,门禁的 `--keep` 说的是它自己那个根。继承了保留
|
|
1035
|
+
# 开关时子进程末行会变成「保留临时根:…」而不是结果行 —— 那条断言测的「跑完整轮」就永远不成立。
|
|
1036
|
+
TEAM_REPLY_NO_PROC_IO=1 env -u TEAM_TMP_KEEP timeout 900 bash "$SELF_DIR/key-replies.sh" --select bounded,flip >"$out" 2>&1; rc=$?
|
|
1023
1037
|
# 实质判据有两条:子进程跑完了整轮(末行是结果行且 ✗0)且没有红行。失败时**重跑一次带 trace**
|
|
1024
1038
|
# 只为取证(不是掩盖红:红照旧判红,只是把成因写进断言与证据包)。
|
|
1025
1039
|
local last
|
|
@@ -1028,7 +1042,7 @@ kr_group_skip_path() {
|
|
|
1028
1042
|
*"✗0"*) ok "skip-path:缺观测器时子进程跑完整轮且 ✗0(末行:${last})" ;;
|
|
1029
1043
|
*)
|
|
1030
1044
|
local trace="$TMP/skip-path-trace.out"
|
|
1031
|
-
TEAM_REPLY_NO_PROC_IO=1 timeout 600 bash -x "$SELF_DIR/key-replies.sh" --select bounded,flip >"$trace" 2>&1
|
|
1045
|
+
TEAM_REPLY_NO_PROC_IO=1 env -u TEAM_TMP_KEEP timeout 600 bash -x "$SELF_DIR/key-replies.sh" --select bounded,flip >"$trace" 2>&1
|
|
1032
1046
|
kr_ev_save "$trace" "skip-path-failure-trace.txt"
|
|
1033
1047
|
bad "skip-path:子进程没跑完整轮(末行=[${last:-<空>}],rc=$rc,子进程日志长度=$(stat -c %s "$out" 2>/dev/null || echo 0))—— 带 trace 的重跑见证据包 skip-path-failure-trace.txt;trace 尾部=[$(tail -3 "$trace" 2>/dev/null | tr '\n' ' ' | cut -c1-200)]"
|
|
1034
1048
|
;;
|
|
@@ -39,41 +39,15 @@
|
|
|
39
39
|
# PTY_TRACE=0 print every wait/cleanup decision to stderr (fixture diagnostics)
|
|
40
40
|
# PTY_SELFTEST_BREAK="" self-test only (`--self-test`): sabotage one rule so the guard test
|
|
41
41
|
# can go red (early / nosettle / noclockmask / unguarded / noscene /
|
|
42
|
-
# noext / alwaysext /
|
|
42
|
+
# noext / alwaysext / pipeshadow)
|
|
43
43
|
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
# rounds have been observed — a horizon below the window (the fixture's own
|
|
52
|
-
# site overrides at 6/8 rounds) is never extended and a scene that stopped
|
|
53
|
-
# painting gets no extension at all, so the extension can never hide a
|
|
54
|
-
# static failure. Measured basis: a round costs ~0.6-0.85 s, so 8 rounds is
|
|
55
|
-
# ~5-7 s of identical masked frames.
|
|
56
|
-
# PTY_EXT_FACTOR=3 the extension ceiling: at most this many times the base horizon (bounded
|
|
57
|
-
# cost: a red can never take more than 3 x ~26 s per wait, and the scenario
|
|
58
|
-
# stops at the first unattributable exhaustion)
|
|
59
|
-
#
|
|
60
|
-
# At that ceiling the wait asks the caller's premise hook and decides:
|
|
61
|
-
# still painting OR pty_premise_over returns 0 (the machine's own readings are over their
|
|
62
|
-
# ceilings) -> a **visible SKIP**: one line naming the wait, its rounds, its elapsed time, the
|
|
63
|
-
# M59 scene report and the reason (the readings). The wait returns 3, sets PTY_SKIPPED=1 and
|
|
64
|
-
# runs the caller's pty_on_skip when it defines one (the fixtures stop that scenario there);
|
|
65
|
-
# a static scene with the readings under their ceilings -> the ordinary failure (rc 1) with the
|
|
66
|
-
# M59 scene, so a real regression always reds on a healthy machine. A skip is never reported as
|
|
67
|
-
# a pass and never as a failure by this file.
|
|
68
|
-
#
|
|
69
|
-
# The caller may define (both optional; absent = "the machine is under its premise"):
|
|
70
|
-
# pty_premise_over 0 when the machine is over its premise (attributed -> SKIP), 1 otherwise
|
|
71
|
-
# pty_premise_reason prints the one-line reason the SKIP line carries (loadavg/cores/probe)
|
|
72
|
-
# pty_on_skip called after a skip is printed (the pty fixtures exit their scenario with 4)
|
|
73
|
-
# PTY_INJECT_NEEDLE="" fixture/self-test only: an extra needle that can never appear, appended to
|
|
74
|
-
# every wait — the "the state never arrives" shape the exhaustion tests need.
|
|
75
|
-
# Wait verdict: 0 green | 1 red (the M59 failure scene) | 3 visible SKIP (machine, not code) | 2
|
|
76
|
-
# setup (pty_cap missing).
|
|
44
|
+
# P316(用户裁定第二条:性能只能是参考指标,不能阻塞):**没有负载前提、没有 SKIP**。
|
|
45
|
+
# 等待视界是**失败探测器**(防死等),不是性能判定:
|
|
46
|
+
# PTY_WAIT_ITERS=100 基础视界(每轮 ~0.6-0.85 s → ~60-85 s);到点以后仍**在绘制**的现场
|
|
47
|
+
# 继续延长(PTY_EXT_FACTOR=5 → 最多 ~300-425 s),静态现场到点就停。
|
|
48
|
+
# 耗尽一律**红**:一行「没等到「X」(轮数 n/N,耗时约 Xs;最后一次状态:…;缺:…)」+ M59 现场,
|
|
49
|
+
# rc=1。**没有 rc=3**:机器忙不再是「没结论」的出口。
|
|
50
|
+
# Wait verdict: 0 green | 1 red (the M59 failure scene) | 2 setup (pty_cap missing).
|
|
77
51
|
#
|
|
78
52
|
# Constants, bands and how to re-derive them (design.md §3/§4; the raw table is
|
|
79
53
|
# docs/team/reports/P48-dev3.md):
|
|
@@ -88,18 +62,16 @@
|
|
|
88
62
|
# {probe,storm,burn} (owned load, owned targets, private roots).
|
|
89
63
|
set -uo pipefail
|
|
90
64
|
|
|
91
|
-
PTY_WAIT_ITERS="${PTY_WAIT_ITERS:-
|
|
65
|
+
PTY_WAIT_ITERS="${PTY_WAIT_ITERS:-100}"
|
|
92
66
|
PTY_WAIT_PAUSE="${PTY_WAIT_PAUSE:-0.35}"
|
|
93
67
|
PTY_SETTLE_PAUSE="${PTY_SETTLE_PAUSE:-0.25}"
|
|
94
68
|
PTY_CLEANUP_ITERS="${PTY_CLEANUP_ITERS:-4}"
|
|
95
69
|
PTY_SCENE_LINES="${PTY_SCENE_LINES:-12}"
|
|
96
70
|
PTY_STALL_ROUNDS="${PTY_STALL_ROUNDS:-8}"
|
|
97
|
-
PTY_EXT_FACTOR="${PTY_EXT_FACTOR:-
|
|
71
|
+
PTY_EXT_FACTOR="${PTY_EXT_FACTOR:-5}"
|
|
98
72
|
PTY_INJECT_NEEDLE="${PTY_INJECT_NEEDLE:-}"
|
|
99
73
|
PTY_TRACE="${PTY_TRACE:-0}"
|
|
100
74
|
PTY_KEYS_SENT="${PTY_KEYS_SENT:-0}"
|
|
101
|
-
PTY_SKIPPED="${PTY_SKIPPED:-0}"
|
|
102
|
-
PTY_WAIT_PAINTING="${PTY_WAIT_PAINTING:-}"
|
|
103
75
|
PTY_WAIT_CEILING="${PTY_WAIT_CEILING:-}"
|
|
104
76
|
PTY_FAIL_STREAK="${PTY_FAIL_STREAK:-0}"
|
|
105
77
|
PTY_WAIT_FAILED="${PTY_WAIT_FAILED:-0}"
|
|
@@ -197,51 +169,24 @@ _pty_painting_recent() {
|
|
|
197
169
|
[ "$(( $1 - $2 ))" -le "$stall" ]
|
|
198
170
|
}
|
|
199
171
|
|
|
200
|
-
# _pty_premise_over — the caller's hook, with the two self-test sabotages: `noskip` makes an
|
|
201
|
-
# over-premise exhaustion fail anyway (the guard test must catch a skip that stopped happening) and
|
|
202
|
-
# `alwaysskip` skips even under the premise (the guard test must catch a skip that swallows a red).
|
|
203
|
-
_pty_premise_over() {
|
|
204
|
-
[ "${PTY_SELFTEST_BREAK:-}" = "alwaysskip" ] && return 0
|
|
205
|
-
[ "${PTY_SELFTEST_BREAK:-}" = "noskip" ] && return 1
|
|
206
|
-
declare -F pty_premise_over >/dev/null 2>&1 || return 1
|
|
207
|
-
pty_premise_over
|
|
208
|
-
}
|
|
209
|
-
_pty_premise_reason() {
|
|
210
|
-
if declare -F pty_premise_reason >/dev/null 2>&1; then pty_premise_reason
|
|
211
|
-
else printf '机器读数超前提'; fi
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
# pty_skip_line — the one visible line a skip prints. It names the wait, its rounds against the
|
|
215
|
-
# ceiling, the elapsed time, whether the scene was still painting, what was missing (the M59
|
|
216
|
-
# report) and the caller's reason (the readings). stdout, so the gate's log carries it.
|
|
217
|
-
pty_skip_line() {
|
|
218
|
-
local painting='场景已静止'
|
|
219
|
-
[ "${PTY_WAIT_PAINTING:-no}" = "yes" ] && painting='场景仍在绘制'
|
|
220
|
-
printf ' \033[33mSKIP\033[0m 等待耗尽但归因于机器(既不是通过也不是失败):%s · 轮数 %s/%s · 耗时约 %ss · %s · %s · 归因:%s\n' \
|
|
221
|
-
"${PTY_WAIT_LABEL:-?}" "${PTY_WAIT_ROUNDS:-?}" "${PTY_WAIT_CEILING:-?}" "${PTY_WAIT_SECONDS:-?}" \
|
|
222
|
-
"$painting" "${PTY_WAIT_REPORT:-}" "$(_pty_premise_reason)"
|
|
223
|
-
}
|
|
224
|
-
|
|
225
172
|
# pty_wait_frame <outfile|-> <label> <needle...> → 0 when a settled frame carries every needle
|
|
226
173
|
# (absent ones prefixed with `!`). The latest capture is written to <outfile> every round so the
|
|
227
174
|
# caller's assertion can show what was on screen. The horizon is a failure detector: it is extended
|
|
228
175
|
# (bounded, PTY_EXT_FACTOR) while the scene is still painting, and at the ceiling the verdict is
|
|
229
|
-
#
|
|
230
|
-
# rc 1, which the caller's bad() classifies as isolated vs cascade).
|
|
176
|
+
# always a failure (the M59 scene, rc 1, "没等到 X") — P316 removed the machine-attributed SKIP.
|
|
231
177
|
pty_wait_frame() {
|
|
232
178
|
local out="$1" label="$2"; shift 2
|
|
233
179
|
declare -F pty_cap >/dev/null 2>&1 || { printf 'pty-wait: pty_cap is not defined\n' >&2; return 2; }
|
|
234
|
-
local base="${PTY_WAIT_ITERS:-
|
|
235
|
-
case "$base" in ''|*[!0-9]*) base=
|
|
180
|
+
local base="${PTY_WAIT_ITERS:-100}" extf="${PTY_EXT_FACTOR:-5}"
|
|
181
|
+
case "$base" in ''|*[!0-9]*) base=100 ;; esac
|
|
236
182
|
[ "$base" -ge 1 ] || base=1
|
|
237
|
-
case "$extf" in ''|*[!0-9]*) extf=
|
|
183
|
+
case "$extf" in ''|*[!0-9]*) extf=5 ;; esac
|
|
238
184
|
[ "$extf" -ge 1 ] || extf=1
|
|
239
185
|
[ "${PTY_SELFTEST_BREAK:-}" = "noext" ] && extf=1
|
|
240
186
|
local ceiling=$(( base * extf ))
|
|
241
187
|
local extra="${PTY_INJECT_NEEDLE:-}"
|
|
242
188
|
local i=0 a last_masked='' masked last_change=0 t0="$SECONDS"
|
|
243
189
|
PTY_WAIT_FAILED=0
|
|
244
|
-
PTY_SKIPPED=0
|
|
245
190
|
while [ "$i" -lt "$ceiling" ]; do
|
|
246
191
|
i=$((i + 1))
|
|
247
192
|
a="$(pty_cap)"
|
|
@@ -250,7 +195,7 @@ pty_wait_frame() {
|
|
|
250
195
|
PTY_WAIT_ROUNDS="$i"; PTY_WAIT_CEILING="$ceiling"
|
|
251
196
|
# The trace line keeps the pre-P48 shape (`rounds=$i`): panel-p21.sh's own M59 assertion
|
|
252
197
|
# (`wait picker … rounds=[0-9]+ settled=1`) pins it, and the ceiling already appears in the
|
|
253
|
-
# exhaustion report
|
|
198
|
+
# exhaustion report. A diagnostics line is no place to break a pin.
|
|
254
199
|
[ "${PTY_TRACE:-0}" = "1" ] && pty_trace "wait $label rounds=$i settled=1"
|
|
255
200
|
return 0
|
|
256
201
|
fi
|
|
@@ -270,12 +215,9 @@ pty_wait_frame() {
|
|
|
270
215
|
PTY_WAIT_PAINTING="no"
|
|
271
216
|
_pty_painting_recent "$i" "$last_change" && PTY_WAIT_PAINTING="yes"
|
|
272
217
|
PTY_WAIT_REPORT="$(_pty_report_missing "$a" "$@" ${extra:+"$extra"})"
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if declare -F pty_on_skip >/dev/null 2>&1; then pty_on_skip; fi
|
|
277
|
-
return 3
|
|
278
|
-
fi
|
|
218
|
+
# P316:耗尽就是「没等到」——一行点名等待/轮数/耗时/最后一次状态,再给 M59 现场;没有机器维度。
|
|
219
|
+
printf ' \033[33m没等到\033[0m %s:%s/%s 轮(耗时约 %ss;最后一次状态:%s;缺:%s)\n' \
|
|
220
|
+
"$label" "$i" "$ceiling" "$((SECONDS - t0))" "${PTY_WAIT_PAINTING:-no}" "${PTY_WAIT_REPORT:-?}"
|
|
279
221
|
pty_wait_scene "$label" "$i" "$((SECONDS - t0))" "$a" "$@" ${extra:+"$extra"}
|
|
280
222
|
return 1
|
|
281
223
|
}
|
|
@@ -424,10 +366,9 @@ pty_selftest() {
|
|
|
424
366
|
. "$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/tmp-root.sh"
|
|
425
367
|
st_dir="$(tmp_root_create pty-wait-selftest)" || return 3
|
|
426
368
|
trap 'tmp_root_reap_all' EXIT
|
|
427
|
-
local _PASS=0 _FAIL=0
|
|
369
|
+
local _PASS=0 _FAIL=0
|
|
428
370
|
_st_ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; _PASS=$((_PASS + 1)); pty_fail_reset; }
|
|
429
371
|
_st_bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; _FAIL=$((_FAIL + 1)); }
|
|
430
|
-
_st_skip() { printf ' \033[33mSKIP\033[0m %s\n' "$1"; _SKIP=$((_SKIP + 1)); pty_fail_reset; }
|
|
431
372
|
|
|
432
373
|
# The fake pane: a settings view; a picker paints one line per capture (max 4); the title clock
|
|
433
374
|
# ticks every capture so only the masked comparison can settle. Keys mutate the app state:
|
|
@@ -606,38 +547,7 @@ pty_selftest() {
|
|
|
606
547
|
_st_bad "静态场景被延长或没红(rc=$stat_rc rounds=$stat_rounds;断点=${PTY_SELFTEST_BREAK:-无})"
|
|
607
548
|
fi
|
|
608
549
|
|
|
609
|
-
# ──
|
|
610
|
-
# 注入的前提钩子(真实夹具里由 panel-p21.sh 提供;这里换成一个可切换的自检读数)。
|
|
611
|
-
_pty_selftest_premise="under"
|
|
612
|
-
pty_premise_over() { [ "${_pty_selftest_premise:-under}" = "over" ]; }
|
|
613
|
-
pty_premise_reason() {
|
|
614
|
-
printf '注入读数:探针 999ms > 顶 120ms(loadavg %s · %s 核)' \
|
|
615
|
-
"$(cut -d' ' -f1 /proc/loadavg 2>/dev/null || echo '?')" "$(nproc 2>/dev/null || echo '?')"
|
|
616
|
-
}
|
|
617
|
-
local skip_rc red_rc
|
|
618
|
-
_st_reset view
|
|
619
|
-
_pty_selftest_premise="over"
|
|
620
|
-
PTY_WAIT_ITERS=6 PTY_STALL_ROUNDS=2 PTY_WAIT_PAUSE=0.01 PTY_SETTLE_PAUSE=0.01 \
|
|
621
|
-
pty_wait_frame "$st_dir/skip.txt" "超前提的等待" "这条目永远不来" > "$st_dir/skip.out" 2> "$st_dir/skip.err"
|
|
622
|
-
skip_rc=$?
|
|
623
|
-
if [ "$skip_rc" -eq 3 ] && [ "${PTY_SKIPPED:-0}" = "1" ] \
|
|
624
|
-
&& grep -q 'SKIP' "$st_dir/skip.out" && grep -q '超前提的等待' "$st_dir/skip.out" \
|
|
625
|
-
&& grep -q '999ms' "$st_dir/skip.out" && grep -q '这条目永远不来' "$st_dir/skip.out"; then
|
|
626
|
-
_st_skip "超前提:rc=3 + PTY_SKIPPED=1 + 一行可见 SKIP(点名等待/轮数/耗时/现场/读数)→ 记为 skip,不是失败"
|
|
627
|
-
else
|
|
628
|
-
_st_bad "超前提没有给出可见 SKIP(rc=$skip_rc PTY_SKIPPED=${PTY_SKIPPED:-};断点=${PTY_SELFTEST_BREAK:-无})"
|
|
629
|
-
fi
|
|
630
|
-
_st_reset view
|
|
631
|
-
_pty_selftest_premise="under"
|
|
632
|
-
PTY_WAIT_ITERS=6 PTY_STALL_ROUNDS=2 PTY_WAIT_PAUSE=0.01 PTY_SETTLE_PAUSE=0.01 \
|
|
633
|
-
pty_wait_frame "$st_dir/red.txt" "前提之内的等待" "这条目永远不来" 2> "$st_dir/red.err"
|
|
634
|
-
red_rc=$?
|
|
635
|
-
if [ "$red_rc" -eq 1 ] && [ "${PTY_SKIPPED:-0}" = "0" ] && grep -q '等待超时' "$st_dir/red.err"; then
|
|
636
|
-
_st_ok "前提之内:同一个静态现场仍是红(rc=1 + M59 现场)—— SKIP 不是逃逸门"
|
|
637
|
-
else
|
|
638
|
-
_st_bad "前提之内的耗尽没有红(rc=$red_rc PTY_SKIPPED=${PTY_SKIPPED:-};断点=${PTY_SELFTEST_BREAK:-无})"
|
|
639
|
-
fi
|
|
640
|
-
|
|
550
|
+
# ── 判据⑤(P316 退役):原「超前提 → 可见 SKIP」不再存在;耗尽一律红,见判据④的静态场景。
|
|
641
551
|
# ── 判据⑥:长帧(>128 KiB)的两向 —— 命中不能被 SIGPIPE 吃掉,缺失必须照缺报(P127)──
|
|
642
552
|
# P124 的最小复现:帧 120607 B > 管道缓冲(64 KiB),needle 在最前面;旧写法
|
|
643
553
|
# `printf '%s\n' "$c" | grep -qF` 命中即退 → 写端 SIGPIPE → pipefail 下 rc=141 → 假「没出现」。
|
|
@@ -666,7 +576,7 @@ pty_selftest() {
|
|
|
666
576
|
_st_bad "长帧缺失没有照缺报(rc=$long_miss_rc;断点=${PTY_SELFTEST_BREAK:-无})"
|
|
667
577
|
fi
|
|
668
578
|
|
|
669
|
-
printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d
|
|
579
|
+
printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d\n' "$_PASS" "$_FAIL"
|
|
670
580
|
[ "$_FAIL" -eq 0 ] && exit 0
|
|
671
581
|
exit 1
|
|
672
582
|
}
|