@mmerterden/multi-agent-pipeline 16.29.0 → 16.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1865,7 +1865,26 @@
1865
1865
  "minimum": 5,
1866
1866
  "maximum": 300,
1867
1867
  "default": 60,
1868
- "description": "Recording cap. A flow needing longer is a debugging session, not a review artefact."
1868
+ "description": "Recording cap. A flow needing longer is a debugging session, not a review artefact. Android's `screenrecord` has its own ceiling of 180s that no setting can lift, so capture-evidence.sh clamps to it and says when it did: one preference honoured on one platform and silently halved on the other is worse than a stated limit."
1869
+ },
1870
+ "githubHost": {
1871
+ "type": "string",
1872
+ "enum": ["branch", "off"],
1873
+ "default": "branch",
1874
+ "description": "Where stills go on a run with no Jira. `branch` pushes them to an orphan `evidence/<task-id>` branch so the PR body can show them; GitHub has no API that attaches a file to an issue or a PR, and the web uploader needs a browser session, so a branch is the only mechanism a script has. `off` means no upload, the PR names the artefact directory, and the absence is recorded as a gap. Video is never pushed here: an mp4 behind a blob link is a download, not evidence a reviewer will open."
1875
+ }
1876
+ }
1877
+ },
1878
+ "testDepth": {
1879
+ "type": "object",
1880
+ "additionalProperties": false,
1881
+ "description": "How far a run tests by default. The question is asked at intake (Phase 0), not in Phase 5, because Phase 5 is not in the phase set for autopilot or either local mode. Autopilot never asks and reads `default` instead; the run records which rule fired.",
1882
+ "properties": {
1883
+ "default": {
1884
+ "type": "string",
1885
+ "enum": ["unit", "unit+ui", "unit+mcp"],
1886
+ "default": "unit+ui",
1887
+ "description": "Used by both autopilot entries, and as the preselected option for everyone else. An option the capability probe found closed is never taken from here: a default that cannot run is not a default."
1869
1888
  }
1870
1889
  }
1871
1890
  },
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/token-budget.json",
4
- "description": "Per-phase token budget for lazy-loaded pipeline docs. Enforced by smoke-token-budget.sh.",
4
+ "description": "Per-phase token budget for lazy-loaded pipeline docs. Enforced by smoke-token-budget.sh. Raised in 16.30.0 for the four phases that gained a visual-evidence step (probe + depth question in 0, recording in 3 and 5, host resolution in 6): the docs were compressed first and these numbers are the measured residual, not headroom.",
5
5
  "phases": {
6
6
  "phase-0-init": {
7
- "max_tokens": 12500,
8
- "warn_tokens": 11900
7
+ "max_tokens": 13000,
8
+ "warn_tokens": 12400
9
9
  },
10
10
  "phase-1-analysis": {
11
11
  "max_tokens": 4600,
@@ -16,26 +16,26 @@
16
16
  "warn_tokens": 5650
17
17
  },
18
18
  "phase-3-dev": {
19
- "max_tokens": 8950,
20
- "warn_tokens": 7900
19
+ "max_tokens": 9250,
20
+ "warn_tokens": 8600
21
21
  },
22
22
  "phase-4-review": {
23
23
  "max_tokens": 15150,
24
24
  "warn_tokens": 12950
25
25
  },
26
26
  "phase-5-test": {
27
- "max_tokens": 2900,
28
- "warn_tokens": 2550
27
+ "max_tokens": 3050,
28
+ "warn_tokens": 2850
29
29
  },
30
30
  "phase-6-commit": {
31
- "max_tokens": 6150,
32
- "warn_tokens": 5450
31
+ "max_tokens": 6550,
32
+ "warn_tokens": 6100
33
33
  },
34
34
  "phase-7-report": {
35
35
  "max_tokens": 6350,
36
36
  "warn_tokens": 5600
37
37
  }
38
38
  },
