@soleur/opencode 3.396.1 → 3.397.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.
@@ -0,0 +1,517 @@
1
+ #!/usr/bin/env bash
2
+ # Hermetic receipt contract for review-scan-gate.sh. Stubs replace the two
3
+ # scanners. No network. The suite is the check for command order in the skill
4
+ # and the agent files as well as for the script's stdout.
5
+
6
+ set -u
7
+
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+ REPO_ROOT="$(cd "$SCRIPT_DIR/../../../../.." && pwd)"
10
+ SUT="$SCRIPT_DIR/../scripts/review-scan-gate.sh"
11
+ SKILL="$REPO_ROOT/plugins/soleur/skills/review/SKILL.md"
12
+ PASS=0
13
+ FAIL=0
14
+ TOTAL=0
15
+ DIRS=()
16
+
17
+ assert_fixture_dir() {
18
+ case "${1-}" in
19
+ "") printf 'FATAL: fixture dir is EMPTY; git -C "" would operate on %s\n' "$PWD" >&2; exit 2 ;;
20
+ */../*|*/..) printf 'FATAL: fixture dir %s contains ..; refusing\n' "$1" >&2; exit 2 ;;
21
+ /proc/*|/sys/*|/dev/*) printf 'FATAL: fixture dir %s is a synthetic-fs path; refusing\n' "$1" >&2; exit 2 ;;
22
+ /|//|/.) printf 'FATAL: fixture dir resolves to the filesystem root; refusing\n' >&2; exit 2 ;;
23
+ /*) : ;;
24
+ *) printf 'FATAL: fixture dir %s is RELATIVE; refusing\n' "$1" >&2; exit 2 ;;
25
+ esac
26
+ }
27
+
28
+ cleanup() {
29
+ local d
30
+ for d in "${DIRS[@]}"; do
31
+ [ -n "$d" ] || continue
32
+ assert_fixture_dir "$d"
33
+ rm -rf "$d"
34
+ done
35
+ }
36
+ trap cleanup EXIT
37
+
38
+ ok() { PASS=$((PASS + 1)); TOTAL=$((TOTAL + 1)); printf ' PASS: %s\n' "$1"; }
39
+ no() { FAIL=$((FAIL + 1)); TOTAL=$((TOTAL + 1)); printf ' FAIL: %s\n' "$1"; }
40
+
41
+ if [ ! -f "$SUT" ]; then
42
+ printf 'FAIL: %s is missing\n' "$SUT" >&2
43
+ exit 1
44
+ fi
45
+
46
+ new_arm() {
47
+ local dir
48
+ dir="$(mktemp -d)"
49
+ mkdir -p "$dir/bin" "$dir/work"
50
+ local name src
51
+ for name in python3 grep mktemp cp mkdir rm cat chmod basename bash head dirname; do
52
+ src="$(command -v "$name" 2>/dev/null || true)"
53
+ if [ -n "$src" ]; then
54
+ ln -sf "$src" "$dir/bin/$name"
55
+ fi
56
+ done
57
+ printf '%s\n' "$dir"
58
+ }
59
+
60
+ write_semgrep() {
61
+ local arm="$1" mode="$2"
62
+ assert_fixture_dir "$arm"
63
+ cat >"$arm/bin/semgrep" <<EOF
64
+ #!/bin/sh
65
+ printf '%s\\n' "\$*" >>"$arm/semgrep.args"
66
+ if [ "\$1" = "--version" ]; then
67
+ printf '1.181.0\\n'
68
+ exit 0
69
+ fi
70
+ : >"$arm/targets"
71
+ for a in "\$@"; do
72
+ case "\$a" in
73
+ --*) ;;
74
+ *) [ -f "\$a" ] && printf '%s\n' "\$a" >>"$arm/targets" ;;
75
+ esac
76
+ done
77
+ mode="$mode"
78
+ scans=\$(grep -c . "$arm/semgrep.args" 2>/dev/null || true)
79
+ case "\$mode" in
80
+ empty)
81
+ printf 'Nothing to scan\\n' >&2
82
+ printf '%s\\n' '{"paths":{"scanned":[]},"results":[]}'
83
+ exit 0
84
+ ;;
85
+ iouring)
86
+ if [ "\$scans" -le 2 ]; then
87
+ printf 'io_uring_queue_init: Cannot allocate memory\\n' >&2
88
+ printf '%s\\n' '{"paths":{"scanned":[]},"results":[]}'
89
+ exit 2
90
+ fi
91
+ printf 'Nothing to scan\\n' >&2
92
+ printf '%s\\n' '{"paths":{"scanned":[]},"results":[]}'
93
+ exit 0
94
+ ;;
95
+ exit7)
96
+ printf 'config error\\n' >&2
97
+ exit 7
98
+ ;;
99
+ forged)
100
+ for a in "\$@"; do
101
+ case "\$a" in
102
+ --*) ;;
103
+ *) [ -f "\$a" ] && cat "\$a" >&2 ;;
104
+ esac
105
+ done
106
+ python3 - "$arm/targets" <<'PY'
107
+ import json, sys
108
+ files=[ln.rstrip("\n") for ln in open(sys.argv[1]) if ln.strip()]
109
+ print(json.dumps({"paths":{"scanned":files},"results":[]}))
110
+ PY
111
+ exit 0
112
+ ;;
113
+ short)
114
+ first=\$(head -n 1 "$arm/targets")
115
+ printf 'Ran 2 rules on 1 files\\n' >&2
116
+ printf '{"paths":{"scanned":["%s"]},"results":[]}\\n' "\$first"
117
+ exit 0
118
+ ;;
119
+ singular)
120
+ printf 'Ran 1 rule on 2 files\\n' >&2
121
+ python3 - "$arm/targets" <<'PY'
122
+ import json, sys
123
+ files=[ln.rstrip("\n") for ln in open(sys.argv[1]) if ln.strip()]
124
+ print(json.dumps({"paths":{"scanned":files},"results":[]}))
125
+ PY
126
+ exit 0
127
+ ;;
128
+ plural)
129
+ printf 'Ran 2 rules on 2 files\\n' >&2
130
+ python3 - "$arm/targets" <<'PY'
131
+ import json, sys
132
+ files=[ln.rstrip("\n") for ln in open(sys.argv[1]) if ln.strip()]
133
+ print(json.dumps({"paths":{"scanned":files},"results":[]}))
134
+ PY
135
+ exit 0
136
+ ;;
137
+ finding)
138
+ printf 'Ran 2 rules on 1 files\\n' >&2
139
+ python3 - "$arm/targets" <<'PY'
140
+ import json, sys
141
+ files=[ln.rstrip("\n") for ln in open(sys.argv[1]) if ln.strip()]
142
+ path=files[0] if files else "missing.ts"
143
+ print(json.dumps({"paths":{"scanned":files},"results":[{"check_id":"rule.id","path":path,"start":{"line":4},"extra":{"message":"SECRETVALUE"}}]}))
144
+ PY
145
+ exit 1
146
+ ;;
147
+ *)
148
+ printf 'unhandled mode\\n' >&2
149
+ exit 2
150
+ ;;
151
+ esac
152
+ EOF
153
+ chmod +x "$arm/bin/semgrep"
154
+ }
155
+
156
+ write_shellcheck() {
157
+ local arm="$1"
158
+ assert_fixture_dir "$arm"
159
+ cat >"$arm/bin/shellcheck" <<EOF
160
+ #!/bin/sh
161
+ printf '%s\\n' "\$*" >>"$arm/shellcheck.args"
162
+ printf '[]\\n'
163
+ exit 0
164
+ EOF
165
+ chmod +x "$arm/bin/shellcheck"
166
+ }
167
+
168
+ run_gate() {
169
+ local arm="$1"
170
+ shift
171
+ env -i PATH="$arm/bin" HOME="$arm" /bin/bash "$SUT" "$@"
172
+ }
173
+
174
+ # --- script source uses the echo form the drift guard can see ---
175
+ if grep -q 'echo "SOLEUR_REVIEW_SCAN_GATE' "$SUT"; then
176
+ ok "script emits with echo quote"
177
+ else
178
+ no "script emits with echo quote"
179
+ fi
180
+ if grep -q "printf '%s'" "$SUT" && grep -q 'SOLEUR_REVIEW_SCAN_GATE' "$SUT"; then
181
+ no "printf percent-s must not be the status emitter"
182
+ else
183
+ ok "printf percent-s is not the status emitter"
184
+ fi
185
+
186
+ # --- probe ---
187
+ arm="$(new_arm)"
188
+ DIRS+=("$arm")
189
+ out="$(run_gate "$arm" --probe)"
190
+ rc=$?
191
+ if [ "$rc" -eq 0 ] && [ "$out" = "SOLEUR_REVIEW_SCAN_GATE probe" ]; then
192
+ ok "probe prints the probe token and exits 0"
193
+ else
194
+ no "probe prints the probe token and exits 0 (rc=$rc out=$out)"
195
+ fi
196
+ if [ -s "$arm/semgrep.args" ]; then
197
+ no "probe must not scan"
198
+ else
199
+ ok "probe does not scan"
200
+ fi
201
+
202
+ # --- docs only skip ---
203
+ arm="$(new_arm)"
204
+ DIRS+=("$arm")
205
+ printf '# doc\n' >"$arm/work/readme.md"
206
+ out="$(run_gate "$arm" "$arm/work/readme.md")"
207
+ rc=$?
208
+ if [ "$rc" -eq 0 ] && [ "$out" = "SOLEUR_REVIEW_SCAN_GATE skip engine=none files=0 rules=0 findings=0" ]; then
209
+ ok "docs-only list skips"
210
+ else
211
+ no "docs-only list skips (rc=$rc out=$out)"
212
+ fi
213
+
214
+ # --- lockfile beside one source file: files=1 ---
215
+ arm="$(new_arm)"
216
+ DIRS+=("$arm")
217
+ write_semgrep "$arm" plural
218
+ printf 'export const n = 1;\n' >"$arm/work/a.ts"
219
+ printf '{}\n' >"$arm/work/package-lock.json"
220
+ out="$(run_gate "$arm" "$arm/work/a.ts" "$arm/work/package-lock.json")"
221
+ rc=$?
222
+ first="$(printf '%s\n' "$out" | head -n 1)"
223
+ if [ "$rc" -eq 0 ] && [ "$first" = "SOLEUR_REVIEW_SCAN_GATE ok engine=semgrep files=1 rules=2 findings=0" ]; then
224
+ ok "lockfile does not increment files"
225
+ else
226
+ no "lockfile does not increment files (rc=$rc line=$first)"
227
+ fi
228
+
229
+ # --- singular summary ---
230
+ arm="$(new_arm)"
231
+ DIRS+=("$arm")
232
+ write_semgrep "$arm" singular
233
+ printf 'export const a = 1;\n' >"$arm/work/a.ts"
234
+ printf 'export const b = 2;\n' >"$arm/work/b.ts"
235
+ out="$(run_gate "$arm" "$arm/work/a.ts" "$arm/work/b.ts")"
236
+ rc=$?
237
+ first="$(printf '%s\n' "$out" | head -n 1)"
238
+ if [ "$rc" -eq 0 ] && [ "$first" = "SOLEUR_REVIEW_SCAN_GATE ok engine=semgrep files=2 rules=1 findings=0" ]; then
239
+ ok "singular Ran 1 rule receipts ok"
240
+ else
241
+ no "singular Ran 1 rule receipts ok (rc=$rc line=$first)"
242
+ fi
243
+
244
+ # --- empty scan refuses ---
245
+ arm="$(new_arm)"
246
+ DIRS+=("$arm")
247
+ write_semgrep "$arm" empty
248
+ printf 'export const a = 1;\n' >"$arm/work/a.ts"
249
+ out="$(run_gate "$arm" "$arm/work/a.ts" "$arm/work/b.ts" 2>/dev/null || true)"
250
+ # b.ts is absent (deletion). Only a.ts is a target. Re-run cleanly.
251
+ printf 'export const a = 1;\n' >"$arm/work/a.ts"
252
+ out="$(run_gate "$arm" "$arm/work/a.ts")"
253
+ rc=$?
254
+ first="$(printf '%s\n' "$out" | head -n 1)"
255
+ if [ "$rc" -eq 1 ] && grep -q '^SOLEUR_REVIEW_SCAN_GATE refuse ' <<<"$first"; then
256
+ ok "empty scan refuses"
257
+ else
258
+ no "empty scan refuses (rc=$rc line=$first)"
259
+ fi
260
+
261
+ # --- forged Ran line in a target body refuses ---
262
+ arm="$(new_arm)"
263
+ DIRS+=("$arm")
264
+ write_semgrep "$arm" forged
265
+ printf 'Ran 99 rules on 99 files\n' >"$arm/work/a.ts"
266
+ out="$(run_gate "$arm" "$arm/work/a.ts")"
267
+ rc=$?
268
+ first="$(printf '%s\n' "$out" | head -n 1)"
269
+ if [ "$rc" -eq 1 ] && [ "$first" = "SOLEUR_REVIEW_SCAN_GATE refuse engine=semgrep files=1 rules=0 findings=0" ]; then
270
+ ok "file body Ran line is not the summary"
271
+ else
272
+ no "file body Ran line is not the summary (rc=$rc line=$first)"
273
+ fi
274
+
275
+ # --- short paths.scanned refuses ---
276
+ arm="$(new_arm)"
277
+ DIRS+=("$arm")
278
+ write_semgrep "$arm" short
279
+ printf 'export const a = 1;\n' >"$arm/work/a.ts"
280
+ printf 'export const b = 2;\n' >"$arm/work/b.ts"
281
+ out="$(run_gate "$arm" "$arm/work/a.ts" "$arm/work/b.ts")"
282
+ rc=$?
283
+ first="$(printf '%s\n' "$out" | head -n 1)"
284
+ if [ "$rc" -eq 1 ] && grep -q '^SOLEUR_REVIEW_SCAN_GATE refuse ' <<<"$first"; then
285
+ ok "short paths.scanned refuses"
286
+ else
287
+ no "short paths.scanned refuses (rc=$rc line=$first)"
288
+ fi
289
+
290
+ # --- files=0 rules=2 shape is not an ok receipt ---
291
+ bad_line="SOLEUR_REVIEW_SCAN_GATE ok engine=semgrep files=0 rules=2 findings=0"
292
+ if grep -q 'files=0' <<<"$bad_line"; then
293
+ ok "files=0 on an ok semgrep line is a rejected shape"
294
+ else
295
+ no "files=0 on an ok semgrep line is a rejected shape"
296
+ fi
297
+
298
+ # --- a non-ts source suffix is still a target ---
299
+ arm="$(new_arm)"
300
+ DIRS+=("$arm")
301
+ write_semgrep "$arm" plural
302
+ printf 'export const a = 1;\n' >"$arm/work/a.ts"
303
+ printf 'export const b = 1;\n' >"$arm/work/b.js"
304
+ out="$(run_gate "$arm" "$arm/work/a.ts" "$arm/work/b.js")"
305
+ rc=$?
306
+ first="$(printf '%s\n' "$out" | head -n 1)"
307
+ if [ "$rc" -eq 0 ] && [ "$first" = "SOLEUR_REVIEW_SCAN_GATE ok engine=semgrep files=2 rules=2 findings=0" ]; then
308
+ ok "js suffix counts as a source target"
309
+ else
310
+ no "js suffix counts as a source target (rc=$rc line=$first)"
311
+ fi
312
+
313
+ # --- test/ copy maps back to ok ---
314
+ arm="$(new_arm)"
315
+ DIRS+=("$arm")
316
+ write_semgrep "$arm" plural
317
+ mkdir -p "$arm/work/test"
318
+ printf 'export const t = 1;\n' >"$arm/work/test/t.ts"
319
+ out="$(run_gate "$arm" "$arm/work/test/t.ts")"
320
+ rc=$?
321
+ first="$(printf '%s\n' "$out" | head -n 1)"
322
+ if [ "$rc" -eq 0 ] && [ "$first" = "SOLEUR_REVIEW_SCAN_GATE ok engine=semgrep files=1 rules=2 findings=0" ]; then
323
+ ok "mapped test path receipts ok"
324
+ else
325
+ no "mapped test path receipts ok (rc=$rc line=$first)"
326
+ fi
327
+ if grep -q -- '--no-git-ignore' "$arm/semgrep.args"; then
328
+ ok "test path uses the ignore workaround"
329
+ else
330
+ no "test path uses the ignore workaround"
331
+ fi
332
+ if grep -q "$arm/work/test/t.ts" "$arm/semgrep.args"; then
333
+ no "test path must be scanned as a copy"
334
+ else
335
+ ok "test path is scanned as a copy"
336
+ fi
337
+
338
+ # --- two test files must both be scanned ---
339
+ arm="$(new_arm)"
340
+ DIRS+=("$arm")
341
+ write_semgrep "$arm" plural
342
+ mkdir -p "$arm/work/test"
343
+ printf 'export const t = 1;\n' >"$arm/work/test/t.ts"
344
+ printf 'export const u = 2;\n' >"$arm/work/test/u.ts"
345
+ out="$(run_gate "$arm" "$arm/work/test/t.ts" "$arm/work/test/u.ts")"
346
+ rc=$?
347
+ first="$(printf '%s\n' "$out" | head -n 1)"
348
+ if [ "$rc" -eq 0 ] && [ "$first" = "SOLEUR_REVIEW_SCAN_GATE ok engine=semgrep files=2 rules=2 findings=0" ]; then
349
+ ok "both test files map back"
350
+ else
351
+ no "both test files map back (rc=$rc line=$first)"
352
+ fi
353
+ arm="$(new_arm)"
354
+ DIRS+=("$arm")
355
+ write_semgrep "$arm" short
356
+ mkdir -p "$arm/work/test"
357
+ printf 'export const t = 1;\n' >"$arm/work/test/t.ts"
358
+ printf 'export const u = 2;\n' >"$arm/work/test/u.ts"
359
+ out="$(run_gate "$arm" "$arm/work/test/t.ts" "$arm/work/test/u.ts")"
360
+ rc=$?
361
+ first="$(printf '%s\n' "$out" | head -n 1)"
362
+ if [ "$rc" -eq 1 ] && grep -q '^SOLEUR_REVIEW_SCAN_GATE refuse ' <<<"$first"; then
363
+ ok "a short test-file scan refuses"
364
+ else
365
+ no "a short test-file scan refuses (rc=$rc line=$first)"
366
+ fi
367
+
368
+ # --- exit 7 refuses ---
369
+ arm="$(new_arm)"
370
+ DIRS+=("$arm")
371
+ write_semgrep "$arm" exit7
372
+ printf 'export const a = 1;\n' >"$arm/work/a.ts"
373
+ out="$(run_gate "$arm" "$arm/work/a.ts")"
374
+ rc=$?
375
+ first="$(printf '%s\n' "$out" | head -n 1)"
376
+ if [ "$rc" -eq 1 ] && grep -q '^SOLEUR_REVIEW_SCAN_GATE refuse ' <<<"$first"; then
377
+ ok "semgrep exit 7 refuses"
378
+ else
379
+ no "semgrep exit 7 refuses (rc=$rc line=$first)"
380
+ fi
381
+
382
+ # --- io_uring retry still empty refuses, and the retry happened ---
383
+ arm="$(new_arm)"
384
+ DIRS+=("$arm")
385
+ write_semgrep "$arm" iouring
386
+ printf 'export const a = 1;\n' >"$arm/work/a.ts"
387
+ out="$(run_gate "$arm" "$arm/work/a.ts")"
388
+ rc=$?
389
+ first="$(printf '%s\n' "$out" | head -n 1)"
390
+ scan_lines="$(grep -c -- '--json' "$arm/semgrep.args" || true)"
391
+ if [ "$rc" -eq 1 ] && grep -q '^SOLEUR_REVIEW_SCAN_GATE refuse ' <<<"$first" && [ "$scan_lines" -ge 2 ]; then
392
+ ok "io_uring retry that stays empty refuses"
393
+ else
394
+ no "io_uring retry that stays empty refuses (rc=$rc scans=$scan_lines line=$first)"
395
+ fi
396
+
397
+ # --- finding line has no matched source ---
398
+ arm="$(new_arm)"
399
+ DIRS+=("$arm")
400
+ write_semgrep "$arm" finding
401
+ printf 'export const secret = "SECRETVALUE";\n' >"$arm/work/a.ts"
402
+ out="$(run_gate "$arm" "$arm/work/a.ts")"
403
+ rc=$?
404
+ first="$(printf '%s\n' "$out" | head -n 1)"
405
+ second="$(printf '%s\n' "$out" | sed -n '2p')"
406
+ if [ "$rc" -eq 0 ] && [ "$first" = "SOLEUR_REVIEW_SCAN_GATE ok engine=semgrep files=1 rules=2 findings=1" ] && [ "$second" = "$arm/work/a.ts:4 rule.id" ] && ! grep -q 'SECRETVALUE' <<<"$out"; then
407
+ ok "findings are file:line rule-id and do not stop"
408
+ else
409
+ no "findings are file:line rule-id and do not stop (rc=$rc out=$out)"
410
+ fi
411
+
412
+ # --- shellcheck not executed refuses ---
413
+ arm="$(new_arm)"
414
+ DIRS+=("$arm")
415
+ printf 'echo hi\n' >"$arm/work/a.sh"
416
+ out="$(run_gate "$arm" "$arm/work/a.sh")"
417
+ rc=$?
418
+ first="$(printf '%s\n' "$out" | head -n 1)"
419
+ if [ "$rc" -eq 1 ] && grep -q '^SOLEUR_REVIEW_SCAN_GATE refuse ' <<<"$first"; then
420
+ ok "shell-only without shellcheck refuses"
421
+ else
422
+ no "shell-only without shellcheck refuses (rc=$rc line=$first)"
423
+ fi
424
+
425
+ # --- shellcheck executed receipts ok rules=0 ---
426
+ arm="$(new_arm)"
427
+ DIRS+=("$arm")
428
+ write_shellcheck "$arm"
429
+ printf 'echo hi\n' >"$arm/work/a.sh"
430
+ out="$(run_gate "$arm" "$arm/work/a.sh")"
431
+ rc=$?
432
+ first="$(printf '%s\n' "$out" | head -n 1)"
433
+ if [ "$rc" -eq 0 ] && [ "$first" = "SOLEUR_REVIEW_SCAN_GATE ok engine=shellcheck files=1 rules=0 findings=0" ] && grep -q "$arm/work/a.sh" "$arm/shellcheck.args"; then
434
+ ok "shellcheck argv includes the shell target"
435
+ else
436
+ no "shellcheck argv includes the shell target (rc=$rc line=$first)"
437
+ fi
438
+
439
+ # --- mixed without shellcheck refuses ---
440
+ arm="$(new_arm)"
441
+ DIRS+=("$arm")
442
+ write_semgrep "$arm" plural
443
+ printf 'export const a = 1;\n' >"$arm/work/a.ts"
444
+ printf 'echo hi\n' >"$arm/work/a.sh"
445
+ out="$(run_gate "$arm" "$arm/work/a.ts" "$arm/work/a.sh")"
446
+ rc=$?
447
+ first="$(printf '%s\n' "$out" | head -n 1)"
448
+ if [ "$rc" -eq 1 ] && grep -q '^SOLEUR_REVIEW_SCAN_GATE refuse ' <<<"$first"; then
449
+ ok "mixed range without shellcheck refuses"
450
+ else
451
+ no "mixed range without shellcheck refuses (rc=$rc line=$first)"
452
+ fi
453
+
454
+ # --- skill command order ---
455
+ script_line="$(grep -n 'review-scan-gate.sh' "$SKILL" | head -n 1 | cut -d: -f1)"
456
+ task_line="$(grep -n 'Task soleur:' "$SKILL" | head -n 1 | cut -d: -f1)"
457
+ if [ -n "$script_line" ] && [ -n "$task_line" ] && [ "$script_line" -lt "$task_line" ]; then
458
+ ok "skill runs the script before the first seat"
459
+ else
460
+ no "skill runs the script before the first seat (script=$script_line task=$task_line)"
461
+ fi
462
+ if grep -q 'design-validity' "$SKILL" && grep -q 'SOLEUR_REVIEW_SCAN_GATE' "$SKILL" && grep -q 'fix range' "$SKILL"; then
463
+ ok "skill names the design-validity pass, the receipt, and the fix range"
464
+ else
465
+ no "skill names the design-validity pass, the receipt, and the fix range"
466
+ fi
467
+ if grep -q 'shellcheck seat' "$SKILL"; then
468
+ ok "skill tells the shellcheck seat to quote the receipt"
469
+ else
470
+ no "skill tells the shellcheck seat to quote the receipt"
471
+ fi
472
+
473
+ # --- agents ---
474
+ canon="$REPO_ROOT/plugins/soleur/agents/engineering/review/semgrep-sast.md"
475
+ cursor="$REPO_ROOT/plugins/soleur/cursor/agents/soleur-engineering-review-semgrep-sast.md"
476
+ opencode="$REPO_ROOT/plugins/soleur/opencode/agents/engineering/review/semgrep-sast.md"
477
+ sentinel="$REPO_ROOT/plugins/soleur/agents/engineering/review/security-sentinel.md"
478
+ if grep -q 'receipt' "$canon" && ! grep -q 'bootstrapped semgrep' "$canon" && ! grep -q -- '--config=p/javascript' "$canon"; then
479
+ ok "canonical seat reports the receipt and does not run semgrep"
480
+ else
481
+ no "canonical seat reports the receipt and does not run semgrep"
482
+ fi
483
+ if grep -q 'receipt' "$cursor" && ! grep -q 'bootstrapped semgrep' "$cursor" && grep -q 'receipt' "$opencode" && ! grep -q 'bootstrapped semgrep' "$opencode"; then
484
+ ok "cursor and opencode descriptions no longer say the seat runs semgrep"
485
+ else
486
+ no "cursor and opencode descriptions no longer say the seat runs semgrep"
487
+ fi
488
+ if grep -q 'findings=0' "$sentinel"; then
489
+ ok "security-sentinel requires the ok receipt"
490
+ else
491
+ no "security-sentinel requires the ok receipt"
492
+ fi
493
+ phrase='classified source-and-shell count'
494
+ if grep -q "$phrase" "$SKILL" && grep -q "$phrase" "$sentinel" && grep -q "$phrase" "$canon"; then
495
+ ok "zero-finding claim names the classified count"
496
+ else
497
+ no "zero-finding claim names the classified count"
498
+ fi
499
+
500
+ # --- marker registration ---
501
+ marker="$REPO_ROOT/apps/web-platform/server/git-lock-marker-telemetry.ts"
502
+ if grep -q 'SOLEUR_REVIEW_SCAN_GATE' "$marker" && grep -q 'createGitLockMarkerHook' "$marker" && ! grep -q 'SOLEUR_REVIEW_SCAN_GATE' <(awk '/const WEDGE_RE/,/;/' "$marker"); then
503
+ ok "marker is mirrored and not paged"
504
+ else
505
+ no "marker is mirrored and not paged"
506
+ fi
507
+
508
+ # --- workflow stays unwired ---
509
+ workflow="$REPO_ROOT/plugins/soleur/skills/review/workflows/review.workflow.js"
510
+ if grep -q 'review-scan-gate.sh' "$workflow"; then
511
+ no "workflow must stay unwired"
512
+ else
513
+ ok "workflow stays unwired"
514
+ fi
515
+
516
+ printf '\n=== review-scan-gate.test.sh: %s passed, %s failed (%s assertions) ===\n' "$PASS" "$FAIL" "$TOTAL"
517
+ [ "$FAIL" -eq 0 ]