teamsmith 0.1.2 → 0.3.0
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 +13 -7
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +67 -0
- package/skills/teamsmith/SKILL.md +26 -8
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/agent-adapters.md +7 -7
- package/skills/teamsmith/references/config.md +65 -18
- package/skills/teamsmith/references/migration.md +220 -34
- package/skills/teamsmith/references/protocol.md +250 -25
- package/skills/teamsmith/references/troubleshooting.md +124 -7
- package/skills/teamsmith/references/workflows.md +66 -20
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +525 -90
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +71 -10
- package/skills/teamsmith/scripts/lib/cmd-config.sh +562 -128
- package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +149 -105
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +188 -40
- package/skills/teamsmith/scripts/lib/cmd-status.sh +268 -30
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +634 -54
- package/skills/teamsmith/scripts/lib/common.sh +1560 -109
- package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
- package/skills/teamsmith/scripts/monitor.mjs +34 -3
- package/skills/teamsmith/scripts/panel/README.md +22 -11
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +226 -224
- package/skills/teamsmith/scripts/panel/src/App.tsx +478 -184
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +95 -7
- package/skills/teamsmith/scripts/panel/src/layout.ts +703 -152
- package/skills/teamsmith/scripts/panel/src/main.tsx +129 -19
- package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +76 -31
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +78 -33
- package/skills/teamsmith/scripts/panel/src/types.ts +204 -17
- package/skills/teamsmith/scripts/replies.mjs +896 -0
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +20 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +23 -3
- package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
- package/skills/teamsmith/templates/config.sh.tmpl +29 -5
- package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -1
- package/skills/teamsmith/templates/report.md.tmpl +12 -0
- package/skills/teamsmith/templates/task.md.tmpl +4 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
- package/skills/teamsmith/tests/config-cli.sh +320 -300
- package/skills/teamsmith/tests/death-cause.sh +5 -2
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-m37.sh +4 -1
- package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
- package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p210.sh +4 -1
- package/skills/teamsmith/tests/flip-p217.sh +4 -1
- package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
- package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
- package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +283 -22
- package/skills/teamsmith/tests/key-replies-pty.sh +374 -0
- package/skills/teamsmith/tests/key-replies-ui.sh +325 -0
- package/skills/teamsmith/tests/key-replies.sh +1314 -0
- package/skills/teamsmith/tests/ledger-ban.sh +9 -8
- package/skills/teamsmith/tests/ledger-claim.sh +248 -0
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +30 -0
- package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
- package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +187 -0
- package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
- package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
- package/skills/teamsmith/tests/lib/reply-fixture.sh +367 -0
- package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +39 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
- package/skills/teamsmith/tests/panel-b2.sh +107 -4
- package/skills/teamsmith/tests/panel-b3-stub.sh +139 -4
- package/skills/teamsmith/tests/panel-b3.sh +189 -29
- package/skills/teamsmith/tests/panel-choices.sh +81 -63
- package/skills/teamsmith/tests/panel-cpu.sh +3 -2
- package/skills/teamsmith/tests/panel-knobs.sh +7 -1
- package/skills/teamsmith/tests/panel-p21.sh +445 -241
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +122 -31
- package/skills/teamsmith/tests/pm-box-real.sh +1 -1
- package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
- package/skills/teamsmith/tests/routes.sh +364 -109
- package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-budgets.tsv +26 -12
- package/skills/teamsmith/tests/section-guard.sh +6 -1
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +42 -26
- package/skills/teamsmith/tests/section-select.sh +90 -7
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/smoke.sh +3762 -628
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
- package/skills/teamsmith/tests/task-header-model.sh +2 -1
- package/skills/teamsmith/tests/task-model-routing.sh +1511 -0
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith-init/SKILL.md +43 -43
- package/skills/teamsmith-init/references/bootstrap.md +8 -6
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
#
|
|
10
10
|
# 为什么要有它(design.md §D1–D3、§D8):
|
|
11
11
|
# ① 根一律建在**解析后的**临时根 `${TMPDIR:-/tmp}`(写死 `/tmp` 的模板会被 --lint 判红);
|
|
12
|
-
# 名字进一个 owned 家族 `teamsmith-<kind>.XXXXXX`(
|
|
13
|
-
#
|
|
12
|
+
# 名字进一个 owned 家族 **并带本项目的命名空间** `teamsmith-<kind>-<ns>.XXXXXX`(P287;
|
|
13
|
+
# sweep 只认这个前缀,别的前缀不碰;ns 让「另一个项目的清理命令」认不出这是它的东西);
|
|
14
|
+
# ② 根里写 owner 标记 `.teamsmith-tmp`(kind / 创建 pid / 该进程启动时间 / boot id / run id / ns),
|
|
14
15
|
# 于是 killed run 的残留**可归因**,且「owner 已死」判定对 pid 复用安全;
|
|
15
16
|
# ③ 每次创建追加一条 run 台账(`$TEAM_TMP_LEDGER`,默认临时根下的点开头文件;台账头从 P122 起带
|
|
16
17
|
# `repo=<主仓库>` 仓库身份)—— 门禁据此断言「本轮创建的根一个都不许留下」,而不是去猜文件系统,
|
|
@@ -38,10 +39,66 @@
|
|
|
38
39
|
TMP_ROOT_LIB=1
|
|
39
40
|
TMP_ROOT_FAMILY_PREFIX="teamsmith-"
|
|
40
41
|
|
|
42
|
+
# P287(change: gate-lock-external-deletion):项目命名空间 ns 的**唯一实现**在
|
|
43
|
+
# `scripts/lib/common.sh`(team_project_ns)—— 本文件只调它,不复制第二份。没有那份库时
|
|
44
|
+
# (极端手工拷贝)退到一个诚实的无签名值,绝不报错。
|
|
45
|
+
# P309:产品库的位置。默认按本文件的相对位置推;**部分拷贝的夹具**(自我变异副本只拷了
|
|
46
|
+
# `lib/tmp-root.sh`)显式给出 `TEAM_TMP_SKILL_DIR` 指回真库 —— 否则解析器不在,创建者会具名失败
|
|
47
|
+
# (这是刻意的:宁可具名失败也不猜一个默认根)。仍然只有**一处**实现(common.sh)。
|
|
48
|
+
TMP_ROOT_SKILL_DIR="${TEAM_TMP_SKILL_DIR:-$(cd -P "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd || true)}"
|
|
49
|
+
if [ -n "$TMP_ROOT_SKILL_DIR" ] && [ -f "$TMP_ROOT_SKILL_DIR/scripts/lib/common.sh" ]; then
|
|
50
|
+
# shellcheck source=../../scripts/lib/common.sh
|
|
51
|
+
. "$TMP_ROOT_SKILL_DIR/scripts/lib/common.sh"
|
|
52
|
+
fi
|
|
53
|
+
|
|
41
54
|
_tmp_root_err() { printf 'tmp-root: %s\n' "$*" >&2; }
|
|
42
55
|
|
|
43
56
|
# ---------------------------------------------------------------- 基础事实
|
|
44
|
-
|
|
57
|
+
# P309:基准 = product 库里**唯一**的解析器 `team_tmp_root`(TMPDIR → TEAM_TMP_ROOT → 磁盘默认
|
|
58
|
+
# `/var/tmp/teamsmith-<ns>`)。创建者不自己算这个根:两处各算 = 两个答案 = 清扫器与门禁对不上基准。
|
|
59
|
+
# 库没 source 进来 → 具名失败(绝不猜一个默认值接着跑)。
|
|
60
|
+
tmp_root_base() {
|
|
61
|
+
if ! declare -F team_tmp_root >/dev/null 2>&1; then
|
|
62
|
+
_tmp_root_err "缺少解析器 team_tmp_root(scripts/lib/common.sh 没被 source 进来)—— 不猜默认值"
|
|
63
|
+
return 3
|
|
64
|
+
fi
|
|
65
|
+
team_tmp_root
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
# 私有 tmux socket 的**短基址**(P310 的判据、P309 起由这里统一实现):`<dir>/tmux-<uid>/<名字>` 必须
|
|
69
|
+
# ≤ AF_UNIX 的 107 字节,而 socket 路径的**长度不许跟着临时根变长**(临时根名带 ns + 6 位随机,嵌套一层
|
|
70
|
+
# 就把 83 顶到 129)。先试解析出的临时根(与夹具同一块盘),放不下再退 OS 默认临时目录;两处都不行 →
|
|
71
|
+
# 返回 1,由调用者决定硬停还是退回临时根下(不静默)。
|
|
72
|
+
# 这里是**唯一**允许直接写平台默认临时目录的地方(--lint 对本文件豁免;别处一律调 team_tmp_root)。
|
|
73
|
+
# 回退基址是**系统**临时目录(不是 `$TMPDIR`):判据就是「无论临时根被指到多深,socket 都放得下」,
|
|
74
|
+
# 回退到 `$TMPDIR` 再深一次等于没回退(flip-p158 的 case 目录 120 字节就是这样把 cleanup 顶到 158 的)。
|
|
75
|
+
TMP_ROOT_SOCKET_FALLBACK="${TMP_ROOT_SOCKET_FALLBACK:-/tmp}"
|
|
76
|
+
tmp_root_socket_dir() { # <kind> <socket 名(含 tmux-<uid>/ 前缀,取上界)> → 打印目录
|
|
77
|
+
local kind="${1:-tmux}" name="${2:-default}" base dir
|
|
78
|
+
for base in "$(tmp_root_base 2>/dev/null || true)" "$TMP_ROOT_SOCKET_FALLBACK"; do
|
|
79
|
+
[ -n "$base" ] && [ -d "$base" ] || continue
|
|
80
|
+
dir="$(mktemp -d "$base/.${kind:0:1}-$(id -u).XXXXXX" 2>/dev/null || true)"
|
|
81
|
+
[ -n "$dir" ] || continue
|
|
82
|
+
if [ $(( ${#dir} + 1 + ${#name} )) -le 107 ]; then printf '%s\n' "$dir"; return 0; fi
|
|
83
|
+
rmdir "$dir" 2>/dev/null || true
|
|
84
|
+
done
|
|
85
|
+
return 1
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# 解析来源(tmpdir | config | default);库不在 → 空
|
|
89
|
+
tmp_root_source() { declare -F team_tmp_root_source >/dev/null 2>&1 && team_tmp_root_source; }
|
|
90
|
+
|
|
91
|
+
# 本项目的命名空间(`<slug>-<hash8>`,一处实现在 common.sh)。
|
|
92
|
+
tmp_root_ns() {
|
|
93
|
+
if [ -z "${TMP_ROOT_NS:-}" ]; then
|
|
94
|
+
TMP_ROOT_NS=""
|
|
95
|
+
if declare -F team_project_ns >/dev/null 2>&1; then
|
|
96
|
+
TMP_ROOT_NS="$(team_project_ns 2>/dev/null || true)"
|
|
97
|
+
fi
|
|
98
|
+
[ -n "$TMP_ROOT_NS" ] || TMP_ROOT_NS="nosig-00000000"
|
|
99
|
+
fi
|
|
100
|
+
printf '%s\n' "$TMP_ROOT_NS"
|
|
101
|
+
}
|
|
45
102
|
|
|
46
103
|
# run id:优先 TEAM_TMP_RUN_ID;嵌套夹具会清掉 TEAM_*(身份清理),所以门禁同时给非 TEAM_ 的
|
|
47
104
|
# SMOKE_TMP_RUN_ID(它不属于身份,清不掉的传播位)。都没有 → 本进程自己算一个(跨子 shell 稳定)。
|
|
@@ -88,11 +145,17 @@ _tmp_root_proc_alive() {
|
|
|
88
145
|
return 0
|
|
89
146
|
}
|
|
90
147
|
|
|
91
|
-
# 路径是不是「解析后的临时根下的 owned
|
|
148
|
+
# 路径是不是「解析后的临时根下的 owned 家族,且名字带本项目的 ns」——--lint/自检用;
|
|
149
|
+
# `--break=notmpdir` 模拟写死 /tmp 混过关。
|
|
92
150
|
tmp_root_path_ok() {
|
|
93
151
|
if [ "${TMP_ROOT_BREAK:-}" = "notmpdir" ]; then return 0; fi
|
|
152
|
+
local rest
|
|
94
153
|
case "${1:-}" in
|
|
95
|
-
"$(tmp_root_base)"/"$TMP_ROOT_FAMILY_PREFIX"*)
|
|
154
|
+
"$(tmp_root_base)"/"$TMP_ROOT_FAMILY_PREFIX"*) rest="${1#"$(tmp_root_base)"/}" ;;
|
|
155
|
+
*) return 1 ;;
|
|
156
|
+
esac
|
|
157
|
+
case "$rest" in
|
|
158
|
+
"$TMP_ROOT_FAMILY_PREFIX"*"-$(tmp_root_ns)".*) return 0 ;;
|
|
96
159
|
*) return 1 ;;
|
|
97
160
|
esac
|
|
98
161
|
}
|
|
@@ -106,11 +169,11 @@ _tmp_root_repo_id() {
|
|
|
106
169
|
g="$(git -C "$lib" rev-parse --path-format=absolute --git-common-dir 2>/dev/null || true)"
|
|
107
170
|
if [ -n "$g" ]; then dirname "$g"; else printf 'unknown\n'; fi
|
|
108
171
|
}
|
|
109
|
-
_tmp_root_ledger_append() { # <path> <pid> <start> <kind> <created>
|
|
172
|
+
_tmp_root_ledger_append() { # <path> <pid> <start> <kind> <created> <ns>
|
|
110
173
|
local f; f="$(tmp_root_ledger)"
|
|
111
174
|
if [ ! -f "$f" ]; then
|
|
112
|
-
printf '# teamsmith temp ledger run=%s owner=%s started=%s repo=%s\n' \
|
|
113
|
-
"$(tmp_root_run_id)" "$$" "$(date +%s 2>/dev/null || printf 0)" "$(_tmp_root_repo_id)" >"$f" 2>/dev/null || return 1
|
|
175
|
+
printf '# teamsmith temp ledger run=%s owner=%s started=%s repo=%s ns=%s\n' \
|
|
176
|
+
"$(tmp_root_run_id)" "$$" "$(date +%s 2>/dev/null || printf 0)" "$(_tmp_root_repo_id)" "${6:-?}" >"$f" 2>/dev/null || return 1
|
|
114
177
|
fi
|
|
115
178
|
printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$1" "$2" "$3" "$4" "$5" "$(tmp_root_run_id)" >>"$f" 2>/dev/null || return 1
|
|
116
179
|
return 0
|
|
@@ -139,26 +202,53 @@ tmp_root_create() {
|
|
|
139
202
|
case "$kind" in
|
|
140
203
|
''|*[!A-Za-z0-9._-]*) _tmp_root_err "非法 kind [${kind}](只允许 A-Za-z0-9._-)"; return 2 ;;
|
|
141
204
|
esac
|
|
142
|
-
local base; base="$(tmp_root_base)"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
205
|
+
local base src; base="$(tmp_root_base)" || return 3
|
|
206
|
+
src="$(tmp_root_source)"
|
|
207
|
+
[ -n "$src" ] || src="default"
|
|
208
|
+
# P309:默认腿的目录由**创建者**按需建(0700,本变更里唯一被自动创建的目录);显式选定的根
|
|
209
|
+
# (TMPDIR / 契约的 TEAM_TMP_ROOT)必须已经存在且可写 —— 具名失败,**绝不**静默回落到 /tmp。
|
|
210
|
+
if [ "$src" = "default" ] && [ ! -d "$base" ]; then
|
|
211
|
+
if mkdir -p -m 700 -- "$base" 2>/dev/null; then
|
|
212
|
+
_tmp_root_err "临时根目录已创建:$base(source=default,0700)"
|
|
213
|
+
fi
|
|
146
214
|
fi
|
|
215
|
+
if ! team_tmp_root_usable "$base" 2>/dev/null; then
|
|
216
|
+
if [ "${TMP_ROOT_BREAK:-}" = "fallback" ]; then
|
|
217
|
+
# 自检红侧:把「静默回落」这个缺陷形状放回来(守门断言必须因此变红)
|
|
218
|
+
_tmp_root_err "FLIP(fallback):$base 不可用 → 静默改用 /tmp"
|
|
219
|
+
base="/tmp"
|
|
220
|
+
else
|
|
221
|
+
local why="不存在"
|
|
222
|
+
if [ -e "$base" ]; then
|
|
223
|
+
if [ ! -d "$base" ]; then why="不是目录"; elif [ ! -w "$base" ]; then why="不可写"; fi
|
|
224
|
+
fi
|
|
225
|
+
_tmp_root_err "临时根不可用:$base(source=$src)$why"
|
|
226
|
+
_tmp_root_err " 修法:mkdir -p '$base' 并确保可写;或把 $([ "$src" = "tmpdir" ] && printf 'TMPDIR' || printf 'TEAM_TMP_ROOT') 改到已存在的可写目录"
|
|
227
|
+
return 3
|
|
228
|
+
fi
|
|
229
|
+
fi
|
|
230
|
+
local ns; ns="$(tmp_root_ns)"
|
|
231
|
+
# P287:根的名字带项目 ns(`teamsmith-<kind>-<ns>.XXXXXX`);自检红侧 flat-name 回到改动前的
|
|
232
|
+
# 平铺名(名字里没有 ns),no-ns 保留名字但让标记/台账丢掉 ns。
|
|
233
|
+
local tmpl="$base/$TMP_ROOT_FAMILY_PREFIX$kind-$ns.XXXXXX"
|
|
234
|
+
[ "${TMP_ROOT_BREAK:-}" = "flat-name" ] && tmpl="$base/$TMP_ROOT_FAMILY_PREFIX$kind.XXXXXX"
|
|
147
235
|
local root
|
|
148
|
-
root="$(mktemp -d "$
|
|
236
|
+
root="$(mktemp -d "$tmpl" 2>/dev/null)" || {
|
|
149
237
|
_tmp_root_err "在 $base 下建不出根(空间/inode/权限?)"; return 3; }
|
|
150
|
-
local pid=$$ start boot created run
|
|
238
|
+
local pid=$$ start boot created run marker_ns
|
|
151
239
|
start="$(_tmp_root_proc_start "$pid" 2>/dev/null || true)"
|
|
152
240
|
boot="$(cat /proc/sys/kernel/random/boot_id 2>/dev/null || printf 'unknown')"
|
|
153
241
|
created="$(date +%s 2>/dev/null || printf 0)"
|
|
154
242
|
run="$(tmp_root_run_id)"
|
|
155
|
-
|
|
156
|
-
|
|
243
|
+
marker_ns="$ns"
|
|
244
|
+
[ "${TMP_ROOT_BREAK:-}" = "no-ns" ] && marker_ns="-"
|
|
245
|
+
if ! { printf 'kind=%s\npid=%s\nstart=%s\nboot=%s\nrun=%s\ncreated=%s\nns=%s\n' \
|
|
246
|
+
"$kind" "$pid" "${start:-unknown}" "$boot" "$run" "$created" "$marker_ns" >"$root/.teamsmith-tmp"; }; then
|
|
157
247
|
_tmp_root_err "写不了 owner 标记 $root/.teamsmith-tmp"
|
|
158
248
|
rm -rf -- "$root" 2>/dev/null || true
|
|
159
249
|
return 3
|
|
160
250
|
fi
|
|
161
|
-
_tmp_root_ledger_append "$root" "$pid" "${start:-unknown}" "$kind" "$created" || true
|
|
251
|
+
_tmp_root_ledger_append "$root" "$pid" "${start:-unknown}" "$kind" "$created" "$marker_ns" || true
|
|
162
252
|
printf '%s\n' "$root"
|
|
163
253
|
return 0
|
|
164
254
|
}
|
|
@@ -316,7 +406,7 @@ _tmp_root_selftest() {
|
|
|
316
406
|
case "$a" in
|
|
317
407
|
--break=*) break_stage="${a#--break=}" ;;
|
|
318
408
|
-h|--help)
|
|
319
|
-
printf '用法:bash %s --self-test [--break=nokill|nokeeep|notmpdir|noreap]\n' "${BASH_SOURCE[0]}"
|
|
409
|
+
printf '用法:bash %s --self-test [--break=nokill|nokeeep|notmpdir|noreap|flat-name|no-ns]\n' "${BASH_SOURCE[0]}"
|
|
320
410
|
return 0 ;;
|
|
321
411
|
*) _tmp_root_err "不认识的自检参数 [$a]"; return 2 ;;
|
|
322
412
|
esac
|
|
@@ -329,33 +419,49 @@ _tmp_root_selftest() {
|
|
|
329
419
|
local self_path
|
|
330
420
|
self_path="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
|
|
331
421
|
local st_dir
|
|
332
|
-
st_dir="$(mktemp -d "$(tmp_root_base)/teamsmith-libselftest.XXXXXX" 2>/dev/null)" || {
|
|
422
|
+
st_dir="$(mktemp -d "$(tmp_root_base)/teamsmith-libselftest-$(tmp_root_ns).XXXXXX" 2>/dev/null)" || {
|
|
333
423
|
_tmp_root_err "自检建不出临时目录"; return 3; }
|
|
334
424
|
trap "rm -rf -- '$st_dir'" EXIT # 路径要内嵌:trap 在函数返回后执行,local 变量那时已经不在了
|
|
335
425
|
|
|
336
426
|
printf '\n\033[1m== tmp-root.sh 自检 ==\033[0m(break=%s)\n' "${break_stage:-none}"
|
|
337
427
|
|
|
338
|
-
# ①
|
|
428
|
+
# ① 创建:路径、家族名、命名空间、标记、台账
|
|
339
429
|
export TMPDIR="$st_dir"
|
|
340
|
-
local r; r="$(tmp_root_create selftest)"
|
|
341
|
-
case "$r" in "$st_dir"/teamsmith-selftest
|
|
342
|
-
*) st_bad "根的路径/名字不对([$r],期望 $st_dir/teamsmith-selftest
|
|
430
|
+
local r my_ns; my_ns="$(tmp_root_ns)"; r="$(tmp_root_create selftest)"
|
|
431
|
+
case "$r" in "$st_dir"/teamsmith-selftest-*) st_ok "根建在解析出的临时根下并且名字在 owned 家族($r)" ;;
|
|
432
|
+
*) st_bad "根的路径/名字不对([$r],期望 $st_dir/teamsmith-selftest-<ns>.*)" ;; esac
|
|
433
|
+
# P287:名字必须带本项目的 ns(flat-name 红侧会在这里变红)
|
|
434
|
+
if case "$r" in "$st_dir"/teamsmith-selftest-"$my_ns".*) true ;; *) false ;; esac; then
|
|
435
|
+
st_ok "根的名字带项目命名空间(ns=$my_ns)"
|
|
436
|
+
else
|
|
437
|
+
st_bad "根的名字没有带项目命名空间([$r],期望 $st_dir/teamsmith-selftest-$my_ns.*)"
|
|
438
|
+
fi
|
|
343
439
|
if [ -f "$r/.teamsmith-tmp" ] && grep -q "^kind=selftest$" "$r/.teamsmith-tmp" \
|
|
344
440
|
&& grep -q "^pid=$$$" "$r/.teamsmith-tmp" && grep -q '^run=' "$r/.teamsmith-tmp"; then
|
|
345
|
-
st_ok "owner 标记写全(kind / pid / start / boot / run / created)"
|
|
441
|
+
st_ok "owner 标记写全(kind / pid / start / boot / run / created / ns)"
|
|
346
442
|
else
|
|
347
443
|
st_bad "owner 标记缺字段:$(tr '\n' ' ' <"$r/.teamsmith-tmp" 2>/dev/null)"
|
|
348
444
|
fi
|
|
445
|
+
if grep -q "^ns=$my_ns$" "$r/.teamsmith-tmp" 2>/dev/null; then
|
|
446
|
+
st_ok "owner 标记带 ns=$my_ns(no-ns 红侧会在这里变红)"
|
|
447
|
+
else
|
|
448
|
+
st_bad "owner 标记没带 ns(期望 ns=$my_ns,实际 $(sed -n 's/^ns=//p' "$r/.teamsmith-tmp" 2>/dev/null))"
|
|
449
|
+
fi
|
|
349
450
|
if [ -f "$(tmp_root_ledger)" ] && grep -qF "$r $$" "$(tmp_root_ledger)"; then
|
|
350
451
|
st_ok "run 台账里有这一条($(tmp_root_ledger))"
|
|
351
452
|
else
|
|
352
453
|
st_bad "run 台账里没有这条根"
|
|
353
454
|
fi
|
|
354
455
|
if head -1 "$(tmp_root_ledger)" 2>/dev/null | grep -Eq ' repo=[^ ]'; then
|
|
355
|
-
st_ok "run 台账头记了仓库身份($(head -1 "$(tmp_root_ledger)" | sed -n 's/.* repo
|
|
456
|
+
st_ok "run 台账头记了仓库身份($(head -1 "$(tmp_root_ledger)" | sed -n 's/.* repo=\([^ ]*\).*/\1/p'))"
|
|
356
457
|
else
|
|
357
458
|
st_bad "run 台账头没有 repo= 仓库身份"
|
|
358
459
|
fi
|
|
460
|
+
if head -1 "$(tmp_root_ledger)" 2>/dev/null | grep -q " ns=$my_ns"; then
|
|
461
|
+
st_ok "run 台账头带 ns=$my_ns"
|
|
462
|
+
else
|
|
463
|
+
st_bad "run 台账头没有 ns=(no-ns 红侧会在这里变红)"
|
|
464
|
+
fi
|
|
359
465
|
|
|
360
466
|
# ② notmpdir:写死 /tmp 的路径不许被当成合规根
|
|
361
467
|
if tmp_root_path_ok /tmp/teamsmith-whatever.1234; then
|
|
@@ -363,10 +469,16 @@ _tmp_root_selftest() {
|
|
|
363
469
|
else
|
|
364
470
|
st_ok "写死 /tmp 的路径被拒(tmp_root_path_ok 非 0)"
|
|
365
471
|
fi
|
|
472
|
+
if tmp_root_path_ok "$st_dir/teamsmith-x-$(tmp_root_ns).1234"; then
|
|
473
|
+
st_ok "解析出的临时根下带 ns 的家族路径被接受"
|
|
474
|
+
else
|
|
475
|
+
st_bad "解析出的临时根下带 ns 的家族路径被误拒"
|
|
476
|
+
fi
|
|
477
|
+
# P287:家族名在但不带 ns 的路径照样不合规(no-ns 的形状)
|
|
366
478
|
if tmp_root_path_ok "$st_dir/teamsmith-x.1234"; then
|
|
367
|
-
|
|
479
|
+
st_bad "解析出的临时根下不带 ns 的家族路径被接受(命名空间规则失效)"
|
|
368
480
|
else
|
|
369
|
-
|
|
481
|
+
st_ok "解析出的临时根下不带 ns 的家族路径被拒(tmp_root_path_ok 非 0)"
|
|
370
482
|
fi
|
|
371
483
|
|
|
372
484
|
# ③ 正常回收:子进程创建 → 退出 → 根消失
|
|
@@ -16,11 +16,20 @@
|
|
|
16
16
|
# shellcheck source=tmux-iso.sh
|
|
17
17
|
. "$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/tmux-iso.sh"
|
|
18
18
|
|
|
19
|
+
# P287:ns(临时根名字里的项目命名空间)的唯一实现在 scripts/lib/common.sh —— 本库被 smoke 前导段
|
|
20
|
+
# source(tmp-root.sh 已经带进来了),独立 source 时自己补一次。
|
|
21
|
+
if ! declare -F team_project_ns >/dev/null 2>&1; then
|
|
22
|
+
_tmux_cap_lib="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)/scripts/lib/common.sh"
|
|
23
|
+
[ -f "$_tmux_cap_lib" ] && . "$_tmux_cap_lib"
|
|
24
|
+
unset _tmux_cap_lib
|
|
25
|
+
fi
|
|
26
|
+
|
|
19
27
|
# M47:`#{bracket_paste_flag}` 是 tmux **3.7 起**才有的格式(同族的旧 tmux 上产品保守地走「多行落文件
|
|
20
28
|
# + 一行指针」,那不是缺陷,是无从探测)。
|
|
21
29
|
tmux_has_bracket_paste_format() {
|
|
22
30
|
local s="bpf-$$" d v rc=1
|
|
23
|
-
|
|
31
|
+
team_tmp_root_prepare >/dev/null 2>&1 || true
|
|
32
|
+
d="$(mktemp -d "$(team_tmp_root)/teamsmith-tmux-cap-$(team_project_ns).XXXXXX" 2>/dev/null)" || return 1
|
|
24
33
|
if env -u TMUX -u TMUX_PANE TMUX_TMPDIR="$d" tmux new-session -d -s "$s" -x 80 -y 24 'sleep 5' 2>/dev/null; then
|
|
25
34
|
v="$(env -u TMUX -u TMUX_PANE TMUX_TMPDIR="$d" tmux display-message -p -t "$s" '#{bracket_paste_flag}' 2>/dev/null)"
|
|
26
35
|
[ -n "$v" ] && rc=0
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
# 硬停)。唯一的旋钮 TEAM_TMUX_ISO_LOG 只决定审计行写哪(不改判定;自检 0h 正面钉住)。
|
|
22
22
|
#
|
|
23
23
|
# 入口:
|
|
24
|
-
# tmux_iso_prove [--tmpdir D] [--sock-name N] [--own-root R] [--caller-tmpdir C] [--argv <tmux argv…>] → 0/1(判定)
|
|
24
|
+
# tmux_iso_prove [--tmpdir D] [--sock-name N] [--own-root R]… [--caller-tmpdir C] [--argv <tmux argv…>] → 0/1(判定)
|
|
25
|
+
# (--own-root 可重复:目标 socket 落在**任一个**本轮自有目录之下即可;P310 起套件
|
|
26
|
+
# 同时给临时根与私有 socket 目录 —— 后者在临时根之外,见 smoke.sh 的 P310 注释)
|
|
25
27
|
# tmux_iso_require <段> <用途> [同上] → 证明通过则静默返回;不通过则硬停(exit 2)
|
|
26
28
|
# tmux_iso_guard_soft <段> <用途> [同上] → 不通过则「响亮拒绝但不 exit」(收尾路径用)
|
|
27
29
|
# tmux_iso_argv_parse <argv…> → 解析动词/显式目标(只吃逐词 argv,产出见下)
|
|
@@ -59,6 +61,8 @@ if ! . "$TMUX_ISO_SHARED_DIR/tmux-argv.sh" 2>/dev/null || ! declare -F tmux_cls_
|
|
|
59
61
|
exit 127
|
|
60
62
|
fi
|
|
61
63
|
|
|
64
|
+
# P309:审计日志的默认位置在解析出的临时根下 —— 解析器只有一处,这里把它 source 进来(幂等:纯定义)。
|
|
65
|
+
. "$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/tmp-root.sh"
|
|
62
66
|
TMUX_ISO_AF_UNIX_MAX="${TMUX_ISO_AF_UNIX_MAX:-107}" # Linux sun_path 全 108 字节(含 NUL)→ 可用 107
|
|
63
67
|
TMUX_ISO_STOP_CODE="${TMUX_ISO_STOP_CODE:-2}"
|
|
64
68
|
|
|
@@ -101,7 +105,8 @@ tmux_iso_argv_parse() { # <argv…>
|
|
|
101
105
|
|
|
102
106
|
|
|
103
107
|
tmux_iso_log() { # 审计行落点(只影响落点,不影响判定)
|
|
104
|
-
|
|
108
|
+
# P287:直接落在解析后临时根上的审计日志点开头(不是别人的前缀 glob 的猎物)
|
|
109
|
+
printf '%s' "${TEAM_TMUX_ISO_LOG:-$(team_tmp_root)/.teamsmith-tmux-iso-guard.$$.log}"
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
tmux_iso_audit() { # <段> <用途> <不成立> <细节> <期望 socket> <实际 socket>
|
|
@@ -149,13 +154,15 @@ tmux_iso_prove() { # [--tmpdir D] [--sock-name N] [--own-root R] [--caller-tmpdi
|
|
|
149
154
|
TMUX_ISO_EFFECTIVE_TMPDIR=""
|
|
150
155
|
local dir="" name="default" own="" caller=""
|
|
151
156
|
TMUX_ISO_CALL_ARGV=()
|
|
157
|
+
# P310:--own-root 可重复(多个本轮自有目录,命中任一即可)
|
|
158
|
+
local -a owns=()
|
|
152
159
|
# 值类选项缺值时**立刻**以 bad-option 退出(M36 的教训:`shift 2` 在 $#<2 上失败会让 while
|
|
153
160
|
# 原地打转 → 挂死;这里每条路径都 shift ≥1 或 break)。
|
|
154
161
|
while [ $# -gt 0 ]; do
|
|
155
162
|
case "$1" in
|
|
156
163
|
--tmpdir) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--tmpdir 缺值"; return 1; }; dir="${2-}"; shift 2 ;;
|
|
157
164
|
--sock-name) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--sock-name 缺值"; return 1; }; name="${2-}"; [ -n "$name" ] || name="default"; shift 2 ;;
|
|
158
|
-
--own-root) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--own-root 缺值"; return 1; };
|
|
165
|
+
--own-root) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--own-root 缺值"; return 1; }; owns+=("${2-}"); shift 2 ;;
|
|
159
166
|
--caller-tmpdir) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--caller-tmpdir 缺值"; return 1; }; caller="${2-}"; shift 2 ;;
|
|
160
167
|
--argv) shift; TMUX_ISO_CALL_ARGV=("$@"); break ;;
|
|
161
168
|
*) TMUX_ISO_REASON="bad-option"
|
|
@@ -202,13 +209,20 @@ tmux_iso_prove() { # [--tmpdir D] [--sock-name N] [--own-root R] [--caller-tmpdi
|
|
|
202
209
|
TMUX_ISO_DETAIL="socket 路径 ${#expected} 字节 > AF_UNIX 上限 $TMUX_ISO_AF_UNIX_MAX(私有 server 绑不上)"
|
|
203
210
|
return 1
|
|
204
211
|
fi
|
|
205
|
-
|
|
212
|
+
# P310:多个自有目录(临时根 + 临时根之外的私有 socket 目录),**任一个**盖住目标即可。
|
|
213
|
+
# 空值不算数(空 own-root 会被规范化成空串,`""/*` 会匹配任何绝对路径 —— 那是假的放行)。
|
|
214
|
+
local _own_ok=0 _own_norm _own_list=""
|
|
215
|
+
for own in ${owns[@]+"${owns[@]}"}; do
|
|
216
|
+
[ -n "$own" ] || continue
|
|
217
|
+
_own_list="${_own_list:+$_own_list、}$own"
|
|
206
218
|
case "$(tmux_iso_norm "$expected")" in
|
|
207
|
-
"$(tmux_iso_norm "$own")"/*) ;;
|
|
208
|
-
*) TMUX_ISO_REASON="outside-own-root"
|
|
209
|
-
TMUX_ISO_DETAIL="目标 socket 不在本轮自有目录 $own 之下($expected)"
|
|
210
|
-
return 1 ;;
|
|
219
|
+
"$(tmux_iso_norm "$own")"/*) _own_ok=1 ;;
|
|
211
220
|
esac
|
|
221
|
+
done
|
|
222
|
+
if [ -n "$_own_list" ] && [ "$_own_ok" != "1" ]; then
|
|
223
|
+
TMUX_ISO_REASON="outside-own-root"
|
|
224
|
+
TMUX_ISO_DETAIL="目标 socket 不在本轮自有目录 ${_own_list} 之下($expected)"
|
|
225
|
+
return 1
|
|
212
226
|
fi
|
|
213
227
|
# ③ 不许是共享默认 socket(或调用者原来那份默认 socket)
|
|
214
228
|
if [ "$(tmux_iso_norm "$expected")" = "$(tmux_iso_norm "$default_sock")" ]; then
|
|
@@ -310,13 +324,14 @@ tmux_iso_guard_soft() { # <段> <用途> [证明参数…]:通过 → 0;不
|
|
|
310
324
|
# ── P180/P188 · 套件的壳函数(tmux / command tmux / builtin command tmux):同一条入口 ──────────
|
|
311
325
|
# 非破坏性调用原样透传(PATH 解析与改动前一致);破坏性调用先过前置(不成立 → 硬停),再按 M23 的
|
|
312
326
|
# 形态执行(env -u TMUX -u TMUX_PANE + 本轮私有 TMUX_TMPDIR)—— 那也是 tmux-lint 认的隔离证据形态。
|
|
313
|
-
tmux_iso_suite_call() { # <段> [--tmpdir D --own-root R --caller-tmpdir C] -- <argv…>
|
|
327
|
+
tmux_iso_suite_call() { # <段> [--tmpdir D --own-root R… --caller-tmpdir C] -- <argv…>
|
|
314
328
|
local label="${1:-?}"; shift || true
|
|
315
|
-
local dir=""
|
|
329
|
+
local dir="" caller=""
|
|
330
|
+
local -a own_args=()
|
|
316
331
|
while [ $# -gt 0 ]; do
|
|
317
332
|
case "$1" in
|
|
318
333
|
--tmpdir) [ $# -ge 2 ] || break; dir="${2-}"; shift 2 ;;
|
|
319
|
-
--own-root) [ $# -ge 2 ] || break; own
|
|
334
|
+
--own-root) [ $# -ge 2 ] || break; own_args+=(--own-root "${2-}"); shift 2 ;;
|
|
320
335
|
--caller-tmpdir) [ $# -ge 2 ] || break; caller="${2-}"; shift 2 ;;
|
|
321
336
|
--) shift; break ;;
|
|
322
337
|
*) break ;;
|
|
@@ -324,7 +339,7 @@ tmux_iso_suite_call() { # <段> [--tmpdir D --own-root R --caller-tmpdir C] -- <
|
|
|
324
339
|
done
|
|
325
340
|
tmux_iso_argv_parse "$@"
|
|
326
341
|
if [ "$TMUX_ISO_ARGV_DESTRUCTIVE" = "1" ]; then
|
|
327
|
-
tmux_iso_require "$label" "tmux $*" --tmpdir "$dir"
|
|
342
|
+
tmux_iso_require "$label" "tmux $*" --tmpdir "$dir" ${own_args[@]+"${own_args[@]}"} \
|
|
328
343
|
--caller-tmpdir "$caller" --argv "$@" || return 1
|
|
329
344
|
env -u TMUX -u TMUX_PANE TMUX_TMPDIR="$dir" "${TMUX_ISO_REAL_TMUX:-tmux}" "$@"
|
|
330
345
|
else
|
|
@@ -345,7 +360,10 @@ tmux_iso_suite_call() { # <段> [--tmpdir D --own-root R --caller-tmpdir C] -- <
|
|
|
345
360
|
tmux_iso_install_suite_guards() { # <真 tmux 路径>
|
|
346
361
|
TMUX_ISO_REAL_TMUX="${1:-}"
|
|
347
362
|
tmux() {
|
|
348
|
-
|
|
363
|
+
# P310:两个本轮自有目录 —— 临时根,与**临时根之外**的私有 socket 目录(后者太短不进临时根,见 smoke.sh)
|
|
364
|
+
local -a _iso_own=(--own-root "${TMP:-}")
|
|
365
|
+
[ -n "${SMOKE_TMUX_OWN_ROOT:-}" ] && _iso_own+=(--own-root "$SMOKE_TMUX_OWN_ROOT")
|
|
366
|
+
tmux_iso_suite_call "${SMOKE_SEC_OPEN_ID:-?}" --tmpdir "${TMUX_TMPDIR:-}" ${_iso_own[@]+"${_iso_own[@]}"} \
|
|
349
367
|
--caller-tmpdir "${SMOKE_CALLER_TMUX_TMPDIR:-}" -- "$@"
|
|
350
368
|
}
|
|
351
369
|
command() {
|
|
@@ -379,3 +397,11 @@ tmux_iso_install_suite_guards() { # <真 tmux 路径>
|
|
|
379
397
|
esac
|
|
380
398
|
}
|
|
381
399
|
}
|
|
400
|
+
|
|
401
|
+
# P242/A9 · 路由夹具(task-model-routing.sh 与 model-routing-*.sh)的私有 server 调用。
|
|
402
|
+
# 这三处以前写裸 `tmux new-window`,静态上没有任何隔离证据(M28 判据 A–D)→ §31 的隔离 lint 必红;
|
|
403
|
+
# 而它们执行时靠的是 harness 的 TMUX_TMPDIR + PATH shim,**文本上看不出来**。这里把隔离写成
|
|
404
|
+
# 文本可见的(env -u TMUX + 私有 TMUX_TMPDIR),并且缺私有目录时**响失败**,绝不回落默认 socket。
|
|
405
|
+
routing_fixture_tmux() { # <tmux 参数…>
|
|
406
|
+
env -u TMUX -u TMUX_PANE TMUX_TMPDIR="${TMUX_TMPDIR:?routing fixture requires a private TMUX_TMPDIR}" tmux "$@"
|
|
407
|
+
}
|
|
@@ -20,53 +20,61 @@ panel-b3.sh 173 cap="$i" -le "${B3_CAP_ITERS:-30}" while [ "$i" -le "${B3_CAP_IT
|
|
|
20
20
|
panel-cpu.sh 311 bound=sub_end 计算出的截止时间(到点自己退出) while :; do
|
|
21
21
|
panel-p21.sh 1728 cap="$_i" -le 15 while [ "$_i" -le 15 ]; do
|
|
22
22
|
pm-box-real.sh 168 cap="$i" -lt "$READY_TRIES" while [ "$i" -lt "$READY_TRIES" ]; do
|
|
23
|
-
smoke.sh
|
|
24
|
-
smoke.sh
|
|
25
|
-
smoke.sh
|
|
26
|
-
smoke.sh
|
|
27
|
-
smoke.sh
|
|
28
|
-
smoke.sh
|
|
29
|
-
smoke.sh
|
|
30
|
-
smoke.sh
|
|
31
|
-
smoke.sh
|
|
32
|
-
smoke.sh
|
|
33
|
-
smoke.sh
|
|
34
|
-
smoke.sh
|
|
35
|
-
smoke.sh
|
|
36
|
-
smoke.sh
|
|
37
|
-
smoke.sh
|
|
38
|
-
smoke.sh
|
|
39
|
-
smoke.sh
|
|
40
|
-
smoke.sh
|
|
41
|
-
smoke.sh
|
|
42
|
-
smoke.sh
|
|
43
|
-
smoke.sh
|
|
44
|
-
smoke.sh
|
|
45
|
-
smoke.sh
|
|
46
|
-
smoke.sh
|
|
47
|
-
smoke.sh
|
|
48
|
-
smoke.sh
|
|
49
|
-
smoke.sh
|
|
50
|
-
smoke.sh
|
|
51
|
-
smoke.sh
|
|
52
|
-
smoke.sh
|
|
53
|
-
smoke.sh
|
|
54
|
-
smoke.sh
|
|
55
|
-
smoke.sh
|
|
56
|
-
smoke.sh
|
|
57
|
-
smoke.sh
|
|
58
|
-
smoke.sh
|
|
59
|
-
smoke.sh
|
|
60
|
-
smoke.sh
|
|
61
|
-
smoke.sh
|
|
62
|
-
smoke.sh
|
|
63
|
-
smoke.sh
|
|
64
|
-
smoke.sh
|
|
65
|
-
smoke.sh
|
|
66
|
-
smoke.sh
|
|
67
|
-
smoke.sh
|
|
68
|
-
|
|
69
|
-
|
|
23
|
+
smoke.sh 493 bound=持有者公布的排队上限 lock_cap(到点 break 进超限分支)+ TEAM_SMOKE_LOCK_WAIT 下限 while :; do
|
|
24
|
+
smoke.sh 1220 bound=停止位文件 SMOKE_TMP_STOP + 主 shell 寿命(M33 哨兵的文件握手) while [ ! -e "$SMOKE_TMP_STOP" ]; do
|
|
25
|
+
smoke.sh 2868 cap="$S6_WAIT" -lt 100 while [ "$S6_WAIT" -lt 100 ] && [ ! -s "$TMP/pi-args.log" ]; do sleep 0.1; S6_WAIT=$((S6_WAIT + 1)); done
|
|
26
|
+
smoke.sh 3619 cap="$_i" -lt 60 _i=0; while [ "$_i" -lt 60 ] && [ ! -f "$ADAPTER_DONE" ]; do sleep 0.5; _i=$((_i + 1)); done
|
|
27
|
+
smoke.sh 3858 cap="$B4_ROUND" -le 5 while [ "$B4_ROUND" -le 5 ]; do
|
|
28
|
+
smoke.sh 3865 cap="$B4_WAIT" -lt 40 while [ "$B4_WAIT" -lt 40 ] && ! grep -qF "exit code 7" "$TMP/m43-b4-$B4_ROUND.log"; do sleep 0.05; B4_WAIT=$((B4_WAIT + 1)); done
|
|
29
|
+
smoke.sh 3872 cap="$B4_WAIT" -lt 40 while [ "$B4_WAIT" -lt 40 ]; do
|
|
30
|
+
smoke.sh 4156 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do "$@" && return 0; sleep 0.1; i=$((i + 1)); done
|
|
31
|
+
smoke.sh 4165 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
|
|
32
|
+
smoke.sh 4266 cap="$PM_TICKS" -lt 3 while [ "$PM_TICKS" -lt 3 ]; do
|
|
33
|
+
smoke.sh 4462 cap="$M82_WAIT" -lt 60 while [ "$M82_WAIT" -lt 60 ] && [ ! -s "$TMP/m82-bare-ran.log" ]; do sleep 0.25; M82_WAIT=$((M82_WAIT + 1)); done
|
|
34
|
+
smoke.sh 4568 cap="$i" -lt "${2:-50}" local i=0; while [ "$i" -lt "${2:-50}" ]; do [ -n "$(m37_child_of "$1")" ] && return 0; sleep 0.1; i=$((i + 1)); done
|
|
35
|
+
smoke.sh 4576 cap="$i" -lt "${4:-50}" local i=0; while [ "$i" -lt "${4:-50}" ]; do
|
|
36
|
+
smoke.sh 4601 cap="$i" -lt "${3:-50}" while [ "$i" -lt "${3:-50}" ]; do
|
|
37
|
+
smoke.sh 5331 cap="$M25_CWAIT" -lt 60 while [ "$M25_CWAIT" -lt 60 ]; do
|
|
38
|
+
smoke.sh 5353 cap="$M25_WAIT" -lt 120 while [ "$M25_WAIT" -lt 120 ]; do
|
|
39
|
+
smoke.sh 5452 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
|
|
40
|
+
smoke.sh 5466 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
|
|
41
|
+
smoke.sh 5477 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
|
|
42
|
+
smoke.sh 5487 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
|
|
43
|
+
smoke.sh 5514 cap="$i" -lt 40 while [ "$i" -lt 40 ]; do
|
|
44
|
+
smoke.sh 5545 cap="$i" -lt 100 while [ "$i" -lt 100 ]; do
|
|
45
|
+
smoke.sh 5557 cap="$i" -lt "$tries" while [ "$i" -lt "$tries" ]; do
|
|
46
|
+
smoke.sh 5566 cap="$i" -lt "$max" while [ "$i" -lt "$max" ]; do [ -f "$f" ] && [ -s "$f" ] && return 0; sleep 1; i=$((i+1)); done
|
|
47
|
+
smoke.sh 5661 cap="$WD_LOGS_WAIT" -lt 40 while [ "$WD_LOGS_WAIT" -lt 40 ]; do
|
|
48
|
+
smoke.sh 5929 cap="$i" -lt 60 while [ "$i" -lt 60 ]; do
|
|
49
|
+
smoke.sh 6045 cap="$i" -lt 30 while [ "$i" -lt 30 ] && [ "$(( $(start_count) - STARTS_BEFORE ))" -lt 1 ]; do sleep 0.1; i=$((i + 1)); done
|
|
50
|
+
smoke.sh 6144 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do [ "$(p36_lines)" -gt "$base" ] && return 0; sleep 0.1; i=$((i + 1)); done
|
|
51
|
+
smoke.sh 6153 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do [ -z "$(p36_same_cwd_pids)" ] && return 0; sleep 0.2; i=$((i + 1)); done
|
|
52
|
+
smoke.sh 6230 cap="$R_WAIT" -lt 20 while [ "$R_WAIT" -lt 20 ] && ! $TEAM roster 2>/dev/null | grep -qF "pi 已退出"; do sleep 0.2; R_WAIT=$((R_WAIT + 1)); done
|
|
53
|
+
smoke.sh 6712 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
|
|
54
|
+
smoke.sh 10968 cap="$i" -lt "$max" while [ "$i" -lt "$max" ]; do grep -q -- "$pat" "$f" 2>/dev/null && return 0; sleep 0.1; i=$((i + 1)); done
|
|
55
|
+
smoke.sh 11890 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
|
|
56
|
+
smoke.sh 11904 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
|
|
57
|
+
smoke.sh 14872 cap="$M36_W" -lt 100 while [ "$M36_W" -lt 100 ] && [ ! -f "$M36_D/env-worker.done" ]; do sleep 0.2; M36_W=$((M36_W + 1)); done
|
|
58
|
+
smoke.sh 14890 cap="$M36_W" -lt 25 while [ "$M36_W" -lt 25 ]; do grep -q 'argv=ls' "$REPO/.pi/team/state/tmux-calls.log" 2>/dev/null && break; sleep 0.2; M36_W=$((M36_W + 1)); done
|
|
59
|
+
smoke.sh 14895 cap="$M36_W" -lt 25 while [ "$M36_W" -lt 25 ]; do grep -q 'act=allowed-owned' "$REPO/.pi/team/state/tmux-calls.log" 2>/dev/null && break; sleep 0.2; M36_W=$((M36_W + 1)); done
|
|
60
|
+
smoke.sh 14928 cap="$M36_W" -lt 100 while [ "$M36_W" -lt 100 ] && [ ! -f "$M36_D/env-pm.done" ]; do sleep 0.2; M36_W=$((M36_W + 1)); done
|
|
61
|
+
smoke.sh 15115 cap="$M40_W" -lt 60 while [ "$M40_W" -lt 60 ]; do
|
|
62
|
+
smoke.sh 15133 cap="$M40_LOGS_WAIT" -lt 40 while [ "$M40_LOGS_WAIT" -lt 40 ]; do
|
|
63
|
+
smoke.sh 15160 cap="$M40_W" -lt 100 while [ "$M40_W" -lt 100 ] && [ ! -f "$M40_D/8c-worker.done" ]; do sleep 0.2; M40_W=$((M40_W + 1)); done
|
|
64
|
+
smoke.sh 16892 cap="$i" -lt 600 while kill -0 "$pid" 2>/dev/null && [ "$i" -lt 600 ]; do
|
|
65
|
+
smoke.sh 17116 cap="$i" -lt "$n" while [ "$i" -lt "$n" ]; do
|
|
66
|
+
smoke.sh 17129 cap="$i" -lt 200 while [ "$i" -lt 200 ]; do
|
|
67
|
+
smoke.sh 17169 cap="$i" -lt 200 while [ "$i" -lt 200 ]; do
|
|
68
|
+
smoke.sh 18726 cap="$i" -lt 25 while [ "$i" -lt 25 ]; do
|
|
69
|
+
smoke.sh 18744 cap="$P55_W" -lt 30 while [ "$P55_W" -lt 30 ]; do
|
|
70
|
+
smoke.sh 18788 cap="$P55_W" -lt 20 while [ "$P55_W" -lt 20 ]; do
|
|
71
|
+
smoke.sh 18925 cap="$P55_W" -lt 20 while [ "$P55_W" -lt 20 ]; do
|
|
72
|
+
smoke.sh 18970 cap="$P55_W" -lt 25 while [ "$P55_W" -lt 25 ]; do
|
|
73
|
+
tmp-hygiene.sh 1696 cap="$_i" -lt 50 while [ "$_i" -lt 50 ] && ! grep -q '^ROOT=' "$kr_out" 2>/dev/null; do sleep 0.1; _i=$((_i + 1)); done
|
|
74
|
+
tmp-hygiene.sh 1790 cap="$_j" -lt 50 while [ "$_j" -lt 50 ] && kill -0 "$orphan" 2>/dev/null; do sleep 0.1; _j=$((_j + 1)); done
|
|
75
|
+
tmp-hygiene.sh 1842 cap="$_w" -lt 40 while [ "$_w" -lt 40 ]; do
|
|
76
|
+
tmp-hygiene.sh 1849 cap="$_w" -lt 40 while [ "$_w" -lt 40 ]; do
|
|
77
|
+
lib/bounded-spin.sh 75 cap="$cap_s" while _bs_parent_alive "$parent"; do
|
|
70
78
|
lib/pty-wait.sh 229 cap="$i" -lt "$ceiling" while [ "$i" -lt "$ceiling" ]; do
|
|
71
79
|
lib/pty-wait.sh 360 cap="$i" -le "${PTY_CLEANUP_ITERS:-4}" while [ "$i" -le "${PTY_CLEANUP_ITERS:-4}" ]; do
|
|
72
80
|
lib/pty-wait.sh 384 cap="$i" -le "${PTY_CLEANUP_ITERS:-4}" while [ "$i" -le "${PTY_CLEANUP_ITERS:-4}" ]; do
|
|
@@ -82,3 +90,7 @@ lib/tmp-root.sh 452 cap="$_i" -lt 100 while [ "$_i" -lt 100 ] && kill -0 "$term_
|
|
|
82
90
|
lib/tmp-root.sh 478 cap="$_i" -lt 50 while [ "$_i" -lt 50 ]; do
|
|
83
91
|
lib/tmp-root.sh 488 cap="$_i" -lt 25 while [ "$_i" -lt 25 ] && kill -0 "$fg_pid" 2>/dev/null; do sleep 0.1; _i=$((_i + 1)); done
|
|
84
92
|
flip-p158.sh 109 cap="$i" -lt 500 while [ "$i" -lt 500 ] && [ -z "$fp" ]; do
|
|
93
|
+
perf.sh 200 bound=持有者公布的排队上限 cap(缺则 TEAM_PERF_LOCK_WAIT),到点 exit 3(没结论) while :; do
|
|
94
|
+
tmux-identity-leak.sh 368 cap="$i" -lt 300 while [ "$i" -lt 300 ] && [ ! -f "$TMP/$name.done" ]; do sleep 0.1; i=$((i + 1)); done
|
|
95
|
+
tmux-identity-leak.sh 436 cap="$_i" -lt 80 _i=0; while [ "$_i" -lt 80 ] && [ ! -f "$TMP/win-env.log.done" ]; do sleep 0.1; _i=$((_i + 1)); done
|
|
96
|
+
tmux-identity-leak.sh 475 cap="$_i" -lt 120 _i=0; while [ "$_i" -lt 120 ] && [ ! -f "$TMP/win-kill.done" ]; do sleep 0.1; _i=$((_i + 1)); done
|