39
- "total_max_tokens": 60750,
39
+ "total_max_tokens": 62400,
40
40
  "note": "Token estimate = ceil(chars / 4). Per-phase budget rule: warn = current+10% (rounded to nearest 50), max = current+25%. Gives ~6 edit cycles of headroom before warn trips - intentionally quiet under normal maintenance, loud when a phase grows unusually. Only the active phase is loaded (lazy). Recalibrated at v10.0.0 after the validator/consistency/simplifier/lesson gate contracts landed in phases 1-4. Recalibrated again at v10.9.0 after the verify-by-test (Phase 4 Step 3.7), update-check (Phase 0 Step 0.6), immutable-test (Phase 3 GREEN) and redTests re-entry contracts landed - Step 3.7 prose was compressed to a pointer into refs/features/verify-by-test.md before the recalibration. Total bumped 50000 -> 51000 at v12.5.0 after the worktree residue/traversal-prune contract (Phase 0 + Phase 5 heal) and the Reflexion causal-diagnosis contract (Phase 4 lesson memory) landed; the prose was compressed first (161 tokens reclaimed) and every per-phase max still passes - only the aggregate needed room. Recalibrated again at v13.6.0 after the install-relative path correction: an instruction that names `pipeline/scripts/x` resolves only from a repo checkout, and a run happens in the user's worktree, so 157 references across these docs moved to `$HOME/.claude/...` at +5 bytes each - 196 tokens of pure correctness cost. Same discipline as before: prose was compressed FIRST (149 tokens reclaimed, by pointing Phase 1's Figma tier table at the Phase 0 probe that already resolved it and Phase 4's Codex constraints at the always-loaded AGENTS.md block), and only then were the budgets moved. Five warn lines had been permanently amber, which makes the amber tier useless as a signal, so every warn was reset to the documented current+10% and the four maxes that the new warn would have collided with were reset to current+25%. Aggregate 51000 -> 51500. Total bumped 51500 -> 52200 at v14.0.0 after Phase 4 Review entered the four --dev mode phase sets and the criteria-resolution contract (Step 1.78) landed. Same discipline as every prior bump: prose was compressed FIRST, 820 tokens reclaimed, before the number moved. Two of those compressions are structural rather than cosmetic - the hardcoded SwiftUI interaction list in Step 1.5 and the SwiftUI convention paragraph in Step 2.8 were transcriptions of rules that now live in a scoped registry, so keeping them here would have re-created the drift this release exists to remove, and the third moved the Step 1.78 full contract into refs/features/skill-conformance.md leaving a pointer. What remains is contract text that cannot be inferred: the manifest's four consumer-visible parts, the conformance checklist the reviewers must return, and the fail-closed semantics. Every per-phase max still passes (phase-4 12405/14750); only the aggregate needed room. Total bumped 52200 -> 52700 at v14.1.0 after two more contracts landed: stack skill routing (Phase 3 pre-flight step 9) and worktree finalize (Phase 6 step 9). Compression came first, as always, and twice: 224 tokens out of Phase 3 by pointing its criteria-ledger and routing steps at their feature files instead of restating them, and 190 out of Phase 6 by moving the finalize contract into refs/features/worktree-finalize.md and leaving the invocation plus the exit-3 semantics. Both new contracts follow the pattern the earlier ones set: the phase doc carries the call and the decision, the feature file carries the reasoning, and the feature files are outside this budget because it loops only the eight phase-N-* keys. Every per-phase max still passes (phase-3 7677/8950, phase-6 5223/6150 and both under warn); only the aggregate needed room. Total bumped 52700 -> 52750 for the Phase 0 Step 3 branch-persistence correction: the step wrote the legacy `projects[].branches` while the TTL filter two sections below read `global.recentBranches`, and both spots named a `{name, lastUsed}` shape the schema rejects (`branch` required, `additionalProperties: false`), so the recent-branch picker option could never populate and a literal implementation would have failed prefs validation. Naming the right target, the right key and the legacy field to avoid costs 41 tokens over the one line it replaces. Compression came first and was applied three times to the replacement text itself, from 120 tokens down to 66, by moving the rationale out of the phase doc entirely: the reasoning now lives where it is enforced, in the migrate-prefs carry-forward comment and the smoke-pref-migration f7 block, leaving the phase doc with only the instruction. 50 was the smallest step that clears it; phase-0-init sits at 10893/12400, far under its own max, so this is purely an aggregate ceiling. v15.0.0: total 52750 -> 53100, the stack-skill tables in phase-1/2/4 now carry plugin-namespaced names (ai-<stack>-toolkit:<skill>) - functional prefixes, ~170 tokens. v15.10.0: total 53350 -> 53950 for the memory-recall + context-offload contracts (Phase 1 two-block durable-knowledge injection and its telemetry, Phase 3 build-log offload pipe, Phase 4 ranked prior art, offload pipe and recall telemetry). Compression came first and twice, taking the new prose from 1168 tokens to 580: the reasoning behind the two blocks lives in multi-agent-refs/prompt-assembly.md and the reasoning behind the offload filter lives in the offload-ref.sh header, both outside this budget, so the phase docs carry only the call, the pref that gates it and the one fact an agent cannot infer - that the evidence gate still reads the whole build log, so offloading changes what is read, never what counts as a verified pass. Every per-phase max still passes (phase-3 7985/8950, phase-4 12997/14750); phase-3 and phase-4 crossed their warn lines and are left amber on purpose, because that is the signal that those two docs are the next ones needing structural compression rather than another bump. v15.13.0: total 53950 -> 54050 for the prefs-to-flag bridges. Five settings had shipped declared-but-inert: contextOffload.minLines and .tailLines (fixed in 15.11.0), learningsLedger.maxBriefEntries, and testGap.scanTree and .promoteSeverity - the last two declared in the schema AND implemented as flags in the scanner, with nothing in between reading the pref and passing the flag. Wiring three of them costs the phase docs 94 tokens, which is the wiring itself and not prose: two `--max` substitutions and a three-line GAP_FLAGS block. Compression came first and twice, as always: the rationale that would have sat in phase-5 now lives in the header of smoke-prefs-consumed.sh, the gate that makes this class fail a build instead of shipping, and a `--severity-promote` table row was dropped because the invocation above it now shows the flag and names the pref that triggers it, which the row did not. 100 was the smallest step that clears it. Every per-phase max still passes; phase-3 and phase-4 remain amber on purpose. v15.14.0: total 54050 -> 54400 for the supported-version gate. Phase 0 Step 0.6 stopped being purely advisory: a release can now publish an npm dist-tag `required` that names the oldest runnable version, and below it the run halts instead of nagging. What the phase doc has to carry is the part an agent cannot infer - the third stdout field, that the halt is identical in autopilot, and that the run must NOT continue on the freshly updated install because its docs were already loaded from the old version. Compression came first, as always, and took the new prose from 469 tokens to 337: the rationale for the floor, the exemption list, the fail-open rules and the `npm dist-tag add` recipe all moved to multi-agent-refs/rules.md \"Supported Version Gate\" (loaded by 25 commands, outside this budget) and to the header of require-supported-version.sh, leaving the phase doc with the call, the decision table and the halt. 350 was the smallest step that clears it. Every per-phase max still passes (phase-0-init 11230/12400); phase-3 and phase-4 remain amber on purpose. v15.17.0: total 54400 -> 54900 for the Phase 1 analysis-document step. Phase 2 and Phase 3 pre-flights had BLOCKED on `analysis/<feature>-<platform>.md` since v9.0.0 while nothing produced it, so a full run either aborted at Phase 2 or the model ignored its own BLOCKING contract; Step 4 is the producer. What the phase doc carries is only what cannot be inferred: the when-table (taskType x Figma reference), the four refs in load order, the two artefacts, and that the doc validator fails closed. Compression came first and took the step from 745 tokens to 497: the history of why the gap existed moved to the CHANGELOG, the per-ref one-line descriptions moved into the refs' own headers, and the autopilot carve-out collapsed to one clause. The 17.4k-token analysis engine itself is NOT in this budget - it moved out of commands/ into multi-agent-refs/analysis/{locked,evidence,synthesis,render}.md, loaded on demand, which also took analysis/SKILL.md from 18081 to 5974 tokens and retired its lint grace entry. 500 was the smallest step that clears it; phase-1-analysis sits at 4338/4600 and is amber on purpose, like phase-3 and phase-4. v15.18.0: total 54900 -> 55250 for analysis mode. Three phase docs gained a mode branch that cannot be inferred: Phase 4 reviews a document instead of a diff (validator, the one question reviewers answer, the open-question walk), and Phase 6 publishes instead of committing. Compression came first and was applied twice to the new prose and once to old: the Phase 4 branch went from 320 tokens to 180 and the Phase 6 branch from 190 to 120 by pointing at multi-agent-refs/analysis/{resolve,render}.md, which now hold the walks themselves, and the front-matter parse contract stopped being spelled out in both pre-flights. The analysis engine keeps leaving this budget rather than entering it: intake joined locked/evidence/synthesis/render/resolve in multi-agent-refs/analysis/, which is what let analysis/SKILL.md drop under the 6000 hard cap after its grace entry was retired. 350 was the smallest step that clears it; phase-4 and phase-6 are amber on purpose, as phase-1 and phase-3 already were. v15.20.0: total 55250 -> 55500 for the TDD bridge. Phase 3 pre-flight read the analysis doc's concept table and even said test method names come from it, while nothing read Section 15 - so the RED step invented tests and the analysis test matrix never reached development. Phase 3 step 5b now loads it into state.dev.testPlan[] and Phase 4 step 1.45 cross-checks every planned row against a real test, which is what turns \"analysis quality is output quality\" from a slogan into a finding. Compression came first on both blocks, 300 tokens down to 175, by dropping the enumerated failure modes to one line each and the rationale to one clause; the reasoning lives in the CHANGELOG. 250 was the smallest step that clears it. v15.21.0: total 55500 -> 55800 for the post-analysis confirmation. Phase 2 gained Step 0.9, the last human checkpoint before Phase 3: derived values are shown for confirmation and only Section 20 rows are asked, through the resolve engine that already exists in refs. It belongs here rather than Phase 4 because Phase 4 runs after development, where an answer arrives too late to change anything. Compression came first and twice, 430 tokens down to 250, by collapsing the derived-vs-asked explanation to one sentence each and moving the walk itself to multi-agent-refs/analysis/resolve.md, which Phase 4 and analysis-resolve already mount. 300 was the smallest step that clears it. v15.22.0: total 55800 -> 55900 for the analyst-toolkit hooks. Phase 1 Step 4 now names the two prefs that decide whether a document is produced at all and how deep it goes (forceFull, mode) - the first of those had shipped declared-but-inert and smoke-prefs-consumed caught it - and Phase 4 triage gained one clause: a finding that blames a third-party library asks evidence-github whether it is already open upstream, which turns it into a deferred item with a citation instead of Phase 3 rework on code that is not ours. Compression came first and three times, taking the new prose from 220 tokens to 110, and the Phase 1d evidence contract itself never entered this budget - it lives in multi-agent-refs/analysis/evidence.md beside the phases it belongs to. 100 was the smallest step that clears it, leaving 34 tokens of headroom. phase-4 stays amber and the debt named at v15.10.0 stands: it is the doc that needs structural compression rather than another bump, and the two candidates are the inline triage JSON shape and the 3.4 telemetry block, both of which restate something already authoritative elsewhere. v16.0.0: total 55900 -> 56350 for the depth picker. `--dev` and the four dev-* commands are gone; depth is Phase 0 Step 7.5, which costs phase-0-init a step it did not have. Compression came first and three times, taking the step from 530 tokens to 300: the question wording, the per-taskType recommendation and the mode tables all live in phases/modes.md (outside this budget), so the phase doc carries only what an agent cannot infer - that the step runs after Step 7 and why, who is exempt, that ASK_CHOICE_DEFAULT must be passed explicitly because ask-choice.sh takes the FIRST option on a non-TTY, and that Short flips the Phase 1/2 tiles late rather than pre-marking them. The phase-4 telemetry block named as compression debt at v15.22.0 was collapsed to an emit() helper (-27) and the four dev-* mode files left the tree entirely, but neither offsets a genuinely new phase step. 450 was the smallest step that clears it, leaving 119 tokens of headroom. phase-4 remains amber and its other named candidate, the inline triage JSON shape, was left alone on purpose: it is the prompt the triage agent is handed, not a restatement for readers. v16.2.0: total 56350 -> 56600 for the spec-freshness and reuse-tag contracts. Phase 3 step 3 had compared `state.run.lastAnalysisDigest` since it was written, against a key nothing ever set and that the state schema did not declare, so the staleness branch was unreachable and every run reported fresh by default. Phase 1 now persists the digest and a `base_commit` anchor, and step 3 gained the repo-drift half the digest cannot see: a reused document keeps a matching digest precisely because its evidence inputs did not change, while the code underneath it moved. The second contract is the Section 14 tag reaching development: Phase 2 carries it onto the todo as `sourceTag` and Phase 3 treats it as an instruction, which is what stops a Reuse row from being re-implemented. Compression came first and took the four additions from 380 tokens to 214, by moving every rationale clause out of the phase docs: why the commit anchor exists rather than a digest recomputation lives in this note and the CHANGELOG, and the schema descriptions carry the field semantics. The baseline had 9 tokens of headroom, so no addition of any size could have fit without a bump. 250 was the smallest step that clears it, leaving 45 tokens. phase-3 and phase-4 remain amber. v16.13.0: total 57600 -> 57700 for the code-graph injection and the fable-rung switch. Phase 1 gained Step 2.6 (query the graph, hand Explore a ranked starting set), Phase 7 gained the post-branch graph refresh, and Phase 0 Step 0 gained one line: a prefs switch that resolves every preferredModel: fable persona to opus for the run, which also collapses the Phase 4 Claude Code panel from three reviewers to two. Compression came first and mostly structurally: of roughly 1,630 tokens of new contract text, 1,310 never entered this budget at all - the whole code-graph contract lives in multi-agent-refs/features/code-graph.md (604) and the fable switch's scope table, per-host effects and cost-accounting consequence live in features/model-fallback.md (+707), leaving the phase docs with the call, the pref that gates it and the one fact an agent cannot infer. Phase 4 was compressed on top of that: its TLDR restated the reviewer matrix 270 lines below it, so 36 tokens came back and the doc nets +6 despite carrying two new clauses. One of those clauses is a correction rather than a feature - the consensus rule still said reviewerCount is 2 on Claude Code, which stopped being true when the third reviewer landed in 16.12.0, and the cross-CLI smoke never caught it because it reads the matrix line instead. 100 was the smallest step that clears it, leaving 54 tokens. phase-3 and phase-4 remain amber. v16.17.0: total 57700 -> 57850 for the platform-parity cross-check. Phase 4 gained Step 1.8: when dev-context carries a counterpart app repo, the review compares the change against the other platform on four axes. Compression came first and structurally, as always - of roughly 1,610 tokens of new contract text, 1,490 never entered this budget at all, because the four axes, the file cap, the graph-query recipe, the read-only prohibitions and the rule that an extractor miss may not be reported as an absence all live in multi-agent-refs/platform-parity.md. The step itself was then cut from ~200 tokens to 120 by deleting everything the ref already owns, leaving the trigger, the pointer and the two facts an agent must not infer: the counterpart repo is read-only, and parity findings are never blocking. The baseline had 13 tokens of headroom, so no addition of any size could have fit without a bump. 150 was the smallest step that clears it, leaving 35 tokens. phase-3 and phase-4 remain amber, and phase-4's structural-compression debt still stands. v16.20.0: phase-4-review max 14750 -> 15150 and total 58250 -> 60250 for the cross-round review delta, the scope self-check handoff and the circuit-breaker wiring. Compression came first and structurally: of roughly 3,900 tokens of new contract text, 2,700 never entered this budget at all - the previous-round-findings block, the scope-self-check block, the Step 3.8 state merge, telemetry and picker wording live in multi-agent-refs/features/review-delta.md, and the scope-check record rules and consumers in features/scope-check.md - so the phase docs carry the call, the pref that gates it and the exit table. The Phase 3 stability rule and the trigger-3 write were cut twice more before the bump; phase-3 stays under its max (8692/8950). Phase 4 is the first per-phase max raised since v10.9.0: the doc gained three steps that cannot be inferred (a per-round triage file, a prefix block that changes what reviewers report, and a halt condition), and its structural-compression debt (the inline triage JSON shape, named at v15.10.0) still stands and is the next candidate. 15150 and 60250 were the smallest steps that clear it, leaving 25 and 45 tokens. v16.23.0: phase-0-init max 12400 -> 12500 and total 60250 -> 60500 for the widget-registration call and the accounting gate. Phase 0 gained the `tiles` call and the exit-3 rule, Phase 7 gained the run report; together they are contract an agent cannot infer - which call registers this host's widget, and that a completion is refused without recorded spend. Compression came first and twice, taking the new prose from 472 tokens to 255: the per-host call list moved into tracker-contract.md \"The card is not the widget\" and the record-then-rerun recovery into \"Accounting is a gate\", both outside this budget, leaving the phase docs with the call and the one fact that cannot be looked up. 100 and 250 were the smallest steps that clear it, leaving 74 and 40 tokens. phase-3 and phase-4 remain amber. v16.24.0: total 60500 -> 60750 for visual evidence. Four phase docs gained one instruction each that cannot be inferred: Phase 0 keeps the issue's own images as the pre-fix evidence, Phase 3 captures the fixed state (there and not Phase 5, because every autopilot and --local entry drops Phase 5), Phase 5 hosts the flow recording when it runs, and Phase 6 blocks on a required artefact that is neither attached nor explained. Compression came first and twice, 42 tokens back, and the contract itself never entered this budget: the trigger matrix, the three video tiers, the size-degradation ladder and both render shapes live in multi-agent-refs/features/visual-evidence.md. phase-0-init cleared its own max without a bump. 250 was the smallest step that clears the aggregate. phase-3 and phase-4 remain amber."
