teamsmith 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +156 -2
- package/bin/team.mjs +59 -0
- package/install.sh +94 -0
- package/package.json +37 -4
- package/skills/teamsmith/CHANGELOG.md +747 -0
- package/skills/teamsmith/SKILL.md +312 -0
- package/skills/teamsmith/extension/team-bg.ts +399 -0
- package/skills/teamsmith/extension/team-inbox-watch.ts +1412 -0
- package/skills/teamsmith/extension/team-notify.ts +524 -0
- package/skills/teamsmith/references/agent-adapters.md +643 -0
- package/skills/teamsmith/references/config.md +477 -0
- package/skills/teamsmith/references/meeting.md +124 -0
- package/skills/teamsmith/references/memory.md +133 -0
- package/skills/teamsmith/references/migration.md +227 -0
- package/skills/teamsmith/references/openspec.md +208 -0
- package/skills/teamsmith/references/philosophy.md +95 -0
- package/skills/teamsmith/references/protocol.md +712 -0
- package/skills/teamsmith/references/troubleshooting.md +1384 -0
- package/skills/teamsmith/references/workflows.md +448 -0
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +1709 -0
- package/skills/teamsmith/scripts/lib/cmd-bg.sh +284 -0
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +311 -0
- package/skills/teamsmith/scripts/lib/cmd-config.sh +1156 -0
- package/skills/teamsmith/scripts/lib/cmd-death.sh +562 -0
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +149 -0
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +124 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +212 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +904 -0
- package/skills/teamsmith/scripts/lib/cmd-outbox.sh +196 -0
- package/skills/teamsmith/scripts/lib/cmd-project.sh +642 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +1393 -0
- package/skills/teamsmith/scripts/lib/cmd-status.sh +1399 -0
- package/skills/teamsmith/scripts/lib/cmd-update.sh +191 -0
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +1681 -0
- package/skills/teamsmith/scripts/lib/common.sh +4964 -0
- package/skills/teamsmith/scripts/lib/draft-entry.sh +51 -0
- package/skills/teamsmith/scripts/lib/outbox.sh +2042 -0
- package/skills/teamsmith/scripts/lib/tmux-argv.sh +165 -0
- package/skills/teamsmith/scripts/monitor.mjs +616 -0
- package/skills/teamsmith/scripts/panel/README.md +192 -0
- package/skills/teamsmith/scripts/panel/build.sh +47 -0
- package/skills/teamsmith/scripts/panel/bun.lock +109 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +68 -0
- package/skills/teamsmith/scripts/panel/package.json +24 -0
- package/skills/teamsmith/scripts/panel/panel.js +388 -0
- package/skills/teamsmith/scripts/panel/src/App.tsx +2150 -0
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +154 -0
- package/skills/teamsmith/scripts/panel/src/compose.ts +691 -0
- package/skills/teamsmith/scripts/panel/src/data.ts +555 -0
- package/skills/teamsmith/scripts/panel/src/format.ts +50 -0
- package/skills/teamsmith/scripts/panel/src/layout.ts +2562 -0
- package/skills/teamsmith/scripts/panel/src/main.tsx +894 -0
- package/skills/teamsmith/scripts/panel/src/markdown.ts +340 -0
- package/skills/teamsmith/scripts/panel/src/sanitize.ts +42 -0
- package/skills/teamsmith/scripts/panel/src/settings.ts +154 -0
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +416 -0
- package/skills/teamsmith/scripts/panel/src/strings/index.ts +65 -0
- package/skills/teamsmith/scripts/panel/src/strings/types.ts +9 -0
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +414 -0
- package/skills/teamsmith/scripts/panel/src/theme.ts +116 -0
- package/skills/teamsmith/scripts/panel/src/types.ts +652 -0
- package/skills/teamsmith/scripts/panel/src/width.ts +105 -0
- package/skills/teamsmith/scripts/panel/tsconfig.json +16 -0
- package/skills/teamsmith/scripts/shim/signal-gate +156 -0
- package/skills/teamsmith/scripts/shim/tmux +403 -0
- package/skills/teamsmith/scripts/team +143 -0
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +147 -0
- package/skills/teamsmith/templates/BOARD.md.tmpl +18 -0
- package/skills/teamsmith/templates/DECISIONS.md.tmpl +22 -0
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +25 -0
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +84 -0
- package/skills/teamsmith/templates/ROADMAP.md.tmpl +29 -0
- package/skills/teamsmith/templates/config.sh.tmpl +106 -0
- package/skills/teamsmith/templates/memory-seed.md.tmpl +46 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +110 -0
- package/skills/teamsmith/templates/report.md.tmpl +36 -0
- package/skills/teamsmith/templates/task.md.tmpl +65 -0
- package/skills/teamsmith/templates/threads-README.md +17 -0
- package/skills/teamsmith/tests/checkout-shape-probe.sh +571 -0
- package/skills/teamsmith/tests/config-cli.sh +1562 -0
- package/skills/teamsmith/tests/container-tmux.sh +493 -0
- package/skills/teamsmith/tests/coverage-inventory.sh +173 -0
- package/skills/teamsmith/tests/death-cause.sh +564 -0
- package/skills/teamsmith/tests/delivery-truth.sh +1231 -0
- package/skills/teamsmith/tests/fake-tui.py +450 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +60 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +139 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/mock-server.py +29 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/observe.ts +20 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +79 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +175 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +229 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/README.md +22 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/dev2.seen +8 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/dev2.wake +9 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/pm-nudges.wake +3 -0
- package/skills/teamsmith/tests/fixtures/signal-lint-cases.txt +40 -0
- package/skills/teamsmith/tests/flip-glue.sh +162 -0
- package/skills/teamsmith/tests/flip-m12-26c.sh +129 -0
- package/skills/teamsmith/tests/flip-m12.sh +185 -0
- package/skills/teamsmith/tests/flip-m16.sh +166 -0
- package/skills/teamsmith/tests/flip-m17.sh +204 -0
- package/skills/teamsmith/tests/flip-m33.sh +284 -0
- package/skills/teamsmith/tests/flip-m34.sh +96 -0
- package/skills/teamsmith/tests/flip-m37.sh +185 -0
- package/skills/teamsmith/tests/flip-m4.3.sh +375 -0
- package/skills/teamsmith/tests/flip-m43.sh +128 -0
- package/skills/teamsmith/tests/flip-m44.sh +262 -0
- package/skills/teamsmith/tests/flip-m45.sh +244 -0
- package/skills/teamsmith/tests/flip-m46.sh +238 -0
- package/skills/teamsmith/tests/flip-m48.sh +304 -0
- package/skills/teamsmith/tests/flip-m6.2.sh +205 -0
- package/skills/teamsmith/tests/flip-m6.3.sh +283 -0
- package/skills/teamsmith/tests/flip-m6.4.sh +267 -0
- package/skills/teamsmith/tests/flip-m6.5.sh +113 -0
- package/skills/teamsmith/tests/flip-m7.1.sh +135 -0
- package/skills/teamsmith/tests/flip-m7.2.sh +321 -0
- package/skills/teamsmith/tests/flip-p144.sh +112 -0
- package/skills/teamsmith/tests/flip-p156.sh +133 -0
- package/skills/teamsmith/tests/flip-p158.sh +301 -0
- package/skills/teamsmith/tests/flip-p160.sh +182 -0
- package/skills/teamsmith/tests/flip-p171.sh +249 -0
- package/skills/teamsmith/tests/flip-p18.1.sh +95 -0
- package/skills/teamsmith/tests/flip-p20.sh +286 -0
- package/skills/teamsmith/tests/flip-p201.sh +249 -0
- package/skills/teamsmith/tests/flip-p210.sh +239 -0
- package/skills/teamsmith/tests/flip-p211.sh +152 -0
- package/skills/teamsmith/tests/flip-p217.sh +288 -0
- package/skills/teamsmith/tests/flip-p22.sh +123 -0
- package/skills/teamsmith/tests/flip-p23.sh +239 -0
- package/skills/teamsmith/tests/flip-p25.sh +165 -0
- package/skills/teamsmith/tests/flip-p71.sh +184 -0
- package/skills/teamsmith/tests/flip-p72.sh +202 -0
- package/skills/teamsmith/tests/frames/README.md +176 -0
- package/skills/teamsmith/tests/frames/p78-conversation-rule-below-box.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-cursor-mid-draft.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor-line.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-blank-region.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-only.txt +5 -0
- package/skills/teamsmith/tests/frames/p78-spinner-row-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-wider-rule-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p86-f1-mixed-width-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/p86-f1-narrower-width-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/p86-f1-spinner-top-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/pi-0.85.1-update-banner.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-draft-half-sentence.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-empty-box.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-one-line-draft.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-project-trust-prompt.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.99.2-empty-editor.txt +32 -0
- package/skills/teamsmith/tests/frames/pi-0.99.2-human-draft.txt +32 -0
- package/skills/teamsmith/tests/frames/pi-1.0.0-git-error-in-box.txt +32 -0
- package/skills/teamsmith/tests/gate-guard.sh +112 -0
- package/skills/teamsmith/tests/guard-matrix.sh +233 -0
- package/skills/teamsmith/tests/install-shape.sh +731 -0
- package/skills/teamsmith/tests/ledger-ban.sh +612 -0
- package/skills/teamsmith/tests/lib/box-judge.sh +68 -0
- package/skills/teamsmith/tests/lib/checkout-shape.sh +77 -0
- package/skills/teamsmith/tests/lib/loop-scan.awk +114 -0
- package/skills/teamsmith/tests/lib/pty-wait.sh +676 -0
- package/skills/teamsmith/tests/lib/section-guard.sh +855 -0
- package/skills/teamsmith/tests/lib/shell-lex.pl +261 -0
- package/skills/teamsmith/tests/lib/tmp-root.sh +528 -0
- package/skills/teamsmith/tests/lib/tmux-cap.sh +35 -0
- package/skills/teamsmith/tests/lib/tmux-iso-call-probe.sh +81 -0
- package/skills/teamsmith/tests/lib/tmux-iso-probe.sh +46 -0
- package/skills/teamsmith/tests/lib/tmux-iso.sh +381 -0
- package/skills/teamsmith/tests/load-experiment.sh +290 -0
- package/skills/teamsmith/tests/loop-inventory.tsv +84 -0
- package/skills/teamsmith/tests/panel-b2-slow-stub.sh +19 -0
- package/skills/teamsmith/tests/panel-b2.sh +1183 -0
- package/skills/teamsmith/tests/panel-b3-pty-mouse.py +240 -0
- package/skills/teamsmith/tests/panel-b3-pty-tmux-mouse.py +138 -0
- package/skills/teamsmith/tests/panel-b3-stub.sh +279 -0
- package/skills/teamsmith/tests/panel-b3.sh +1301 -0
- package/skills/teamsmith/tests/panel-choices.sh +572 -0
- package/skills/teamsmith/tests/panel-clipboard-model.ts +187 -0
- package/skills/teamsmith/tests/panel-compose-model.ts +290 -0
- package/skills/teamsmith/tests/panel-contrast.mjs +81 -0
- package/skills/teamsmith/tests/panel-cpu-premise.sh +173 -0
- package/skills/teamsmith/tests/panel-cpu.sh +391 -0
- package/skills/teamsmith/tests/panel-flip-m54.sh +207 -0
- package/skills/teamsmith/tests/panel-flip-p123.sh +278 -0
- package/skills/teamsmith/tests/panel-flip-p125.sh +318 -0
- package/skills/teamsmith/tests/panel-flip-p128.sh +259 -0
- package/skills/teamsmith/tests/panel-keyprobe-pty.py +99 -0
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +41 -0
- package/skills/teamsmith/tests/panel-keyprobe.sh +82 -0
- package/skills/teamsmith/tests/panel-keyprobe.tsx +116 -0
- package/skills/teamsmith/tests/panel-knobs.sh +83 -0
- package/skills/teamsmith/tests/panel-p21.sh +2181 -0
- package/skills/teamsmith/tests/panel-snapshots.sh +802 -0
- package/skills/teamsmith/tests/panel-strings.mjs +195 -0
- package/skills/teamsmith/tests/perf.sh +740 -0
- package/skills/teamsmith/tests/pm-box-real.sh +350 -0
- package/skills/teamsmith/tests/pulse-nudge-key.sh +563 -0
- package/skills/teamsmith/tests/routes.sh +1652 -0
- package/skills/teamsmith/tests/section-budgets.tsv +150 -0
- package/skills/teamsmith/tests/section-guard.sh +231 -0
- package/skills/teamsmith/tests/section-needs-audit.sh +94 -0
- package/skills/teamsmith/tests/section-paths.tsv +142 -0
- package/skills/teamsmith/tests/section-select.sh +648 -0
- package/skills/teamsmith/tests/signal-gate.sh +366 -0
- package/skills/teamsmith/tests/signal-lint-legacy.txt +14 -0
- package/skills/teamsmith/tests/signal-lint.pl +416 -0
- package/skills/teamsmith/tests/skill-load.mjs +65 -0
- package/skills/teamsmith/tests/smoke.sh +19599 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +32 -0
- package/skills/teamsmith/tests/spec-ledger-refs.tsv +78 -0
- package/skills/teamsmith/tests/spec-refs.sh +826 -0
- package/skills/teamsmith/tests/task-header-model.sh +267 -0
- package/skills/teamsmith/tests/team-bg-flip.sh +239 -0
- package/skills/teamsmith/tests/team-bg-harness.mjs +392 -0
- package/skills/teamsmith/tests/team-bg-stop.sh +434 -0
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +191 -0
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +1559 -0
- package/skills/teamsmith/tests/tmp-hygiene.sh +1190 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +31 -0
- package/skills/teamsmith/tests/tmux-lint.pl +604 -0
- package/skills/teamsmith-init/SKILL.md +100 -0
- package/skills/teamsmith-init/references/bootstrap.md +74 -0
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +46 -0
|
@@ -0,0 +1,2181 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# panel-p21.sh — pty/tmux fixtures for the project-settings view (P22 / B2-B4).
|
|
3
|
+
# M59: every wait releases on a settled frame, every cleanup key is state-checked, and every
|
|
4
|
+
# failure carries its own scene — the mechanics live in tests/lib/pty-wait.sh (sourced below).
|
|
5
|
+
#
|
|
6
|
+
# bash skills/teamsmith/tests/panel-p21.sh # every scenario
|
|
7
|
+
# bash skills/teamsmith/tests/panel-p21.sh settings seats # selected scenarios
|
|
8
|
+
# bash skills/teamsmith/tests/panel-p21.sh settings groups wheel # P30: grouping + the view's wheel
|
|
9
|
+
# TEAM_P21_KEEP=1 bash ... # keep the fixture directory
|
|
10
|
+
#
|
|
11
|
+
# Every scenario runs in a private tmux server and a fresh git project initialised with the real
|
|
12
|
+
# `team init`; the panel runs the **real** CLI through a logging wrapper (`argv.log`), so "the
|
|
13
|
+
# console writes only through the owning command" is checked against real argv, not a stub.
|
|
14
|
+
# Exit: 0 every selected scenario green, 1 at least one assertion failed, 3 setup failure,
|
|
15
|
+
# 4 a scenario was visibly SKIPPED (see the premise below): no failure, no conclusion.
|
|
16
|
+
#
|
|
17
|
+
# P48 / D33 — `panel#The project-settings pty fixture judges under a machine premise` (the gate
|
|
18
|
+
# rule is `verification#The correctness gate judges correctness only`): the wait horizons stay
|
|
19
|
+
# failure detectors, never judgments. Every scenario prints a **premise line** before its first
|
|
20
|
+
# assertion (real `loadavg_1m`/`loadavg_5m`, the logical core count and a **code-independent probe**
|
|
21
|
+
# — `python3 -c pass` + `bash -c true` + `git rev-parse`, in ms), and when a wait runs out of its
|
|
22
|
+
# (progress-extended) horizon the engine attributes the verdict from the machine's own readings:
|
|
23
|
+
# still painting / probe over its ceiling / load over the coarse guard -> one visible SKIP line and
|
|
24
|
+
# the scenario stops there (fixture exit 4, the gate stays 0); a static scene with the readings
|
|
25
|
+
# under their ceilings -> the ordinary red with its M59 scene (a regression is a code verdict).
|
|
26
|
+
# Constants and their measured bands: probe ceiling 120 ms (measured 12-34 ms across loadavg
|
|
27
|
+
# 8.4-42.4 on 32 cores), coarse load guard 2.0 x cores (the highest measured green load is 1.33 x
|
|
28
|
+
# cores) — both sit **outside** the band where this fixture judges. Re-derivation recipe:
|
|
29
|
+
# `tests/load-experiment.sh {storm,burn,probe}` (the safe harness: owned load, owned targets) +
|
|
30
|
+
# design.md §3/§4; the raw calibration table is in docs/team/reports/P48-dev3.md.
|
|
31
|
+
#
|
|
32
|
+
# P68 / fixture-waits-for-landed-reads — 数据态等待(requirement「A fixture observes a data-derived state
|
|
33
|
+
# before it asserts it」):视图行、席位行、组标题这类**断言对象本身**从异步的 settings 读来,断言前必须
|
|
34
|
+
# 先等那一行出现在稳定帧上(`wait_row`,pty-wait.sh 的引擎)。骨架帧不算证据;固定 `sleep` + 单次采样也
|
|
35
|
+
# 不算。上界与实测延迟带(P52 §C 的注入表):settings 读延迟 0s 绿 / 2s → 1 红 / 3s → 7 红 / 6s → 9 红,
|
|
36
|
+
# 自然读 <1s;`wait_row` 用 30 轮基础视界(轮询 0.4s + 稳定确认 0.25s ≈ 20s,静态场景不延长),6s 慢端
|
|
37
|
+
# 约有 3× 余量。上界是失败探测器,不是性能阈值(D33):慢但落在界内的读必须绿。
|
|
38
|
+
#
|
|
39
|
+
# Fixture knobs (honoured **only** under `TEAM_SMOKE_FIXTURE=1`; otherwise printed as ignored and
|
|
40
|
+
# the real reading is used — the panel-cpu.sh precedent):
|
|
41
|
+
# TEAM_P21_PREMISE_PROBE_MS=<ms> inject the probe reading; over its ceiling the fixture also
|
|
42
|
+
# injects the "the state never arrives" stall, so the
|
|
43
|
+
# exhaustion path is reachable on a quiet host
|
|
44
|
+
# TEAM_P21_PREMISE_LOADAVG=<n> inject loadavg_1m
|
|
45
|
+
# TEAM_P21_PREMISE_LOAD_FACTOR=<f> inject the coarse entry guard's factor
|
|
46
|
+
# TEAM_P21_PREMISE_PROBE_CEIL_MS=<ms> inject the probe ceiling
|
|
47
|
+
# TEAM_P21_STALL_ROUNDS=<n> inject the progress window (PTY_STALL_ROUNDS)
|
|
48
|
+
# TEAM_P21_STALL=1 inject a needle that never appears (the exhaustion shape
|
|
49
|
+
# on a healthy machine: it must stay a red, not a skip)
|
|
50
|
+
# TEAM_P21_PREMISE_ONLY=1 print the premise line + the ignore notices, build no tmux
|
|
51
|
+
# and judge nothing, exit 0 (the gate's knob-integrity check)
|
|
52
|
+
set -uo pipefail
|
|
53
|
+
|
|
54
|
+
# ── 身份隔离(必须最先做):绝不继承调用者的团队身份 ──────────────────────────────
|
|
55
|
+
# (自己声明的旋钮先存下来:下面的清理会把 TEAM_* 全清掉)
|
|
56
|
+
_tree_arg="${TEAM_P21_TREE:-}"
|
|
57
|
+
_keep_arg="${TEAM_P21_KEEP:-0}"
|
|
58
|
+
# M59: TEAM_P21_TRACE=1 prints every wait/cleanup decision to stderr (fixture diagnostics, saved
|
|
59
|
+
# before the TEAM_* wipe below so the knob is honored when passed from outside).
|
|
60
|
+
_trace_arg="${TEAM_P21_TRACE:-}"
|
|
61
|
+
_js_arg="${TEAM_P21_JS:-}"
|
|
62
|
+
_js_panel="${TEAM_P21_PANEL:-}"
|
|
63
|
+
# P48: the premise knobs (and the fixture switch itself) are saved before the identity wipe, which
|
|
64
|
+
# would otherwise unset every TEAM_* — including TEAM_SMOKE_FIXTURE, the only switch that makes an
|
|
65
|
+
# injected reading count.
|
|
66
|
+
_smoke_fixture_arg="${TEAM_SMOKE_FIXTURE:-0}"
|
|
67
|
+
_premise_probe_arg="${TEAM_P21_PREMISE_PROBE_MS:-}"
|
|
68
|
+
_premise_load_arg="${TEAM_P21_PREMISE_LOADAVG:-}"
|
|
69
|
+
_premise_factor_arg="${TEAM_P21_PREMISE_LOAD_FACTOR:-}"
|
|
70
|
+
_premise_ceil_arg="${TEAM_P21_PREMISE_PROBE_CEIL_MS:-}"
|
|
71
|
+
_premise_stall_arg="${TEAM_P21_STALL_ROUNDS:-}"
|
|
72
|
+
_stall_arg="${TEAM_P21_STALL:-}"
|
|
73
|
+
_premise_only_arg="${TEAM_P21_PREMISE_ONLY:-0}"
|
|
74
|
+
while IFS='=' read -r _v _; do
|
|
75
|
+
case "$_v" in TEAM_*) unset "$_v" 2>/dev/null || true ;; esac
|
|
76
|
+
done < <(env)
|
|
77
|
+
unset _v 2>/dev/null || true
|
|
78
|
+
|
|
79
|
+
here="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
80
|
+
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
81
|
+
. "$here/lib/tmp-root.sh"
|
|
82
|
+
# P162:破坏性调用(kill-server/kill-session/kill-window)动手前先证明私有 socket 生效
|
|
83
|
+
. "$here/lib/tmux-iso.sh"
|
|
84
|
+
tree="${_tree_arg:-$(cd -P "$here/../../.." && pwd)}"
|
|
85
|
+
skill="$tree/skills/teamsmith"
|
|
86
|
+
panel="${_js_panel:-$skill/scripts/panel/panel.js}"
|
|
87
|
+
js="${_js_arg:-$(command -v node || true)}"
|
|
88
|
+
[ -n "$js" ] || js="$(command -v bun || true)"
|
|
89
|
+
sock="p21-$$"
|
|
90
|
+
sess="p21-$$"
|
|
91
|
+
keep="${_keep_arg:-0}"
|
|
92
|
+
[ "$keep" = "1" ] && export TEAM_TMP_KEEP=1
|
|
93
|
+
tmp="$(tmp_root_create panel-p21)" || exit 3
|
|
94
|
+
PASS=0
|
|
95
|
+
FAIL=0
|
|
96
|
+
SKIP=0
|
|
97
|
+
ROOT=""
|
|
98
|
+
state=""
|
|
99
|
+
current=""
|
|
100
|
+
|
|
101
|
+
cleanup() {
|
|
102
|
+
[ "${BASHPID:-$$}" = "$$" ] || return 0
|
|
103
|
+
# P162:收尾先证明私有 socket 生效(不成立就拒绝;cleanup 里不许 exit)
|
|
104
|
+
tmux_iso_guard_soft "panel-p21" "收尾:私有 server" --tmpdir "${TMUX_TMPDIR:-}" --sock-name "$sock" \
|
|
105
|
+
&& tmux -L "$sock" kill-server 2>/dev/null || true
|
|
106
|
+
rm -f "${TMUX_TMPDIR:-/tmp}/tmux-$(id -u)/$sock" 2>/dev/null || true
|
|
107
|
+
if [ "$keep" = "1" ]; then printf '\n保留夹具目录:%s\n' "$tmp"
|
|
108
|
+
else tmp_root_reap_all; fi
|
|
109
|
+
}
|
|
110
|
+
trap cleanup EXIT
|
|
111
|
+
|
|
112
|
+
section() { printf '\n\033[1m== %s ==\033[0m\n' "$1"; }
|
|
113
|
+
# P48: 每个场景在自己的子 shell 里跑,计数落在文件上(断言数不随场景结束丢失)。
|
|
114
|
+
_p21_count="$tmp/count"
|
|
115
|
+
mkdir -p "$_p21_count"
|
|
116
|
+
p21_count_of() { local f="$1"; if [ -f "$f" ]; then wc -l < "$f" | tr -d ' '; else printf '0'; fi; }
|
|
117
|
+
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; printf 'ok\n' >> "$_p21_count/ok"; pty_fail_reset; }
|
|
118
|
+
# M59: a failure carries its own scene (pane tail + isolated-vs-cascade); pty_bad prints it.
|
|
119
|
+
bad() { pty_bad "$1"; printf 'bad\n' >> "$_p21_count/bad"; }
|
|
120
|
+
assert_eq() { [ "$2" = "$3" ] && ok "$1" || bad "$1(期望 [$3],实际 [$2])"; }
|
|
121
|
+
assert_has() { grep -qF -- "$2" "$1" 2>/dev/null && ok "$3" || bad "$3($1 里找不到 [$2])"; }
|
|
122
|
+
assert_not() { grep -qF -- "$2" "$1" 2>/dev/null && bad "$3(不该出现 [$2])" || ok "$3"; }
|
|
123
|
+
assert_match() { grep -qE -- "$2" "$1" 2>/dev/null && ok "$3" || bad "$3($1 里没有匹配 [$2])"; }
|
|
124
|
+
|
|
125
|
+
# ── 前提(P48 / D33,panel#The project-settings pty fixture judges under a machine premise)────
|
|
126
|
+
# 视界是失败探测器:等待耗尽那一刻由 tests/lib/pty-wait.sh 调 pty_premise_over(下面)按机器读数
|
|
127
|
+
# 归因 —— 超前提 → 一行可见 SKIP 并把当前场景停在原地(整体退出 4);静态场景 + 前提之内 → 红。
|
|
128
|
+
# 前提本身在**入口不判定**(只有粗闸门跳过整体超载的机器),所以前提行只是把真读数打出来。
|
|
129
|
+
P21_PREMISE_PROBE_CEIL_MS_DEFAULT=120
|
|
130
|
+
P21_PREMISE_LOAD_FACTOR_DEFAULT=2.0
|
|
131
|
+
P21_PREMISE_REASON=""
|
|
132
|
+
P21_NOTICED=""
|
|
133
|
+
p21_fixture_on() { [ "${_smoke_fixture_arg:-0}" = "1" ]; }
|
|
134
|
+
p21_notice() { # 每个旋钮只打一次忽略行(同一个值会被几个读数点重复请求)
|
|
135
|
+
case " ${P21_NOTICED:-} " in *" $1 "*) return 0 ;; esac
|
|
136
|
+
P21_NOTICED="${P21_NOTICED:-} $1"
|
|
137
|
+
printf ' 忽略 %s=%s(只有 TEAM_SMOKE_FIXTURE=1 时夹具旋钮才生效;真实路径读真值)\n' "$1" "$2" >&2
|
|
138
|
+
}
|
|
139
|
+
p21_cores() { nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || printf '0'; }
|
|
140
|
+
p21_load5() { cut -d' ' -f2 /proc/loadavg 2>/dev/null || printf '?'; }
|
|
141
|
+
p21_load1() {
|
|
142
|
+
if [ -n "${_premise_load_arg:-}" ]; then
|
|
143
|
+
if p21_fixture_on; then printf '%s\n' "$_premise_load_arg"; return 0; fi
|
|
144
|
+
p21_notice TEAM_P21_PREMISE_LOADAVG "$_premise_load_arg"
|
|
145
|
+
fi
|
|
146
|
+
cut -d' ' -f1 /proc/loadavg 2>/dev/null || printf '?'
|
|
147
|
+
}
|
|
148
|
+
# 代码无关探针(P44 的 probe.sh 口径):只起进程,永远不碰面板;5 轮均值,毫秒。
|
|
149
|
+
p21_probe_ms() {
|
|
150
|
+
local n=5 i t0
|
|
151
|
+
t0="$(date +%s%3N)"
|
|
152
|
+
for i in $(seq 1 "$n"); do
|
|
153
|
+
python3 -c 'pass' >/dev/null 2>&1
|
|
154
|
+
bash -c 'true' >/dev/null 2>&1
|
|
155
|
+
git -C "$tree" rev-parse --quiet HEAD >/dev/null 2>&1
|
|
156
|
+
done
|
|
157
|
+
printf '%s\n' $(( ($(date +%s%3N) - t0) / n ))
|
|
158
|
+
}
|
|
159
|
+
p21_probe_reading() {
|
|
160
|
+
if [ -n "${_premise_probe_arg:-}" ]; then
|
|
161
|
+
if p21_fixture_on; then printf '%s\n' "$_premise_probe_arg"; return 0; fi
|
|
162
|
+
p21_notice TEAM_P21_PREMISE_PROBE_MS "$_premise_probe_arg"
|
|
163
|
+
fi
|
|
164
|
+
p21_probe_ms
|
|
165
|
+
}
|
|
166
|
+
p21_factor() {
|
|
167
|
+
if [ -n "${_premise_factor_arg:-}" ]; then
|
|
168
|
+
if p21_fixture_on; then printf '%s\n' "$_premise_factor_arg"; return 0; fi
|
|
169
|
+
p21_notice TEAM_P21_PREMISE_LOAD_FACTOR "$_premise_factor_arg"
|
|
170
|
+
fi
|
|
171
|
+
printf '%s\n' "$P21_PREMISE_LOAD_FACTOR_DEFAULT"
|
|
172
|
+
}
|
|
173
|
+
p21_probe_ceil() {
|
|
174
|
+
if [ -n "${_premise_ceil_arg:-}" ]; then
|
|
175
|
+
if p21_fixture_on; then printf '%s\n' "$_premise_ceil_arg"; return 0; fi
|
|
176
|
+
p21_notice TEAM_P21_PREMISE_PROBE_CEIL_MS "$_premise_ceil_arg"
|
|
177
|
+
fi
|
|
178
|
+
printf '%s\n' "$P21_PREMISE_PROBE_CEIL_MS_DEFAULT"
|
|
179
|
+
}
|
|
180
|
+
p21_load_threshold() { awk -v c="$(p21_cores)" -v f="$(p21_factor)" 'BEGIN { printf "%.2f", f * c }'; }
|
|
181
|
+
p21_premise_line() { # <场景名>:真读数 + 两个顶(只打,不判)
|
|
182
|
+
local label="${1:-?}" load1 load5 cores probe factor ceil
|
|
183
|
+
load1="$(p21_load1)"; load5="$(p21_load5)"; cores="$(p21_cores)"
|
|
184
|
+
probe="$(p21_probe_reading)"; factor="$(p21_factor)"; ceil="$(p21_probe_ceil)"
|
|
185
|
+
printf '== 前提 %s:loadavg_1m %s / loadavg_5m %s · 逻辑核 %s · 代码无关探针 %sms(顶 %sms)· 粗闸门 %s = %s×%s 核 ==\n' \
|
|
186
|
+
"$label" "$load1" "$load5" "$cores" "$probe" "$ceil" \
|
|
187
|
+
"$(p21_load_threshold)" "$factor" "$cores"
|
|
188
|
+
}
|
|
189
|
+
# 入口粗闸门:0 = 前提之内(照跑)/ 1 = 负载超顶(在第一个等待之前 SKIP 整个场景)。
|
|
190
|
+
# 它故意取在实测绿带**之外**(最高实测绿 1.33×核),只是别在严重过载的宿主上白烧几分钟,
|
|
191
|
+
# 不是「绿/红交叉点」(P44 的结论:负载平均没有实测交叉点)。
|
|
192
|
+
p21_entry_guard() {
|
|
193
|
+
local load1 cores thr
|
|
194
|
+
load1="$(p21_load1)"; cores="$(p21_cores)"; thr="$(p21_load_threshold)"
|
|
195
|
+
case "$cores" in ''|*[!0-9]*) return 0 ;; esac
|
|
196
|
+
[ "$cores" -gt 0 ] || return 0
|
|
197
|
+
if awk -v l="$load1" -v t="$thr" 'BEGIN { exit !(l <= t) }'; then return 0; fi
|
|
198
|
+
return 1
|
|
199
|
+
}
|
|
200
|
+
p21_entry_skip_line() {
|
|
201
|
+
printf ' \033[33mSKIP\033[0m 入口粗闸门:loadavg_1m %s > %s(%s×%s 核)—— 场景 %s 在第一个等待之前就停下(无失败、无结论,exit 4)\n' \
|
|
202
|
+
"$(p21_load1)" "$(p21_load_threshold)" "$(p21_factor)" "$(p21_cores)" "${1:-?}"
|
|
203
|
+
}
|
|
204
|
+
# 引擎在耗尽那一刻调的两个钩子(tests/lib/pty-wait.sh):超前提 → 引擎打 SKIP 行并调 pty_on_skip。
|
|
205
|
+
pty_on_skip() { exit 4; }
|
|
206
|
+
pty_premise_over() { # 0 = 机器超前提(归因给机器)/ 1 = 前提之内(代码判决)
|
|
207
|
+
local load1 cores probe ceil thr factor
|
|
208
|
+
load1="$(p21_load1)"; cores="$(p21_cores)"; probe="$(p21_probe_reading)"
|
|
209
|
+
ceil="$(p21_probe_ceil)"; factor="$(p21_factor)"; thr="$(p21_load_threshold)"
|
|
210
|
+
P21_PREMISE_REASON="loadavg_1m ${load1} vs 粗闸门 ${thr}(${factor}×${cores} 核);探针 ${probe}ms vs 顶 ${ceil}ms"
|
|
211
|
+
case "$probe" in ''|*[!0-9]*) probe=0 ;; esac
|
|
212
|
+
case "$ceil" in ''|*[!0-9]*) ceil=120 ;; esac
|
|
213
|
+
[ "$probe" -le "$ceil" ] || return 0
|
|
214
|
+
case "$cores" in ''|*[!0-9]*) return 1 ;; esac
|
|
215
|
+
[ "$cores" -gt 0 ] || return 1
|
|
216
|
+
awk -v l="$load1" -v t="$thr" 'BEGIN { exit !(l > t) }' && return 0
|
|
217
|
+
return 1
|
|
218
|
+
}
|
|
219
|
+
pty_premise_reason() { printf '%s' "${P21_PREMISE_REASON:-(没有读数)}"; }
|
|
220
|
+
|
|
221
|
+
# ── 前提自述模式(M58/panel-knobs 的先例 + P48):只打前提行与每个注入旋钮的忽略行,不建 tmux、
|
|
222
|
+
# 不起面板、不判任何时长 —— 门禁每轮用它证明「旋钮不得漏进真路径」(时间无关)。
|
|
223
|
+
if [ "${_premise_only_arg:-0}" = "1" ]; then
|
|
224
|
+
_only_sections=("$@")
|
|
225
|
+
[ "${#_only_sections[@]}" -gt 0 ] || _only_sections=(premise-only)
|
|
226
|
+
for _only_s in "${_only_sections[@]}"; do p21_premise_line "$_only_s"; done
|
|
227
|
+
printf 'panel-p21: premise-only 模式(裸读数 + 旋钮忽略声明;除代码无关探针外没有起进程、没有建 tmux、没有判定;exit 0)\n'
|
|
228
|
+
exit 0
|
|
229
|
+
fi
|
|
230
|
+
|
|
231
|
+
if ! command -v tmux >/dev/null 2>&1; then printf 'panel-p21: tmux is required\n' >&2; exit 3; fi
|
|
232
|
+
if [ -z "$js" ]; then printf 'panel-p21: no node/bun runtime\n' >&2; exit 3; fi
|
|
233
|
+
[ -f "$panel" ] || { printf 'panel-p21: no bundle at %s\n' "$panel" >&2; exit 3; }
|
|
234
|
+
|
|
235
|
+
# M59: the settled-frame waits, the state-checked cleanup keys and the failure scenes live in the
|
|
236
|
+
# shared helper (its --self-test injects the incident's mid-frame; smoke §38-c runs it).
|
|
237
|
+
# shellcheck source=lib/pty-wait.sh
|
|
238
|
+
. "$here/lib/pty-wait.sh"
|
|
239
|
+
# Fixture-wide knobs. PTY_WAIT_ITERS is a failure-detector horizon, never spent on a green run (a
|
|
240
|
+
# green wait returns on the first settled frame, usually rounds 1-3); per-wait overrides use local.
|
|
241
|
+
PTY_TRACE="${_trace_arg:-0}"
|
|
242
|
+
PTY_SCENE_DIR=""
|
|
243
|
+
# P48: 延长窗口与上限由夹具钉住(默认 8 / 3);夹具旋钮只在 TEAM_SMOKE_FIXTURE=1 下覆盖。
|
|
244
|
+
# 注入读数超顶时同时注入「状态永不到来」的针:那是夹具在模拟「这台机器交不出这一帧」,
|
|
245
|
+
# 让耗尽路径在安静机上可达(真路径下没有针,也没有注入)。
|
|
246
|
+
PTY_STALL_ROUNDS=8
|
|
247
|
+
PTY_EXT_FACTOR=3
|
|
248
|
+
if p21_fixture_on; then
|
|
249
|
+
case "${_premise_stall_arg:-}" in ''|*[!0-9]*) ;; *) PTY_STALL_ROUNDS="$_premise_stall_arg" ;; esac
|
|
250
|
+
case "${_premise_probe_arg:-}" in
|
|
251
|
+
''|*[!0-9]*) ;;
|
|
252
|
+
*) [ "$_premise_probe_arg" -gt "$(p21_probe_ceil)" ] && PTY_INJECT_NEEDLE='◊P48-注入:状态永不到来◊' ;;
|
|
253
|
+
esac
|
|
254
|
+
[ "${_stall_arg:-0}" = "1" ] && PTY_INJECT_NEEDLE='◊P48-注入:状态永不到来◊'
|
|
255
|
+
fi
|
|
256
|
+
|
|
257
|
+
SECTIONS=("$@")
|
|
258
|
+
[ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(settings groups wheel choices choices-schema write conflict seats readonly)
|
|
259
|
+
want() { local s; for s in "${SECTIONS[@]}"; do [ "$s" = "$1" ] && return 0; done; return 1; }
|
|
260
|
+
|
|
261
|
+
# ---------------------------------------------------------------- fixture plumbing
|
|
262
|
+
server_up() { # <name> [agents] → fresh project + private tmux session + argv-logging wrapper
|
|
263
|
+
current="$1"
|
|
264
|
+
PTY_SCENE_DIR="$tmp/$1" # M59: a timed-out wait saves its two captures here for post-mortem
|
|
265
|
+
local agents="${2:-dev verify}"
|
|
266
|
+
ROOT="$tmp/$1/root"
|
|
267
|
+
mkdir -p "$ROOT"
|
|
268
|
+
( cd "$ROOT" && git init -q -b main && git config user.email p21@teamsmith && git config user.name p21 \
|
|
269
|
+
&& printf '{"name":"%s","scripts":{"verify":"true"}}\n' "$1" > package.json \
|
|
270
|
+
&& git add -A && git commit -qm init ) >/dev/null 2>&1
|
|
271
|
+
( cd "$ROOT" && bash "$skill/scripts/team" init --session "$sess" --agents "$agents" --vcs local \
|
|
272
|
+
--gates "true" --docs docs/team ) >"$tmp/$1-init.log" 2>&1 \
|
|
273
|
+
|| { printf 'panel-p21: team init failed (%s)\n' "$1" >&2; tail -3 "$tmp/$1-init.log" >&2; exit 3; }
|
|
274
|
+
state="$ROOT/.pi/team/state"
|
|
275
|
+
mkdir -p "$state" "$ROOT/docs/team"
|
|
276
|
+
cat > "$tmp/$1-wrapper.sh" <<EOF
|
|
277
|
+
#!/usr/bin/env bash
|
|
278
|
+
printf '%s\n' "\$*" >> "$tmp/$1-argv.log"
|
|
279
|
+
exec bash "$skill/scripts/team" "\$@"
|
|
280
|
+
EOF
|
|
281
|
+
chmod +x "$tmp/$1-wrapper.sh"
|
|
282
|
+
# P162:重起私有 server 前的 kill-server 也要先证明隔离生效(不成立 → 硬停)
|
|
283
|
+
tmux_iso_require "panel-p21" "重起私有 server 前的 kill-server" --tmpdir "${TMUX_TMPDIR:-}" --sock-name "$sock"
|
|
284
|
+
tmux -L "$sock" kill-server 2>/dev/null || true
|
|
285
|
+
rm -f "${TMUX_TMPDIR:-/tmp}/tmux-$(id -u)/$sock" 2>/dev/null || true
|
|
286
|
+
tmux -L "$sock" new-session -d -s "$sess" -x 160 -y 40 -n bootstrap -c "$ROOT" 'sleep 900'
|
|
287
|
+
tmux -L "$sock" set -g window-size manual 2>/dev/null || true
|
|
288
|
+
# A pane that dies keeps its last frame (capturable), and tmux writes its own "Pane is dead
|
|
289
|
+
# (status N)" line into it: a fixture failure names a dead panel instead of comparing empty
|
|
290
|
+
# captures. #{pane_dead_status} still answers for the one-line note below.
|
|
291
|
+
tmux -L "$sock" set -g remain-on-exit on 2>/dev/null || true
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
start_panel() {
|
|
295
|
+
local cli="${P21_CLI:-$tmp/$current-wrapper.sh}"
|
|
296
|
+
local home_prefix=""
|
|
297
|
+
# M55/R2:选择器用例把面板放在 scratch HOME 下 —— 机器目录里的 provider 不许成为选项。
|
|
298
|
+
[ -n "${P21_HOME:-}" ] && home_prefix="HOME=$(printf '%q' "$P21_HOME") "
|
|
299
|
+
tmux -L "$sock" kill-window -t "$sess:panel" 2>/dev/null || true
|
|
300
|
+
tmux -L "$sock" new-window -d -t "$sess" -n panel -c "$ROOT" \
|
|
301
|
+
"${home_prefix}TEAM_JS_BIN=$(printf '%q' "$js") exec '$js' '$panel' --root '$ROOT' --state-dir '$state' \
|
|
302
|
+
--team-cli '$cli' --no-pulse --refresh ${P21_REFRESH:-3} ${*:-}"
|
|
303
|
+
wait_panel
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
wait_panel() {
|
|
307
|
+
# The panel's first frame must be settled too (the first paint also arrives line by line).
|
|
308
|
+
local PTY_WAIT_ITERS=80 PTY_WAIT_PAUSE=0.25 PTY_SETTLE_PAUSE=0.3
|
|
309
|
+
if pty_wait_frame - "面板首帧($current)" 'teamsmith pulse'; then
|
|
310
|
+
sleep 0.5
|
|
311
|
+
return 0
|
|
312
|
+
fi
|
|
313
|
+
printf 'panel-p21: the console pane never rendered (%s)\n' "$current" >&2
|
|
314
|
+
return 1
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
cap() { tmux -L "$sock" capture-pane -p -t "$sess:panel" -S -400 2>/dev/null; }
|
|
318
|
+
cap_now() { tmux -L "$sock" capture-pane -p -t "$sess:panel" 2>/dev/null; }
|
|
319
|
+
# The lib's sinks (M59): waits settle on the pty_cap stream; cleanup keys go through pty_keys.
|
|
320
|
+
pty_cap() { cap; }
|
|
321
|
+
pty_keys() { keys "$@"; }
|
|
322
|
+
pty_pane_state() { tmux -L "$sock" list-panes -t "$sess:panel" -F '#{pane_dead}:#{pane_dead_status}' 2>/dev/null | head -1; }
|
|
323
|
+
|
|
324
|
+
# Wait for the setting editor's tray. The optional body marker is what the caller is about to
|
|
325
|
+
# assert next: the tray title alone can be on screen while the body has not been painted (Ink
|
|
326
|
+
# paints line by line), so the frame must be settled — needles present + two consecutive captures
|
|
327
|
+
# identical (title clock masked) — before the wait releases (M59).
|
|
328
|
+
wait_editor() { # <tray title> [body marker]
|
|
329
|
+
pty_wait_frame - "editor $1" "╭─ $1" "${2:-}"
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
# Wait for the current frame to carry <text>; writes settle asynchronously. The latest capture is
|
|
333
|
+
# written to the assertion's file every round, so a failure shows exactly what was on screen.
|
|
334
|
+
wait_cap() { # <name> <text>
|
|
335
|
+
local PTY_WAIT_ITERS=30 PTY_WAIT_PAUSE=0.4
|
|
336
|
+
pty_wait_frame "$tmp/$current/$1.txt" "回执 $1" "$2"
|
|
337
|
+
}
|
|
338
|
+
# P68/fixture-waits-for-landed-reads:数据态等待。断言一行**从异步 settings 读来的数据**之前,先等
|
|
339
|
+
# 那一行自己(值也在)出现在稳定帧上;骨架帧、固定 sleep + 单次采样都不算证据。上界 30 轮基础视界
|
|
340
|
+
# (≈20s,静态场景不延长)与它的实测延迟带见文件头;耗尽时 pty-wait.sh 打一行归因(等待名 + 缺的
|
|
341
|
+
# 标记 + 轮数),由 bad() 按机器读数分派红/SKIP。捕获仍写到 $tmp/$current/<name>.txt 供断言复用。
|
|
342
|
+
wait_row() { # <name> <label> <needle...>
|
|
343
|
+
local _name="$1" _label="$2"; shift 2
|
|
344
|
+
local PTY_WAIT_ITERS=30 PTY_WAIT_PAUSE=0.4
|
|
345
|
+
pty_wait_frame "$tmp/$current/$_name.txt" "数据态:$_label" "$@"
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
# Poll the wrapper's argv log (a file, not the pane — no frames involved) until it carries <text>.
|
|
349
|
+
wait_argv() { # <name> <text>
|
|
350
|
+
local i
|
|
351
|
+
for i in $(seq 1 30); do
|
|
352
|
+
tail -n 50 "$(argv_log)" > "$tmp/$current/$1.txt" 2>/dev/null || true
|
|
353
|
+
grep -qF -- "$2" "$tmp/$current/$1.txt" && return 0
|
|
354
|
+
sleep 0.3
|
|
355
|
+
done
|
|
356
|
+
return 1
|
|
357
|
+
}
|
|
358
|
+
cap_to() { cap > "$tmp/$current/${1:-cap}.txt"; }
|
|
359
|
+
cap_has() { local f="$tmp/$current/${2:-cap}.txt"; cap >"$f"; assert_has "$f" "$1" "捕获里有 [$1]"; }
|
|
360
|
+
cap_not() { local f="$tmp/$current/${2:-cap}.txt"; cap >"$f"; assert_not "$f" "$1" "捕获里没有 [$1]"; }
|
|
361
|
+
cap_match() { local f="$tmp/$current/${2:-cap}.txt"; cap >"$f"; assert_match "$f" "$1" "$3"; }
|
|
362
|
+
keys() { tmux -L "$sock" send-keys -t "$sess:panel" "$@" 2>/dev/null; }
|
|
363
|
+
type_text() { tmux -L "$sock" send-keys -t "$sess:panel" -l "$1" 2>/dev/null; }
|
|
364
|
+
click_at() { tmux -L "$sock" send-keys -t "$sess:panel" -l "$(printf '\033[<0;%s;%sM' "$1" "$2")" 2>/dev/null; }
|
|
365
|
+
argv_log() { printf '%s/%s-argv.log' "$tmp" "$current"; }
|
|
366
|
+
# M65(直写 / 交互路径无读取):wrapper 的 argv 日志按行切片 —— 一次交互 spawn 了哪些子进程。
|
|
367
|
+
argv_count() { wc -l < "$(argv_log)" 2>/dev/null || echo 0; }
|
|
368
|
+
argv_since() { # <start-lines> <file>:第 start 行之后的全部(start=0 就是从头)
|
|
369
|
+
tail -n +$(( $1 + 1 )) "$(argv_log)" > "$2" 2>/dev/null || : > "$2"
|
|
370
|
+
}
|
|
371
|
+
# 读路径的两个子进程形态:`config list` / `__panel-data`(M65/D11 的判据)。
|
|
372
|
+
argv_reads() { grep -cE 'config list|__panel-data' "$1" 2>/dev/null || true; }
|
|
373
|
+
cfg() { printf '%s/.pi/team/config.sh' "$ROOT"; }
|
|
374
|
+
audit_log() { printf '%s/config.log' "$state"; }
|
|
375
|
+
audit_lines() { [ -f "$(audit_log)" ] && wc -l < "$(audit_log)" || echo 0; }
|
|
376
|
+
sha() { sha256sum "$1" 2>/dev/null | awk '{print $1}'; }
|
|
377
|
+
tree_hash() { ( cd "$ROOT" && find "$@" -type f 2>/dev/null | sort | while IFS= read -r f; do printf '%s ' "$f"; sha "$f"; done ) | sha256sum | awk '{print $1}'; }
|
|
378
|
+
conf_set() { mkdir -p "$state"; printf '%s\n' "$@" > "$state/panel.conf"; }
|
|
379
|
+
panel_pid() { tmux -L "$sock" list-panes -t "$sess:panel" -F '#{pane_pid}' 2>/dev/null | head -1; }
|
|
380
|
+
|
|
381
|
+
# Open the overlay and its project-settings navigation row (the sixth row), then wait for data.
|
|
382
|
+
# <marker> is the string the wait looks for: P30/D2 made the view open on the read-only skeleton,
|
|
383
|
+
# so the default is the first functional group heading (identity) — a class word is no longer a
|
|
384
|
+
# heading and, at the top of the list, would only appear on some badge (zh by default; the en pass
|
|
385
|
+
# passes its own marker).
|
|
386
|
+
open_view() {
|
|
387
|
+
local marker="${1:-身份与账本布局}"
|
|
388
|
+
keys ,
|
|
389
|
+
sleep 0.7
|
|
390
|
+
keys Down Down Down Down Down
|
|
391
|
+
sleep 0.5
|
|
392
|
+
keys Enter
|
|
393
|
+
local PTY_WAIT_ITERS=40 PTY_WAIT_PAUSE=0.4
|
|
394
|
+
if pty_wait_frame - "设置视图(marker=$marker)" "$marker"; then
|
|
395
|
+
sleep 0.4
|
|
396
|
+
return 0
|
|
397
|
+
fi
|
|
398
|
+
bad "项目设置视图没有在预算内出现数据(marker=$marker)"
|
|
399
|
+
return 1
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
# Close the settings view and the overlay, then open the view again: entering the view is the view's
|
|
403
|
+
# own read (M65/D11 allows it — the interaction path is what must not read). A fixture that edits the
|
|
404
|
+
# contract by hand needs this to see its own bytes on screen.
|
|
405
|
+
reopen_view() {
|
|
406
|
+
keys Escape
|
|
407
|
+
sleep 0.5
|
|
408
|
+
keys Escape
|
|
409
|
+
sleep 0.5
|
|
410
|
+
open_view
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
# Filter the view to <text> (the `/` line, then Enter applies). The editor opens holding the
|
|
414
|
+
# previous filter, so the seed is cleared first (Backspace per codepoint).
|
|
415
|
+
_p21_filter=""
|
|
416
|
+
filter_to() {
|
|
417
|
+
keys /
|
|
418
|
+
sleep 0.4
|
|
419
|
+
# pi's `ctrl+u` kills to the line start: the seed (the previous filter) goes in one key.
|
|
420
|
+
keys C-u
|
|
421
|
+
sleep 0.3
|
|
422
|
+
type_text "$1"
|
|
423
|
+
sleep 0.4
|
|
424
|
+
keys Enter
|
|
425
|
+
# M59: conditional — the applied filter closes the compose tray. Wait for that settled absence
|
|
426
|
+
# (both language titles) instead of a fixed sleep; the filtered rows repaint in the same commit.
|
|
427
|
+
local PTY_WAIT_ITERS=8
|
|
428
|
+
pty_wait_frame - "筛选已应用:$1" '!╭─ 筛选设置' '!╭─ Filter settings' || true
|
|
429
|
+
_p21_filter="$1"
|
|
430
|
+
}
|
|
431
|
+
# Clear an applied filter: open the line and esc it (the spec's clear rule).
|
|
432
|
+
filter_clear() {
|
|
433
|
+
keys /
|
|
434
|
+
sleep 0.4
|
|
435
|
+
# M59: the cancel esc is state-checked (zh or en filter tray must be on a settled frame).
|
|
436
|
+
pty_key_when "清除筛选" '╭─ 筛选设置' Escape || pty_key_when "clear filter" '╭─ Filter settings' Escape || true
|
|
437
|
+
local PTY_WAIT_ITERS=8
|
|
438
|
+
pty_wait_frame - "筛选已清除" '!╭─ 筛选设置' '!╭─ Filter settings' || true
|
|
439
|
+
_p21_filter=""
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
# Focus the row whose capture line matches <regex> and contains the cursor glyph.
|
|
443
|
+
# The row set can be asynchronously REPLACED by a contract-change re-read (M55's lesson) or dropped
|
|
444
|
+
# entirely while a block rebuild fails and re-tries on its TTL (the panel renders an empty list
|
|
445
|
+
# until the next good read — observed as a 40s blank after a seat write under load). M59: only
|
|
446
|
+
# press Down when the row is NOT on screen; when it is but the frame is still repainting, re-check
|
|
447
|
+
# instead of walking past it; Downs on an empty list are harmless no-ops, so the walk resumes
|
|
448
|
+
# cleanly when the rows come back.
|
|
449
|
+
focus_row() { # <grep -E pattern>
|
|
450
|
+
local i c matched
|
|
451
|
+
for i in $(seq 1 80); do
|
|
452
|
+
c="$(cap)"
|
|
453
|
+
matched="$({ printf '%s\n' "$c" | grep -E -- "$1" || true; })"
|
|
454
|
+
if [ -n "$matched" ] && printf '%s\n' "$matched" | grep -q '›'; then
|
|
455
|
+
if pty_frame_settled "$c"; then
|
|
456
|
+
sleep 0.3
|
|
457
|
+
return 0
|
|
458
|
+
fi
|
|
459
|
+
sleep 0.25 # the row is on screen but the frame is still moving — re-check, don't walk
|
|
460
|
+
else
|
|
461
|
+
keys Down
|
|
462
|
+
sleep 0.25
|
|
463
|
+
fi
|
|
464
|
+
done
|
|
465
|
+
return 1
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
# Wait for the choice picker (M55): its title carries the raw key after a ` · `, and the optional
|
|
469
|
+
# entry marker is what the caller asserts next. Both must be in one settled frame (M59): the title
|
|
470
|
+
# alone is not proof the picker is usable — Ink paints a frame line by line, so a capture can catch
|
|
471
|
+
# the title before the entry lines land (the PM's review run saw exactly that and cascaded).
|
|
472
|
+
wait_picker() { # <KEY> [entry marker]
|
|
473
|
+
pty_wait_frame - "picker $1" " · $1" "${2:-}"
|
|
474
|
+
}
|
|
475
|
+
# The regression pin uses a short budget: a missing marker must fail fast, not burn the full one.
|
|
476
|
+
wait_picker_quick() {
|
|
477
|
+
local PTY_WAIT_ITERS=6 PTY_WAIT_PAUSE=0.25 PTY_SETTLE_PAUSE=0.2
|
|
478
|
+
wait_picker "$@"
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
# Cleanup escs are state-checked (M59): the widget's marker must be on a settled frame, and the
|
|
482
|
+
# esc is confirmed afterwards. A widget that is not there gets NO key — so one missed wait can no
|
|
483
|
+
# longer turn the next esc into "leave the settings view" (the §38-b cascade's first casualty).
|
|
484
|
+
# Returns 0 when the widget is gone afterwards (closed by this esc, or already gone — no key sent),
|
|
485
|
+
# 1 when an esc went out but the widget is still on screen.
|
|
486
|
+
leave_picker() { # <KEY>
|
|
487
|
+
pty_cleanup_esc "picker $1" " · $1"
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
# P30/D2: the grouping is a functional domain, the effect class lives in the row's badge. A line
|
|
491
|
+
# that carries nothing but a class word can only come from a class-group heading — this is the pin
|
|
492
|
+
# that the view did not go back to grouping by class (both languages' six words).
|
|
493
|
+
assert_no_class_heading() { # <capture file> [label]
|
|
494
|
+
local f="$1" label="${2:-视图没有类分组标题(分组是功能域)}"
|
|
495
|
+
# M59/P127: `{ … || true; } | grep -q` — the capture file can outgrow the pipe buffer; grep -q
|
|
496
|
+
# exits on the first hit and sed would take SIGPIPE (rc=141 → a class heading falsely "absent").
|
|
497
|
+
if { sed 's/[│|]//g' "$f" || true; } | grep -qE '^ *(立即生效|需要重启|只读|Takes effect now|Needs a restart|Read-only) *$'; then
|
|
498
|
+
bad "$label(捕获里出现了只有类词的行)"
|
|
499
|
+
else
|
|
500
|
+
ok "$label"
|
|
501
|
+
fi
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
# Inject one SGR wheel notch into the pane (the same path as `click_at`: tmux writes the bytes to
|
|
505
|
+
# the pane's pty, where Ink parses them). 65 = wheel down, 64 = wheel up.
|
|
506
|
+
wheel_at() { # <down|up> <col> <row> [n]
|
|
507
|
+
local btn=65 i
|
|
508
|
+
[ "$1" = "up" ] && btn=64
|
|
509
|
+
for i in $(seq 1 "${4:-1}"); do
|
|
510
|
+
tmux -L "$sock" send-keys -t "$sess:panel" -l "$(printf '\033[<%s;%s;%sM' "$btn" "$2" "$3")" 2>/dev/null || true
|
|
511
|
+
sleep 0.15
|
|
512
|
+
done
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
# Same rule for the write editor's cleanup sites (the tray title is the marker).
|
|
516
|
+
leave_editor() { # <tray title>
|
|
517
|
+
pty_cleanup_esc "editor $1" "╭─ $1"
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
# Wait until the setting editor's tray is gone. The settings view's own frame also draws
|
|
521
|
+
# `╭─ 项目设置`, so the probe matches the tray title the setting editor uses (the raw key), not any
|
|
522
|
+
# box corner; the absence must be on a settled frame too (M59).
|
|
523
|
+
wait_no_editor() {
|
|
524
|
+
pty_wait_frame - "editor closed" '!╭─ TEAM_'
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
# Walk the picker's cursor to the option whose line contains <text> (grep -F) and press Enter —
|
|
528
|
+
# releasing only once the option line with the cursor is on a settled frame (M59).
|
|
529
|
+
pick_option() {
|
|
530
|
+
local i c
|
|
531
|
+
for i in $(seq 1 12); do
|
|
532
|
+
c="$(cap)"
|
|
533
|
+
# M59: `{ … || true; } | grep -q` — same SIGPIPE-under-pipefail guard as focus_row.
|
|
534
|
+
if { printf '%s\n' "$c" | grep -F -- "$1" || true; } | grep -q '›'; then
|
|
535
|
+
if pty_frame_settled "$c"; then
|
|
536
|
+
keys Enter
|
|
537
|
+
sleep 1.3
|
|
538
|
+
return 0
|
|
539
|
+
fi
|
|
540
|
+
fi
|
|
541
|
+
keys Down
|
|
542
|
+
sleep 0.3
|
|
543
|
+
done
|
|
544
|
+
return 1
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
# ---------------------------------------------------------------- scenarios
|
|
548
|
+
|
|
549
|
+
scn_settings() {
|
|
550
|
+
section "settings · 标签/类徽章/默认值/过滤/窗口/点击/CLI 对齐/refuse 路由/q(B2 + M49)"
|
|
551
|
+
server_up settings
|
|
552
|
+
python3 - "$(cfg)" <<'PYFIX'
|
|
553
|
+
import re, sys
|
|
554
|
+
p = sys.argv[1]
|
|
555
|
+
s = open(p, encoding='utf-8').read()
|
|
556
|
+
s = re.sub(r'^TEAM_PULSE_NUDGE_GAP=.*$', 'TEAM_PULSE_NUDGE_GAP="900" # 15min', s, count=1, flags=re.M)
|
|
557
|
+
# M49:文件里手加一个 schema 不认识的键(命令报 known=false)—— 它没有标签可用,行回退显示原始键。
|
|
558
|
+
s = s.rstrip('\n') + '\nTEAM_HAND_ADDED="hand"\n'
|
|
559
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
560
|
+
PYFIX
|
|
561
|
+
start_panel
|
|
562
|
+
local conf_before; conf_before="$(sha "$state/panel.conf" 2>/dev/null || echo none)"
|
|
563
|
+
local fstats
|
|
564
|
+
open_view
|
|
565
|
+
assert_eq "导航行打开视图没有写 panel.conf" "$(sha "$state/panel.conf" 2>/dev/null || echo none)" "$conf_before"
|
|
566
|
+
cap_to view
|
|
567
|
+
# P30/D2:分组 = schema 第 10 列的功能域。视图开屏在只读骨架(identity),标题就是功能域名;
|
|
568
|
+
# 旧的三条类分组标题(立即生效 / 需要重启 / 只读)不再是标题(徽章词仍在,见类徽章段)。
|
|
569
|
+
assert_has "$tmp/$current/view.txt" "身份与账本布局" "功能域分组标题(identity,开屏即见)"
|
|
570
|
+
assert_no_class_heading "$tmp/$current/view.txt"
|
|
571
|
+
# 行文本是人话标签(不是裸键),开屏聚焦行是 identity 的第一条 schema 键。
|
|
572
|
+
assert_match "$tmp/$current/view.txt" '› 项目名 +.*只读' "开屏聚焦行是 identity 第一条(标签 + 只读 徽章)"
|
|
573
|
+
assert_not "$tmp/$current/view.txt" "TEAM_GATES" "行里不再出现裸键 TEAM_GATES"
|
|
574
|
+
# 组内保持 schema 顺序(项目名 在 会话名 之前)。
|
|
575
|
+
local n_first n_second
|
|
576
|
+
n_first="$(grep -n '项目名' "$tmp/$current/view.txt" | head -1 | cut -d: -f1)"
|
|
577
|
+
n_second="$(grep -n '会话名' "$tmp/$current/view.txt" | head -1 | cut -d: -f1)"
|
|
578
|
+
if [ -n "$n_first" ] && [ -n "$n_second" ] && [ "$n_first" -lt "$n_second" ]; then
|
|
579
|
+
ok "同一组内保持 schema 顺序(项目名 在第 $n_first 行,会话名 在第 $n_second 行)"
|
|
580
|
+
else
|
|
581
|
+
bad "组内顺序不对(项目名=$n_first 会话名=$n_second)"
|
|
582
|
+
fi
|
|
583
|
+
# 类徽章是词(P30/D4):过滤到一条 apply 行看它的徽章。
|
|
584
|
+
filter_to 模型并发上限
|
|
585
|
+
cap_to badge-apply
|
|
586
|
+
assert_match "$tmp/$current/badge-apply.txt" '模型并发上限 +.*立即生效' "apply 行:人话标签 + 立即生效 徽章(词仍在)"
|
|
587
|
+
cap_has "↑/↓ 行 · Enter 打开 · / 筛选" keyband
|
|
588
|
+
# One filter per class: the badge, the unset marker and the line's own comment (all unchanged).
|
|
589
|
+
filter_to TEAM_PULSE_INTERVAL
|
|
590
|
+
cap_to restart
|
|
591
|
+
assert_match "$tmp/$current/restart.txt" '巡检周期 +900 · 需重启' "restart 行的标签 + 需重启 徽章"
|
|
592
|
+
assert_has "$tmp/$current/restart.txt" "命令行:team config set TEAM_PULSE_INTERVAL <新值>" "CLI 提示行点名原始键(照敲命令用)"
|
|
593
|
+
filter_to TEAM_PROJECT
|
|
594
|
+
cap_to refuse
|
|
595
|
+
assert_match "$tmp/$current/refuse.txt" '项目名 +root · 只读' "refuse 行的标签 + 只读 徽章"
|
|
596
|
+
assert_has "$tmp/$current/refuse.txt" "手改 .pi/team/config.sh 里的 TEAM_PROJECT" "refuse 提示行点名原始键与手改路线"
|
|
597
|
+
# P32:短列表(一条过滤结果)也把卡片填满 —— 空白留在卡片**里面**,卡片下边框仍紧贴键栏。
|
|
598
|
+
cap_visible_to filter-fill
|
|
599
|
+
fstats="$(settings_window_stats "$tmp/$current/filter-fill.txt")"
|
|
600
|
+
IFS=' ' read -r _fr _fu _fd fgap <<<"$fstats"
|
|
601
|
+
if [ "${_fr:-0}" -ge 1 ] && [ "${fgap:-9}" -le 1 ]; then
|
|
602
|
+
ok "过滤到一条时卡片仍填满窗口(行=$_fr 空白=$fgap)"
|
|
603
|
+
else
|
|
604
|
+
bad "过滤到一条时卡片没有填满窗口($fstats)"
|
|
605
|
+
fi
|
|
606
|
+
filter_to TEAM_PANEL_DETAIL_CAP
|
|
607
|
+
cap_to unset
|
|
608
|
+
assert_match "$tmp/$current/unset.txt" '详情文件读取上限 +未设 · 默认 131072' "未设的键显示 schema 默认值 + unset 标记"
|
|
609
|
+
filter_to TEAM_PULSE_NUDGE_GAP
|
|
610
|
+
cap_to comment
|
|
611
|
+
assert_match "$tmp/$current/comment.txt" '重复提醒间隔 +900 · 立即生效 +# 15min' "行内注释原样渲染"
|
|
612
|
+
# M49 回退:schema 不认识的键没有标签 → 行的主文本就是原始键(未知键徽章 + 未知键提示)。
|
|
613
|
+
filter_to TEAM_HAND_ADDED
|
|
614
|
+
cap_to unknown
|
|
615
|
+
assert_match "$tmp/$current/unknown.txt" 'TEAM_HAND_ADDED +hand · 未知键' "schema 不认识的键回退显示原始键"
|
|
616
|
+
assert_has "$tmp/$current/unknown.txt" "未知键:TEAM_HAND_ADDED" "未知键的提示行说清楚为什么没有标签"
|
|
617
|
+
# The filter matches the label (M49), key or value; esc clears it without closing the view.
|
|
618
|
+
filter_to 巡检周期
|
|
619
|
+
cap_to filter-label
|
|
620
|
+
assert_has "$tmp/$current/filter-label.txt" "巡检周期" "按标签搜到该行"
|
|
621
|
+
assert_not "$tmp/$current/filter-label.txt" "模型并发上限" "按标签过滤掉不匹配的行"
|
|
622
|
+
filter_to pulse
|
|
623
|
+
cap_to filter
|
|
624
|
+
assert_has "$tmp/$current/filter.txt" "巡检周期" "按原始键 pulse 仍能找到(行上仍是标签)"
|
|
625
|
+
assert_not "$tmp/$current/filter.txt" "模型并发上限" "过滤掉不匹配的行"
|
|
626
|
+
filter_clear
|
|
627
|
+
cap_to cleared
|
|
628
|
+
assert_has "$tmp/$current/cleared.txt" "项目名" "esc 清过滤后全部行回来(回到未过滤列表的顶部)"
|
|
629
|
+
assert_has "$tmp/$current/cleared.txt" "身份与账本布局" "清过滤后第一组标题也回来"
|
|
630
|
+
assert_has "$tmp/$current/cleared.txt" "项目设置" "esc 没有关掉视图"
|
|
631
|
+
# The focus window moves with the keys and counts what it hides at the top.
|
|
632
|
+
local i
|
|
633
|
+
for i in $(seq 1 40); do keys Down; sleep 0.02; done
|
|
634
|
+
if wait_cap window "↑"; then ok "窗口顶部出现被隐藏的行数计数行"; else bad "窗口滚动后没有出现 ↑N 计数行"; fi
|
|
635
|
+
assert_match "$tmp/$current/window.txt" '↑[0-9]+' "窗口顶部显示被隐藏的行数"
|
|
636
|
+
# A click moves the focus to an unfocused row; the second click opens that row's editor. M49:行
|
|
637
|
+
# 按**标签**认,原始键从第一次点击后的 CLI 提示行读(标签用来看,键用来敲)。
|
|
638
|
+
# P30:视图开屏在只读骨架上,先过滤出**多条** apply 行(「上限」命中模型并发上限 / 席位内存上限 /
|
|
639
|
+
# 详情文件读取上限…)——点击用例需要一条未聚焦的 apply 行。
|
|
640
|
+
filter_to 上限
|
|
641
|
+
cap_to click-set
|
|
642
|
+
local target_line label keyname
|
|
643
|
+
target_line="$(cap | grep -n '· 立即生效' | grep -v '›' | grep -v '命令行:' | head -1 | cut -d: -f1)"
|
|
644
|
+
if [ -n "$target_line" ]; then
|
|
645
|
+
label="$(cap | sed -n "${target_line}p" | sed 's/^│//' | sed -E 's/^ +//' | sed -E 's/ +.*//')"
|
|
646
|
+
click_at 20 "$target_line"
|
|
647
|
+
if wait_cap click "› $label"; then ok "第一次点击把光标放到那一行(按标签认行)"; else bad "第一次点击后光标没有落到那一行"; fi
|
|
648
|
+
keyname="$(cap | grep -F 'team config set' | grep -oE 'TEAM_[A-Z0-9_]+' | head -1)"
|
|
649
|
+
assert_has "$tmp/$current/click.txt" "team config set $keyname" "CLI 提示行跟着焦点换到该行的原始键"
|
|
650
|
+
# The window may have scrolled with the focus: click the row the cursor is on now.
|
|
651
|
+
target_line="$(cap | grep -n '› .*· 立即生效' | head -1 | cut -d: -f1)"
|
|
652
|
+
[ -n "$target_line" ] && click_at 20 "$target_line"
|
|
653
|
+
# M55:有选择集的键打开选择器(标题 `选择 … 的值 · KEY`),没有的仍是 compose 托盘。
|
|
654
|
+
# M59: wait for THIS row's widget (tray or picker title) on a settled frame — the view can sit
|
|
655
|
+
# settled *before* the editor paints (the row's data is re-read on open), so a settle-only
|
|
656
|
+
# probe misjudges; the pre-M59 serial `wait_editor || wait_picker` burned two full budgets.
|
|
657
|
+
local opened="" _probe_i c_probe
|
|
658
|
+
for _probe_i in $(seq 1 24); do
|
|
659
|
+
c_probe="$(cap)"
|
|
660
|
+
# P127: here-strings, not `printf | grep -q` — the probe frame can outgrow the pipe buffer
|
|
661
|
+
# and grep's early exit would SIGPIPE the printf writer (rc=141 → the open falsely unseen).
|
|
662
|
+
if { grep -qF -- "╭─ $keyname" <<< "$c_probe" || grep -qF -- " · $keyname" <<< "$c_probe"; } \
|
|
663
|
+
&& pty_frame_settled "$c_probe"; then
|
|
664
|
+
opened="$c_probe"; break
|
|
665
|
+
fi
|
|
666
|
+
sleep 0.3
|
|
667
|
+
done
|
|
668
|
+
[ -n "$opened" ] || opened="$c_probe"
|
|
669
|
+
printf '%s\n' "$opened" > "$tmp/$current/click2.txt"
|
|
670
|
+
if grep -qF "╭─ $keyname" "$tmp/$current/click2.txt"; then
|
|
671
|
+
assert_has "$tmp/$current/click2.txt" "╭─ $keyname" "第二次点击打开该行的编辑器(compose 托盘,标题点名原始键)"
|
|
672
|
+
elif grep -qF " · $keyname" "$tmp/$current/click2.txt"; then
|
|
673
|
+
assert_has "$tmp/$current/click2.txt" " · $keyname" "第二次点击打开该行的编辑器(选择器,标题点名原始键)"
|
|
674
|
+
else
|
|
675
|
+
bad "第二次点击没有打开该行的编辑器"
|
|
676
|
+
fi
|
|
677
|
+
# M59: state-checked cleanup — whichever widget is on a settled frame gets the esc (at most one
|
|
678
|
+
# sends; a widget that is not there gets no key, so the view can never be the esc's casualty).
|
|
679
|
+
leave_editor "$keyname"
|
|
680
|
+
leave_picker "$keyname"
|
|
681
|
+
else
|
|
682
|
+
cap | tail -5 >&2
|
|
683
|
+
bad "窗口里没有找到可点击的 apply 行"
|
|
684
|
+
fi
|
|
685
|
+
# A refuse row opens no editor: the route is surfaced and the contract is untouched.
|
|
686
|
+
local before; before="$(sha "$(cfg)")"
|
|
687
|
+
filter_to TEAM_SESSION
|
|
688
|
+
sleep 0.3
|
|
689
|
+
if focus_row '会话名 +.*只读'; then
|
|
690
|
+
keys Enter
|
|
691
|
+
else
|
|
692
|
+
bad "没能把焦点移到 refuse 行"
|
|
693
|
+
fi
|
|
694
|
+
if wait_cap refuse-route "手改"; then ok "refuse 行的回执点名路线"; else bad "refuse 行的回执没出现"; fi
|
|
695
|
+
assert_eq "refuse 行没有写契约" "$(sha "$(cfg)")" "$before"
|
|
696
|
+
# P144:磁盘底线的两行 + 夹具缝一行 —— 行主文本是标签(不是裸键),类徽章照旧;缝是 refuse:
|
|
697
|
+
# 回车只给路线,不开编辑器、不写契约。
|
|
698
|
+
filter_to 临时根空间底线
|
|
699
|
+
cap_to p144-mb
|
|
700
|
+
assert_match "$tmp/$current/p144-mb.txt" '› 临时根空间底线 +未设 · 默认 1024 · 立即生效' \
|
|
701
|
+
"P144:临时根空间底线 行是人话标签 + apply 徽章"
|
|
702
|
+
assert_not "$tmp/$current/p144-mb.txt" '临时根空间底线 +TEAM_' "P144:字节底线行主文本不是裸键"
|
|
703
|
+
filter_to inode 底线
|
|
704
|
+
if focus_row '临时根 inode 底线 +未设 · 默认 100000'; then :; else bad "P144:没能把焦点移到 inode 底线行"; fi
|
|
705
|
+
cap_to p144-ino
|
|
706
|
+
assert_match "$tmp/$current/p144-ino.txt" '› 临时根 inode 底线 +未设 · 默认 100000 · 立即生效' \
|
|
707
|
+
"P144:临时根 inode 底线 行是人话标签 + apply 徽章"
|
|
708
|
+
local p144_before; p144_before="$(sha "$(cfg)")"
|
|
709
|
+
filter_to 磁盘读数夹具
|
|
710
|
+
cap_to p144-seam
|
|
711
|
+
assert_match "$tmp/$current/p144-seam.txt" '› 磁盘读数夹具 +.*只读' \
|
|
712
|
+
"P144:磁盘读数夹具 行是人话标签 + refuse 徽章"
|
|
713
|
+
if focus_row '磁盘读数夹具 +.*只读'; then keys Enter; else bad "P144:没能把焦点移到夹具缝行"; fi
|
|
714
|
+
if wait_cap p144-seam-route "手改"; then ok "P144:缝行的回执点名手改路线(不开编辑器)"; else bad "P144:缝行的回执没出现"; fi
|
|
715
|
+
assert_eq "P144:缝行没有写契约" "$(sha "$(cfg)")" "$p144_before"
|
|
716
|
+
# M59: the navigation esc is state-checked too — it fires only while the settings view is on a
|
|
717
|
+
# settled frame, so a drifted scene gets a named red instead of a blind key.
|
|
718
|
+
pty_key_when "esc 回浮层" '╭─ 项目设置' Escape || bad "esc 前设置视图已经不在屏幕上"
|
|
719
|
+
# The origin is remembered (esc back to the overlay's navigation row). P68:等那一行本身在稳定帧上。
|
|
720
|
+
wait_row overlay-back "esc 回到浮层且仍选中「项目设置」" '› 项目设置' \
|
|
721
|
+
|| bad "esc 之后浮层没有回到「项目设置」这一行"
|
|
722
|
+
assert_has "$tmp/$current/overlay-back.txt" "项目设置" "esc 回到设置浮层"
|
|
723
|
+
assert_match "$tmp/$current/overlay-back.txt" '› 项目设置' "回到浮层时仍选中那一行"
|
|
724
|
+
# The current frame minus its last line (the status/receipt row, which may quote the key the user
|
|
725
|
+
# just tried to edit): the overlay itself must list no contract key.
|
|
726
|
+
cap_now | sed '$d' > "$tmp/$current/overlay-now.txt"
|
|
727
|
+
assert_not "$tmp/$current/overlay-now.txt" "TEAM_" "当前这一帧的浮层没有契约的 TEAM_* 键"
|
|
728
|
+
keys Enter
|
|
729
|
+
pty_wait_frame - "q 用例的设置视图" '╭─ 项目设置' || bad "q 用例的设置视图没有打开"
|
|
730
|
+
# `q` keeps its global meaning: the collapse path runs (the argv log is the observable).
|
|
731
|
+
local q0; q0="$(wc -l < "$(argv_log)" 2>/dev/null || echo 0)"
|
|
732
|
+
keys q
|
|
733
|
+
if wait_argv q-collapse 'pulse collapse'; then ok "q 仍然触发全局的收起动作"; else bad "q 的收起动作没有进 argv 日志"; fi
|
|
734
|
+
# The bundle carries no second key table (P22/B2): a scratch CLI whose schema gains TEAM_ZZZ_TEST
|
|
735
|
+
# and whose TEAM_GATES class is refuse shows both through the same committed panel.js.
|
|
736
|
+
local scratch="$tmp/$current/scratch"
|
|
737
|
+
mkdir -p "$scratch/skills/teamsmith"
|
|
738
|
+
cp -a "$skill/scripts" "$scratch/skills/teamsmith/scripts"
|
|
739
|
+
cp -a "$skill/templates" "$skill/references" "$scratch/skills/teamsmith/"
|
|
740
|
+
python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PYFIX'
|
|
741
|
+
import sys
|
|
742
|
+
p = sys.argv[1]
|
|
743
|
+
s = open(p, encoding='utf-8').read()
|
|
744
|
+
s = s.replace('TEAM_GATES|apply|cmd||plain||-|', 'TEAM_GATES|refuse|cmd||plain||-|改门禁请手改(scratch 夹具)')
|
|
745
|
+
s = s.replace('TEAM_DEFAULT_MODEL|restart|model|req|plain|deepseek/deepseek-flash|-|',
|
|
746
|
+
'TEAM_ZZZ_TEST|apply|text||plain|zzz-default|-|||workflow\nTEAM_DEFAULT_MODEL|restart|model|req|plain|deepseek/deepseek-flash|-|')
|
|
747
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
748
|
+
PYFIX
|
|
749
|
+
cat > "$tmp/$current-scratch-wrapper.sh" <<EOF2
|
|
750
|
+
#!/usr/bin/env bash
|
|
751
|
+
printf '%s\n' "\$*" >> "$tmp/$current-scratch-argv.log"
|
|
752
|
+
exec bash "$scratch/skills/teamsmith/scripts/team" "\$@"
|
|
753
|
+
EOF2
|
|
754
|
+
chmod +x "$tmp/$current-scratch-wrapper.sh"
|
|
755
|
+
P21_CLI="$tmp/$current-scratch-wrapper.sh" start_panel
|
|
756
|
+
# The view opens on the overview: reach the overlay again (the panel was restarted).
|
|
757
|
+
open_view
|
|
758
|
+
filter_to TEAM_ZZZ_TEST
|
|
759
|
+
# P68:等那一行(值也在)出现在稳定帧上,不用固定 sleep 采样。
|
|
760
|
+
wait_row scratch-key "scratch 视图里的 TEAM_ZZZ_TEST 行" 'TEAM_ZZZ_TEST' '未设 · 默认 zzz-default' \
|
|
761
|
+
|| bad "scratch CLI 新增的键行没有在预算内出现"
|
|
762
|
+
assert_match "$tmp/$current/scratch-key.txt" 'TEAM_ZZZ_TEST +未设 · 默认 zzz-default' "scratch CLI 新增的键出现在视图里(不重建 panel.js;无标签→回退裸键)"
|
|
763
|
+
filter_to TEAM_GATES
|
|
764
|
+
wait_row scratch-class "scratch 视图里的 TEAM_GATES 行(类改成只读)" '门禁命令' 'true · 只读' \
|
|
765
|
+
|| bad "scratch CLI 改过的类行没有在预算内出现"
|
|
766
|
+
assert_match "$tmp/$current/scratch-class.txt" '门禁命令 +true · 只读' "scratch CLI 改过的类跟着变(bundle 没有第二张键表)"
|
|
767
|
+
assert_has "$tmp/$current/scratch-class.txt" "手改 .pi/team/config.sh 里的 TEAM_GATES" "scratch CLI 的拒统路线也点名原始键"
|
|
768
|
+
# M49:另一种语言的人话标签(同一张表切换,标签不是渲染时的硬编码)。
|
|
769
|
+
conf_set "lang=en" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
|
|
770
|
+
start_panel
|
|
771
|
+
open_view 'Identity & ledger layout'
|
|
772
|
+
filter_to TEAM_PULSE_INTERVAL
|
|
773
|
+
cap_to en
|
|
774
|
+
assert_match "$tmp/$current/en.txt" '› Patrol interval' "en 行的人话标签(行不是裸键)"
|
|
775
|
+
assert_has "$tmp/$current/en.txt" "CLI: team config set TEAM_PULSE_INTERVAL <value>" "en 的 CLI 提示行同样点名原始键"
|
|
776
|
+
|
|
777
|
+
# ── P32:视图用满窗口高度(用户实测 45 行里 16 行空白)+ 行数记账诚实 ──
|
|
778
|
+
# 同一条契约、同一个面板,只改 pane 行高:① 内容结尾(卡片下边框)到键栏的空白 ≤1 行;
|
|
779
|
+
# ② 画出的行数随行高长(45 vs 30 的差 ≥8);③ rows + ↑N + ↓N 恰好等于命令报的键+席位总数
|
|
780
|
+
# (窗口的计数行必须与窗口实际画出的行数一致 —— P30/D5 的成本模型曾经按「带注释的行占两行」
|
|
781
|
+
# 记账,虚报了 15 行,那 15 行就是用户看到的空白)。
|
|
782
|
+
conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
|
|
783
|
+
unset P21_CLI
|
|
784
|
+
start_panel
|
|
785
|
+
open_view
|
|
786
|
+
local want_count
|
|
787
|
+
want_count="$( (cd "$ROOT" && bash "$skill/scripts/team" config list --json) \
|
|
788
|
+
| python3 -c 'import json,sys; d=json.load(sys.stdin); print(len(d["keys"]) + len(d.get("models",{}).get("seats",[])))' )"
|
|
789
|
+
[ "${want_count:-0}" -gt 0 ] || bad "读数拿不到键数(前提不成立)"
|
|
790
|
+
local h s rows up down gap prev_rows=""
|
|
791
|
+
for h in 45 33 30 25; do
|
|
792
|
+
if resize_panel 120 "$h"; then
|
|
793
|
+
if wait_settings_frame "$h" "height$h"; then
|
|
794
|
+
s="$(settings_window_stats "$tmp/$current/height$h.txt")"
|
|
795
|
+
IFS=' ' read -r rows up down gap <<<"$s"
|
|
796
|
+
# ① 内容结束到键栏的空白 ≤1 行(P32 前:45 行里 16 行)
|
|
797
|
+
if [ "$gap" -le 1 ]; then ok "${h} 行:内容结尾到键栏只剩 $gap 行空白(≤1)"; else bad "${h} 行:内容结尾到键栏还有 $gap 行空白"; fi
|
|
798
|
+
# ③ 记账诚实:窗口画出的行 + 两条计数 = 命令报的总行数
|
|
799
|
+
assert_eq "${h} 行:rows($rows) + ↑($up) + ↓($down) = 命令报的键+席位($want_count)" \
|
|
800
|
+
"$((rows + up + down))" "$want_count"
|
|
801
|
+
case "$h" in
|
|
802
|
+
45) prev_rows="$rows" ;;
|
|
803
|
+
30) if [ -n "$prev_rows" ] && [ "$((prev_rows - rows))" -ge 8 ]; then
|
|
804
|
+
ok "窗口随行高长:45 行 $prev_rows → 30 行 $rows(差 $((prev_rows - rows)) ≥ 8)"
|
|
805
|
+
else
|
|
806
|
+
bad "窗口没有随行高长:45 行 $prev_rows → 30 行 $rows"
|
|
807
|
+
fi ;;
|
|
808
|
+
esac
|
|
809
|
+
else
|
|
810
|
+
cap_visible_to "height$h-fail"
|
|
811
|
+
bad "缩到 120×${h} 之后没有画出完整的设置视图帧($(settings_window_stats "$tmp/$current/height$h-fail.txt"))"
|
|
812
|
+
fi
|
|
813
|
+
else
|
|
814
|
+
bad "pane 缩到 120×${h} 没有生效"
|
|
815
|
+
fi
|
|
816
|
+
done
|
|
817
|
+
resize_panel 160 40 || true
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
scn_choices() {
|
|
821
|
+
section "choices · 选择器(M55 的选项 + M65 的直写:一次 accept = 校验+写入 / 交互路径零读取 / 危险值一次确认 / 只有自由输入进编辑器)"
|
|
822
|
+
local agents="dev verify" i
|
|
823
|
+
for i in $(seq 2 28); do agents="$agents dev$i"; done
|
|
824
|
+
server_up choices "$agents"
|
|
825
|
+
python3 - "$(cfg)" <<'PY'
|
|
826
|
+
import re, sys
|
|
827
|
+
p = sys.argv[1]
|
|
828
|
+
s = open(p, encoding='utf-8').read()
|
|
829
|
+
# 未设的 bool(默认 1)/ seconds(默认 300)/ 数值(默认 900):删掉模板里的行,让前提真的成立。
|
|
830
|
+
s = re.sub(r'^TEAM_NOTIFY_TMUX=.*\n?', '', s, flags=re.M)
|
|
831
|
+
s = re.sub(r'^TEAM_DEFER_TTL=.*\n?', '', s, flags=re.M)
|
|
832
|
+
s = re.sub(r'^TEAM_PULSE_INTERVAL=.*\n?', '', s, flags=re.M)
|
|
833
|
+
# path exec,opt 指向一个不存在的文件:存在性标记要看得见。
|
|
834
|
+
s = re.sub(r'^TEAM_AGENT_BIN=.*$', 'TEAM_AGENT_BIN="/nonexistent/m55-agent"', s, count=1, flags=re.M)
|
|
835
|
+
# 危险值当「当前」选项:M65 的危险例外必须对来自选项的值同样生效(第一次 accept 只警告、不写)。
|
|
836
|
+
s = re.sub(r'^TEAM_MIN_FREE_SWAP_MB=.*$', 'TEAM_MIN_FREE_SWAP_MB="0"', s, count=1, flags=re.M)
|
|
837
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
838
|
+
PY
|
|
839
|
+
# 席位模型:28 个记录 → known 变长,滚轮用例的条目列表会超出可视预算(不需要改 pane 几何)。
|
|
840
|
+
mkdir -p "$state"
|
|
841
|
+
for i in $(seq 2 28); do printf 'model=provider/m%s\n' "$i" > "$state/dev$i.env"; done
|
|
842
|
+
conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
|
|
843
|
+
# R2 的机器目录夹具:scratch HOME 里放一个含 sub2api(已下线的 provider)与 openrouter 的 Pi 模型
|
|
844
|
+
# 目录 —— 读与选择器都不许出现它们(真实的 models-store.json 是活缓存,绝不能被当成选项来源)。
|
|
845
|
+
local home="$tmp/$current-home"
|
|
846
|
+
mkdir -p "$home/.pi/agent"
|
|
847
|
+
cat > "$home/.pi/agent/models-store.json" <<'JSON'
|
|
848
|
+
{ "sub2api": { "models": { "gpt-5.6-luna": { "name": "gpt-5.6-luna", "baseUrl": "http://127.0.0.1:8080/v1" } } },
|
|
849
|
+
"openrouter": { "models": { "anthropic/claude-x": { "name": "claude-x" } } } }
|
|
850
|
+
JSON
|
|
851
|
+
# M65/D11:读取窗口的判据是「按键与帧之间没有读取」。后台节拍(activity 块 3s TTL)会无关地
|
|
852
|
+
# spawn `__panel-data` —— 本段的面板跑在 P21_REFRESH=3600 下(`--refresh` 才是 panel 自己的刷新
|
|
853
|
+
# 区间;`--interval` 是 `team monitor` 的旗标,panel 忽略它),窗口里出现的任何子进程都是这次
|
|
854
|
+
# 交互因果产生的。
|
|
855
|
+
P21_REFRESH=3600 P21_HOME="$home" start_panel
|
|
856
|
+
open_view
|
|
857
|
+
local gap0 acc0
|
|
858
|
+
|
|
859
|
+
# ── (1) bool:两个带标签的条目;一次 accept = 校验 + 直写(无确认帧、无编辑器) ──
|
|
860
|
+
filter_to TEAM_NOTIFY_TMUX
|
|
861
|
+
# P68:断言那一行本身之前先等数据态(未设 bool 行 + 它的默认值)落定。
|
|
862
|
+
wait_row bool-row "未设 bool 行显示「未设 · 默认 1」" '走 tmux 投递' '未设 · 默认 1' \
|
|
863
|
+
|| bad "未设的 bool 行没有在预算内显示默认值"
|
|
864
|
+
assert_match "$tmp/$current/bool-row.txt" '走 tmux 投递 +未设 · 默认 1' "未设的 bool 行显示 未设 · 默认 1"
|
|
865
|
+
gap0="$(argv_count)"
|
|
866
|
+
keys Enter
|
|
867
|
+
wait_picker TEAM_NOTIFY_TMUX '› 保持未设' || bad "bool 的选择器没有打开"
|
|
868
|
+
argv_since "$gap0" "$tmp/$current/gap-open.log"
|
|
869
|
+
local gap_reads gap_total
|
|
870
|
+
gap_reads="$(argv_reads "$tmp/$current/gap-open.log")"; [ -n "$gap_reads" ] || gap_reads=0
|
|
871
|
+
gap_total="$(wc -l < "$tmp/$current/gap-open.log")"
|
|
872
|
+
if [ "$gap_reads" = "0" ] && [ "$gap_total" = "0" ]; then
|
|
873
|
+
ok "打开选择器:按键→帧之间零读取、零子进程(编辑器只用屏幕上的 settings 块)"
|
|
874
|
+
else
|
|
875
|
+
bad "打开选择器:按键→帧之间零读取、零子进程(读=$gap_reads 总=$gap_total):$(head -3 "$tmp/$current/gap-open.log" 2>/dev/null | tr '\n' ';')"
|
|
876
|
+
fi
|
|
877
|
+
cap_to bool
|
|
878
|
+
assert_match "$tmp/$current/bool.txt" '› 保持未设' "未设键的首个条目是保持未设(并且是焦点)"
|
|
879
|
+
assert_has "$tmp/$current/bool.txt" "开(1) · 默认" "1 是默认条目,带表里的 on 词"
|
|
880
|
+
assert_has "$tmp/$current/bool.txt" "关(0)" "0 是另一个条目,带表里的 off 词"
|
|
881
|
+
assert_not "$tmp/$current/bool.txt" "…(自由输入)" "bool 是封闭域:没有自由输入项"
|
|
882
|
+
local bool_sha bool_audit
|
|
883
|
+
bool_sha="$(sha "$(cfg)")"; bool_audit="$(audit_lines)"
|
|
884
|
+
acc0="$(argv_count)"
|
|
885
|
+
pick_option '关(0)' || bad "bool 选择器里没有 关(0)"
|
|
886
|
+
if wait_cap bool-written "已写入 TEAM_NOTIFY_TMUX = 0"; then ok "bool 选项在一次 accept 上写入(直写)"; else bad "bool 的直写回执没出现"; fi
|
|
887
|
+
cap_to bool-written
|
|
888
|
+
assert_not "$tmp/$current/bool-written.txt" "确认:" "直写没有确认帧"
|
|
889
|
+
assert_not "$tmp/$current/bool-written.txt" "╭─ TEAM_NOTIFY_TMUX" "直写没有打开编辑器"
|
|
890
|
+
assert_not "$tmp/$current/bool-written.txt" " · TEAM_NOTIFY_TMUX" "直写之后选择器已关闭"
|
|
891
|
+
assert_match "$(cfg)" "^TEAM_NOTIFY_TMUX=.0.\$" "契约里落了规范值 0"
|
|
892
|
+
assert_eq "直写让审计长一行" "$(audit_lines)" "$((bool_audit + 1))"
|
|
893
|
+
argv_since "$acc0" "$tmp/$current/bool-argv.log"
|
|
894
|
+
assert_eq "accept 的第 1 个子进程是 --dry-run(校验)" "$(sed -n '1p' "$tmp/$current/bool-argv.log" | grep -c -- '--dry-run')" "1"
|
|
895
|
+
assert_eq "accept 的第 2 个子进程是 --yes 写入" "$(sed -n '2p' "$tmp/$current/bool-argv.log" | grep -c -- '--yes')" "1"
|
|
896
|
+
assert_eq "accept 之前没有读子进程(第 1 行不是 config list/__panel-data)" "$(sed -n '1p' "$tmp/$current/bool-argv.log" | grep -cE 'config list|__panel-data' || true)" "0"
|
|
897
|
+
local accept_tail
|
|
898
|
+
accept_tail="$(tail -n +3 "$tmp/$current/bool-argv.log" 2>/dev/null | grep -v -- '__panel-data --block settings' || true)"
|
|
899
|
+
if [ -z "$accept_tail" ]; then
|
|
900
|
+
ok "accept 之后只剩 settings 块的 settle 重读(没有别的块、没有第二次写)"
|
|
901
|
+
else
|
|
902
|
+
bad "accept 之后还有别的子进程:$(printf '%s' "$accept_tail" | head -3 | tr '\n' ';')"
|
|
903
|
+
fi
|
|
904
|
+
filter_to TEAM_NOTIFY_TMUX
|
|
905
|
+
# P68:等那一行真的显示刚写下的规范值(accept 后的 settle 重读落定),再按 Enter ——
|
|
906
|
+
# 选择器是一次成形的快照(D43),不等读就会从旧块开(CI 那三条红就是这个形状)。
|
|
907
|
+
wait_row bool-set-row "写入后的 bool 行显示新值 0" '走 tmux 投递' '0 · 立即生效' \
|
|
908
|
+
|| bad "写入后的设置行没有在预算内显示新值"
|
|
909
|
+
keys Enter
|
|
910
|
+
wait_picker TEAM_NOTIFY_TMUX '关(0) · 当前' || bad "bool 选择器第二次没有打开"
|
|
911
|
+
cap_to bool-set
|
|
912
|
+
assert_has "$tmp/$current/bool-set.txt" "关(0) · 当前" "已设的 bool 把文件里的值标成当前"
|
|
913
|
+
assert_has "$tmp/$current/bool-set.txt" "开(1) · 默认" "默认标记移到 1 上"
|
|
914
|
+
assert_not "$tmp/$current/bool-set.txt" "保持未设" "已设的键没有保持未设条目"
|
|
915
|
+
leave_picker TEAM_NOTIFY_TMUX
|
|
916
|
+
# 非规范拼写(手改出来的 true):当前条目原样显示,不许被贴成「关(0)」(命令写入时才 canonical 化)。
|
|
917
|
+
python3 - "$(cfg)" <<'PY2'
|
|
918
|
+
import re, sys
|
|
919
|
+
p = sys.argv[1]
|
|
920
|
+
s = open(p, encoding='utf-8').read()
|
|
921
|
+
s = re.sub(r'^TEAM_NOTIFY_TMUX=.*$', 'TEAM_NOTIFY_TMUX=true', s, count=1, flags=re.M)
|
|
922
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
923
|
+
PY2
|
|
924
|
+
# 手改之后要用视图自己的读取把它读进来(M65/D11:进入视图是视图自己的读取;交互路径没有读取)
|
|
925
|
+
reopen_view
|
|
926
|
+
filter_to TEAM_NOTIFY_TMUX
|
|
927
|
+
# P68(本变更的主目标):等那一行**本身**显示手改后的值(视图打开时那次强制读落定)再按 Enter。
|
|
928
|
+
# 等待名把被等的状态写清楚;耗尽时引擎打一行 `等待超时:数据态:…(缺 [走 tmux 投递 true · 立即生效])`,
|
|
929
|
+
# bad() 再按机器读数分派红/SKIP。骨架标记(分组标题)与固定 sleep 都不再是证据。
|
|
930
|
+
wait_row bool-spelling-row "设置行显示手改后的值 true" '走 tmux 投递' 'true · 立即生效' \
|
|
931
|
+
|| bad "手改后的设置行没有在预算内显示新值"
|
|
932
|
+
keys Enter
|
|
933
|
+
wait_picker TEAM_NOTIFY_TMUX 'true · 当前' || bad "非规范 bool 的选择器没有打开"
|
|
934
|
+
cap_to bool-spelling
|
|
935
|
+
assert_has "$tmp/$current/bool-spelling.txt" "true · 当前" "非规范拼写的手改值原样显示成当前条目"
|
|
936
|
+
assert_not "$tmp/$current/bool-spelling.txt" "关(0) · 当前" "非规范拼写不许被贴成规范值的标签"
|
|
937
|
+
assert_has "$tmp/$current/bool-spelling.txt" "开(1) · 默认" "规范默认值仍在"
|
|
938
|
+
leave_picker TEAM_NOTIFY_TMUX
|
|
939
|
+
|
|
940
|
+
# ── (2) enum:只给 constraints 里的取值,原序;接受即写(直写,restart 回执说明时机) ──
|
|
941
|
+
filter_to TEAM_MONITOR_UI
|
|
942
|
+
sleep 0.5
|
|
943
|
+
keys Enter
|
|
944
|
+
wait_picker TEAM_MONITOR_UI 'auto · 默认' || bad "enum 的选择器没有打开"
|
|
945
|
+
cap_to enum
|
|
946
|
+
assert_match "$tmp/$current/enum.txt" '› 保持未设' "未设的 enum 也以保持未设开头"
|
|
947
|
+
assert_has "$tmp/$current/enum.txt" "auto · 默认" "默认标记在 auto 上"
|
|
948
|
+
assert_has "$tmp/$current/enum.txt" "tui" "enum 给出 constraints 里的 tui"
|
|
949
|
+
assert_has "$tmp/$current/enum.txt" "text" "enum 给出 constraints 里的 text"
|
|
950
|
+
assert_not "$tmp/$current/enum.txt" "…(自由输入)" "enum 是封闭域:没有自由输入项"
|
|
951
|
+
local enum_sha enum_audit
|
|
952
|
+
enum_sha="$(sha "$(cfg)")"; enum_audit="$(audit_lines)"
|
|
953
|
+
pick_option 'tui' || bad "enum 选择器里没有 tui"
|
|
954
|
+
if wait_cap enum-written "已写入 TEAM_MONITOR_UI = tui"; then ok "enum 选项在一次 accept 上写入(直写)"; else bad "enum 的直写回执没出现"; fi
|
|
955
|
+
cap_to enum-written
|
|
956
|
+
assert_has "$tmp/$current/enum-written.txt" "需要重启才生效" "restart 类的回执说明重启时机"
|
|
957
|
+
assert_not "$tmp/$current/enum-written.txt" "确认:" "enum 直写没有确认帧"
|
|
958
|
+
assert_not "$tmp/$current/enum-written.txt" "╭─ TEAM_MONITOR_UI" "enum 直写没有编辑器"
|
|
959
|
+
assert_eq "enum 一次 accept 只审计一行" "$(audit_lines)" "$((enum_audit + 1))"
|
|
960
|
+
assert_match "$(argv_log)" 'config set TEAM_MONITOR_UI tui --actor panel --dry-run --fingerprint [0-9a-f]{64}' "wrapper 记录了 --dry-run"
|
|
961
|
+
assert_match "$(argv_log)" 'config set TEAM_MONITOR_UI tui --actor panel --yes --fingerprint [0-9a-f]{64}' "wrapper 记录了 --yes + 指纹"
|
|
962
|
+
|
|
963
|
+
# ── (3) 未设键:编辑器开在「保持未设」上,接受 = 取消(不写、不留审计、不留临时文件);再接受 300 = 直写 ──
|
|
964
|
+
filter_to TEAM_DEFER_TTL
|
|
965
|
+
wait_row defer-row "未设 seconds 行显示「未设 · 默认 300」" '排队过期时间' '未设 · 默认 300' \
|
|
966
|
+
|| bad "未设键的行没有在预算内显示默认值"
|
|
967
|
+
assert_match "$tmp/$current/defer-row.txt" '排队过期时间 +未设 · 默认 300' "未设键的行显示 未设 · 默认 300"
|
|
968
|
+
local defer_sha defer_audit
|
|
969
|
+
defer_sha="$(sha "$(cfg)")"; defer_audit="$(audit_lines)"
|
|
970
|
+
keys Enter
|
|
971
|
+
wait_picker TEAM_DEFER_TTL '› 保持未设' || bad "未设键的选择器没有打开"
|
|
972
|
+
cap_to defer
|
|
973
|
+
assert_match "$tmp/$current/defer.txt" '› 保持未设' "未设键的编辑器开在保持未设上"
|
|
974
|
+
keys Enter
|
|
975
|
+
# M59: conditional — 保持未设 accepts = the picker closes with no editor; wait for BOTH the tray
|
|
976
|
+
# and the picker title to be absent on a settled frame, instead of a fixed sleep.
|
|
977
|
+
pty_wait_frame "$tmp/$current/defer-cancel.txt" "保持未设接受(无编辑器无选择器)" '!╭─ TEAM_DEFER_TTL' '! · TEAM_DEFER_TTL' \
|
|
978
|
+
|| bad "保持未设没有干净地回到行列表"
|
|
979
|
+
assert_not "$tmp/$current/defer-cancel.txt" "╭─ TEAM_DEFER_TTL" "保持未设不打开写编辑器"
|
|
980
|
+
assert_not "$tmp/$current/defer-cancel.txt" " · TEAM_DEFER_TTL" "保持未设关掉了选择器(回到行列表)"
|
|
981
|
+
assert_eq "保持未设后契约不变" "$(sha "$(cfg)")" "$defer_sha"
|
|
982
|
+
assert_eq "保持未设后审计不增长" "$(audit_lines)" "$defer_audit"
|
|
983
|
+
assert_eq "保持未设后没有临时文件" "$(ls "$ROOT/.pi/team/"config.sh.tmp.* 2>/dev/null | wc -l)" "0"
|
|
984
|
+
# 再开一次:接受「300」这一项 → 一次 accept 直写(M65/D10;视图不说这是 unset)
|
|
985
|
+
filter_to TEAM_DEFER_TTL
|
|
986
|
+
sleep 0.5
|
|
987
|
+
keys Enter
|
|
988
|
+
wait_picker TEAM_DEFER_TTL '› 保持未设' || bad "未设键的选择器第二次没有打开"
|
|
989
|
+
pick_option '300' || bad "未设键的选择器里没有 300 项"
|
|
990
|
+
if wait_cap defer-written "已写入 TEAM_DEFER_TTL = 300"; then
|
|
991
|
+
ok "未设键选默认值 = 一次 accept 直写(视图没有把这次写入说成 unset)"
|
|
992
|
+
else
|
|
993
|
+
bad "未设键选默认值的直写回执没出现"
|
|
994
|
+
fi
|
|
995
|
+
cap_to defer-written
|
|
996
|
+
assert_not "$tmp/$current/defer-written.txt" "确认:" "未设键直写没有确认帧"
|
|
997
|
+
assert_not "$tmp/$current/defer-written.txt" "╭─ TEAM_DEFER_TTL" "未设键直写没有编辑器"
|
|
998
|
+
assert_match "$(cfg)" "^TEAM_DEFER_TTL=.300.\$" "契约里显式写上 300"
|
|
999
|
+
assert_eq "未设键直写审计长一行" "$(audit_lines)" "$((defer_audit + 1))"
|
|
1000
|
+
|
|
1001
|
+
# ── (4) 数值键:区间 + 建议值 + 自由输入(唯一进编辑器的路径);非法值被拒且保留草稿;建议值直写 ──
|
|
1002
|
+
filter_to TEAM_PULSE_INTERVAL
|
|
1003
|
+
sleep 0.5
|
|
1004
|
+
keys Enter
|
|
1005
|
+
wait_picker TEAM_PULSE_INTERVAL '› 保持未设' || bad "数值键的选择器没有打开"
|
|
1006
|
+
cap_to numeric
|
|
1007
|
+
assert_has "$tmp/$current/numeric.txt" "接受区间 60–∞" "数值键显示命令给的接受区间(上界空 = 无界)"
|
|
1008
|
+
assert_match "$tmp/$current/numeric.txt" '› 保持未设' "未设的数值键也以保持未设开头"
|
|
1009
|
+
assert_has "$tmp/$current/numeric.txt" "900 · 默认" "建议值里的默认值带默认标记"
|
|
1010
|
+
assert_has "$tmp/$current/numeric.txt" "1800" "建议值原样给出"
|
|
1011
|
+
assert_has "$tmp/$current/numeric.txt" "…(自由输入)" "数值键有自由输入项"
|
|
1012
|
+
local num_sha num_audit
|
|
1013
|
+
num_sha="$(sha "$(cfg)")"; num_audit="$(audit_lines)"
|
|
1014
|
+
pick_option '自由输入' || bad "数值选择器里没有自由输入项"
|
|
1015
|
+
wait_editor TEAM_PULSE_INTERVAL || bad "数值自由输入没有打开写编辑器"
|
|
1016
|
+
keys C-u; sleep 0.3
|
|
1017
|
+
type_text "30"; sleep 0.4
|
|
1018
|
+
keys Enter
|
|
1019
|
+
if wait_cap numeric-invalid "最小 60"; then ok "越界的数值被命令拒绝并点名最小 60"; else bad "越界数值的拒绝没出现"; fi
|
|
1020
|
+
assert_eq "被拒后契约不变" "$(sha "$(cfg)")" "$num_sha"
|
|
1021
|
+
cap_has "TEAM_PULSE_INTERVAL" numeric-draft
|
|
1022
|
+
leave_editor TEAM_PULSE_INTERVAL
|
|
1023
|
+
# 4b)建议值也是值条目:一次 accept 直写,不进编辑器(M65/D10)
|
|
1024
|
+
filter_to TEAM_PULSE_INTERVAL
|
|
1025
|
+
sleep 0.5
|
|
1026
|
+
keys Enter
|
|
1027
|
+
wait_picker TEAM_PULSE_INTERVAL '› 保持未设' || bad "数值键的选择器第二次没有打开"
|
|
1028
|
+
pick_option '1800' || bad "数值选择器里没有 1800"
|
|
1029
|
+
if wait_cap num-written "已写入 TEAM_PULSE_INTERVAL = 1800"; then ok "建议值条目一次 accept 直写"; else bad "建议值条目的直写回执没出现"; fi
|
|
1030
|
+
cap_to num-written
|
|
1031
|
+
assert_not "$tmp/$current/num-written.txt" "确认:" "建议值直写没有确认帧"
|
|
1032
|
+
assert_not "$tmp/$current/num-written.txt" "╭─ TEAM_PULSE_INTERVAL" "建议值直写没有编辑器"
|
|
1033
|
+
assert_eq "建议值直写审计长一行" "$(audit_lines)" "$((num_audit + 1))"
|
|
1034
|
+
|
|
1035
|
+
# ── (5) path:存在性标记 / 只有命令接受空值时才给清空项 / 清空也是直写 / 自由输入的确认行重复标记 ──
|
|
1036
|
+
filter_to TEAM_AGENT_BIN
|
|
1037
|
+
sleep 0.5
|
|
1038
|
+
keys Enter
|
|
1039
|
+
wait_picker TEAM_AGENT_BIN 'nonexistent/m55-agent' || bad "path 选择器没有打开"
|
|
1040
|
+
cap_to path
|
|
1041
|
+
assert_match "$tmp/$current/path.txt" '/nonexistent/m55-agent · 当前 · 不存在' "path 当前值带着缺失标记"
|
|
1042
|
+
assert_has "$tmp/$current/path.txt" "清空(写入空值)" "exec,opt 的 path 给出清空项"
|
|
1043
|
+
assert_has "$tmp/$current/path.txt" "…(自由输入)" "path 给出自由输入项"
|
|
1044
|
+
local path_audit
|
|
1045
|
+
path_audit="$(audit_lines)"
|
|
1046
|
+
pick_option '清空(写入空值)' || bad "path 选择器里没有清空项"
|
|
1047
|
+
if wait_cap path-cleared "已写入 TEAM_AGENT_BIN"; then ok "清空项也是一次 accept 直写"; else bad "清空项的直写回执没出现"; fi
|
|
1048
|
+
cap_to path-cleared
|
|
1049
|
+
assert_not "$tmp/$current/path-cleared.txt" "确认:" "清空直写没有确认帧"
|
|
1050
|
+
assert_not "$(cfg)" "/nonexistent/m55-agent" "清空把文件里的当前值写掉"
|
|
1051
|
+
assert_eq "清空直写审计长一行" "$(audit_lines)" "$((path_audit + 1))"
|
|
1052
|
+
filter_to TEAM_PI_BIN
|
|
1053
|
+
sleep 0.5
|
|
1054
|
+
keys Enter
|
|
1055
|
+
wait_picker TEAM_PI_BIN '· 当前' || bad "必填 path 的选择器没有打开"
|
|
1056
|
+
cap_to path-required
|
|
1057
|
+
assert_not "$tmp/$current/path-required.txt" "清空" "必填 path 不给清空项(命令不接受空值)"
|
|
1058
|
+
pick_option '自由输入' || bad "必填 path 没有自由输入项"
|
|
1059
|
+
wait_editor TEAM_PI_BIN || bad "必填 path 的自由输入没有打开写编辑器"
|
|
1060
|
+
keys C-u; sleep 0.3
|
|
1061
|
+
type_text "/nonexistent/m55-pi"; sleep 0.4
|
|
1062
|
+
keys Enter
|
|
1063
|
+
if wait_cap path-confirm "不存在"; then ok "确认行重复存在性标记(命令不拒写,视图也不谎称拒绝)"; else bad "确认行的存在性标记没出现"; fi
|
|
1064
|
+
leave_editor TEAM_PI_BIN
|
|
1065
|
+
wait_no_editor || bad "path 编辑器没有关干净"
|
|
1066
|
+
|
|
1067
|
+
# ── (6) 没有选项集的 kind:打开自由输入并写明原因,不渲染条目列表 ──
|
|
1068
|
+
filter_to TEAM_GATES
|
|
1069
|
+
sleep 0.5
|
|
1070
|
+
gap0="$(argv_count)"
|
|
1071
|
+
keys Enter
|
|
1072
|
+
wait_editor TEAM_GATES "没有选项集" || bad "cmd 键没有打开自由输入"
|
|
1073
|
+
argv_since "$gap0" "$tmp/$current/gap-editor.log"
|
|
1074
|
+
local ed_reads
|
|
1075
|
+
ed_reads="$(argv_reads "$tmp/$current/gap-editor.log")"; [ -n "$ed_reads" ] || ed_reads=0
|
|
1076
|
+
assert_eq "打开自由输入:按键→帧之间零读取(现场:$(head -2 "$tmp/$current/gap-editor.log" 2>/dev/null | tr '\n' ';'))" "$ed_reads" "0"
|
|
1077
|
+
cap_to no-choice
|
|
1078
|
+
assert_has "$tmp/$current/no-choice.txt" "╭─ TEAM_GATES" "cmd 键直接打开自由输入"
|
|
1079
|
+
assert_has "$tmp/$current/no-choice.txt" "没有选项集" "编辑器上方写明原因(kind 没有选项集,写入仍由命令校验)"
|
|
1080
|
+
leave_editor TEAM_GATES
|
|
1081
|
+
wait_no_editor || bad "cmd 编辑器没有关干净"
|
|
1082
|
+
|
|
1083
|
+
# ── (7) pairlist:Enter 把焦点移到席位块,绝不在这里组合(不读、不开编辑器) ──
|
|
1084
|
+
filter_to TEAM_AGENT_MODELS
|
|
1085
|
+
sleep 0.5
|
|
1086
|
+
keys Enter
|
|
1087
|
+
if wait_cap pairlist "席位块就是这一行的编辑器"; then ok "pairlist 行把焦点交给席位块"; else bad "pairlist 路由的说明行没出现"; fi
|
|
1088
|
+
cap_to pairlist
|
|
1089
|
+
assert_not "$tmp/$current/pairlist.txt" "╭─ TEAM_AGENT_MODELS" "pairlist 不开写编辑器"
|
|
1090
|
+
assert_not "$tmp/$current/pairlist.txt" " · TEAM_AGENT_MODELS" "pairlist 不开选择器"
|
|
1091
|
+
assert_match "$tmp/$current/pairlist.txt" '› dev +' "焦点移到席位块的第一行"
|
|
1092
|
+
assert_has "$tmp/$current/pairlist.txt" "team config set-agent-model" "命令行点名 set-agent-model(唯一写者)"
|
|
1093
|
+
|
|
1094
|
+
# ── (8) 鼠标:第一次点击只移光标(不写);第二次点击 = 接受并直写;esc 什么都不写 ──
|
|
1095
|
+
wait_no_editor || bad "点击用例开始前还有编辑器开着"
|
|
1096
|
+
filter_to TEAM_MONITOR_UI
|
|
1097
|
+
sleep 0.5
|
|
1098
|
+
keys Enter
|
|
1099
|
+
wait_picker TEAM_MONITOR_UI 'tui · 当前' || bad "点击用例的选择器没有打开"
|
|
1100
|
+
local click_sha click_audit target_line
|
|
1101
|
+
click_sha="$(sha "$(cfg)")"; click_audit="$(audit_lines)"
|
|
1102
|
+
target_line="$(cap | grep -n 'text' | grep -v '›' | head -1 | cut -d: -f1)"
|
|
1103
|
+
[ -n "$target_line" ] || bad "选择器里找不到可点击的 text 条目"
|
|
1104
|
+
[ -n "$target_line" ] && click_at 4 "$target_line"
|
|
1105
|
+
# P68:等点击的光标移动在稳定帧上(原来是固定 sleep + 单次采样)。
|
|
1106
|
+
wait_row click-move "第一次点击把光标移到该条目" '› text' \
|
|
1107
|
+
|| bad "第一次点击后光标没有落到该条目"
|
|
1108
|
+
assert_match "$tmp/$current/click-move.txt" '› text' "第一次点击把光标移到该条目(D7 的规矩)"
|
|
1109
|
+
assert_eq "第一次点击不写契约" "$(sha "$(cfg)")" "$click_sha"
|
|
1110
|
+
assert_eq "第一次点击不增审计" "$(audit_lines)" "$click_audit"
|
|
1111
|
+
click_at 4 "$target_line"
|
|
1112
|
+
if wait_cap click-written "已写入 TEAM_MONITOR_UI = text"; then ok "第二次点击与 Enter 一样接受并直写"; else bad "第二次点击的直写回执没出现"; fi
|
|
1113
|
+
assert_eq "第二次点击审计长一行" "$(audit_lines)" "$((click_audit + 1))"
|
|
1114
|
+
assert_match "$(argv_log)" 'config set TEAM_MONITOR_UI text --actor panel --yes --fingerprint [0-9a-f]{64}' "第二次点击走了直写(--yes + 指纹)"
|
|
1115
|
+
# esc:打开选择器 → esc → 什么都不写
|
|
1116
|
+
filter_to TEAM_MONITOR_UI
|
|
1117
|
+
sleep 0.5
|
|
1118
|
+
local esc_audit esc0 esc_sha
|
|
1119
|
+
esc_audit="$(audit_lines)"; esc0="$(argv_count)"; esc_sha="$(sha "$(cfg)")"
|
|
1120
|
+
keys Enter
|
|
1121
|
+
wait_picker TEAM_MONITOR_UI 'text · 当前' || bad "esc 用例的选择器没有打开"
|
|
1122
|
+
# M59: the test-action esc is also state-checked — if the picker is not on a settled frame the
|
|
1123
|
+
# key is not sent and the miss is named, instead of the esc closing whatever is underneath.
|
|
1124
|
+
pty_key_when "esc 用例" " · TEAM_MONITOR_UI" Escape || bad "esc 用例:选择器不在稳定帧上,esc 没有发"
|
|
1125
|
+
# P68:等 esc 的效果(选择器关掉、回到行列表)在稳定帧上,不用固定 sleep 采样。
|
|
1126
|
+
wait_row picker-esc "esc 后选择器关掉、回到行列表那一行" '! · TEAM_MONITOR_UI' 'team config set TEAM_MONITOR_UI' \
|
|
1127
|
+
|| bad "esc 之后选择器没有关掉(或行列表没有回来)"
|
|
1128
|
+
assert_not "$tmp/$current/picker-esc.txt" " · TEAM_MONITOR_UI" "esc 关掉选择器"
|
|
1129
|
+
assert_has "$tmp/$current/picker-esc.txt" "team config set TEAM_MONITOR_UI" "回到行列表且焦点仍在原来那一行"
|
|
1130
|
+
assert_eq "esc 后契约不变" "$(sha "$(cfg)")" "$esc_sha"
|
|
1131
|
+
assert_eq "esc 后审计不增长" "$(audit_lines)" "$esc_audit"
|
|
1132
|
+
argv_since "$esc0" "$tmp/$current/esc-argv.log"
|
|
1133
|
+
assert_not "$tmp/$current/esc-argv.log" "config set" "esc 的窗口里没有 config set"
|
|
1134
|
+
assert_not "$tmp/$current/esc-argv.log" "set-agent-model" "esc 的窗口里没有席位写"
|
|
1135
|
+
# M59 判据②(真实场景):此刻选择器已被上面那条 esc 关掉 —— 清理点的 esc 必须先确认状态。
|
|
1136
|
+
# 旧写法的裸 esc 在这里会把设置视图整个关掉,之后每段都在错的视图里跑(§38-b 的级联入口)。
|
|
1137
|
+
PTY_TRACE=1 pty_cleanup_esc "回归钉:已关闭的选择器" " · TEAM_MONITOR_UI" > "$tmp/$current/cleanup-trace.txt" 2>&1
|
|
1138
|
+
assert_has "$tmp/$current/cleanup-trace.txt" "action=none" "已关闭的选择器:清理守卫一个键都不发"
|
|
1139
|
+
assert_has "$tmp/$current/cleanup-trace.txt" "reason=not-settled" " 守卫的理由是「标记不在稳定帧上」,不是预算"
|
|
1140
|
+
cap_to cleanup-after
|
|
1141
|
+
assert_has "$tmp/$current/cleanup-after.txt" "╭─ 项目设置" "设置视图还开着(没有裸 esc 打到它身上)"
|
|
1142
|
+
# M59 判据①的 trace 面:一次正常等待的放行点在 trace 里可见(命中 + 稳定确认,轮数自适应)。
|
|
1143
|
+
keys Enter
|
|
1144
|
+
PTY_TRACE=1 wait_picker TEAM_MONITOR_UI 'text · 当前' > "$tmp/$current/wait-trace.txt" 2>&1 \
|
|
1145
|
+
|| bad "trace 探针的选择器没有打开"
|
|
1146
|
+
assert_match "$tmp/$current/wait-trace.txt" 'wait picker TEAM_MONITOR_UI rounds=[0-9]+ settled=1' "正常等待放行在稳定帧上(trace 可见轮数)"
|
|
1147
|
+
leave_picker TEAM_MONITOR_UI || bad "trace 探针的选择器没有关掉"
|
|
1148
|
+
|
|
1149
|
+
# ── (9) 滚轮:条目列表比可视预算长时滚得动(焦点走过的就是列表滚过的) ──
|
|
1150
|
+
wait_no_editor || bad "滚轮用例开始前还有编辑器开着"
|
|
1151
|
+
filter_to TEAM_DEFAULT_MODEL
|
|
1152
|
+
sleep 0.5
|
|
1153
|
+
keys Enter
|
|
1154
|
+
wait_picker TEAM_DEFAULT_MODEL '↓' || bad "长列表选择器没有打开"
|
|
1155
|
+
cap_to wheel-before
|
|
1156
|
+
local before_hidden
|
|
1157
|
+
before_hidden="$(grep -oE '↓[0-9]+' "$tmp/$current/wheel-before.txt" | head -1 | tr -d '↓' || true)"
|
|
1158
|
+
[ -n "$before_hidden" ] && ok "长列表在可视预算之外还有 $before_hidden 个条目(计数行)" \
|
|
1159
|
+
|| bad "长列表没有被窗口截断(滚轮用例前提不成立)"
|
|
1160
|
+
assert_not "$tmp/$current/wheel-before.txt" "…(自由输入)" "滚动前看不到列表末尾的自由输入项"
|
|
1161
|
+
local w
|
|
1162
|
+
for w in $(seq 1 32); do
|
|
1163
|
+
tmux -L "$sock" send-keys -t "$sess:panel" -l "$(printf '\033[<65;20;20M')" 2>/dev/null || true
|
|
1164
|
+
sleep 0.1
|
|
1165
|
+
done
|
|
1166
|
+
# M59: conditional — wait for the wheel's repaint to settle AND the hidden count to drop.
|
|
1167
|
+
local after_hidden=""
|
|
1168
|
+
for w in $(seq 1 20); do
|
|
1169
|
+
cap_to wheel-after
|
|
1170
|
+
after_hidden="$(grep -oE '↓[0-9]+' "$tmp/$current/wheel-after.txt" | head -1 | tr -d '↓' || true)"
|
|
1171
|
+
{ [ -n "$after_hidden" ] && [ "$after_hidden" -lt "$before_hidden" ]; } && break
|
|
1172
|
+
sleep 0.2
|
|
1173
|
+
done
|
|
1174
|
+
if [ -n "$before_hidden" ] && [ "${after_hidden:-0}" -lt "$before_hidden" ]; then
|
|
1175
|
+
ok "滚轮把可见窗口往下推了(↓$before_hidden → ↓${after_hidden:-0})"
|
|
1176
|
+
else
|
|
1177
|
+
bad "滚轮没有推动可见窗口(↓$before_hidden → ↓${after_hidden:-0})"
|
|
1178
|
+
fi
|
|
1179
|
+
assert_has "$tmp/$current/wheel-after.txt" "…(自由输入)" "滚轮一直滚到列表末尾(自由输入项可见)"
|
|
1180
|
+
assert_match "$tmp/$current/wheel-after.txt" "↑[0-9]+" "滚过之后列表上方也有被隐藏的条目"
|
|
1181
|
+
# R2 的入口断言:scratch HOME 的目录(sub2api / openrouter)不在选择器里,也不在读里。
|
|
1182
|
+
assert_not "$tmp/$current/wheel-before.txt" "sub2api" "选择器开屏不列机器目录里的 sub2api(词表只有项目数据)"
|
|
1183
|
+
assert_not "$tmp/$current/wheel-after.txt" "sub2api" "滚到底也不列机器目录里的 sub2api"
|
|
1184
|
+
assert_not "$tmp/$current/wheel-after.txt" "openrouter" "选择器不列机器目录里的 openrouter"
|
|
1185
|
+
( cd "$ROOT" && HOME="$home" bash "$skill/scripts/team" config list --json ) > "$tmp/$current/read-json.json" 2>&1
|
|
1186
|
+
assert_not "$tmp/$current/read-json.json" "sub2api" "同一 scratch HOME 下的读也不含目录 provider"
|
|
1187
|
+
# 硬化自检(M55 第一次复验 FAIL 的回归钉 + M59 判据①/③)……
|
|
1188
|
+
if wait_picker_quick TEAM_DEFAULT_MODEL '这条目不存在-硬线自检'; then
|
|
1189
|
+
bad "wait_picker 只凭标题就放行了(条目标记/稳定帧没起作用)"
|
|
1190
|
+
else
|
|
1191
|
+
ok "wait_picker 要的条目不在稳定帧里时判负(标题命中不算,现场见上面的黄点场景)"
|
|
1192
|
+
fi
|
|
1193
|
+
# 清理守卫把 esc 只打在真开着的选择器上(这里选择器确实开着 → 恰好一个 esc)。
|
|
1194
|
+
leave_picker TEAM_DEFAULT_MODEL || bad "回归钉之后的选择器没有关掉"
|
|
1195
|
+
|
|
1196
|
+
# ── (10) 危险值来自选项:第一次 accept 只给警告(不写、不审计),第二次才带 danger allowance 写入 ──
|
|
1197
|
+
filter_to TEAM_MIN_FREE_SWAP_MB
|
|
1198
|
+
sleep 0.5
|
|
1199
|
+
keys Enter
|
|
1200
|
+
wait_picker TEAM_MIN_FREE_SWAP_MB '0 · 当前' || bad "danger 用例的选择器没有打开"
|
|
1201
|
+
cap_to danger
|
|
1202
|
+
assert_has "$tmp/$current/danger.txt" "0 · 当前" "文件里的 0 在选项里就是「当前」(选项也可以是危险值)"
|
|
1203
|
+
local d_sha d_audit d0
|
|
1204
|
+
d_sha="$(sha "$(cfg)")"; d_audit="$(audit_lines)"; d0="$(argv_count)"
|
|
1205
|
+
pick_option '0 · 当前' || bad "danger 用例里没有 0 条目"
|
|
1206
|
+
if wait_cap danger-warn "危险:"; then ok "选项里的危险值先要一次确认(第一次 accept 不写)"; else bad "危险值的警告没出现"; fi
|
|
1207
|
+
assert_eq "警告后契约不变" "$(sha "$(cfg)")" "$d_sha"
|
|
1208
|
+
assert_eq "警告后审计不增长" "$(audit_lines)" "$d_audit"
|
|
1209
|
+
cap_to danger-warn
|
|
1210
|
+
assert_has "$tmp/$current/danger-warn.txt" " · TEAM_MIN_FREE_SWAP_MB" "警告之后选择器还开着(第二次 accept 在同一处)"
|
|
1211
|
+
argv_since "$d0" "$tmp/$current/danger-argv.log"
|
|
1212
|
+
assert_not "$tmp/$current/danger-argv.log" "--yes" "警告这一次没有 --yes(什么都没写)"
|
|
1213
|
+
keys Enter
|
|
1214
|
+
if wait_cap danger-written "已写入 TEAM_MIN_FREE_SWAP_MB = 0"; then ok "第二次 accept 带 danger allowance 写入"; else bad "危险值的第二次 accept 没有落盘"; fi
|
|
1215
|
+
assert_match "$(argv_log)" 'config set TEAM_MIN_FREE_SWAP_MB 0 --actor panel --yes --fingerprint [0-9a-f]{64} --allow-danger' "写入带 --allow-danger(命令的 danger 例外)"
|
|
1216
|
+
assert_eq "危险值第二次 accept 审计长一行" "$(audit_lines)" "$((d_audit + 1))"
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
scn_choices_schema() {
|
|
1220
|
+
section "choices-schema · 新增 enum 键零代码出现 / 去掉 constraints 可见降级(M55 的核心卖点)"
|
|
1221
|
+
server_up choices-schema "dev verify"
|
|
1222
|
+
conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
|
|
1223
|
+
# scratch CLI:schema 里临时加一个 enum 键 TEAM_ZZZ_MODE —— bundle 就是提交的那份(不重建、不改一行 TS)。
|
|
1224
|
+
local scratch="$tmp/$current/scratch"
|
|
1225
|
+
mkdir -p "$scratch/skills/teamsmith"
|
|
1226
|
+
cp -a "$skill/scripts" "$scratch/skills/teamsmith/scripts"
|
|
1227
|
+
cp -a "$skill/templates" "$skill/references" "$scratch/skills/teamsmith/"
|
|
1228
|
+
python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
|
|
1229
|
+
import sys
|
|
1230
|
+
p = sys.argv[1]
|
|
1231
|
+
s = open(p, encoding='utf-8').read()
|
|
1232
|
+
old = "TEAM_MEETING_ALLOW_USER_ID|"
|
|
1233
|
+
new = "TEAM_ZZZ_MODE|apply|enum|red,blue|plain|red|scratch 夹具:验证 schema 新增 enum 键零改动出现|||workflow\nTEAM_MEETING_ALLOW_USER_ID|"
|
|
1234
|
+
assert old in s, "找不到 schema 尾部锚"
|
|
1235
|
+
open(p, 'w', encoding='utf-8').write(s.replace(old, new, 1))
|
|
1236
|
+
PY
|
|
1237
|
+
cat > "$tmp/$current-scratch-wrapper.sh" <<EOF2
|
|
1238
|
+
#!/usr/bin/env bash
|
|
1239
|
+
printf '%s\n' "\$*" >> "$tmp/$current-scratch-argv.log"
|
|
1240
|
+
exec bash "$scratch/skills/teamsmith/scripts/team" "\$@"
|
|
1241
|
+
EOF2
|
|
1242
|
+
chmod +x "$tmp/$current-scratch-wrapper.sh"
|
|
1243
|
+
# 注意:`VAR=x func` 的赋值只活到函数返回 —— 本场景要起两次面板,所以先赋再调,末尾清掉。
|
|
1244
|
+
P21_CLI="$tmp/$current-scratch-wrapper.sh"
|
|
1245
|
+
start_panel
|
|
1246
|
+
open_view
|
|
1247
|
+
filter_to TEAM_ZZZ_MODE
|
|
1248
|
+
wait_row zzz-row "scratch 新增 enum 键的行(裸键 + red 默认)" 'TEAM_ZZZ_MODE' '未设 · 默认 red' \
|
|
1249
|
+
|| bad "scratch CLI 新增的 enum 键行没有在预算内出现"
|
|
1250
|
+
assert_has "$tmp/$current/zzz-row.txt" "TEAM_ZZZ_MODE" "scratch CLI 新增的 enum 键出现在视图里(无标签→回退裸键)"
|
|
1251
|
+
assert_has "$tmp/$current/zzz-row.txt" "未设 · 默认 red" "新键的默认值来自 schema"
|
|
1252
|
+
keys Enter
|
|
1253
|
+
wait_picker TEAM_ZZZ_MODE 'red · 默认' || bad "新增 enum 键的选择器没有打开(要重建 bundle = 反硬编码判据失败)"
|
|
1254
|
+
cap_to zzz-picker
|
|
1255
|
+
assert_match "$tmp/$current/zzz-picker.txt" '› 保持未设' "未设的新键也以保持未设开头"
|
|
1256
|
+
assert_has "$tmp/$current/zzz-picker.txt" "red · 默认" "constraints 里的 red 是默认条目"
|
|
1257
|
+
assert_has "$tmp/$current/zzz-picker.txt" "blue" "constraints 里的 blue 也在(原序,零代码改动)"
|
|
1258
|
+
# 针是「…(自由输入)」条目形(不是裸词):选择器的页脚帮助行本身就写着「『自由输入』才进编辑器」
|
|
1259
|
+
# (M68 a36a7c0c 起),裸针会把页脚当命中 —— 这条断言关的是封闭域**没有那个条目**。
|
|
1260
|
+
assert_not "$tmp/$current/zzz-picker.txt" "…(自由输入)" "enum 是封闭域:没有自由输入项"
|
|
1261
|
+
leave_picker TEAM_ZZZ_MODE
|
|
1262
|
+
# 去掉 constraints:同一个 bundle 必须可见地退回自由输入并写明原因(不是静默空白框)。
|
|
1263
|
+
python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
|
|
1264
|
+
import sys
|
|
1265
|
+
p = sys.argv[1]
|
|
1266
|
+
s = open(p, encoding='utf-8').read()
|
|
1267
|
+
old = "TEAM_ZZZ_MODE|apply|enum|red,blue|plain|red|scratch 夹具:验证 schema 新增 enum 键零改动出现"
|
|
1268
|
+
new = "TEAM_ZZZ_MODE|apply|enum||plain|red|scratch 夹具:验证 schema 新增 enum 键零改动出现"
|
|
1269
|
+
assert old in s, "找不到刚加的 scratch 行"
|
|
1270
|
+
open(p, 'w', encoding='utf-8').write(s.replace(old, new, 1))
|
|
1271
|
+
PY
|
|
1272
|
+
start_panel
|
|
1273
|
+
open_view
|
|
1274
|
+
filter_to TEAM_ZZZ_MODE
|
|
1275
|
+
wait_row zzz-row2 "第二次起的面板仍显示 scratch 新增键" 'TEAM_ZZZ_MODE' \
|
|
1276
|
+
|| bad "第二次起的面板没有用 scratch CLI(新键不在预算内出现)"
|
|
1277
|
+
assert_has "$tmp/$current/zzz-row2.txt" "TEAM_ZZZ_MODE" "第二次起的面板仍用 scratch CLI(新键还在)"
|
|
1278
|
+
keys Enter
|
|
1279
|
+
wait_editor TEAM_ZZZ_MODE "没有选项集" || bad "去掉 constraints 后没有打开自由输入"
|
|
1280
|
+
cap_to zzz-noconstraints
|
|
1281
|
+
assert_has "$tmp/$current/zzz-noconstraints.txt" "╭─ TEAM_ZZZ_MODE" "enum 没有选项集时打开自由输入"
|
|
1282
|
+
assert_has "$tmp/$current/zzz-noconstraints.txt" "没有选项集" "降级是可见的并写明原因(kind 没有选项集)"
|
|
1283
|
+
leave_editor TEAM_ZZZ_MODE
|
|
1284
|
+
wait_no_editor || bad "降级用例的编辑器没有关干净"
|
|
1285
|
+
P21_CLI=""
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
scn_write() {
|
|
1289
|
+
section "write · 一行 diff / 注释保留 / 两次确认 / 取消 / 非法保留草稿 / danger 两步 / restart 不谎报(B3)"
|
|
1290
|
+
server_up write
|
|
1291
|
+
python3 - "$(cfg)" <<'PY'
|
|
1292
|
+
import re, sys
|
|
1293
|
+
p = sys.argv[1]
|
|
1294
|
+
s = open(p, encoding='utf-8').read()
|
|
1295
|
+
s = re.sub(r'^TEAM_PULSE_NUDGE_GAP=.*$', 'TEAM_PULSE_NUDGE_GAP="900" # 15min', s, count=1, flags=re.M)
|
|
1296
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
1297
|
+
PY
|
|
1298
|
+
conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
|
|
1299
|
+
start_panel
|
|
1300
|
+
open_view
|
|
1301
|
+
cp "$(cfg)" "$tmp/$current/before.cfg"
|
|
1302
|
+
filter_to TEAM_PULSE_NUDGE_GAP
|
|
1303
|
+
sleep 0.5
|
|
1304
|
+
keys Enter
|
|
1305
|
+
# M55:数值键现在先开选择器(建议值 + 自由输入),写路径本身没变 —— 走进自由输入那一项。
|
|
1306
|
+
wait_picker TEAM_PULSE_NUDGE_GAP '· 当前' || bad "写用例的选择器没有打开"
|
|
1307
|
+
pick_option '自由输入' || bad "写用例的选择器里没有自由输入项"
|
|
1308
|
+
wait_editor TEAM_PULSE_NUDGE_GAP || bad "写用例的编辑器没有打开"
|
|
1309
|
+
cap_has "TEAM_PULSE_NUDGE_GAP" editor
|
|
1310
|
+
keys BSpace BSpace BSpace
|
|
1311
|
+
sleep 0.3
|
|
1312
|
+
type_text "1200"
|
|
1313
|
+
sleep 0.4
|
|
1314
|
+
keys Enter
|
|
1315
|
+
if wait_cap confirm "→ 1200"; then ok "第一次 Enter 只给确认行(没写)"; else bad "确认行没有出现(见 confirm.txt)"; fi
|
|
1316
|
+
assert_has "$tmp/$current/confirm.txt" "下一个读取它的进程生效" "确认行说明 apply 的时机"
|
|
1317
|
+
assert_eq "确认阶段契约未变" "$(sha "$(cfg)")" "$(sha "$tmp/$current/before.cfg")"
|
|
1318
|
+
keys Enter
|
|
1319
|
+
if wait_cap written "✓ 已写入 TEAM_PULSE_NUDGE_GAP = 1200"; then
|
|
1320
|
+
ok "第二次 Enter 的回执说已写入"
|
|
1321
|
+
else
|
|
1322
|
+
bad "第二次 Enter 的回执没有出现(见 written.txt)"
|
|
1323
|
+
fi
|
|
1324
|
+
assert_eq "只改了一行" "$(diff "$tmp/$current/before.cfg" "$(cfg)" | grep -c '^[<>]' || true)" "2"
|
|
1325
|
+
assert_eq "注释原样保留" "$(grep -c "^TEAM_PULSE_NUDGE_GAP='1200' # 15min\$" "$(cfg)" || true)" "1"
|
|
1326
|
+
( cd "$ROOT" && bash -n .pi/team/config.sh ) && ok "写入后 bash -n 通过" || bad "写入后 bash -n 失败"
|
|
1327
|
+
assert_match "$(argv_log)" 'config set TEAM_PULSE_NUDGE_GAP 1200 --actor panel --dry-run --fingerprint [0-9a-f]{64}' "wrapper 记录了 --dry-run 调用"
|
|
1328
|
+
assert_match "$(argv_log)" 'config set TEAM_PULSE_NUDGE_GAP 1200 --actor panel --yes --fingerprint [0-9a-f]{64}' "wrapper 记录了写入调用"
|
|
1329
|
+
# Cancel: esc writes nothing and audits nothing.
|
|
1330
|
+
local a0 b0
|
|
1331
|
+
a0="$(audit_lines)"
|
|
1332
|
+
b0="$(sha "$(cfg)")"
|
|
1333
|
+
filter_to TEAM_PULSE_NUDGE_GAP
|
|
1334
|
+
sleep 0.5
|
|
1335
|
+
keys Enter
|
|
1336
|
+
wait_picker TEAM_PULSE_NUDGE_GAP '· 当前' || bad "取消用例的选择器没有打开"
|
|
1337
|
+
pick_option '自由输入' || bad "取消用例的选择器里没有自由输入项"
|
|
1338
|
+
wait_editor TEAM_PULSE_NUDGE_GAP || bad "取消用例的编辑器没有打开"
|
|
1339
|
+
type_text "x"
|
|
1340
|
+
sleep 0.4
|
|
1341
|
+
leave_editor TEAM_PULSE_NUDGE_GAP || bad "取消用例的 esc 发了但编辑器还在"
|
|
1342
|
+
wait_no_editor || bad "取消用例的编辑器没有关干净"
|
|
1343
|
+
assert_eq "取消后契约不变" "$(sha "$(cfg)")" "$b0"
|
|
1344
|
+
assert_eq "取消后审计不增长" "$(audit_lines)" "$a0"
|
|
1345
|
+
assert_eq "取消后没有临时文件" "$(ls "$ROOT/.pi/team/"config.sh.tmp.* 2>/dev/null | wc -l)" "0"
|
|
1346
|
+
# Invalid: TEAM_PULSE_INTERVAL=0 → refusal names the range, sha unchanged, editor keeps the draft.
|
|
1347
|
+
filter_to TEAM_PULSE_INTERVAL
|
|
1348
|
+
sleep 0.5
|
|
1349
|
+
keys Enter
|
|
1350
|
+
wait_picker TEAM_PULSE_INTERVAL '· 当前' || bad "非法值用例的选择器没有打开"
|
|
1351
|
+
pick_option '自由输入' || bad "非法值用例的选择器里没有自由输入项"
|
|
1352
|
+
wait_editor TEAM_PULSE_INTERVAL || bad "非法值用例的编辑器没有打开"
|
|
1353
|
+
keys BSpace BSpace BSpace BSpace
|
|
1354
|
+
sleep 0.3
|
|
1355
|
+
type_text "0"
|
|
1356
|
+
sleep 0.4
|
|
1357
|
+
local b1; b1="$(sha "$(cfg)")"
|
|
1358
|
+
keys Enter
|
|
1359
|
+
if wait_cap invalid "最小 60"; then ok "越界数值的拒绝点名最小 60"; else bad "越界数值的拒绝没出现"; fi
|
|
1360
|
+
assert_has "$tmp/$current/invalid.txt" "不合法" "非法值的回执说明被拒"
|
|
1361
|
+
assert_eq "非法值契约不变" "$(sha "$(cfg)")" "$b1"
|
|
1362
|
+
cap_has "TEAM_PULSE_INTERVAL" draft-kept
|
|
1363
|
+
leave_editor TEAM_PULSE_INTERVAL || bad "非法值用例的 esc 发了但编辑器还在"
|
|
1364
|
+
wait_no_editor || bad "非法值用例的编辑器没有关干净"
|
|
1365
|
+
# Danger: TEAM_MIN_FREE_SWAP_MB=0 needs one more Enter.
|
|
1366
|
+
filter_to TEAM_MIN_FREE_SWAP_MB
|
|
1367
|
+
sleep 0.5
|
|
1368
|
+
keys Enter
|
|
1369
|
+
wait_picker TEAM_MIN_FREE_SWAP_MB '· 当前' || bad "danger 用例的选择器没有打开"
|
|
1370
|
+
pick_option '自由输入' || bad "danger 用例的选择器里没有自由输入项"
|
|
1371
|
+
wait_editor TEAM_MIN_FREE_SWAP_MB || bad "danger 用例的编辑器没有打开"
|
|
1372
|
+
keys BSpace BSpace BSpace BSpace
|
|
1373
|
+
sleep 0.3
|
|
1374
|
+
type_text "0"
|
|
1375
|
+
sleep 0.4
|
|
1376
|
+
local b2; b2="$(sha "$(cfg)")"
|
|
1377
|
+
keys Enter
|
|
1378
|
+
if wait_cap danger "危险:"; then ok "危险值先要一个额外确认"; else bad "危险值的确认提示没出现"; fi
|
|
1379
|
+
assert_eq "危险确认前契约不变" "$(sha "$(cfg)")" "$b2"
|
|
1380
|
+
keys Enter
|
|
1381
|
+
if wait_cap danger-written "已写入 TEAM_MIN_FREE_SWAP_MB = 0"; then
|
|
1382
|
+
ok "第二次 Enter 写入危险值"
|
|
1383
|
+
else
|
|
1384
|
+
bad "危险值的第二次 Enter 没有落盘(见 danger-written.txt)"
|
|
1385
|
+
fi
|
|
1386
|
+
# Restart honesty: the running console keeps its argv while a fresh reader sees the new value.
|
|
1387
|
+
local pid_args_before
|
|
1388
|
+
pid_args_before="$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline" 2>/dev/null || true)"
|
|
1389
|
+
filter_to TEAM_MONITOR_REFRESH
|
|
1390
|
+
sleep 0.5
|
|
1391
|
+
keys Enter
|
|
1392
|
+
wait_picker TEAM_MONITOR_REFRESH '· 当前' || bad "restart 用例的选择器没有打开"
|
|
1393
|
+
pick_option '自由输入' || bad "restart 用例的选择器里没有自由输入项"
|
|
1394
|
+
wait_editor TEAM_MONITOR_REFRESH || bad "restart 用例的编辑器没有打开"
|
|
1395
|
+
keys BSpace
|
|
1396
|
+
sleep 0.3
|
|
1397
|
+
type_text "7"
|
|
1398
|
+
sleep 0.4
|
|
1399
|
+
keys Enter
|
|
1400
|
+
if wait_cap restart-confirm "→ 7"; then ok "restart 值先给确认行"; else bad "restart 的确认行没出现"; fi
|
|
1401
|
+
keys Enter
|
|
1402
|
+
if wait_cap restart "已写入 TEAM_MONITOR_REFRESH = 7"; then
|
|
1403
|
+
ok "restart 值已写入"
|
|
1404
|
+
else
|
|
1405
|
+
bad "restart 值没有写进去(见 restart.txt)"
|
|
1406
|
+
fi
|
|
1407
|
+
assert_eq "运行中的控制台仍拿着旧 argv" "$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline" 2>/dev/null || true)" "$pid_args_before"
|
|
1408
|
+
( cd "$ROOT" && bash "$skill/scripts/team" monitor --json ) > "$tmp/$current/monitor.json" 2>/dev/null
|
|
1409
|
+
assert_has "$tmp/$current/monitor.json" '"refresh_s":7' "下一个读契约的进程看到 7(team monitor --json)"
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
scn_conflict() {
|
|
1413
|
+
section "conflict · 编辑器开着时另一个写者改文件:指纹拒绝、字节是对方的、视图重读、审计一行 conflict(B3)"
|
|
1414
|
+
server_up conflict
|
|
1415
|
+
python3 - "$(cfg)" <<'PY'
|
|
1416
|
+
import re, sys
|
|
1417
|
+
p = sys.argv[1]
|
|
1418
|
+
s = open(p, encoding='utf-8').read()
|
|
1419
|
+
s = re.sub(r'^TEAM_PULSE_NUDGE_GAP=.*$', 'TEAM_PULSE_NUDGE_GAP="900" # 15min', s, count=1, flags=re.M)
|
|
1420
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
1421
|
+
PY
|
|
1422
|
+
start_panel
|
|
1423
|
+
open_view
|
|
1424
|
+
filter_to TEAM_PULSE_NUDGE_GAP
|
|
1425
|
+
sleep 0.5
|
|
1426
|
+
keys Enter
|
|
1427
|
+
wait_picker TEAM_PULSE_NUDGE_GAP '· 当前' || bad "冲突用例的选择器没有打开"
|
|
1428
|
+
pick_option '自由输入' || bad "冲突用例的选择器里没有自由输入项"
|
|
1429
|
+
wait_editor TEAM_PULSE_NUDGE_GAP || bad "冲突用例的编辑器没有打开"
|
|
1430
|
+
keys BSpace BSpace BSpace
|
|
1431
|
+
sleep 0.3
|
|
1432
|
+
type_text "1200"
|
|
1433
|
+
sleep 0.4
|
|
1434
|
+
# The other writer changes the contract (any byte counts) while the editor is open.
|
|
1435
|
+
printf '\n# other writer\n' >> "$(cfg)"
|
|
1436
|
+
local other; other="$(sha "$(cfg)")"
|
|
1437
|
+
keys Enter
|
|
1438
|
+
sleep 2
|
|
1439
|
+
keys Enter
|
|
1440
|
+
# M59: conditional — the conflict receipt must land on a settled frame (was: fixed 2.5s).
|
|
1441
|
+
if wait_cap conflict "指纹不符"; then ok "回执点名指纹冲突"; else bad "冲突的回执没出现"; fi
|
|
1442
|
+
assert_eq "对方的字节被保住" "$(sha "$(cfg)")" "$other"
|
|
1443
|
+
assert_match "$(audit_log)" 'result=conflict actor=panel key=TEAM_PULSE_NUDGE_GAP' "审计增了一行 conflict"
|
|
1444
|
+
# The view reloaded and shows the other writer's value (1200 was never written). M49:行上是标签,
|
|
1445
|
+
# 原始键在 CLI 提示行里(重读后仍与命令对齐)。M59: wait_cap 的字面针用「值 · 立即生效」,
|
|
1446
|
+
# 行标签与值之间的留白宽度交给后面的 assert_match(ERE)去验。
|
|
1447
|
+
if wait_cap reloaded "900 · 立即生效"; then ok "视图重读后显示对方的 900"; else bad "视图重读后没有显示对方的 900"; fi
|
|
1448
|
+
assert_match "$tmp/$current/reloaded.txt" '重复提醒间隔 +900' "视图重读后显示对方的 900(标签 + 值)"
|
|
1449
|
+
assert_not "$tmp/$current/reloaded.txt" "重复提醒间隔 +1200" "视图没有显示未写入的 1200"
|
|
1450
|
+
assert_has "$tmp/$current/reloaded.txt" "team config set TEAM_PULSE_NUDGE_GAP" "视图仍点名原始键(照敲命令用)"
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
scn_seats() {
|
|
1454
|
+
section "seats · 来源三态 / picker / 一 token diff / 移除回退 / 运行中的席位不变(B4)"
|
|
1455
|
+
server_up seats "dev verify dev2"
|
|
1456
|
+
python3 - "$(cfg)" <<'PY'
|
|
1457
|
+
import re, sys
|
|
1458
|
+
p = sys.argv[1]
|
|
1459
|
+
s = open(p, encoding='utf-8').read()
|
|
1460
|
+
s = s.replace('TEAM_AGENT_MODELS=""', 'TEAM_AGENT_MODELS="dev=deepseek/deepseek-flash"')
|
|
1461
|
+
# model-id-shape R1:known 里必须有一个三段 id(pm 席位)——席位选择器要能列出并选中它。
|
|
1462
|
+
s = re.sub(r'^TEAM_PM_MODEL=.*$', 'TEAM_PM_MODEL="openrouter/amazon/nova-lite-v1"', s, count=1, flags=re.M)
|
|
1463
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
1464
|
+
PY
|
|
1465
|
+
mkdir -p "$state"
|
|
1466
|
+
printf 'model=xai/grok-4.6\n' > "$state/dev.env"
|
|
1467
|
+
printf 'model=deepseek/deepseek-flash\n' > "$state/verify.env"
|
|
1468
|
+
printf 'model=kimi-coding/k3-256k\nmodel_src=explicit\n' > "$state/dev2.env"
|
|
1469
|
+
start_panel
|
|
1470
|
+
open_view
|
|
1471
|
+
filter_to verify
|
|
1472
|
+
wait_row seats-verify "席位 verify 行显示配置来源" 'verify' 'deepseek/deepseek-flash · 配置' \
|
|
1473
|
+
|| bad "席位 verify 的行没有在预算内出现"
|
|
1474
|
+
assert_match "$tmp/$current/seats-verify.txt" 'verify +deepseek/deepseek-flash · 配置' "配置解析 → 配置"
|
|
1475
|
+
filter_to dev2
|
|
1476
|
+
wait_row seats-dev2 "席位 dev2 行显示显式来源" 'dev2' 'kimi-coding/k3-256k · 显式' \
|
|
1477
|
+
|| bad "席位 dev2 的行没有在预算内出现"
|
|
1478
|
+
assert_match "$tmp/$current/seats-dev2.txt" 'dev2 +kimi-coding/k3-256k · 显式' "显式记录 → 显式"
|
|
1479
|
+
filter_to dev
|
|
1480
|
+
wait_row seats "席位 dev 行显示历史记录来源" 'dev' 'xai/grok-4.6 · 历史记录' \
|
|
1481
|
+
|| bad "席位 dev 的行没有在预算内出现"
|
|
1482
|
+
assert_match "$tmp/$current/seats.txt" 'dev +xai/grok-4.6 · 历史记录' "记录与配置不一致 → 历史记录 + 记录的模型"
|
|
1483
|
+
( cd "$ROOT" && bash "$skill/scripts/team" roster ) > "$tmp/$current/roster.txt" 2>/dev/null
|
|
1484
|
+
assert_match "$tmp/$current/roster.txt" 'xai/grok-4\.6·历史记录' "team roster 的标签与 models 块同口径"
|
|
1485
|
+
# Focus the dev seat row (its line carries the record's model) and open the picker.
|
|
1486
|
+
# M59: Enter only follows a successful walk (focus_row tolerates the row set being replaced).
|
|
1487
|
+
sleep 0.3
|
|
1488
|
+
if focus_row 'dev +xai/grok-4.6'; then
|
|
1489
|
+
keys Enter
|
|
1490
|
+
else
|
|
1491
|
+
bad "没能把焦点移到 dev 席位行"
|
|
1492
|
+
fi
|
|
1493
|
+
# M59: conditional — wait for the seat picker on a settled frame (title + the three-segment known entry).
|
|
1494
|
+
pty_wait_frame "$tmp/$current/picker.txt" "seat picker dev" "选择 dev 的模型" "openrouter/amazon/nova-lite-v1" \
|
|
1495
|
+
|| bad "seat picker 没有打开(标题或已知模型不在稳定帧上)"
|
|
1496
|
+
assert_match "$tmp/$current/picker.txt" '选择 dev 的模型' "picker 打开并点名席位"
|
|
1497
|
+
assert_has "$tmp/$current/picker.txt" "openrouter/amazon/nova-lite-v1" "picker 列出命令报告的三段已知模型"
|
|
1498
|
+
assert_has "$tmp/$current/picker.txt" "kimi-coding/k3-256k" "picker 同时列出记录来源的已知模型"
|
|
1499
|
+
assert_has "$tmp/$current/picker.txt" "-(移除覆盖,回退默认)" "picker 有移除项"
|
|
1500
|
+
assert_has "$tmp/$current/picker.txt" "自由输入" "picker 有自由输入项"
|
|
1501
|
+
# Choose the three-segment known model that differs from the seat's displayed one, then confirm through the editor.
|
|
1502
|
+
pick_option 'openrouter/amazon/nova-lite-v1' || bad "picker 里没有 openrouter/amazon/nova-lite-v1"
|
|
1503
|
+
wait_editor dev || bad "seat 编辑器没有打开"
|
|
1504
|
+
sleep 0.3
|
|
1505
|
+
local line_before; line_before="$(grep '^TEAM_AGENT_MODELS=' "$(cfg)")"
|
|
1506
|
+
keys Enter
|
|
1507
|
+
if wait_cap seat-confirm "确认席位 dev"; then ok "确认行点名席位"; else bad "确认行没有出现"; fi
|
|
1508
|
+
assert_has "$tmp/$current/seat-confirm.txt" "下次 dispatch/resume 生效" "确认行说明下次 spawn 生效"
|
|
1509
|
+
keys Enter
|
|
1510
|
+
if wait_cap seat-written "✓ 已写入席位 dev = "; then
|
|
1511
|
+
cap_to seat-written
|
|
1512
|
+
assert_match "$tmp/$current/seat-written.txt" '✓ 已写入席位 dev = openrouter/amazon/nova-lite-v1 · 下次 dispatch/resume 生效' "写入回执带完整三段 id(不是最后一段)"
|
|
1513
|
+
else
|
|
1514
|
+
bad "席位写入的回执没有出现(见 seat-written.txt)"
|
|
1515
|
+
fi
|
|
1516
|
+
assert_match "$(cfg)" '^TEAM_AGENT_MODELS=.*dev=openrouter/amazon/nova-lite-v1' "契约里 dev 的 token 落盘(完整三段 id)"
|
|
1517
|
+
assert_eq "契约行只改了一行" "$(diff <(printf '%s\n' "$line_before") <(grep '^TEAM_AGENT_MODELS=' "$(cfg)") | grep -c '^[<>]' || true)" "2"
|
|
1518
|
+
assert_match "$(argv_log)" 'config set-agent-model dev .* --actor panel --dry-run --fingerprint [0-9a-f]{64}' "wrapper 记录了 set-agent-model 的 --dry-run"
|
|
1519
|
+
assert_match "$(argv_log)" 'config set-agent-model dev .* --actor panel --yes --fingerprint [0-9a-f]{64}' "wrapper 记录了 set-agent-model 的写入"
|
|
1520
|
+
assert_eq "席位记录 state/dev.env 未被碰" "$(cat "$state/dev.env")" "model=xai/grok-4.6"
|
|
1521
|
+
# Removal: the picker's `-` row falls back to TEAM_DEFAULT_MODEL.
|
|
1522
|
+
filter_to dev
|
|
1523
|
+
# M55/M59:刚写过的席位让视图异步重读合同(行集会被整批替换、甚至整段空缺等块重建)。
|
|
1524
|
+
# focus_row 自己容忍这个窗口;Enter 只跟在成功的走位后(盲发 Enter 实测打到 dev2 行)。
|
|
1525
|
+
sleep 0.3
|
|
1526
|
+
if focus_row 'dev +xai/grok-4.6'; then
|
|
1527
|
+
keys Enter
|
|
1528
|
+
else
|
|
1529
|
+
bad "移除前没能把焦点移到 dev 席位行"
|
|
1530
|
+
fi
|
|
1531
|
+
pty_wait_frame - "seat picker dev(移除用例)" "选择 dev 的模型" || bad "移除用例的 seat picker 没有打开"
|
|
1532
|
+
pick_option '-(移除覆盖' || bad "picker 里没有移除项"
|
|
1533
|
+
wait_editor dev || bad "移除用例的 seat 编辑器没有打开"
|
|
1534
|
+
keys Enter
|
|
1535
|
+
sleep 2
|
|
1536
|
+
keys Enter
|
|
1537
|
+
if wait_cap removed "已移除席位 dev 的覆盖"; then
|
|
1538
|
+
ok "移除回执说回到默认"
|
|
1539
|
+
else
|
|
1540
|
+
bad "移除回执没有出现(见 removed.txt)"
|
|
1541
|
+
fi
|
|
1542
|
+
assert_eq "dev 的 token 离开契约行" "$(grep '^TEAM_AGENT_MODELS=' "$(cfg)")" "TEAM_AGENT_MODELS=''"
|
|
1543
|
+
# A shapeless model is refused by the owning command (free-text row → deepseek-flash).
|
|
1544
|
+
local sha_b; sha_b="$(sha "$(cfg)")"
|
|
1545
|
+
# 刚写过的席位:视图会重读合同(行上的“覆盖”变成“回退默认”)。等它落定再走位,否则走位可能在
|
|
1546
|
+
# 一个正在被替换的行集上做过(实测:拿旧帧算出 40 步,新帧一到就冲过 dev 行)。
|
|
1547
|
+
wait_cap removed-fresh 'xai/grok-4.6 · 历史记录 · 回退默认' || bad "移除后视图没有重读合同"
|
|
1548
|
+
filter_to dev
|
|
1549
|
+
sleep 0.3
|
|
1550
|
+
if focus_row 'dev +xai/grok-4.6'; then
|
|
1551
|
+
keys Enter
|
|
1552
|
+
else
|
|
1553
|
+
bad "拒绝用例没能把焦点移到 dev 席位行"
|
|
1554
|
+
fi
|
|
1555
|
+
pty_wait_frame - "seat picker dev(拒绝用例)" "选择 dev 的模型" || bad "拒绝用例的 seat picker 没有打开"
|
|
1556
|
+
pick_option '自由输入' || bad "picker 里没有自由输入项"
|
|
1557
|
+
wait_editor dev || bad "自由输入用例的 seat 编辑器没有打开"
|
|
1558
|
+
type_text "deepseek-flash"
|
|
1559
|
+
sleep 0.3
|
|
1560
|
+
keys Enter
|
|
1561
|
+
if wait_cap shapeless "provider/model"; then ok "没有 provider 的模型被命令拒绝"; else bad "拒绝回执没有出现"; fi
|
|
1562
|
+
leave_editor dev || bad "拒绝用例的 esc 发了但 seat 编辑器还在"
|
|
1563
|
+
assert_eq "被拒后契约 sha 不变" "$(sha "$(cfg)")" "$sha_b"
|
|
1564
|
+
# The running seat's window keeps its model; the next dispatch would use the new one.
|
|
1565
|
+
local sha_b; sha_b="$(sha "$(cfg)")"
|
|
1566
|
+
# P24 起 dispatch 要求任务书声明锚(change: 或 anchor:)——夹具的 P22-x 也补上,否则
|
|
1567
|
+
# `dispatch --print` 在渲染启动命令前就被拒(与面板无关的夹具漂移)。
|
|
1568
|
+
cat > "$ROOT/docs/team/tasks/P22-x.md" <<'BRIEF'
|
|
1569
|
+
# P22-x fixture brief
|
|
1570
|
+
|
|
1571
|
+
```
|
|
1572
|
+
task: P22-x
|
|
1573
|
+
agent: dev
|
|
1574
|
+
issue: -
|
|
1575
|
+
change: -
|
|
1576
|
+
specs: -
|
|
1577
|
+
phase: apply
|
|
1578
|
+
deps: -
|
|
1579
|
+
anchor: none (infra) — panel-p21 夹具:只为 dispatch --print 渲染启动命令
|
|
1580
|
+
status: todo
|
|
1581
|
+
budget: -
|
|
1582
|
+
```
|
|
1583
|
+
|
|
1584
|
+
body
|
|
1585
|
+
BRIEF
|
|
1586
|
+
tmux -L "$sock" new-window -d -t "$sess" -n dev -c "$ROOT" 'sleep 900'
|
|
1587
|
+
# A stub `pi` so `dispatch --print` can render the command it would run.
|
|
1588
|
+
printf '#!/bin/sh\nexit 0\n' > "$tmp/$current-pi.sh"; chmod +x "$tmp/$current-pi.sh"
|
|
1589
|
+
( cd "$ROOT" && bash "$skill/scripts/team" config set TEAM_PI_BIN "$tmp/$current-pi.sh" --yes ) >/dev/null 2>&1
|
|
1590
|
+
sleep 0.5
|
|
1591
|
+
local win_before; win_before="$(tmux -L "$sock" list-panes -t "$sess:dev" -F '#{pane_start_command}' 2>/dev/null)"
|
|
1592
|
+
( cd "$ROOT" && bash "$skill/scripts/team" config set-agent-model dev kimi-coding/k3-256k --yes ) >/dev/null 2>&1
|
|
1593
|
+
sleep 0.5
|
|
1594
|
+
assert_eq "运行中的 dev 窗口参数不变" "$(tmux -L "$sock" list-panes -t "$sess:dev" -F '#{pane_start_command}' 2>/dev/null)" "$win_before"
|
|
1595
|
+
( cd "$ROOT" && bash "$skill/scripts/team" dispatch dev P22-x "$ROOT/docs/team/tasks/P22-x.md" --print ) > "$tmp/$current/dispatch.txt" 2>&1
|
|
1596
|
+
local wtcmd
|
|
1597
|
+
wtcmd="$(sed -n 's/^ 先由 PM 建: //p' "$tmp/$current/dispatch.txt" | head -1)"
|
|
1598
|
+
[ -n "$wtcmd" ] && eval "$wtcmd" >/dev/null 2>&1
|
|
1599
|
+
( cd "$ROOT" && bash "$skill/scripts/team" dispatch dev P22-x "$ROOT/docs/team/tasks/P22-x.md" --print ) > "$tmp/$current/dispatch.txt" 2>&1
|
|
1600
|
+
assert_has "$tmp/$current/dispatch.txt" "--model k3-256k" "下一次 dispatch --print 用新模型(--provider kimi-coding --model k3-256k)"
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
scn_readonly() {
|
|
1604
|
+
section "readonly · 契约与审计不动 / 只读导航与取消的编辑什么都不写(B5 的只读纪律)"
|
|
1605
|
+
server_up readonly
|
|
1606
|
+
start_panel
|
|
1607
|
+
local h_docs h_cfg a0
|
|
1608
|
+
h_docs="$(tree_hash docs)"
|
|
1609
|
+
h_cfg="$(sha "$(cfg)")"
|
|
1610
|
+
a0="$(audit_lines)"
|
|
1611
|
+
keys 2; sleep 0.5
|
|
1612
|
+
keys 4; sleep 0.5
|
|
1613
|
+
keys 3; sleep 0.5
|
|
1614
|
+
keys 1; sleep 0.5
|
|
1615
|
+
open_view
|
|
1616
|
+
filter_to TEAM_GATES
|
|
1617
|
+
sleep 0.5
|
|
1618
|
+
keys Enter
|
|
1619
|
+
wait_editor TEAM_GATES "没有选项集" || bad "readonly 用例的编辑器没有打开"
|
|
1620
|
+
type_text "changed"
|
|
1621
|
+
sleep 0.3
|
|
1622
|
+
# The three unwind escs are the test action, but each is still state-checked (M59): a drifted
|
|
1623
|
+
# scene gets a named red instead of a blind key closing whatever happens to be on screen.
|
|
1624
|
+
leave_editor TEAM_GATES || bad "readonly:编辑器 esc 后还在"
|
|
1625
|
+
pty_key_when "readonly 退回浮层" '╭─ 项目设置' Escape || bad "readonly:esc 前设置视图不在屏幕上"
|
|
1626
|
+
sleep 0.6
|
|
1627
|
+
pty_key_when "readonly 关闭浮层" '› 项目设置' Escape || bad "readonly:第二次 esc 前浮层不在屏幕上"
|
|
1628
|
+
sleep 0.6
|
|
1629
|
+
assert_eq "契约没被控制台碰过" "$(sha "$(cfg)")" "$h_cfg"
|
|
1630
|
+
assert_eq "审计没长" "$(audit_lines)" "$a0"
|
|
1631
|
+
assert_eq "docs 没被动" "$(tree_hash docs)" "$h_docs"
|
|
1632
|
+
if [ -d "$state/outbox" ]; then
|
|
1633
|
+
assert_eq "outbox 目录没有新增条目" "$(find "$state/outbox" -type f | wc -l)" "0"
|
|
1634
|
+
else
|
|
1635
|
+
ok "outbox 目录不存在(控制台没有创建它)"
|
|
1636
|
+
fi
|
|
1637
|
+
# The only `team` invocations the wrapper logged are reads (the block readers).
|
|
1638
|
+
assert_not "$(argv_log)" "config set" "wrapper 里没有 config set(这一轮没有写动作)"
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
# ---------------------------------------------------------------- P30(settings-view-groups)
|
|
1642
|
+
|
|
1643
|
+
# P32:分组标题是**分节线**(`│ ── 身份与账本布局 ─────… │`),不再是缩进的文本行 —— 所以
|
|
1644
|
+
# 「这一行恰好等于标题词」不再是标题的判据。这里找的是带分节线的标题行;返回行号(0 = 找不到)。
|
|
1645
|
+
cap_line_heading() { # <file> <label>
|
|
1646
|
+
python3 - "$1" "$2" <<'PY'
|
|
1647
|
+
import sys
|
|
1648
|
+
lines = open(sys.argv[1], encoding='utf-8', errors='replace').read().split('\n')
|
|
1649
|
+
label = sys.argv[2]
|
|
1650
|
+
for i, line in enumerate(lines):
|
|
1651
|
+
if line.startswith('\u2502') and label in line and '\u2500' in line:
|
|
1652
|
+
print(i + 1)
|
|
1653
|
+
break
|
|
1654
|
+
else:
|
|
1655
|
+
print(0)
|
|
1656
|
+
PY
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
# P32:标题可辨认 + 组间可见分隔(两条断言合一)。标题行必须是分节线,且它的上一行是上一组的
|
|
1660
|
+
# 最后一条、下一行是本组的第一条 —— 标题自己承担分隔,不另花一行。
|
|
1661
|
+
assert_heading_rule() { # <file> <label> <上一组最后一条> <本组第一条> <message>
|
|
1662
|
+
local msg="$5" out rc
|
|
1663
|
+
out="$(python3 - "$1" "$2" "$3" "$4" <<'PY'
|
|
1664
|
+
import sys
|
|
1665
|
+
cap, label, before, after = sys.argv[1:5]
|
|
1666
|
+
lines = open(cap, encoding='utf-8', errors='replace').read().split('\n')
|
|
1667
|
+
hit = [i for i, l in enumerate(lines) if l.startswith('\u2502') and label in l and '\u2500' in l]
|
|
1668
|
+
if not hit:
|
|
1669
|
+
print('%r 不是分节线标题(没有带 ─ 的标题行)' % label); sys.exit(1)
|
|
1670
|
+
i = hit[0]
|
|
1671
|
+
prev = lines[i - 1] if i > 0 else ''
|
|
1672
|
+
nxt = lines[i + 1] if i + 1 < len(lines) else ''
|
|
1673
|
+
if before not in prev:
|
|
1674
|
+
print('标题上一行不是上一组的最后一条(%r 不在 %r)' % (before, prev.strip('\u2502 ').rstrip())); sys.exit(1)
|
|
1675
|
+
if after not in nxt:
|
|
1676
|
+
print('标题下一行不是本组的第一条(%r 不在 %r)' % (after, nxt.strip('\u2502 ').rstrip())); sys.exit(1)
|
|
1677
|
+
print('%s 是分节线标题,夹在 %s 与 %s 之间' % (label, before, after))
|
|
1678
|
+
PY
|
|
1679
|
+
)"
|
|
1680
|
+
rc=$?
|
|
1681
|
+
if [ "$rc" -eq 0 ]; then ok "$msg($out)"; else bad "$msg:$out"; fi
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
# P32:把设置视图的**可见**面板缩到 <cols>×<rows>(会话是 window-size manual,所以窗口随我们),
|
|
1685
|
+
# 并等到 tmux 报出这个 pane 高度 —— 之后 capture-pane(不带 -S)的每一行就是屏幕上的每一行。
|
|
1686
|
+
resize_panel() { # <cols> <rows>
|
|
1687
|
+
tmux -L "$sock" resize-window -t "$sess:panel" -x "$1" -y "$2" 2>/dev/null || true
|
|
1688
|
+
local i h
|
|
1689
|
+
for i in $(seq 1 25); do
|
|
1690
|
+
h="$(tmux -L "$sock" display-message -p -t "$sess:panel" '#{pane_height}' 2>/dev/null)"
|
|
1691
|
+
[ "$h" = "$2" ] && return 0
|
|
1692
|
+
sleep 0.2
|
|
1693
|
+
done
|
|
1694
|
+
return 1
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
cap_visible_to() { tmux -L "$sock" capture-pane -p -t "$sess:panel" > "$tmp/$current/${1:-visible}.txt" 2>/dev/null; }
|
|
1698
|
+
|
|
1699
|
+
# P32:等新行高下的**完整**一帧。只等「settle」不够:缩完 tmux 立刻按新尺寸裁剪旧帧,而 Ink 还没重画,
|
|
1700
|
+
# 两张连续捕获可能一致却是旧内容。所以判据是结构:可见帧行数等于新 pane 高度、且能认出卡片的
|
|
1701
|
+
# 上/下边框与键栏(settings_window_stats 的两个非 -1),并把那帧写进 <cap name>.txt。
|
|
1702
|
+
wait_settings_frame() { # <rows> <cap name> → 0 = 帧按新行高画完整
|
|
1703
|
+
local rows="$1" name="${2:-height}" i a b st lines r u d g
|
|
1704
|
+
for i in $(seq 1 30); do
|
|
1705
|
+
a="$(cap_now | sed -E 's/[0-9]{2}:[0-9]{2}:[0-9]{2}/HH:MM:SS/g')"
|
|
1706
|
+
sleep 0.25
|
|
1707
|
+
b="$(cap_now)"
|
|
1708
|
+
[ "$(printf '%s\n' "$b" | sed -E 's/[0-9]{2}:[0-9]{2}:[0-9]{2}/HH:MM:SS/g')" = "$a" ] || continue
|
|
1709
|
+
lines="$(printf '%s\n' "$b" | wc -l)"
|
|
1710
|
+
printf '%s\n' "$b" > "$tmp/$current/$name.txt"
|
|
1711
|
+
st="$(settings_window_stats "$tmp/$current/$name.txt")"
|
|
1712
|
+
IFS=' ' read -r r u d g <<<"$st"
|
|
1713
|
+
[ "$lines" = "$rows" ] || continue
|
|
1714
|
+
[ "${r:-0}" -ge 0 ] && [ "${g:-0}" -ge 0 ] && return 0
|
|
1715
|
+
done
|
|
1716
|
+
return 1
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
# P32:一帧里视图的**行数记账**:窗口里画出的行数、上下两条隐藏计数、以及内容结尾(卡片下边框)到
|
|
1720
|
+
# 键栏之间的空白行数。打印 "<rows> <hidden_up> <hidden_down> <gap>"(认不出来打印 "-1 -1 -1 -1")。
|
|
1721
|
+
settings_window_stats() { # <capture file>
|
|
1722
|
+
python3 - "$1" <<'PY'
|
|
1723
|
+
import re, sys
|
|
1724
|
+
lines = open(sys.argv[1], encoding='utf-8', errors='replace').read().split('\n')
|
|
1725
|
+
top = next((i for i, l in enumerate(lines) if l.lstrip().startswith('\u256d\u2500 项目设置') or l.lstrip().startswith('\u256d\u2500 Project settings')), -1)
|
|
1726
|
+
bot = next((i for i, l in enumerate(lines) if i > top and l.lstrip().startswith('\u2570')), -1)
|
|
1727
|
+
foot = next((i for i, l in enumerate(lines) if i > bot and ('\u5199\u4fe1' in l or 'compose' in l)), -1)
|
|
1728
|
+
if top < 0 or bot < 0 or foot < 0:
|
|
1729
|
+
print('-1 -1 -1 -1'); sys.exit(0)
|
|
1730
|
+
interior = lines[top + 1:bot]
|
|
1731
|
+
audit = next((i for i, l in enumerate(interior) if '\u5ba1\u8ba1\uff08\u6700\u8fd1\uff09' in l or 'Audit' in l), -1)
|
|
1732
|
+
if audit < 3:
|
|
1733
|
+
print('-1 -1 -1 -1'); sys.exit(0)
|
|
1734
|
+
# 尾部固定占位:CLI 提示行、空行、审计标题(audit-2 起),所以行只可能在 audit-2 之前。
|
|
1735
|
+
tail_start = audit - 2
|
|
1736
|
+
rows = up = down = 0
|
|
1737
|
+
for i, l in enumerate(interior):
|
|
1738
|
+
b = l.strip('\u2502 ').rstrip()
|
|
1739
|
+
m = re.fullmatch(r'([\u2191\u2193])(\d+)', b)
|
|
1740
|
+
if m:
|
|
1741
|
+
if m.group(1) == '\u2191': up = int(m.group(2))
|
|
1742
|
+
else: down = int(m.group(2))
|
|
1743
|
+
continue
|
|
1744
|
+
if i >= tail_start or not b or '\u2500' in b:
|
|
1745
|
+
continue
|
|
1746
|
+
rows += 1
|
|
1747
|
+
print('%d %d %d %d' % (rows, up, down, foot - bot - 1))
|
|
1748
|
+
PY
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
# 含 <text> 的第一行行号(0 = 找不到)。
|
|
1752
|
+
cap_line_of() { # <file> <substring>
|
|
1753
|
+
local n
|
|
1754
|
+
n="$(grep -nF -- "$2" "$1" 2>/dev/null | head -1 | cut -d: -f1)"
|
|
1755
|
+
printf '%s\n' "${n:-0}"
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
# P68/fixture-waits-for-landed-reads:等含 <needle> 的那一行行号**超过** <阈值>(滚轮把光标推下去)。
|
|
1759
|
+
# 这是交互重绘的等待(不是异步读),但守同一套纪律:计数轮 + 上界 + 耗尽时一行归因(等待名/轮数/最后读数)。
|
|
1760
|
+
# 上界 15 轮 ×(轮询 0.25s + 稳定确认 0.25s)≈ 7s;原来是一个固定 sleep + 单次采样。
|
|
1761
|
+
wait_line_gt() { # <name> <label> <needle> <threshold>
|
|
1762
|
+
local _name="$1" _label="$2" _needle="$3" _thr="$4" _i=1 _c _line
|
|
1763
|
+
while [ "$_i" -le 15 ]; do
|
|
1764
|
+
_c="$(cap)"
|
|
1765
|
+
printf '%s\n' "$_c" > "$tmp/$current/$_name.txt"
|
|
1766
|
+
_line="$(cap_line_of "$tmp/$current/$_name.txt" "$_needle")"
|
|
1767
|
+
if [ "${_line:-0}" -gt "$_thr" ] && pty_frame_settled "$_c"; then return 0; fi
|
|
1768
|
+
sleep 0.25
|
|
1769
|
+
_i=$((_i + 1))
|
|
1770
|
+
done
|
|
1771
|
+
printf ' \033[33m·\033[0m 等待超时:%s(%s 轮/%s;等 [%s] 的行号 > %s,最后读到 %s)\n' \
|
|
1772
|
+
"$_label" "$((_i - 1))" 15 "$_needle" "$_thr" "${_line:-?}" >&2
|
|
1773
|
+
return 1
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
# The same capture with SGR runs (`capture-pane -e`): tmux restores each cell's truecolor
|
|
1777
|
+
# sequence, which is what the tone assertion reads (without rebuilding the bundle by hand).
|
|
1778
|
+
cap_e_to() { tmux -L "$sock" capture-pane -p -e -t "$sess:panel" > "$tmp/$current/${1:-cap-e}.txt" 2>/dev/null; }
|
|
1779
|
+
|
|
1780
|
+
assert_no_match() { # <file> <ere> <message>
|
|
1781
|
+
grep -qE -- "$2" "$1" 2>/dev/null && bad "$3(不该匹配 [$2])" || ok "$3"
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
# P30/D4 tone: the badge's colour must be the class's tone **and** the value beside it must stay in
|
|
1785
|
+
# the palette's text tone. Colours come from the bundle's own `--palette` (nothing hardcoded; the
|
|
1786
|
+
# active theme is identified by which palette's text tone the value's colour is).
|
|
1787
|
+
assert_badge_tone() { # <capture-e file> <row label> <badge word> <tone key> <message>
|
|
1788
|
+
local msg="$5" out rc
|
|
1789
|
+
out="$(python3 - "$1" "$2" "$3" "$4" "$tmp/$current/palette.json" <<'PY'
|
|
1790
|
+
import json, re, sys
|
|
1791
|
+
cap_file, label, badge, tone_key, palette_file = sys.argv[1:6]
|
|
1792
|
+
SGR = re.compile(r'\x1b\[[0-9;]*m')
|
|
1793
|
+
|
|
1794
|
+
def runs(line):
|
|
1795
|
+
out, last, pos = [], '', 0
|
|
1796
|
+
for m in SGR.finditer(line):
|
|
1797
|
+
if line[pos:m.start()]:
|
|
1798
|
+
out.append((last, line[pos:m.start()]))
|
|
1799
|
+
last = m.group(0)
|
|
1800
|
+
pos = m.end()
|
|
1801
|
+
if line[pos:]:
|
|
1802
|
+
out.append((last, line[pos:]))
|
|
1803
|
+
return out
|
|
1804
|
+
|
|
1805
|
+
def color(sgr):
|
|
1806
|
+
m = re.search(r'38;2;(\d+);(\d+);(\d+)', sgr)
|
|
1807
|
+
return '#%02x%02x%02x' % tuple(int(x) for x in m.groups()) if m else 'default'
|
|
1808
|
+
|
|
1809
|
+
line = next((l for l in open(cap_file, encoding='utf-8', errors='replace') if label in l and badge in l), '')
|
|
1810
|
+
if not line:
|
|
1811
|
+
print('找不到同时含 %r 与 %r 的行' % (label, badge)); sys.exit(1)
|
|
1812
|
+
rs = runs(line)
|
|
1813
|
+
li = next((i for i, (_, t) in enumerate(rs) if label in t), None)
|
|
1814
|
+
bi = next((i for i, (_, t) in enumerate(rs) if badge in t), None)
|
|
1815
|
+
if li is None or bi is None or bi <= li:
|
|
1816
|
+
print('run 结构不对(label=%s badge=%s)' % (li, bi)); sys.exit(1)
|
|
1817
|
+
vi = next((i for i in range(li + 1, bi) if rs[i][1].strip()), bi)
|
|
1818
|
+
value_color, badge_color = color(rs[vi][0]), color(rs[bi][0])
|
|
1819
|
+
palettes = json.load(open(palette_file, encoding='utf-8'))['palettes']
|
|
1820
|
+
active = next((p for p in palettes.values() if p['tones']['text'].lower() == value_color), None)
|
|
1821
|
+
if active is None:
|
|
1822
|
+
print('值的颜色 %s 不在任何调色板的 text tone 里' % value_color); sys.exit(1)
|
|
1823
|
+
want = active['tones'][tone_key].lower()
|
|
1824
|
+
if badge_color != want:
|
|
1825
|
+
print('badge 颜色 %s ≠ %s tone %s(调色板 %s)' % (badge_color, tone_key, want, active['name'])); sys.exit(1)
|
|
1826
|
+
print('%s badge=%s value=%s(text)palette=%s' % (badge, badge_color, value_color, active['name']))
|
|
1827
|
+
PY
|
|
1828
|
+
)"
|
|
1829
|
+
rc=$?
|
|
1830
|
+
if [ "$rc" -eq 0 ]; then ok "$msg($out)"; else bad "$msg:$out"; fi
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
# 把焦点走到列表末尾(窗口跟着焦点走),让尾部的「未分组」与席位块同一屏 —— 这两样都在
|
|
1834
|
+
# 「分组之后」,是场景要看的相对顺序。
|
|
1835
|
+
walk_to_tail() { # <capture name>
|
|
1836
|
+
local i attempt name="${1:-tail}" hit=0
|
|
1837
|
+
for attempt in $(seq 1 6); do
|
|
1838
|
+
for i in $(seq 1 140); do keys Down; sleep 0.01; done
|
|
1839
|
+
for i in $(seq 1 12); do
|
|
1840
|
+
cap_to "$name"
|
|
1841
|
+
if grep -q '席位' "$tmp/$current/$name.txt" && grep -q '›' "$tmp/$current/$name.txt"; then hit=1; break; fi
|
|
1842
|
+
sleep 0.4 # 块被 TTL 重读换成摘要行(已知现象)→ 等它回来,必要时再走一轮
|
|
1843
|
+
done
|
|
1844
|
+
[ "$hit" = 1 ] && break
|
|
1845
|
+
done
|
|
1846
|
+
return 0
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
scn_groups() {
|
|
1850
|
+
section "groups · 记录带 group、视图按功能域分组(P30/D1-D3):功能域标题/读取顺序/schema 序/未分组降级/无键→域表/徽章词+tone"
|
|
1851
|
+
server_up groups
|
|
1852
|
+
# 契约里手加一个 schema 不认识的键:它必须落在可见的「未分组」组里(和缺 token 的 schema 行同一条降级路径)。
|
|
1853
|
+
printf 'TEAM_HAND_ADDED="hand"\n' >> "$(cfg)"
|
|
1854
|
+
conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
|
|
1855
|
+
start_panel
|
|
1856
|
+
local bundle_sha; bundle_sha="$(sha "$panel")"
|
|
1857
|
+
"$js" "$panel" --palette > "$tmp/$current/palette.json" 2>/dev/null
|
|
1858
|
+
open_view
|
|
1859
|
+
cap_to view
|
|
1860
|
+
# ① 标题 = 功能域、按读取顺序;类词只活在行徽章里(没有「只有类词」的行)。
|
|
1861
|
+
assert_has "$tmp/$current/view.txt" "身份与账本布局" "第一组标题是 identity 的功能域名"
|
|
1862
|
+
# P32(用户的第一条反馈):标题与选项行必须在渲染上可区分。标题是分节线(── 标题 ────),
|
|
1863
|
+
# 键行不带分节线;标题行同时把两组隔开(上一行=上一组最后一条,下一行=本组第一条)。
|
|
1864
|
+
assert_match "$tmp/$current/view.txt" '^│ ── 身份与账本布局 ─+' "分组标题是分节线(不是缩进的普通行)"
|
|
1865
|
+
assert_no_match "$tmp/$current/view.txt" '^│ [› ] 项目名.*─' "键行不带分节线(标题/行在渲染上可区分)"
|
|
1866
|
+
assert_heading_rule "$tmp/$current/view.txt" "分支与 forge" "契约文件" "分支命名模式" "组间可见分隔:标题是分节线且夹在两组之间"
|
|
1867
|
+
# 读取顺序:identity 的 12 条走完,下一组标题就是 branch(窗口跟着焦点,标题只在它的行进窗时画)。
|
|
1868
|
+
# 带注释的行是两行,窗口按**画出的行数**装(P30/D5 的账),所以这里一步一步走,不假设一屏能装两组。
|
|
1869
|
+
local k
|
|
1870
|
+
for k in $(seq 1 12); do keys Down; sleep 0.05; done
|
|
1871
|
+
# P68:等那一行(下一组标题)在稳定帧上出现,不用固定 sleep + 单次采样。
|
|
1872
|
+
wait_row group-order "第 13 行进窗时的下一组标题" '分支与 forge' \
|
|
1873
|
+
|| bad "第 13 行进窗后没有出现下一组标题"
|
|
1874
|
+
assert_has "$tmp/$current/group-order.txt" "分支与 forge" "第 13 行进窗时出现下一组标题(读取顺序 identity → branch)"
|
|
1875
|
+
for k in $(seq 1 12); do keys Up; sleep 0.05; done
|
|
1876
|
+
sleep 0.4
|
|
1877
|
+
assert_no_class_heading "$tmp/$current/view.txt"
|
|
1878
|
+
# ② 组内保持 schema 顺序(identity:项目名 → 会话名 → PM 窗口)。
|
|
1879
|
+
local n_proj n_sess n_pm
|
|
1880
|
+
n_proj="$(cap_line_of "$tmp/$current/view.txt" '项目名')"
|
|
1881
|
+
n_sess="$(cap_line_of "$tmp/$current/view.txt" '会话名')"
|
|
1882
|
+
n_pm="$(cap_line_of "$tmp/$current/view.txt" 'PM 窗口')"
|
|
1883
|
+
if [ "$n_proj" -gt 0 ] && [ "$n_proj" -lt "$n_sess" ] && [ "$n_sess" -lt "$n_pm" ]; then
|
|
1884
|
+
ok "组内是 schema 顺序(项目名=$n_proj < 会话名=$n_sess < PM 窗口=$n_pm)"
|
|
1885
|
+
else
|
|
1886
|
+
bad "组内顺序不对(项目名=$n_proj 会话名=$n_sess PM 窗口=$n_pm)"
|
|
1887
|
+
fi
|
|
1888
|
+
# ③ 类徽章是词 + tone(D4):三类各过滤一行;词在,tone = 调色板里该类的 tone,值必须是 text tone。
|
|
1889
|
+
filter_to TEAM_MODEL_LIMITS
|
|
1890
|
+
wait_row tone-apply "apply 徽章行" '模型并发上限' '立即生效' \
|
|
1891
|
+
|| bad "apply 行没有在预算内出现"
|
|
1892
|
+
cap_e_to tone-apply-e
|
|
1893
|
+
assert_match "$tmp/$current/tone-apply.txt" '模型并发上限 +.*立即生效' "apply 行的徽章词仍在(颜色不是唯一通道)"
|
|
1894
|
+
assert_badge_tone "$tmp/$current/tone-apply-e.txt" '模型并发上限' '立即生效' 'text' "apply 徽章 = 普通文本 tone"
|
|
1895
|
+
filter_to TEAM_PULSE_INTERVAL
|
|
1896
|
+
wait_row tone-restart "restart 徽章行" '巡检周期' '需重启' \
|
|
1897
|
+
|| bad "restart 行没有在预算内出现"
|
|
1898
|
+
cap_e_to tone-restart-e
|
|
1899
|
+
assert_match "$tmp/$current/tone-restart.txt" '巡检周期 +.*需重启' "restart 行的徽章词仍在"
|
|
1900
|
+
assert_badge_tone "$tmp/$current/tone-restart-e.txt" '巡检周期' '需重启' 'warn' "restart 徽章 = warn tone"
|
|
1901
|
+
filter_to TEAM_PROJECT
|
|
1902
|
+
wait_row tone-refuse "refuse 徽章行" '项目名' 'root · 只读' \
|
|
1903
|
+
|| bad "refuse 行没有在预算内出现"
|
|
1904
|
+
cap_e_to tone-refuse-e
|
|
1905
|
+
assert_match "$tmp/$current/tone-refuse.txt" '项目名 +root · 只读' "refuse 行的徽章词仍在"
|
|
1906
|
+
assert_badge_tone "$tmp/$current/tone-refuse-e.txt" '项目名' '只读' 'dim' "refuse 徽章 = dim tone"
|
|
1907
|
+
# ④ 可见降级:schema 不认识的键落在「未分组」,且「未分组」在席位块之前(走到列表末尾看)。
|
|
1908
|
+
filter_to TEAM_HAND_ADDED
|
|
1909
|
+
wait_row hand-added "未分组里的手加未知键行" 'TEAM_HAND_ADDED' 'hand · 未知键' \
|
|
1910
|
+
|| bad "未知键的行没有在预算内出现"
|
|
1911
|
+
assert_match "$tmp/$current/hand-added.txt" 'TEAM_HAND_ADDED +hand · 未知键' "未知键的行仍在(没有消失)"
|
|
1912
|
+
assert_has "$tmp/$current/hand-added.txt" "未知键:TEAM_HAND_ADDED" "未知键仍按原始键点名"
|
|
1913
|
+
[ "$(cap_line_heading "$tmp/$current/hand-added.txt" '未分组')" -gt 0 ] \
|
|
1914
|
+
&& ok "未知键落在可见的「未分组」标题下" || bad "未知键没有落在「未分组」标题下"
|
|
1915
|
+
assert_match "$tmp/$current/hand-added.txt" '^│ ── 未分组 ─+' "降级组标题也是同一种分节线(标题体系一致)"
|
|
1916
|
+
filter_clear
|
|
1917
|
+
sleep 0.4
|
|
1918
|
+
walk_to_tail tail
|
|
1919
|
+
local n_ungrouped n_seats
|
|
1920
|
+
n_ungrouped="$(cap_line_heading "$tmp/$current/tail.txt" '未分组')"
|
|
1921
|
+
n_seats="$(cap_line_heading "$tmp/$current/tail.txt" '席位')"
|
|
1922
|
+
if [ "$n_ungrouped" -gt 0 ] && [ "$n_seats" -gt 0 ] && [ "$n_ungrouped" -lt "$n_seats" ]; then
|
|
1923
|
+
ok "「未分组」在席位块之前(未分组=$n_ungrouped < 席位=$n_seats)"
|
|
1924
|
+
else
|
|
1925
|
+
bad "尾部顺序不对(未分组=$n_ungrouped 席位=$n_seats)"
|
|
1926
|
+
fi
|
|
1927
|
+
assert_match "$tmp/$current/tail.txt" '^│ ── 席位 ─+' "席位块标题也是同一种分节线(标题体系一致)"
|
|
1928
|
+
# ⑤ 无键→域表:scratch CLI 让 TEAM_ZZZ_TEST 带 workflow、把 TEAM_GATES 移到 meeting;
|
|
1929
|
+
# 提交的那份 bundle 必须跟着两个标题走(bundle 里没有第二张键表/组表)。
|
|
1930
|
+
local scratch="$tmp/$current/scratch"
|
|
1931
|
+
mkdir -p "$scratch/skills/teamsmith"
|
|
1932
|
+
cp -a "$skill/scripts" "$scratch/skills/teamsmith/scripts"
|
|
1933
|
+
cp -a "$skill/templates" "$skill/references" "$scratch/skills/teamsmith/"
|
|
1934
|
+
python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
|
|
1935
|
+
import sys
|
|
1936
|
+
p = sys.argv[1]
|
|
1937
|
+
s = open(p, encoding='utf-8').read()
|
|
1938
|
+
gates = 'TEAM_GATES|apply|cmd||plain||-|||workflow'
|
|
1939
|
+
assert gates in s, '找不到 TEAM_GATES 的 10 列 schema 行'
|
|
1940
|
+
s = s.replace(gates, gates.replace('|workflow', '|meeting'), 1)
|
|
1941
|
+
anchor = 'TEAM_INSTALL_CMD|apply|cmd||plain||-|||workflow'
|
|
1942
|
+
assert anchor in s, '找不到 TEAM_INSTALL_CMD 的 schema 行'
|
|
1943
|
+
s = s.replace(anchor, 'TEAM_ZZZ_TEST|apply|text||plain|zzz-default|-|||workflow\n' + anchor, 1)
|
|
1944
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
1945
|
+
PY
|
|
1946
|
+
cat > "$tmp/$current-scratch-wrapper.sh" <<EOF2
|
|
1947
|
+
#!/usr/bin/env bash
|
|
1948
|
+
printf '%s\n' "\$*" >> "$tmp/$current-scratch-argv.log"
|
|
1949
|
+
exec bash "$scratch/skills/teamsmith/scripts/team" "\$@"
|
|
1950
|
+
EOF2
|
|
1951
|
+
chmod +x "$tmp/$current-scratch-wrapper.sh"
|
|
1952
|
+
# `VAR=x func` 的赋值只活到函数返回 —— 本段要起两次面板(同 scn_choices_schema 的教训)。
|
|
1953
|
+
P21_CLI="$tmp/$current-scratch-wrapper.sh"
|
|
1954
|
+
start_panel
|
|
1955
|
+
open_view
|
|
1956
|
+
filter_to TEAM_ZZZ_TEST
|
|
1957
|
+
wait_row zzz-group "scratch 新增键落在 workflow 域标题下" '工作流与门禁' 'TEAM_ZZZ_TEST' \
|
|
1958
|
+
|| bad "新键的域标题/行没有在预算内出现"
|
|
1959
|
+
assert_has "$tmp/$current/zzz-group.txt" "工作流与门禁" "schema 新增键落在它声明的 workflow 域下(bundle 未重建)"
|
|
1960
|
+
assert_match "$tmp/$current/zzz-group.txt" 'TEAM_ZZZ_TEST +未设 · 默认 zzz-default' "新键的行完整(值/默认来自 schema)"
|
|
1961
|
+
filter_to TEAM_GATES
|
|
1962
|
+
wait_row gates-moved "TEAM_GATES 跟到 meeting 域标题下" '跨项目会议' '门禁命令' \
|
|
1963
|
+
|| bad "TEAM_GATES 的新域标题/行没有在预算内出现"
|
|
1964
|
+
assert_has "$tmp/$current/gates-moved.txt" "跨项目会议" "TEAM_GATES 的 token 改成 meeting 后跟到新标题下(bundle 里没有键→域表)"
|
|
1965
|
+
assert_match "$tmp/$current/gates-moved.txt" '门禁命令 +true · 立即生效' "同一行仍按 schema 渲染(标签/值/徽章)"
|
|
1966
|
+
assert_eq "三次运行之间 bundle 逐字节不变" "$(sha "$panel")" "$bundle_sha"
|
|
1967
|
+
# ⑥ 第 10 列缺失 = 畸形行:走查那边判红(config-cli.sh 的 groups 段),视图这边可见降级到「未分组」,
|
|
1968
|
+
# 行本身(标签/值/徽章/命令行)一个字不少。
|
|
1969
|
+
python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
|
|
1970
|
+
import sys
|
|
1971
|
+
p = sys.argv[1]
|
|
1972
|
+
s = open(p, encoding='utf-8').read()
|
|
1973
|
+
row = 'TEAM_GATES|apply|cmd||plain||-|||meeting'
|
|
1974
|
+
assert row in s, '找不到移动后的 TEAM_GATES 行'
|
|
1975
|
+
s = s.replace(row, 'TEAM_GATES|apply|cmd||plain||-|', 1)
|
|
1976
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
1977
|
+
PY
|
|
1978
|
+
start_panel
|
|
1979
|
+
open_view
|
|
1980
|
+
filter_to TEAM_GATES
|
|
1981
|
+
wait_row gates-fallback "畸形 schema 行落在「未分组」里" '未分组' '门禁命令' \
|
|
1982
|
+
|| bad "降级组的行没有在预算内出现"
|
|
1983
|
+
unset P21_CLI
|
|
1984
|
+
assert_has "$tmp/$current/gates-fallback.txt" "未分组" "第 10 列缺失的 schema 行落在可见的降级组里(不消失)"
|
|
1985
|
+
assert_match "$tmp/$current/gates-fallback.txt" '门禁命令 +true · 立即生效' "降级组里的行仍完整(标签/值/徽章)"
|
|
1986
|
+
assert_has "$tmp/$current/gates-fallback.txt" "命令行:team config set TEAM_GATES <新值>" "降级组里的行仍给出命令行"
|
|
1987
|
+
# 同一个 scratch 树里,「未分组」现在同时装着手加的未知键与畸形行:走到末尾,两者同屏且在席位之前。
|
|
1988
|
+
filter_clear
|
|
1989
|
+
sleep 0.4
|
|
1990
|
+
walk_to_tail tail-scratch
|
|
1991
|
+
assert_has "$tmp/$current/tail-scratch.txt" "TEAM_HAND_ADDED" "降级组里未知键与畸形行同屏(未知键可见)"
|
|
1992
|
+
assert_has "$tmp/$current/tail-scratch.txt" "门禁命令" "降级组里畸形行同屏(schema 行可见)"
|
|
1993
|
+
local n_u n_s
|
|
1994
|
+
n_u="$(cap_line_heading "$tmp/$current/tail-scratch.txt" '未分组')"
|
|
1995
|
+
n_s="$(cap_line_heading "$tmp/$current/tail-scratch.txt" '席位')"
|
|
1996
|
+
if [ "$n_u" -gt 0 ] && [ "$n_s" -gt 0 ] && [ "$n_u" -lt "$n_s" ]; then
|
|
1997
|
+
ok "scratch 尾部:「未分组」仍在席位块之前($n_u < $n_s)"
|
|
1998
|
+
else
|
|
1999
|
+
bad "scratch 尾部顺序不对(未分组=$n_u 席位=$n_s)"
|
|
2000
|
+
fi
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
scn_wheel_settings() {
|
|
2004
|
+
section "wheel · 设置视图自己的窗口(P30/D5):一格一行/焦点不动/计数行跟随/不穿透页面/焦点推窗/两个 picker"
|
|
2005
|
+
server_up settings-wheel
|
|
2006
|
+
# 页面(page 3 的巡检块)要真的滚得动,「页面没被穿透」才有可观察的对照:写满 12 行巡检日志。
|
|
2007
|
+
mkdir -p "$state"
|
|
2008
|
+
python3 - "$state/watchdog.log" <<'PY'
|
|
2009
|
+
import sys
|
|
2010
|
+
with open(sys.argv[1], 'w', encoding='utf-8') as f:
|
|
2011
|
+
for i in range(1, 13):
|
|
2012
|
+
f.write('P-%02d patrol tick marker\n' % i)
|
|
2013
|
+
PY
|
|
2014
|
+
conf_set "lang=zh" "page=3" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
|
|
2015
|
+
start_panel
|
|
2016
|
+
# ① 页面自己的滚轮还活着(对照 + 不回归钉):先滚 3 格,P-01 出屏、P-04 进屏。
|
|
2017
|
+
wheel_at down 100 8 3
|
|
2018
|
+
# P68:等页面滚动的结果(P-04 进屏、P-01 出屏)在稳定帧上,不用固定 sleep 采样。
|
|
2019
|
+
wait_row page-scrolled "页面滚轮 3 格后的巡检窗口" 'P-04' '!P-01' \
|
|
2020
|
+
|| bad "页面滚轮 3 格后的窗口没有落定(P-04 未进屏或 P-01 未出屏)"
|
|
2021
|
+
assert_not "$tmp/$current/page-scrolled.txt" "P-01" "页面滚轮 3 格:P-01 已出屏(页面确实滚得动)"
|
|
2022
|
+
assert_has "$tmp/$current/page-scrolled.txt" "P-04" "页面滚轮 3 格:P-04 进屏"
|
|
2023
|
+
# ② 视图里的滚轮:一格一行、焦点不动、顶部计数行跟随(先下滚 3 格,再上滚回顶部)。
|
|
2024
|
+
open_view
|
|
2025
|
+
cap_to wheel-before
|
|
2026
|
+
assert_match "$tmp/$current/wheel-before.txt" '› 项目名 +.*只读' "视图开屏焦点在第一行(identity 第一条)"
|
|
2027
|
+
wheel_at down 20 10 3
|
|
2028
|
+
local i
|
|
2029
|
+
for i in $(seq 1 20); do
|
|
2030
|
+
cap_to wheel-down
|
|
2031
|
+
grep -qE '↑3' "$tmp/$current/wheel-down.txt" && break
|
|
2032
|
+
sleep 0.25
|
|
2033
|
+
done
|
|
2034
|
+
assert_match "$tmp/$current/wheel-down.txt" '↑3' "下滚 3 格:顶部计数行读出 ↑3(窗口正好移 3 行)"
|
|
2035
|
+
assert_not "$tmp/$current/wheel-down.txt" "项目名" "下滚 3 格:原本第一行(项目名)已出窗"
|
|
2036
|
+
assert_has "$tmp/$current/wheel-down.txt" "名册" "下滚 3 格:后面的行进窗(窗口第一行 = 第 4 条)"
|
|
2037
|
+
assert_has "$tmp/$current/wheel-down.txt" "只读:手改 .pi/team/config.sh 里的 TEAM_PROJECT" "下滚 3 格:焦点没动(命令行仍点名 TEAM_PROJECT)"
|
|
2038
|
+
wheel_at up 20 10 3
|
|
2039
|
+
for i in $(seq 1 20); do
|
|
2040
|
+
cap_to wheel-up
|
|
2041
|
+
grep -qE '↑[0-9]+' "$tmp/$current/wheel-up.txt" || break
|
|
2042
|
+
sleep 0.25
|
|
2043
|
+
done
|
|
2044
|
+
assert_match "$tmp/$current/wheel-up.txt" '› 项目名' "上滚 3 格:窗口回到顶部,第一行回来"
|
|
2045
|
+
assert_no_match "$tmp/$current/wheel-up.txt" '↑[0-9]+' "上滚 3 格:顶部计数行消失"
|
|
2046
|
+
# ③ 焦点键把窗口推到聚焦行(滚开之后 enter 打开的就是命令行点名的那一行)。
|
|
2047
|
+
wheel_at down 20 10 3
|
|
2048
|
+
for i in $(seq 1 20); do
|
|
2049
|
+
cap_to wheel-push-pre
|
|
2050
|
+
grep -qE '↑3' "$tmp/$current/wheel-push-pre.txt" && break
|
|
2051
|
+
sleep 0.25
|
|
2052
|
+
done
|
|
2053
|
+
keys Down
|
|
2054
|
+
# P68:等窗口被推到聚焦行(↑1 + 光标在会话名)在稳定帧上,不用固定 sleep 采样。
|
|
2055
|
+
wait_row wheel-push "↓ 之后窗口被推到聚焦行(↑1 + › 会话名)" '↑1' '› 会话名' \
|
|
2056
|
+
|| bad "↓ 之后窗口没有被推到聚焦行上"
|
|
2057
|
+
assert_match "$tmp/$current/wheel-push.txt" '↑1' "↓ 之后窗口被推到聚焦行上(顶部计数行 = ↑1)"
|
|
2058
|
+
assert_match "$tmp/$current/wheel-push.txt" '› 会话名' "光标落在下一条(会话名)"
|
|
2059
|
+
assert_has "$tmp/$current/wheel-push.txt" "只读:手改 .pi/team/config.sh 里的 TEAM_SESSION" "命令行与光标同一行(焦点在会话名上)"
|
|
2060
|
+
keys Up
|
|
2061
|
+
# `↑` 计数行消失(字面 needle:`!↑1` = 刚才那条 ↑1 不再在屏幕上;pty-wait 是 grep -F,不吃正则,
|
|
2062
|
+
# 所以不能用原断言的 `↑[0-9]+`;下面的 assert_no_match 仍守住正则面)。
|
|
2063
|
+
wait_row wheel-push-back "↑ 之后窗口回到顶部(↑1 计数行消失)" '› 项目名' '!↑1' \
|
|
2064
|
+
|| bad "↑ 之后窗口没有回到顶部"
|
|
2065
|
+
assert_match "$tmp/$current/wheel-push-back.txt" '› 项目名' "↑ 之后光标回到第一条"
|
|
2066
|
+
assert_no_match "$tmp/$current/wheel-push-back.txt" '↑[0-9]+' "窗口跟着回到顶部(计数行消失)"
|
|
2067
|
+
keys Enter
|
|
2068
|
+
if wait_cap wheel-enter "只读:手改 .pi/team/config.sh 里的 TEAM_PROJECT"; then
|
|
2069
|
+
ok "enter 打开的行 = 命令行点名的行(TEAM_PROJECT 的只读路线)"
|
|
2070
|
+
else
|
|
2071
|
+
bad "enter 之后没有出现聚焦行的路线回执"
|
|
2072
|
+
fi
|
|
2073
|
+
# ④ 选择器开着时滚轮走条目、页面不动;esc 之后选择器是关着的(一次 esc 就够)。
|
|
2074
|
+
filter_to TEAM_PULSE_INTERVAL
|
|
2075
|
+
sleep 0.5
|
|
2076
|
+
keys Enter
|
|
2077
|
+
wait_picker TEAM_PULSE_INTERVAL '300' || bad "选择器没有打开(滚轮用例前提)"
|
|
2078
|
+
cap_to picker-wheel-before
|
|
2079
|
+
local sel_before sel_after
|
|
2080
|
+
sel_before="$(cap_line_of "$tmp/$current/picker-wheel-before.txt" '›')"
|
|
2081
|
+
wheel_at down 20 12 2
|
|
2082
|
+
# P68:等选中行真的被滚轮推下去(计数轮 + 上界 + 归因),不用固定 sleep 采样。
|
|
2083
|
+
wait_line_gt picker-wheel-after "选择器滚轮把选中行推下去" '›' "${sel_before:-0}" \
|
|
2084
|
+
|| bad "选择器里的滚轮没有走条目(选中行停在 $sel_before)"
|
|
2085
|
+
sel_after="$(cap_line_of "$tmp/$current/picker-wheel-after.txt" '›')"
|
|
2086
|
+
if [ "$sel_before" -gt 0 ] && [ "$sel_after" -gt "$sel_before" ]; then
|
|
2087
|
+
ok "选择器开着时滚轮走条目(选中行 $sel_before → $sel_after)"
|
|
2088
|
+
else
|
|
2089
|
+
bad "选择器里的滚轮没有走条目(选中行 $sel_before → $sel_after)"
|
|
2090
|
+
fi
|
|
2091
|
+
pty_key_when "选选择器的 esc" ' · TEAM_PULSE_INTERVAL' Escape || bad "选择器不在稳定帧上,esc 没有发"
|
|
2092
|
+
# P68:等 esc 的效果(选择器关掉、仍在设置视图里)在稳定帧上。
|
|
2093
|
+
wait_row picker-closed "一次 esc 关掉选择器且仍在设置视图里" '! · TEAM_PULSE_INTERVAL' '╭─ 项目设置' \
|
|
2094
|
+
|| bad "一次 esc 没有关掉选择器(或不在设置视图里了)"
|
|
2095
|
+
assert_not "$tmp/$current/picker-closed.txt" " · TEAM_PULSE_INTERVAL" "一次 esc 就把选择器关掉(不穿透)"
|
|
2096
|
+
assert_has "$tmp/$current/picker-closed.txt" "╭─ 项目设置" "关闭后仍在设置视图里"
|
|
2097
|
+
# ⑤ 席位 picker 的滚轮同样走条目(这一支原来会穿透到页面)。
|
|
2098
|
+
filter_to dev
|
|
2099
|
+
sleep 0.5
|
|
2100
|
+
if focus_row 'dev +deepseek'; then
|
|
2101
|
+
keys Enter
|
|
2102
|
+
else
|
|
2103
|
+
bad "没能把焦点移到 dev 席位行"
|
|
2104
|
+
fi
|
|
2105
|
+
# 席位 picker 的标题是「选择 <seat> 的模型」(没有 ` · KEY` 后缀),所以用 pty_wait_frame 等它。
|
|
2106
|
+
if pty_wait_frame "$tmp/$current/seat-picker.txt" "seat picker dev" "选择 dev 的模型" "回退默认"; then
|
|
2107
|
+
ok "席位 picker 打开(标题 + 已知模型)"
|
|
2108
|
+
else
|
|
2109
|
+
bad "席位 picker 没有打开"
|
|
2110
|
+
fi
|
|
2111
|
+
cap_to seat-wheel-before
|
|
2112
|
+
sel_before="$(cap_line_of "$tmp/$current/seat-wheel-before.txt" '›')"
|
|
2113
|
+
wheel_at down 20 12 2
|
|
2114
|
+
wait_line_gt seat-wheel-after "席位 picker 滚轮把选中行推下去" '›' "${sel_before:-0}" \
|
|
2115
|
+
|| bad "席位 picker 里的滚轮没有走条目(选中行停在 $sel_before)"
|
|
2116
|
+
sel_after="$(cap_line_of "$tmp/$current/seat-wheel-after.txt" '›')"
|
|
2117
|
+
if [ "$sel_before" -gt 0 ] && [ "$sel_after" -gt "$sel_before" ]; then
|
|
2118
|
+
ok "席位 picker 里的滚轮走条目($sel_before → $sel_after)"
|
|
2119
|
+
else
|
|
2120
|
+
bad "席位 picker 里的滚轮没有走条目($sel_before → $sel_after)"
|
|
2121
|
+
fi
|
|
2122
|
+
pty_key_when "席位 picker 的 esc" '选择 dev 的模型' Escape || bad "席位 picker 不在稳定帧上,esc 没有发"
|
|
2123
|
+
# P68:等席位 picker 关掉(仍在设置视图里)在稳定帧上。
|
|
2124
|
+
wait_row seat-closed "一次 esc 关掉席位 picker" '!选择 dev 的模型' '╭─ 项目设置' \
|
|
2125
|
+
|| bad "一次 esc 没有关掉席位 picker"
|
|
2126
|
+
assert_not "$tmp/$current/seat-closed.txt" "选择 dev 的模型" "一次 esc 关掉席位 picker"
|
|
2127
|
+
# ⑥ 回到页面:视图把滚轮吃掉了 —— 页面还是进视图前的那一屏(P-01 出屏、P-04 可见)。
|
|
2128
|
+
pty_key_when "关设置视图" '╭─ 项目设置' Escape || bad "关闭视图前它不在稳定帧上"
|
|
2129
|
+
# P68:等浮层自己回到稳定帧上再发第二个 esc(原来是两个固定 sleep 给按键让路)。
|
|
2130
|
+
pty_wait_frame - "关设置视图后的浮层" '› 项目设置' '!╭─ 项目设置' \
|
|
2131
|
+
|| bad "关掉设置视图后浮层没有回到「项目设置」那行"
|
|
2132
|
+
pty_key_when "关浮层" '项目设置' Escape || bad "浮层不在稳定帧上"
|
|
2133
|
+
# P68:等回到页面的那一屏(仍是进视图前那一屏)在稳定帧上。
|
|
2134
|
+
wait_row page-back "回到页面:仍是进视图前那一屏(P-04 可见、P-01 出屏)" '!P-01' 'P-04' \
|
|
2135
|
+
|| bad "回到页面后那一屏变了"
|
|
2136
|
+
assert_not "$tmp/$current/page-back.txt" "P-01" "视图里的滚轮没有穿透页面(P-01 仍在屏外)"
|
|
2137
|
+
assert_has "$tmp/$current/page-back.txt" "P-04" "页面窗口还是进视图前的那一屏(P-04 仍可见)"
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
# ---------------------------------------------------------------- run
|
|
2141
|
+
|
|
2142
|
+
printf '\033[1m== panel-p21 · 项目设置视图(P22) ==\033[0m\n'
|
|
2143
|
+
for s in "${SECTIONS[@]}"; do
|
|
2144
|
+
mkdir -p "$tmp/$s"
|
|
2145
|
+
# P48:每个场景在自己的子 shell 里跑。等待耗尽且归因于机器时 pty_on_skip 直接 exit 4,只结束
|
|
2146
|
+
# 这个场景(后面的场景照跑);父 shell 的 EXIT 清扫有自己的 BASHPID 守卫,不会被重复触发。
|
|
2147
|
+
(
|
|
2148
|
+
trap - EXIT INT TERM
|
|
2149
|
+
p21_premise_line "$s" # 前提行:每个场景第一个断言之前(真读数;只打不判)
|
|
2150
|
+
if ! p21_entry_guard; then # 粗闸门:超顶就在第一个等待之前停下这个场景
|
|
2151
|
+
p21_entry_skip_line "$s"
|
|
2152
|
+
exit 4
|
|
2153
|
+
fi
|
|
2154
|
+
case "$s" in
|
|
2155
|
+
settings) scn_settings ;;
|
|
2156
|
+
groups) scn_groups ;;
|
|
2157
|
+
wheel) scn_wheel_settings ;;
|
|
2158
|
+
choices) scn_choices ;;
|
|
2159
|
+
choices-schema) scn_choices_schema ;;
|
|
2160
|
+
write) scn_write ;;
|
|
2161
|
+
conflict) scn_conflict ;;
|
|
2162
|
+
seats) scn_seats ;;
|
|
2163
|
+
readonly) scn_readonly ;;
|
|
2164
|
+
*) printf 'panel-p21: 未知场景 %s\n' "$s" >&2; exit 3 ;;
|
|
2165
|
+
esac
|
|
2166
|
+
)
|
|
2167
|
+
rc=$?
|
|
2168
|
+
case "$rc" in
|
|
2169
|
+
0) ;;
|
|
2170
|
+
3) exit 3 ;; # 搭建失败(server_up/未知场景)照旧
|
|
2171
|
+
4) SKIP=$((SKIP + 1)) ;; # 可见 SKIP:无失败、无结论
|
|
2172
|
+
*) ;; # 1 = 断言失败,最后按 FAIL 退出
|
|
2173
|
+
esac
|
|
2174
|
+
done
|
|
2175
|
+
|
|
2176
|
+
PASS="$(p21_count_of "$_p21_count/ok")"
|
|
2177
|
+
FAIL="$(p21_count_of "$_p21_count/bad")"
|
|
2178
|
+
printf '\n\033[1m== 结果 ==\033[0m ✓ %s ✗ %s SKIP %s\n' "$PASS" "$FAIL" "$SKIP"
|
|
2179
|
+
[ "$FAIL" -gt 0 ] && exit 1
|
|
2180
|
+
[ "$SKIP" -gt 0 ] && exit 4
|
|
2181
|
+
exit 0
|