41
41
  }
@@ -6,12 +6,19 @@
6
6
  #
7
7
  # Contract: multi-agent-refs/features/visual-evidence.md
8
8
  #
9
- # Two jobs, deliberately in one script because they share the naming convention
9
+ # Three jobs, deliberately in one script because they share the naming convention
10
10
  # that the Jira comment references by filename:
11
11
  #
12
12
  # capture-evidence.sh after --task <id> --platform <ios|android> --label <slug>
13
13
  # Capture the current screen of the running app into the evidence dir.
14
14
  #
15
+ # capture-evidence.sh video start|stop --task <id> --platform <ios|android> [--label <slug>]
16
+ # Writes <task>[-<label>]-flow.mp4; the label is optional because one
17
+ # recording per task is the common case.
18
+ # Record the screen while something else drives the app (a UI test run, or
19
+ # an MCP-driven flow). start and stop are separate because the recording
20
+ # wraps a run whose duration is not known in advance.
21
+ #
15
22
  # capture-evidence.sh fit --file <path> [--max-mb <n>]
16
23
  # capture-evidence.sh limits
17
24
  # Print the resolved visualEvidence settings as KEY=VALUE lines.
@@ -120,6 +127,163 @@ case "$MODE" in
120
127
  printf '%s\n' "$OUT"
121
128
  ;;
122
129
 
130
+ video)
131
+ # The flow recording. Shell, not MCP, for the same three reasons the "after"
132
+ # capture is: the screenshot path already shells out, a run whose host has no
133
+ # toolkit MCP registered still produces evidence, and Phase 3 / Phase 5 are
134
+ # exactly where an MCP call is contested. start and stop are separate because
135
+ # the recording wraps a test run whose duration is not known in advance - a
136
+ # fixed --duration either truncates the test or trails dead screen after it.
137
+ ACTION="${1:-}"
138
+ shift 2>/dev/null || true
139
+ # LABEL defaults to EMPTY, not to "flow": the suffix is already "-flow", so a
140
+ # default of "flow" produced <task>-flow-flow.mp4 while every renderer cites
141
+ # <task>-flow.mp4. One recording per task is the common case and it should not
142
+ # have to name itself twice to get the filename the contract quotes.
143
+ TASK=""; PLATFORM=""; LABEL=""
144
+ while [ "$#" -gt 0 ]; do
145
+ case "$1" in
146
+ --task) TASK="${2:-}"; shift 2 ;;
147
+ --platform) PLATFORM="${2:-}"; shift 2 ;;
148
+ --label) LABEL="${2:-}"; shift 2 ;;
149
+ *) echo "capture-evidence: unknown option $1" >&2; exit 2 ;;
150
+ esac
151
+ done
152
+ case "$ACTION" in start | stop) ;; *)
153
+ echo "usage: capture-evidence.sh video start|stop --task <id> --platform <ios|android> [--label <slug>]" >&2
154
+ exit 2 ;;
155
+ esac
156
+ [ -n "$TASK" ] && [ -n "$PLATFORM" ] || {
157
+ echo "usage: capture-evidence.sh video start|stop --task <id> --platform <ios|android> [--label <slug>]" >&2
158
+ exit 2
159
+ }
160
+ case "$PLATFORM" in ios | android) ;; *)
161
+ echo "capture-evidence: unsupported platform '$PLATFORM'" >&2; exit 2 ;;
162
+ esac
163
+
164
+ mkdir -p "$EVIDENCE_DIR"
165
+ SLUG="${TASK}${LABEL:+-$LABEL}"
166
+ OUT="$EVIDENCE_DIR/${SLUG}-flow.mp4"
167
+ PIDFILE="$EVIDENCE_DIR/.${SLUG}.recpid"
168
+ WATCHFILE="$EVIDENCE_DIR/.${SLUG}.watchpid"
169
+ REMOTE="/sdcard/_ma_${SLUG}.mp4"
170
+
171
+ # screenrecord's own ceiling is 180s and it is not negotiable, so a
172
+ # maxVideoSeconds above it would silently become 180 on Android and stay
173
+ # honoured on iOS - two platforms disagreeing about one preference. Clamp in
174
+ # one place and say so.
175
+ CAP="$MAX_VIDEO_SECONDS"
176
+ if [ "$CAP" -gt 180 ] 2>/dev/null; then
177
+ echo "capture-evidence: maxVideoSeconds $CAP clamped to 180 (screenrecord ceiling)" >&2
178
+ CAP=180
179
+ fi
180
+
181
+ if [ "$ACTION" = "start" ]; then
182
+ [ -f "$PIDFILE" ] && { echo "capture-evidence: a recording for $SLUG is already running" >&2; exit 2; }
183
+ rm -f "$OUT"
184
+ case "$PLATFORM" in
185
+ ios)
186
+ command -v xcrun >/dev/null 2>&1 || { echo "capture-evidence: xcrun unavailable" >&2; exit 4; }
187
+ xcrun simctl list devices booted 2>/dev/null | grep -q "(Booted)" \
188
+ || { echo "capture-evidence: no booted simulator" >&2; exit 4; }
189
+ # h264 rather than the hevc default: an hevc mp4 does not play in the
190
+ # Jira attachment preview or in several browsers, which turns the
191
+ # artefact into a download nobody opens.
192
+ xcrun simctl io booted recordVideo --codec h264 --force "$OUT" >/dev/null 2>&1 &
193
+ REC_PID=$!
194
+ ;;
195
+ android)
196
+ command -v adb >/dev/null 2>&1 || { echo "capture-evidence: adb unavailable" >&2; exit 4; }
197
+ adb shell true >/dev/null 2>&1 || { echo "capture-evidence: no attached device" >&2; exit 4; }
198
+ adb shell rm -f "$REMOTE" >/dev/null 2>&1 || true
199
+ adb shell screenrecord --time-limit "$CAP" "$REMOTE" >/dev/null 2>&1 &
200
+ REC_PID=$!
201
+ ;;
202
+ esac
203
+
204
+ # A recorder that dies on the first frame leaves a pid file and an empty
205
+ # path, and the caller then "stops" a recording that never ran. Give it a
206
+ # beat and check it actually started.
207
+ sleep 1
208
+ kill -0 "$REC_PID" 2>/dev/null || {
209
+ echo "capture-evidence: recorder exited immediately" >&2
210
+ exit 4
211
+ }
212
+ # On Android the local process is the adb CLIENT, which stays alive even
213
+ # when screenrecord failed on the device, so liveness there proves only
214
+ # that adb is running. The remote file existing is what proves a recording
215
+ # began.
216
+ if [ "$PLATFORM" = "android" ]; then
217
+ adb shell "[ -e '$REMOTE' ]" >/dev/null 2>&1 || {
218
+ kill "$REC_PID" 2>/dev/null || true
219
+ echo "capture-evidence: screenrecord did not start on the device" >&2
220
+ exit 4
221
+ }
222
+ fi
223
+ printf '%s\n' "$REC_PID" > "$PIDFILE"
224
+
225
+ # iOS has no --time-limit, so the cap is ours to enforce. Without this a
226
+ # hung UI test records until the disk complains.
227
+ if [ "$PLATFORM" = "ios" ]; then
228
+ (sleep "$CAP"; kill -INT "$REC_PID" 2>/dev/null || true) >/dev/null 2>&1 &
229
+ printf '%s\n' "$!" > "$WATCHFILE"
230
+ fi
231
+ printf '%s\n' "$OUT"
232
+ exit 0
233
+ fi
234
+
235
+ # stop
236
+ [ -f "$PIDFILE" ] || { echo "capture-evidence: no recording in progress for $SLUG" >&2; exit 2; }
237
+ REC_PID=$(cat "$PIDFILE" 2>/dev/null)
238
+ rm -f "$PIDFILE"
239
+ if [ -f "$WATCHFILE" ]; then
240
+ kill "$(cat "$WATCHFILE" 2>/dev/null)" 2>/dev/null || true
241
+ rm -f "$WATCHFILE"
242
+ fi
243
+
244
+ case "$PLATFORM" in
245
+ ios)
246
+ # SIGINT, not SIGTERM: simctl only writes the moov atom and closes the
247
+ # container on INT. A TERM leaves an mp4 that every player refuses.
248
+ kill -INT "$REC_PID" 2>/dev/null || true
249
+ i=0
250
+ while kill -0 "$REC_PID" 2>/dev/null && [ "$i" -lt 100 ]; do sleep 0.1; i=$((i + 1)); done
251
+ kill -0 "$REC_PID" 2>/dev/null && kill -TERM "$REC_PID" 2>/dev/null || true
252
+ ;;
253
+ android)
254
+ # Match on the output path, not on the program name: a bare
255
+ # `pkill screenrecord` stops every recording on the device, including a
256
+ # second pipeline run's and anything the user started by hand. Fall back
257
+ # to the blunt form only when -f is unavailable.
258
+ adb shell pkill -2 -f "$REMOTE" >/dev/null 2>&1 \
259
+ || adb shell pkill -2 screenrecord >/dev/null 2>&1 || true
260
+ # screenrecord finalises the container after the signal; pulling straight
261
+ # away yields a truncated file that looks like a successful capture.
262
+ sleep 2
263
+ adb pull "$REMOTE" "$OUT" >/dev/null 2>&1 || true
264
+ adb shell rm -f "$REMOTE" >/dev/null 2>&1 || true
265
+ ;;
266
+ esac
267
+
268
+ [ -s "$OUT" ] || { echo "capture-evidence: recording produced no file" >&2; exit 4; }
269
+
270
+ # Both recorders encode on change, so a flow over a screen that never moved
271
+ # produces a valid two-frame mp4 a fraction of a second long. The file is not
272
+ # broken and must not be discarded, but it is not evidence of a flow either,
273
+ # and the duration is the only thing that can tell the two apart. Say so and
274
+ # let the caller record it; never assert this duration against wall clock,
275
+ # which is what makes a correct static capture look like a failure.
276
+ if command -v ffprobe >/dev/null 2>&1; then
277
+ SECS=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$OUT" 2>/dev/null)
278
+ case "$SECS" in
279
+ "" ) echo "capture-evidence: ffprobe could not read the recording; duration unknown" >&2 ;;
280
+ * ) awk -v d="$SECS" 'BEGIN { exit (d < 1.0) ? 0 : 1 }' \
281
+ && echo "capture-evidence: recording is ${SECS}s - the screen did not change during it" >&2 ;;
282
+ esac
283
+ fi
284
+ printf '%s\n' "$OUT"
285
+ ;;
286
+
123
287
  fit)
124
288
  FILE=""; MAX_MB="$MAX_ATTACH_MB"
125
289
  while [ "$#" -gt 0 ]; do
@@ -174,14 +338,15 @@ case "$MODE" in
174
338
  ;;
175
339
 
176
340
  limits)
177
- # The flow recorder lives in the phase doc (it drives MCP tools, not a
178
- # shell); it reads its duration cap from here so visualEvidence.maxVideoSeconds
179
- # is one resolved value rather than a number repeated in two documents.
341
+ # The resolved settings as KEY=VALUE, so visualEvidence.maxVideoSeconds is one
342
+ # value read in one place rather than a number repeated across documents. The
343
+ # `video` mode above reads the same function, so the cap a caller prints and
344
+ # the cap the recorder enforces cannot drift apart.
180
345
  prefs_visual
181
346
  ;;
182
347
 
183
348
  *)
184
- echo "usage: capture-evidence.sh after|fit|limits ..." >&2
349
+ echo "usage: capture-evidence.sh after|video|fit|limits ..." >&2
185
350
  exit 2
186
351
  ;;
187
352
  esac
@@ -19,6 +19,9 @@
19
19
  // manual is JSON-based (Phase 5 manual-test.json, see below)
20
20
  // --status the claimed status (only "passed" is gated; others pass through)
21
21
  // --evidence <path> the log / artifact that must substantiate a "passed" claim
22
+ // --require-screenshot manual claim only: every "pass" criterion must name a
23
+ // screenshot that exists on disk. Set by Phase 5 when
24
+ // state.visualEvidence.required is true.
22
25
  // --success-pattern override the default success regex for the claim type (marker claims only)
23
26
  // --failure-pattern override the default failure regex for the claim type (marker claims only)
24
27
  //
@@ -120,7 +123,7 @@ function nonEmptyString(v) {
120
123
  // Manual-test evidence is a structured document, not a log: every acceptance
121
124
  // criterion must say what was observed and how it came out. A "fail" anywhere
122
125
  // is decisive; an untested criterion is only acceptable when it says why.
123
- function gateManual(claim, evidence, body) {
126
+ function gateManual(claim, evidence, body, requireScreenshot) {
124
127
  let doc;
125
128
  try {
126
129
  doc = JSON.parse(body);
@@ -154,6 +157,32 @@ function gateManual(claim, evidence, body) {
154
157
  `${claim} evidence shows a failed criterion "${failed.spec}" - pass claim contradicted by ${evidence}`,
155
158
  );
156
159
  }
160
+ // A screenshot path is only evidence when a file is behind it. The field has
161
+ // been in the document shape since the gate shipped and was never read, so a
162
+ // criterion carrying "screenshot": null passed as a verified manual test on a
163
+ // UI change - which is the one case the picture was added for. Checked only
164
+ // when the caller says visual evidence is required for this run, because on a
165
+ // backend change there is nothing to photograph.
166
+ if (requireScreenshot) {
167
+ const shotless = criteria.find(
168
+ (item) => item.verdict === "pass" && !nonEmptyString(item.screenshot),
169
+ );
170
+ if (shotless) {
171
+ fail(
172
+ `${claim} evidence has passing criterion "${shotless.spec}" with no screenshot, and this run requires visual evidence: ${evidence} (default-FAIL)`,
173
+ );
174
+ }
175
+ const missing = criteria.find(
176
+ (item) =>
177
+ item.verdict === "pass" && nonEmptyString(item.screenshot) && !existsSync(item.screenshot),
178
+ );
179
+ if (missing) {
180
+ fail(
181
+ `${claim} evidence names a screenshot that is not on disk: ${missing.screenshot} (default-FAIL)`,
182
+ );
183
+ }
184
+ }
185
+
157
186
  const untested = criteria.find(
158
187
  (item) => item.verdict === "not-tested" && !nonEmptyString(item.reason),
159
188
  );
@@ -203,7 +232,7 @@ if (body.trim().length === 0) {
203
232
  }
204
233
 
205
234
  if (JSON_CLAIMS.has(claim)) {
206
- gateManual(claim, evidence, body);
235
+ gateManual(claim, evidence, body, args["require-screenshot"] === true);
207
236
  }
208
237
 
209
238
  const successRe = userRegExp(args["success-pattern"], DEFAULT_MARKERS[claim].success, "success");
@@ -0,0 +1,250 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # probe-evidence-capability.sh - measure what visual evidence this machine and
4
+ # this repo can actually produce, BEFORE the user is asked to choose a test depth.
5
+ #
6
+ # Contract: multi-agent-refs/features/visual-evidence.md section 4.
7
+ #
8
+ # The order is probe, then question, then run. Offering "unit + UI test with a
9
+ # screen recording" and only then discovering there is no UI test target, or no
10
+ # booted simulator, spends the user's answer on something that cannot happen. So
11
+ # the options are built from what this prints.
12
+ #
13
+ # Three rules this file exists to keep:
14
+ #
15
+ # 1. Absence carries a reason. Every empty value is paired with a *_REASON, so
16
+ # a closed option can say why it is closed instead of vanishing from the menu.
17
+ # 2. Unmeasurable is `unknown`, never `false`. A probe that could not look and a
18
+ # probe that looked and found nothing are different facts, and collapsing
19
+ # them lets a missing tool read as a clean negative.
20
+ # 3. Detection is not reimplemented here. The UI test answer comes from
21
+ # run-ui-tests.sh detect, which is also what actually runs the tests; a
22
+ # second copy is a second place for the answer to drift.
23
+ #
24
+ # Usage:
25
+ # probe-evidence-capability.sh --platform <ios|android> [--repo <path>]
26
+ # [--changed <f>[,<f>...]] [--json]
27
+ # [--json-out <path>] [--only all|device]
28
+ #
29
+ # Output: KEY='VALUE' lines (eval-able; every value is shell-quoted), or a JSON object with --json (shaped for
30
+ # state.evidenceCapability). --json-out writes that JSON to a file while stdout
31
+ # stays KEY=VALUE, so one run serves both the shell that builds the menu and the
32
+ # state that records the measurement - two runs would mean two repo scans and
33
+ # two chances to disagree.
34
+ #
35
+ # --only device skips the UI-test detection. Phase 3 re-checks the device right
36
+ # before recording, and nothing else it would re-scan can have changed.
37
+ #
38
+ # Exit: 0 probed (whatever the verdicts), 2 usage.
39
+ # Never non-zero for an absent capability: absence is the finding.
40
+ set -uo pipefail
41
+
42
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
43
+ PLATFORM=""; REPO="$PWD"; CHANGED=""; AS_JSON=0; JSON_OUT=""; ONLY="all"
44
+
45
+ while [ "$#" -gt 0 ]; do
46
+ case "$1" in
47
+ --platform) PLATFORM="${2:-}"; shift 2 ;;
48
+ --repo) REPO="${2:-}"; shift 2 ;;
49
+ --changed) CHANGED="${CHANGED:+$CHANGED,}${2:-}"; shift 2 ;;
50
+ --json) AS_JSON=1; shift ;;
51
+ --json-out) JSON_OUT="${2:-}"; shift 2 ;;
52
+ --only) ONLY="${2:-all}"; shift 2 ;;
53
+ *) echo "probe-evidence-capability: unknown option $1" >&2; exit 2 ;;
54
+ esac
55
+ done
56
+ case "$ONLY" in all | device) ;; *)
57
+ echo "probe-evidence-capability: --only takes 'all' or 'device'" >&2; exit 2 ;;
58
+ esac
59
+
60
+ case "$PLATFORM" in ios | android) ;; *)
61
+ echo "usage: probe-evidence-capability.sh --platform <ios|android> [--repo <path>] [--changed <f>] [--json]" >&2
62
+ exit 2 ;;
63
+ esac
64
+ [ -d "$REPO" ] || { echo "probe-evidence-capability: no such repo directory: $REPO" >&2; exit 2; }
65
+
66
+ UI_TEST_TARGET=""; UI_TEST_TARGETS=""; UI_TEST_TARGET_REASON=""
67
+ UI_TEST_MATCHES=""; UI_TEST_MATCH_REASON=""
68
+ DEVICE=""; DEVICE_REASON=""
69
+ RECORDER="unknown"; RECORDER_REASON=""
70
+ MCP="unknown"; MCP_REASON=""
71
+
72
+ # ---- UI test target, delegated ------------------------------------------------
73
+ RUNNER="$HERE/run-ui-tests.sh"
74
+ if [ "$ONLY" = "device" ]; then
75
+ # Phase 3 re-checks the device right before recording, and only the device.
76
+ # Delegating detection there would re-walk the whole repo for a row that
77
+ # cannot have changed, which cost 5 seconds of a phase that is already holding
78
+ # a green build.
79
+ UI_TEST_TARGET_REASON="not probed (--only device)"
80
+ elif [ ! -x "$RUNNER" ] && [ ! -f "$RUNNER" ]; then
81
+ UI_TEST_TARGET_REASON="run-ui-tests.sh not found beside this script"
82
+ else
83
+ DETECT_ARGS=(detect --platform "$PLATFORM" --repo "$REPO")
84
+ [ -n "$CHANGED" ] && DETECT_ARGS+=(--changed "$CHANGED")
85
+ while IFS='=' read -r k v; do
86
+ case "$k" in
87
+ UI_TEST_TARGET) UI_TEST_TARGET="$v" ;;
88
+ UI_TEST_TARGETS) UI_TEST_TARGETS="$v" ;;
89
+ UI_TEST_TARGET_REASON) UI_TEST_TARGET_REASON="$v" ;;
90
+ UI_TEST_MATCHES) UI_TEST_MATCHES="$v" ;;
91
+ UI_TEST_MATCH_REASON) UI_TEST_MATCH_REASON="$v" ;;
92
+ esac
93
+ done < <(bash "$RUNNER" "${DETECT_ARGS[@]}" 2>/dev/null)
94
+ fi
95
+
96
+ # ---- Device -------------------------------------------------------------------
97
+ case "$PLATFORM" in
98
+ ios)
99
+ if ! command -v xcrun >/dev/null 2>&1; then
100
+ DEVICE_REASON="xcrun unavailable; cannot tell whether a simulator exists"
101
+ else
102
+ DEVICE=$(xcrun simctl list devices booted 2>/dev/null | grep -oE '[0-9A-F-]{36}' | head -1)
103
+ if [ -z "$DEVICE" ]; then
104
+ # Bootable is not booted, and the difference is a question the user can
105
+ # act on: one is "start your simulator", the other is "this machine has
106
+ # no iOS runtime installed".
107
+ if xcrun simctl list devices available 2>/dev/null | grep -q "([0-9A-F-]\{36\})"; then
108
+ DEVICE_REASON="no booted simulator, but one is available to boot"
109
+ else
110
+ DEVICE_REASON="no iOS simulator available on this machine"
111
+ fi
112
+ fi
113
+ fi
114
+ ;;
115
+ android)
116
+ if ! command -v adb >/dev/null 2>&1; then
117
+ DEVICE_REASON="adb unavailable; cannot tell whether a device is attached"
118
+ else
119
+ DEVICE=$(adb devices 2>/dev/null | awk 'NR>1 && $2=="device" {print $1; exit}')
120
+ [ -n "$DEVICE" ] || DEVICE_REASON="no attached device or running emulator"
121
+ fi
122
+ ;;
123
+ esac
124
+
125
+ # ---- Recorder -----------------------------------------------------------------
126
+ # The recorder is the same CLI the capture needs, so this answers "would
127
+ # capture-evidence.sh video start work" rather than "is some recorder installed".
128
+ case "$PLATFORM" in
129
+ ios)
130
+ if command -v xcrun >/dev/null 2>&1; then RECORDER="true"; else
131
+ RECORDER="false"; RECORDER_REASON="xcrun unavailable"
132
+ fi
133
+ ;;
134
+ android)
135
+ if command -v adb >/dev/null 2>&1; then RECORDER="true"; else
136
+ RECORDER="false"; RECORDER_REASON="adb unavailable"
137
+ fi
138
+ ;;
139
+ esac
140
+ if [ "$RECORDER" = "true" ] && ! command -v ffprobe >/dev/null 2>&1; then
141
+ # Not fatal. ffprobe only verifies the result, so its absence downgrades what
142
+ # can be CHECKED about a recording, never whether one can be made.
143
+ RECORDER_REASON="ffprobe unavailable; a recording cannot be verified after capture"
144
+ fi
145
+
146
+ # ---- Toolkit MCP --------------------------------------------------------------
147
+ # Registration only, never a handshake: a probe that spawns the server costs
148
+ # seconds at intake, and the question this answers is whether tier 2 may be
149
+ # offered at all.
150
+ CLAUDE_JSON="$HOME/.claude.json"
151
+ SETTINGS_JSON="$HOME/.claude/settings.json"
152
+ if command -v node >/dev/null 2>&1; then
153
+ MCP=$(node -e '
154
+ const fs = require("fs");
155
+ const hit = (p) => {
156
+ try {
157
+ const j = JSON.parse(fs.readFileSync(p, "utf8"));
158
+ return Object.keys(j.mcpServers || {}).some((k) => /toolkit/i.test(k));
159
+ } catch { return false; }
160
+ };
161
+ process.stdout.write(process.argv.slice(1).some(hit) ? "true" : "false");
162
+ ' "$CLAUDE_JSON" "$SETTINGS_JSON" 2>/dev/null)
163
+ [ -n "$MCP" ] || MCP="unknown"
164
+ [ "$MCP" = "false" ] && MCP_REASON="no mcpServers entry matching /toolkit/i"
165
+ [ "$MCP" = "unknown" ] && MCP_REASON="could not read the MCP registration files"
166
+ else
167
+ MCP="unknown"; MCP_REASON="node unavailable; cannot read the MCP registration"
168
+ fi
169
+
170
+ # ---- Tier verdicts ------------------------------------------------------------
171
+ # Computed before the report so both output forms carry them: a caller that
172
+ # persists the JSON and a caller that evals the KEY=VALUE lines must not have to
173
+ # re-derive the same booleans and risk deriving them differently.
174
+ # TIER1 needs a target AND a device AND a recorder; TIER2 drops the target and
175
+ # adds MCP; tier 3 is always reachable because "record nothing and say why" is.
176
+ T1=closed; T2=closed
177
+ [ -n "$UI_TEST_TARGET$UI_TEST_TARGETS" ] && [ -n "$DEVICE" ] && [ "$RECORDER" = "true" ] && T1=open
178
+ [ -n "$DEVICE" ] && [ "$RECORDER" = "true" ] && [ "$MCP" = "true" ] && T2=open
179
+
180
+ # --only device did not look for a target, so tier 1 is UNKNOWN here, not closed.
181
+ # Reporting it closed would be rule 2 broken by the file that states it: a caller
182
+ # re-checking the device before recording would read "tier 1 unavailable" from a
183
+ # measurement that never ran and downgrade a recording it could have made. Tier 2
184
+ # does not depend on the target, so it stays a real verdict.
185
+ [ "$ONLY" = "device" ] && T1=unknown
186
+
187
+ emit_json() {
188
+ UI_TEST_TARGET="$UI_TEST_TARGET" UI_TEST_TARGETS="$UI_TEST_TARGETS" \
189
+ UI_TEST_TARGET_REASON="$UI_TEST_TARGET_REASON" UI_TEST_MATCHES="$UI_TEST_MATCHES" \
190
+ UI_TEST_MATCH_REASON="$UI_TEST_MATCH_REASON" DEVICE="$DEVICE" DEVICE_REASON="$DEVICE_REASON" \
191
+ RECORDER="$RECORDER" RECORDER_REASON="$RECORDER_REASON" MCP="$MCP" MCP_REASON="$MCP_REASON" \
192
+ PLATFORM="$PLATFORM" TIER1="$T1" TIER2="$T2" \
193
+ node -e '
194
+ const e = process.env;
195
+ const list = (s) => (s ? s.split(",").filter(Boolean) : []);
196
+ const tri = (s) => (s === "true" ? true : s === "false" ? false : null);
197
+ process.stdout.write(JSON.stringify({
198
+ platform: e.PLATFORM,
199
+ uiTestTarget: e.UI_TEST_TARGET || null,
200
+ uiTestTargets: list(e.UI_TEST_TARGETS),
201
+ uiTestTargetReason: e.UI_TEST_TARGET_REASON || null,
202
+ matchingTests: list(e.UI_TEST_MATCHES),
203
+ matchingTestsReason: e.UI_TEST_MATCH_REASON || null,
204
+ device: e.DEVICE || null,
205
+ deviceReason: e.DEVICE_REASON || null,
206
+ recorder: tri(e.RECORDER),
207
+ recorderReason: e.RECORDER_REASON || null,
208
+ mcp: tri(e.MCP),
209
+ mcpReason: e.MCP_REASON || null,
210
+ tier1: e.TIER1,
211
+ tier2: e.TIER2,
212
+ }, null, 2) + "\n");
213
+ '
214
+ }
215
+
216
+ if [ -n "$JSON_OUT" ]; then
217
+ mkdir -p "$(dirname "$JSON_OUT")" 2>/dev/null || true
218
+ emit_json > "$JSON_OUT" || {
219
+ echo "probe-evidence-capability: could not write $JSON_OUT" >&2
220
+ exit 2
221
+ }
222
+ fi
223
+
224
+ if [ "$AS_JSON" -eq 1 ]; then
225
+ emit_json
226
+ exit 0
227
+ fi
228
+
229
+ # Every value is single-quoted, because the caller EVALS this. The reasons are
230
+ # prose - "no booted simulator, but one is available to boot" - and an unquoted
231
+ # assignment makes eval run `booted` as a command and assign the first word. The
232
+ # bug is invisible on a machine where the reasons happen to be empty, which is
233
+ # exactly the machine a developer tests on.
234
+ q() { printf "%s='%s'" "$1" "$(printf '%s' "$2" | sed "s/'/'\\\\''/g")"; printf '\n'; }
235
+
236
+ q EVIDENCE_PLATFORM "$PLATFORM"
237
+ q EVIDENCE_UI_TEST_TARGET "$UI_TEST_TARGET"
238
+ q EVIDENCE_UI_TEST_TARGETS "$UI_TEST_TARGETS"
239
+ q EVIDENCE_UI_TEST_TARGET_REASON "$UI_TEST_TARGET_REASON"
240
+ q EVIDENCE_MATCHING_TESTS "$UI_TEST_MATCHES"
241
+ q EVIDENCE_MATCHING_TESTS_REASON "$UI_TEST_MATCH_REASON"
242
+ q EVIDENCE_DEVICE "$DEVICE"
243
+ q EVIDENCE_DEVICE_REASON "$DEVICE_REASON"
244
+ q EVIDENCE_RECORDER "$RECORDER"
245
+ q EVIDENCE_RECORDER_REASON "$RECORDER_REASON"
246
+ q EVIDENCE_MCP "$MCP"
247
+ q EVIDENCE_MCP_REASON "$MCP_REASON"
248
+
249
+ q EVIDENCE_TIER1 "$T1"
250
+ q EVIDENCE_TIER2 "$T2"