checkwright 0.38.0 → 0.40.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.
Files changed (195) hide show
  1. package/package.json +2 -2
  2. package/payload/artifact/aarch64-apple-darwin/checkwright-gates +0 -0
  3. package/payload/artifact/aarch64-apple-darwin/checkwright-gates.sha256 +1 -1
  4. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe +0 -0
  5. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -1
  6. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates +0 -0
  7. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  8. package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates +0 -0
  9. package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates.sha256 +1 -1
  10. package/payload/artifact/x86_64-apple-darwin/checkwright-gates +0 -0
  11. package/payload/artifact/x86_64-apple-darwin/checkwright-gates.sha256 +1 -1
  12. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe +0 -0
  13. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -1
  14. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  15. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  16. package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates +0 -0
  17. package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates.sha256 +1 -1
  18. package/payload/canon-kit/gate-tests/check-amendment-queue.test.sh +3 -3
  19. package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +3 -3
  20. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +2 -2
  21. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +3 -3
  22. package/payload/canon-kit/gate-tests/check-prose-bounds.test.sh +1 -1
  23. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +2 -2
  24. package/payload/canon-kit/gate-tests/check-provenance-seam/good/TASK-QUEUE.md +4 -0
  25. package/payload/canon-kit/gate-tests/check-provenance-seam/good/widget-toolkit/SPEC.md +1 -1
  26. package/payload/canon-kit/gate-tests/check-todo-task-liveness.test.sh +1 -1
  27. package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +7 -7
  28. package/payload/context-kit/gate-tests/check-surface-ratchet.test.sh +7 -6
  29. package/payload/delegation-kit/README.md +1 -1
  30. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +2 -2
  31. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +2 -2
  32. package/payload/evidence-kit/gate-tests/pre-hook.test.sh +5 -5
  33. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +7 -7
  34. package/payload/evidence-kit/gate-tests/statement-store.test.sh +5 -5
  35. package/payload/evidence-kit/gate-tests/verify-gate-run-strict.test.sh +5 -4
  36. package/payload/gate-sdk/README.md +7 -0
  37. package/payload/gate-sdk/bin/build-native.sh +5 -4
  38. package/payload/gate-sdk/bin/run-gates.ps1 +8 -7
  39. package/payload/gate-sdk/bin/run-gates.sh +10 -8
  40. package/payload/gate-sdk/checks/check-binary-strings.gate +4 -0
  41. package/payload/gate-sdk/checks/check-exec-write.gate +4 -0
  42. package/payload/gate-sdk/checks/check-migration-guard.gate +4 -0
  43. package/payload/gate-sdk/checks/check-path-names.gate +4 -0
  44. package/payload/gate-sdk/checks/check-pipefail-readers.gate +4 -0
  45. package/payload/gate-sdk/checks/check-script-preflight.gate +4 -0
  46. package/payload/gate-sdk/checks/check-site-count.gate +4 -0
  47. package/payload/gate-sdk/checks/check-tree-terms.gate +1 -1
  48. package/payload/gate-sdk/gate-tests/binary-only-recipe.test.sh +2 -2
  49. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +11 -11
  50. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/expect.txt +5 -0
  51. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/out/app.elf +0 -0
  52. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/out/notes.bin +0 -0
  53. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/out/short.bin +0 -0
  54. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/scripts/gate-sdk-config.knobs +3 -0
  55. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/shapes.list +2 -0
  56. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/terms.list +4 -0
  57. package/payload/gate-sdk/gate-tests/check-binary-strings/good/expect.txt +1 -0
  58. package/payload/gate-sdk/gate-tests/check-binary-strings/good/out/app.elf +0 -0
  59. package/payload/gate-sdk/gate-tests/check-binary-strings/good/scripts/gate-sdk-config.knobs +3 -0
  60. package/payload/gate-sdk/gate-tests/check-binary-strings/good/shapes.list +4 -0
  61. package/payload/gate-sdk/gate-tests/check-binary-strings/good/terms.list +4 -0
  62. package/payload/gate-sdk/gate-tests/check-binary-strings.test.sh +74 -0
  63. package/payload/gate-sdk/gate-tests/check-exec-write/bad/expect.txt +14 -0
  64. package/payload/gate-sdk/gate-tests/check-exec-write/bad/scripts/gate-sdk-config.knobs +2 -0
  65. package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/caller.rs +5 -0
  66. package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/helper.rs +5 -0
  67. package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/sites.rs +21 -0
  68. package/payload/gate-sdk/gate-tests/check-exec-write/good/expect.txt +1 -0
  69. package/payload/gate-sdk/gate-tests/check-exec-write/good/scripts/gate-sdk-config.knobs +2 -0
  70. package/payload/gate-sdk/gate-tests/check-exec-write/good/src/helper.rs +5 -0
  71. package/payload/gate-sdk/gate-tests/check-exec-write/good/src/main.rs +15 -0
  72. package/payload/gate-sdk/gate-tests/check-exec-write.test.sh +69 -0
  73. package/payload/gate-sdk/gate-tests/check-identity.test.sh +2 -2
  74. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/args +2 -0
  75. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0001_init.sql +1 -0
  76. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0002_orders.sql +1 -0
  77. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0003_audit.sql +1 -0
  78. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/destructive.list +4 -0
  79. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/expect.txt +8 -0
  80. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0001_init.sql +1 -0
  81. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0002_late.sql +1 -0
  82. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0003_audit_log.sql +1 -0
  83. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0004_prune.sql +3 -0
  84. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0005_accounts.sql +2 -0
  85. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0005_users.sql +2 -0
  86. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/scripts/gate-sdk-config.knobs +2 -0
  87. package/payload/gate-sdk/gate-tests/check-migration-guard/good/args +2 -0
  88. package/payload/gate-sdk/gate-tests/check-migration-guard/good/base/0001_init.sql +1 -0
  89. package/payload/gate-sdk/gate-tests/check-migration-guard/good/base/0002_legacy.sql +1 -0
  90. package/payload/gate-sdk/gate-tests/check-migration-guard/good/destructive.list +4 -0
  91. package/payload/gate-sdk/gate-tests/check-migration-guard/good/expect.txt +1 -0
  92. package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0001_init.sql +1 -0
  93. package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0002_legacy.sql +1 -0
  94. package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0003_retire_legacy.sql +6 -0
  95. package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0004_index_accounts.sql +2 -0
  96. package/payload/gate-sdk/gate-tests/check-migration-guard/good/scripts/gate-sdk-config.knobs +2 -0
  97. package/payload/gate-sdk/gate-tests/check-migration-guard.test.sh +277 -0
  98. package/payload/gate-sdk/gate-tests/check-path-names/bad/expect.txt +6 -0
  99. package/payload/gate-sdk/gate-tests/check-path-names/bad/scripts/gate-sdk-config.knobs +1 -0
  100. package/payload/gate-sdk/gate-tests/check-path-names/bad/terms.list +3 -0
  101. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/ZePhYr.md +1 -0
  102. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo/a.txt +1 -0
  103. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo/zephyr.txt +1 -0
  104. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo-cli.sh +1 -0
  105. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo.rs +1 -0
  106. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo_x.txt +1 -0
  107. package/payload/gate-sdk/gate-tests/check-path-names/good/expect.txt +1 -0
  108. package/payload/gate-sdk/gate-tests/check-path-names/good/scripts/gate-sdk-config.knobs +1 -0
  109. package/payload/gate-sdk/gate-tests/check-path-names/good/terms.list +1 -0
  110. package/payload/gate-sdk/gate-tests/check-path-names/good/tree/foobar.rs +1 -0
  111. package/payload/gate-sdk/gate-tests/check-path-names/good/tree/food/a.txt +1 -0
  112. package/payload/gate-sdk/gate-tests/check-path-names/good/tree/xfoo.txt +1 -0
  113. package/payload/gate-sdk/gate-tests/check-path-names.test.sh +66 -0
  114. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/baseline.tsv +4 -0
  115. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/expect.txt +17 -0
  116. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/scripts/gate-sdk-config.knobs +2 -0
  117. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/over.sh +5 -0
  118. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/readers.sh +16 -0
  119. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/shared-lib.sh +3 -0
  120. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/stale.sh +4 -0
  121. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/baseline.tsv +2 -0
  122. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/expect.txt +1 -0
  123. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/scripts/gate-sdk-config.knobs +2 -0
  124. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/clean.sh +17 -0
  125. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/lib/baselined-lib.sh +4 -0
  126. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/no-pipefail.sh +4 -0
  127. package/payload/gate-sdk/gate-tests/check-pipefail-readers.test.sh +127 -0
  128. package/payload/gate-sdk/gate-tests/check-portability-floor.test.sh +1 -1
  129. package/payload/gate-sdk/gate-tests/check-script-preflight/bad/expect.txt +10 -0
  130. package/payload/gate-sdk/gate-tests/check-script-preflight/bad/rules.list +23 -0
  131. package/payload/gate-sdk/gate-tests/check-script-preflight/bad/scripts/gate-sdk-config.knobs +2 -0
  132. package/payload/gate-sdk/gate-tests/check-script-preflight/bad/tree/submit-job.sh +13 -0
  133. package/payload/gate-sdk/gate-tests/check-script-preflight/good/expect.txt +1 -0
  134. package/payload/gate-sdk/gate-tests/check-script-preflight/good/rules.list +23 -0
  135. package/payload/gate-sdk/gate-tests/check-script-preflight/good/scripts/gate-sdk-config.knobs +2 -0
  136. package/payload/gate-sdk/gate-tests/check-script-preflight/good/tree/submit-job.sh +17 -0
  137. package/payload/gate-sdk/gate-tests/check-script-preflight.test.sh +110 -0
  138. package/payload/gate-sdk/gate-tests/check-site-count/bad/expect.txt +4 -0
  139. package/payload/gate-sdk/gate-tests/check-site-count/bad/rules.list +5 -0
  140. package/payload/gate-sdk/gate-tests/check-site-count/bad/scripts/gate-sdk-config.knobs +1 -0
  141. package/payload/gate-sdk/gate-tests/check-site-count/bad/sites.tsv +3 -0
  142. package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/new.txt +1 -0
  143. package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/over.txt +3 -0
  144. package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/under.txt +1 -0
  145. package/payload/gate-sdk/gate-tests/check-site-count/good/expect.txt +1 -0
  146. package/payload/gate-sdk/gate-tests/check-site-count/good/rules.list +5 -0
  147. package/payload/gate-sdk/gate-tests/check-site-count/good/scripts/gate-sdk-config.knobs +1 -0
  148. package/payload/gate-sdk/gate-tests/check-site-count/good/sites.tsv +2 -0
  149. package/payload/gate-sdk/gate-tests/check-site-count/good/tree/blob.bin +0 -0
  150. package/payload/gate-sdk/gate-tests/check-site-count/good/tree/pinned.txt +2 -0
  151. package/payload/gate-sdk/gate-tests/check-site-count/good/tree/plain.txt +1 -0
  152. package/payload/gate-sdk/gate-tests/check-site-count/good/tree/tests/helper.txt +2 -0
  153. package/payload/gate-sdk/gate-tests/check-site-count.test.sh +90 -0
  154. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +11 -8
  155. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +4 -1
  156. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/scripts/gate-sdk-config.knobs +1 -0
  157. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/terms.list +4 -0
  158. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/terms.txt +2 -0
  159. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  160. package/payload/gate-sdk/gate-tests/check-tree-terms/good/scripts/gate-sdk-config.knobs +1 -0
  161. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/rosters/terms.list +2 -0
  162. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/words.txt +1 -0
  163. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +36 -16
  164. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +5 -6
  165. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +8 -8
  166. package/payload/gate-sdk/gate-tests/lib-test-hermetic.test.sh +35 -1
  167. package/payload/gate-sdk/gate-tests/native-git-hooks.test.sh +7 -7
  168. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +4 -4
  169. package/payload/gate-sdk/gate-tests/run-for-path.test.sh +3 -3
  170. package/payload/gate-sdk/gate-tests/run-gates-linked-worktree.test.sh +6 -6
  171. package/payload/gate-sdk/gate-tests/run-json.test.sh +52 -0
  172. package/payload/gate-sdk/gate-tests/verdict-store.test.sh +99 -0
  173. package/payload/gate-sdk/lib/gate.sh +12 -9
  174. package/payload/gate-sdk/lib/test-hermetic.sh +25 -8
  175. package/payload/gate-sdk/templates/check-skeleton.sh +2 -1
  176. package/payload/gate-sdk/templates/migration-destructive.list +10 -0
  177. package/payload/gate-sdk/templates/script-rules.list +39 -0
  178. package/payload/gate-sdk/templates/strings-shapes.list +15 -0
  179. package/payload/guard-kit/gate-tests/consumer-rules.test.sh +5 -5
  180. package/payload/guard-kit/gate-tests/door-binding-corpus.test.sh +2 -2
  181. package/payload/lifecycle-kit/gate-tests/boundary-worktree-refusal.test.sh +1 -1
  182. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry.test.sh +1 -1
  183. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +3 -3
  184. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +1 -1
  185. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +2 -2
  186. package/payload/lifecycle-kit/gate-tests/lead-journal-open.test.sh +18 -2
  187. package/payload/lifecycle-kit/gate-tests/peer-channel.test.sh +35 -6
  188. package/payload/lifecycle-kit/gate-tests/preflight-valve.test.sh +4 -4
  189. package/payload/lifecycle-kit/templates/consult.md +1 -1
  190. package/payload/lifecycle-kit/templates/stages/scope.md +1 -1
  191. package/payload/queue-kit/README.md +1 -1
  192. package/payload/queue-kit/gate-tests/check-queue-slug-liveness.test.sh +2 -2
  193. package/payload/queue-kit/gate-tests/check-task-conservation.test.sh +4 -4
  194. package/payload/site-kit/gate-tests/check-docs-liquid-parse-parser.test.sh +4 -4
  195. package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +9 -9
@@ -100,7 +100,7 @@ if ! head -c1 "$SANDBOX/repo/locked.list" >/dev/null 2>&1; then
100
100
  out="$( cd "$SANDBOX/repo" \
101
101
  && gate_env GATE_SDK_PORTABILITY_PATHS=. \
102
102
  && gate_run check-portability-floor "$CHECKS" locked.list 2>&1 )"; rc=$?
103
- expect unreadable-pattern-file 2 'pattern file not readable' "$rc" "$out"
103
+ expect unreadable-pattern-file 3 'pattern file not readable' "$rc" "$out"
104
104
  else
105
105
  echo " SKIP [unreadable-pattern-file]: chmod 000 left the file readable — this account or filesystem does not enforce POSIX modes, so the arm's precondition is absent and it declares the skip rather than reporting a failure."
106
106
  fi
@@ -0,0 +1,10 @@
1
+ script site(s) breaking a rule in rules.list
2
+ tree/submit-job.sh:3: [KILL-BROAD] pkill
3
+ tree/submit-job.sh:4: [KILL-BROAD] pkill
4
+ tree/submit-job.sh:5: [MOUNT] token 1
5
+ tree/submit-job.sh:6: [EARLY] head
6
+ tree/submit-job.sh:7: [OWNER] --owner
7
+ tree/submit-job.sh:8: [OWNER] -u
8
+ tree/submit-job.sh:9: [KILL-BROAD] waiver reason under 5 characters
9
+ tree/submit-job.sh:11: [KILL-BROAD] pkill
10
+ tree/submit-job.sh:13: [MOUNT] token 2
@@ -0,0 +1,23 @@
1
+ # One block per kind, the shared rules of both cases.
2
+ waiver-min 5
3
+ body sbatch
4
+
5
+ rule KILL-BROAD command
6
+ cmd pkill
7
+ allow ^pkill -P "[$][A-Za-z_][A-Za-z0-9_]*"$
8
+ before timeout [0-9]+ $
9
+ waiver kill-ok
10
+
11
+ rule MOUNT forbidden-token
12
+ token /mnt/shared
13
+ token /scratch/team
14
+ waiver mount-ok
15
+
16
+ rule EARLY early-exit
17
+ waiver pipefail-ok
18
+
19
+ rule OWNER id-grammar
20
+ cmd submit
21
+ flag --owner
22
+ flag -u
23
+ grammar ^[a-z][a-z0-9]{2,}$
@@ -0,0 +1,2 @@
1
+ GATE_SDK_SCRIPT_FILES = tree
2
+ GATE_SDK_SCRIPT_RULES = rules.list
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ pkill -f worker
4
+ pkill -P "$parent" -9
5
+ cp out.log /mnt/shared/logs/
6
+ grep x in.log | head -1
7
+ submit --owner Admin job.sh
8
+ submit -u=x job.sh
9
+ pkill -f worker # kill-ok: why
10
+ sbatch <<'EOF'
11
+ pkill -u me
12
+ EOF
13
+ sbatch --wrap "ls /scratch/team"
@@ -0,0 +1 @@
1
+ SCRIPT-PREFLIGHT: clean (1 script(s) read against 4 rule(s) in rules.list)
@@ -0,0 +1,23 @@
1
+ # One block per kind, the shared rules of both cases.
2
+ waiver-min 5
3
+ body sbatch
4
+
5
+ rule KILL-BROAD command
6
+ cmd pkill
7
+ allow ^pkill -P "[$][A-Za-z_][A-Za-z0-9_]*"$
8
+ before timeout [0-9]+ $
9
+ waiver kill-ok
10
+
11
+ rule MOUNT forbidden-token
12
+ token /mnt/shared
13
+ token /scratch/team
14
+ waiver mount-ok
15
+
16
+ rule EARLY early-exit
17
+ waiver pipefail-ok
18
+
19
+ rule OWNER id-grammar
20
+ cmd submit
21
+ flag --owner
22
+ flag -u
23
+ grammar ^[a-z][a-z0-9]{2,}$
@@ -0,0 +1,2 @@
1
+ GATE_SDK_SCRIPT_FILES = tree
2
+ GATE_SDK_SCRIPT_RULES = rules.list
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ pkill -P "$parent"
4
+ timeout 5 pkill -f worker
5
+ pkill -f worker # kill-ok: drains the whole worker pool
6
+ echo "pkill -f worker"
7
+ # cp out.log /mnt/shared/logs/
8
+ cat <<EOF
9
+ /mnt/shared is only named in this note
10
+ EOF
11
+ { grep x in.log || true; } | head -1
12
+ grep x in.log | head -1 # pipefail-ok: the first match is enough
13
+ submit --owner admin -u "$USER" job.sh
14
+ submit --owner=ops1 job.sh
15
+ sbatch <<'EOF'
16
+ pkill -P "$job"
17
+ EOF
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of check-script-preflight over what the good/+bad/ pair cannot reach: an
3
+ # empty configuration, operands, the rules file's exit-2 and exit-3 classes, an unparseable
4
+ # script, and the prune set over the tracked tree.
5
+ #
6
+ # Run by the --run-gate-tests arm (any <tests-dir>/*.test.sh; must exit 0).
7
+ set -uo pipefail
8
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
9
+
10
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # gate-sdk/
11
+ CHECKS="$DIR/checks"
12
+ CASES="$DIR/gate-tests/check-script-preflight"
13
+ SANDBOX="$(mktemp -d)"
14
+ trap 'rm -rf "$SANDBOX"' EXIT
15
+
16
+ fails=0
17
+ cases=0
18
+
19
+ expect() { # expect <label> <want-rc> <substring> <got-rc> <output>
20
+ cases=$((cases + 1))
21
+ if [[ "$4" -ne "$2" ]]; then
22
+ echo " FAIL [$1]: want exit $2, got $4 -- $5"; fails=$((fails + 1))
23
+ elif ! grep -qF -- "$3" <<<"$5"; then
24
+ echo " FAIL [$1]: exit $2 but output lacks '$3': $5"; fails=$((fails + 1))
25
+ fi
26
+ }
27
+
28
+ refute() { # refute <label> <substring> <output>
29
+ if grep -qF -- "$2" <<<"$3"; then
30
+ echo " FAIL [$1]: output holds '$2': $3"; fails=$((fails + 1))
31
+ fi
32
+ }
33
+
34
+ # --- no script configured: clean, not applicable, and no rules file read.
35
+ mkdir -p "$SANDBOX/empty"
36
+ out="$( cd "$SANDBOX/empty" && gate_run check-script-preflight "$CHECKS" 2>&1 )"; rc=$?
37
+ expect not-applicable 0 'not applicable: no script configured' "$rc" "$out"
38
+
39
+ # --- an operand naming nothing on disk is refused at 2.
40
+ out="$( cd "$SANDBOX/empty" && gate_run check-script-preflight "$CHECKS" gone.sh 2>&1 )"; rc=$?
41
+ expect absent-operand 2 'no script at gone.sh' "$rc" "$out"
42
+
43
+ # --- an operand is read tracked or not, and narrows the corpus to itself.
44
+ mkdir -p "$SANDBOX/operand"
45
+ cp "$CASES/bad/rules.list" "$SANDBOX/operand/"
46
+ printf '#!/usr/bin/env bash\npkill -f job\n' > "$SANDBOX/operand/one.sh"
47
+ out="$( cd "$SANDBOX/operand" && gate_env GATE_SDK_SCRIPT_RULES=rules.list \
48
+ && gate_run check-script-preflight "$CHECKS" one.sh 2>&1 )"; rc=$?
49
+ expect operand 1 'one.sh:2: [KILL-BROAD] pkill' "$rc" "$out"
50
+
51
+ # --- the rules file: absent while a corpus is configured is refused at 2, unreadable is 3, and a
52
+ # malformed one is 2 naming its file and line.
53
+ out="$( cd "$SANDBOX/operand" && gate_env GATE_SDK_SCRIPT_RULES=missing.list \
54
+ && gate_run check-script-preflight "$CHECKS" one.sh 2>&1 )"; rc=$?
55
+ expect rules-absent 2 'missing.list' "$rc" "$out"
56
+ printf 'rule KILL command\n cmd pkill\n\xff\n' > "$SANDBOX/operand/binary.list"
57
+ out="$( cd "$SANDBOX/operand" && gate_env GATE_SDK_SCRIPT_RULES=binary.list \
58
+ && gate_run check-script-preflight "$CHECKS" one.sh 2>&1 )"; rc=$?
59
+ expect rules-unreadable 3 'binary.list' "$rc" "$out"
60
+ printf 'waiver-min 2\nrule KILL command\n cmd pkill\n allow (\n' > "$SANDBOX/operand/ere.list"
61
+ out="$( cd "$SANDBOX/operand" && gate_env GATE_SDK_SCRIPT_RULES=ere.list \
62
+ && gate_run check-script-preflight "$CHECKS" one.sh 2>&1 )"; rc=$?
63
+ expect rules-ere 2 'ere.list:4: allow:' "$rc" "$out"
64
+ printf 'rule kill command\n cmd pkill\n' > "$SANDBOX/operand/id.list"
65
+ out="$( cd "$SANDBOX/operand" && gate_env GATE_SDK_SCRIPT_RULES=id.list \
66
+ && gate_run check-script-preflight "$CHECKS" one.sh 2>&1 )"; rc=$?
67
+ expect rules-id 2 'id.list:1: rule id' "$rc" "$out"
68
+ printf 'rule KILL command\n allow x\n' > "$SANDBOX/operand/missing-key.list"
69
+ out="$( cd "$SANDBOX/operand" && gate_env GATE_SDK_SCRIPT_RULES=missing-key.list \
70
+ && gate_run check-script-preflight "$CHECKS" one.sh 2>&1 )"; rc=$?
71
+ expect rules-missing-key 2 "missing-key.list:1: rule KILL lacks its 'cmd' key" "$rc" "$out"
72
+
73
+ # --- a span the reader cannot read is LINT-PARSE at 3; a script not UTF-8 is 3.
74
+ printf '#!/usr/bin/env bash\necho "open\n' > "$SANDBOX/operand/broken.sh"
75
+ out="$( cd "$SANDBOX/operand" && gate_env GATE_SDK_SCRIPT_RULES=rules.list \
76
+ && gate_run check-script-preflight "$CHECKS" broken.sh 2>&1 )"; rc=$?
77
+ expect lint-parse 3 'broken.sh:2: [LINT-PARSE] unparseable span' "$rc" "$out"
78
+ printf 'echo \xff\n' > "$SANDBOX/operand/bytes.sh"
79
+ out="$( cd "$SANDBOX/operand" && gate_env GATE_SDK_SCRIPT_RULES=rules.list \
80
+ && gate_run check-script-preflight "$CHECKS" bytes.sh 2>&1 )"; rc=$?
81
+ expect not-utf8 3 'bytes.sh' "$rc" "$out"
82
+
83
+ # --- the knob's pathspecs select tracked files only, and the prune set is never read.
84
+ mkdir -p "$SANDBOX/tree/target" "$SANDBOX/tree/lib"
85
+ cp "$CASES/bad/rules.list" "$SANDBOX/tree/"
86
+ printf 'pkill -P "$pid"\n' > "$SANDBOX/tree/lib/ok.sh"
87
+ printf 'pkill -f job\n' > "$SANDBOX/tree/target/built.sh"
88
+ printf 'pkill -f job\n' > "$SANDBOX/tree/untracked.sh"
89
+ git -C "$SANDBOX/tree" init -q
90
+ git -C "$SANDBOX/tree" add lib/ok.sh target/built.sh
91
+ out="$( cd "$SANDBOX/tree" && gate_env 'GATE_SDK_SCRIPT_FILES=*.sh' GATE_SDK_SCRIPT_RULES=rules.list \
92
+ && gate_run check-script-preflight "$CHECKS" 2>&1 )"; rc=$?
93
+ expect tracked-pruned 0 'clean (1 script(s) read against 4 rule(s)' "$rc" "$out"
94
+ refute tracked-only 'untracked.sh' "$out"
95
+
96
+ # --- outside a work tree the tracked listing fails, and the gate reads that as exit 3, never clean.
97
+ out="$( cd "$SANDBOX/empty" && gate_env 'GATE_SDK_SCRIPT_FILES=*.sh' GATE_SDK_SCRIPT_RULES=rules.list \
98
+ && gate_run check-script-preflight "$CHECKS" 2>&1 )"; rc=$?
99
+ expect no-work-tree 3 'check-script-preflight' "$rc" "$out"
100
+
101
+ # --- an option the gate does not take is a usage error.
102
+ out="$( cd "$SANDBOX/empty" && gate_run check-script-preflight "$CHECKS" --all 2>&1 )"; rc=$?
103
+ expect usage 2 'unknown option --all' "$rc" "$out"
104
+
105
+ if [[ "$fails" -gt 0 ]]; then
106
+ echo "check-script-preflight.test.sh: $fails case(s) failed"
107
+ exit 1
108
+ fi
109
+ echo "check-script-preflight.test.sh: clean (configuration, operands, the rules file's exit classes, LINT-PARSE and the tracked corpus — $cases cases)"
110
+ exit 0
@@ -0,0 +1,4 @@
1
+ site count differs from its reviewed count, rules in rules.list
2
+ tree/new.txt: [CLI-PIN] 1/0
3
+ tree/over.txt: [CLI-PIN] 2/1
4
+ tree/under.txt: [CLI-PIN] 1/2
@@ -0,0 +1,5 @@
1
+ # A call of the `tool` CLI is reviewed per file: at a line start or after `; `.
2
+ rule CLI-PIN site-count
3
+ site (^|; )tool [a-z]
4
+ baseline sites.tsv
5
+ paths tree
@@ -0,0 +1 @@
1
+ GATE_SDK_SITE_RULES = rules.list
@@ -0,0 +1,3 @@
1
+ # reviewed site counts
2
+ 1 tree/over.txt
3
+ 2 tree/under.txt
@@ -0,0 +1,3 @@
1
+ tool fetch --account pinned
2
+ cd work; tool push
3
+ a mention of tool fetch mid-line is no site
@@ -0,0 +1 @@
1
+ tool fetch --account pinned
@@ -0,0 +1 @@
1
+ SITE-COUNT: clean (2 file(s) read against 1 rule(s) in rules.list)
@@ -0,0 +1,5 @@
1
+ # A call of the `tool` CLI is reviewed per file: at a line start or after `; `.
2
+ rule CLI-PIN site-count
3
+ site (^|; )tool [a-z]
4
+ baseline sites.tsv
5
+ paths tree
@@ -0,0 +1 @@
1
+ GATE_SDK_SITE_RULES = rules.list
@@ -0,0 +1,2 @@
1
+ # reviewed site counts
2
+ 2 tree/pinned.txt
@@ -0,0 +1,2 @@
1
+ tool fetch --account pinned
2
+ cd work; tool push --account pinned
@@ -0,0 +1 @@
1
+ a file with no site and no row
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of check-site-count over what the good/+bad/ pair cannot reach: an empty
3
+ # configuration, the baseline's exit-2 and exit-3 classes, a malformed rules file, the test-code
4
+ # classifier's knob and its Rust test module, and a tree with no git listing.
5
+ #
6
+ # Run by the --run-gate-tests arm (any <tests-dir>/*.test.sh; must exit 0).
7
+ set -uo pipefail
8
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
9
+
10
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # gate-sdk/
11
+ CHECKS="$DIR/checks"
12
+ SANDBOX="$(mktemp -d)"
13
+ trap 'rm -rf "$SANDBOX"' EXIT
14
+
15
+ fails=0
16
+ cases=0
17
+
18
+ expect() { # expect <label> <want-rc> <substring> <got-rc> <output>
19
+ cases=$((cases + 1))
20
+ if [[ "$4" -ne "$2" ]]; then
21
+ echo " FAIL [$1]: want exit $2, got $4 -- $5"; fails=$((fails + 1))
22
+ elif ! grep -qF -- "$3" <<<"$5"; then
23
+ echo " FAIL [$1]: exit $2 but output lacks '$3': $5"; fails=$((fails + 1))
24
+ fi
25
+ }
26
+
27
+ # --- no rules file, or one holding no block: clean, not applicable.
28
+ mkdir -p "$SANDBOX/empty"
29
+ out="$( cd "$SANDBOX/empty" && gate_run check-site-count "$CHECKS" 2>&1 )"; rc=$?
30
+ expect not-applicable 0 'not applicable: no site rule configured' "$rc" "$out"
31
+ printf '# no rule yet\n' > "$SANDBOX/empty/rules.list"
32
+ out="$( cd "$SANDBOX/empty" && gate_env GATE_SDK_SITE_RULES=rules.list \
33
+ && gate_run check-site-count "$CHECKS" 2>&1 )"; rc=$?
34
+ expect no-block 0 'not applicable: no site rule configured' "$rc" "$out"
35
+
36
+ # --- a rules file the gate cannot read is 3; a malformed one is 2 naming its line.
37
+ printf 'rule A site-count\n\xff\n' > "$SANDBOX/empty/bytes.list"
38
+ out="$( cd "$SANDBOX/empty" && gate_env GATE_SDK_SITE_RULES=bytes.list \
39
+ && gate_run check-site-count "$CHECKS" 2>&1 )"; rc=$?
40
+ expect rules-unreadable 3 'bytes.list' "$rc" "$out"
41
+ printf 'rule A site-count\n site x\n' > "$SANDBOX/empty/no-baseline.list"
42
+ out="$( cd "$SANDBOX/empty" && gate_env GATE_SDK_SITE_RULES=no-baseline.list \
43
+ && gate_run check-site-count "$CHECKS" 2>&1 )"; rc=$?
44
+ expect rules-missing-key 2 "no-baseline.list:1: rule A lacks its 'baseline' key" "$rc" "$out"
45
+
46
+ # --- outside a work tree there is no tracked listing, which is refused, never clean.
47
+ printf 'rule A site-count\n site x\n baseline sites.tsv\n' > "$SANDBOX/empty/rules.list"
48
+ out="$( cd "$SANDBOX/empty" && gate_env GATE_SDK_SITE_RULES=rules.list \
49
+ && gate_run check-site-count "$CHECKS" 2>&1 )"; rc=$?
50
+ expect no-work-tree 2 'not a git repository' "$rc" "$out"
51
+
52
+ # --- a tracked tree: the baseline's classes, then the test-code classifier.
53
+ mkdir -p "$SANDBOX/tree/src" "$SANDBOX/tree/tests"
54
+ printf 'rule CLI site-count\n site ^tool \n baseline sites.tsv\n paths src tests\n' > "$SANDBOX/tree/rules.list"
55
+ printf 'tool a\n#[cfg(test)]\ntool b\n' > "$SANDBOX/tree/src/lib.rs"
56
+ printf 'tool c\n' > "$SANDBOX/tree/tests/run.sh"
57
+ git -C "$SANDBOX/tree" init -q
58
+ git -C "$SANDBOX/tree" add src/lib.rs tests/run.sh
59
+ run_tree() {
60
+ ( cd "$SANDBOX/tree" && gate_env GATE_SDK_SITE_RULES=rules.list "$@" \
61
+ && gate_run check-site-count "$CHECKS" 2>&1 )
62
+ }
63
+
64
+ out="$(run_tree)"; rc=$?
65
+ expect baseline-absent 2 'sites.tsv' "$rc" "$out"
66
+ printf '1 src/lib.rs\n' > "$SANDBOX/tree/sites.tsv"
67
+ out="$(run_tree)"; rc=$?
68
+ expect baseline-no-tab 3 'sites.tsv:1:' "$rc" "$out"
69
+ printf '1\tsrc/lib.rs\n1\tsrc/lib.rs\n' > "$SANDBOX/tree/sites.tsv"
70
+ out="$(run_tree)"; rc=$?
71
+ expect baseline-duplicate 3 'sites.tsv:2: src/lib.rs is given a second row' "$rc" "$out"
72
+
73
+ # The Rust test module and the tests/ directory are test code under the default globs.
74
+ printf '1\tsrc/lib.rs\n' > "$SANDBOX/tree/sites.tsv"
75
+ out="$(run_tree)"; rc=$?
76
+ expect test-code-skipped 0 'clean (1 file(s) read against 1 rule(s) in rules.list)' "$rc" "$out"
77
+ # An emptied knob names no test path, so the tests/ file is read; the Rust module is still cut.
78
+ out="$(run_tree GATE_SDK_TEST_GLOBS=)"; rc=$?
79
+ expect test-globs-empty 1 'tests/run.sh: [CLI] 1/0' "$rc" "$out"
80
+
81
+ # --- an argument is a usage error.
82
+ out="$( cd "$SANDBOX/empty" && gate_run check-site-count "$CHECKS" extra 2>&1 )"; rc=$?
83
+ expect usage 2 'takes no arguments' "$rc" "$out"
84
+
85
+ if [[ "$fails" -gt 0 ]]; then
86
+ echo "check-site-count.test.sh: $fails case(s) failed"
87
+ exit 1
88
+ fi
89
+ echo "check-site-count.test.sh: clean (configuration, the rules file and baseline exit classes, and the test-code classifier — $cases cases)"
90
+ exit 0
@@ -1,8 +1,11 @@
1
- match a banned pattern
2
- tree/leak.txt:1:Install notes: clone into /home/bob/projects and run the setup script.
3
- tree/multi.txt:1:two leaks on one line: /home/alice/one and /home/bob/two
4
- tree/multi.txt:3:one leak on its own line: /home/carol/three
5
- tree/multi.txt:4:one leak on its own line: /home/carol/three
6
- tree/second-leak.txt:2:a single line: the promo URL claude.com/claude-code is banned here too.
7
- tree/accounts.txt:1:The forge accounts were `fixture-acct-0` and `fixture-acct-1`, one per machine.
8
- tree/msg-patterns.old.list:1:a stale roster no knob names: /home/dave/old
1
+ match a banned pattern or deny term
2
+ tree/leak.txt:1: [HOME-PATH]
3
+ tree/multi.txt:1: [HOME-PATH]
4
+ tree/multi.txt:3: [HOME-PATH]
5
+ tree/multi.txt:4: [HOME-PATH]
6
+ tree/second-leak.txt:2: [TEXT-DENIED]
7
+ tree/accounts.txt:1: [TEXT-DENIED]
8
+ tree/msg-patterns.old.list:1: [HOME-PATH]
9
+ tree/terms.txt:1: [CODENAME]
10
+ tree/terms.txt:1: [HOME-PATH]
11
+ tree/terms.txt:2: [TEXT-DENIED]
@@ -1,7 +1,10 @@
1
1
  # banned-pattern fixture (grep -E, one per line; '#' + blank ignored)
2
- /(home|Users)/[A-Za-z0-9._-]+
3
2
  claude\.com/claude-code
4
3
 
5
4
  # Account-identification class — a handle-shaped backticked token near an
6
5
  # account noun. Cite the role, never the account; a CLI name is not a handle.
7
6
  (^|[^A-Za-z])(accounts?|logins?|usernames?|handles?)[^A-Za-z`-][^`]{0,6}`([a-z]*[0-9A-Z][A-Za-z0-9_.-]*|[a-z]+[_.-][A-Za-z0-9_.-]*|[_.-]+[A-Za-z0-9][A-Za-z0-9_.-]*|[a-z]{6,})`|`([a-z]*[0-9A-Z][A-Za-z0-9_.-]*|[a-z]+[_.-][A-Za-z0-9_.-]*|[_.-]+[A-Za-z0-9][A-Za-z0-9_.-]*|[a-z]{6,})`[^A-Za-z`][^`]{0,6}(accounts?|logins?|usernames?|handles?)([^A-Za-z-]|$)
7
+
8
+ # A rule id names every pattern after it; the ones above take the default id.
9
+ # rule: HOME-PATH
10
+ /(home|Users)/[A-Za-z0-9._-]+
@@ -0,0 +1 @@
1
+ GATE_SDK_DENY_TERMS = terms.list
@@ -0,0 +1,4 @@
1
+ # deny-term fixture: literal terms, one per line
2
+ tolkien-x
3
+ # rule: CODENAME
4
+ zephyr
@@ -0,0 +1,2 @@
1
+ the Zephyr build ships from /home/erin/src
2
+ a bare tolkien-x mention, and zephyrine is a longer word
@@ -1 +1 @@
1
- TREE-TERMS: clean (3 tracked file(s) scanned under tree; none match the 5 banned pattern(s))
1
+ TREE-TERMS: clean (4 tracked file(s) scanned under tree; none match the 5 banned pattern(s) or 1 deny term(s))
@@ -1 +1,2 @@
1
1
  GATE_SDK_KIT_DIRS = tree/demo-kit
2
+ GATE_SDK_DENY_TERMS = tree/rosters/terms.list
@@ -0,0 +1,2 @@
1
+ # A deny-term list the gate resolved: it holds the term it bans and is self-exempt.
2
+ term
@@ -0,0 +1 @@
1
+ The terms2 table and the determined reader hold it only inside longer words.
@@ -58,7 +58,7 @@ printf '# only a comment\n\n' > "$SANDBOX/repo/empty.list"
58
58
  out="$( cd "$SANDBOX/repo" \
59
59
  && gate_env GATE_SDK_MSG_PATTERN_FILES="$SANDBOX/repo/empty.list" \
60
60
  && gate_run check-tree-terms "$CHECKS" . 2>&1 )"; rc=$?
61
- expect empty-pattern-set 0 '0 banned pattern(s) configured; tree unchecked' "$rc" "$out"
61
+ expect empty-pattern-set 0 '0 banned pattern(s) and 0 deny term(s) configured; tree unchecked' "$rc" "$out"
62
62
 
63
63
  # --- a banned shape inside a tracked binary: a path-only record, and still red.
64
64
  # Dead on this tree (no tracked binaries) and live in a consumer's, which is why
@@ -70,7 +70,7 @@ printf 'PNG\x00\x01 clone into /%s/bob/x and more\x00bytes\n' home > "$SANDBOX/r
70
70
  printf '/(home|Users)/[A-Za-z0-9._-]+\n' > "$SANDBOX/repo/banned.list"
71
71
  git -C "$SANDBOX/repo" add blob.bin
72
72
  out="$( cd "$SANDBOX/repo" && gate_run check-tree-terms "$CHECKS" . banned.list 2>&1 )"; rc=$?
73
- expect binary-record 1 'blob.bin' "$rc" "$out"
73
+ expect binary-record 1 'blob.bin: [TEXT-DENIED]' "$rc" "$out"
74
74
  if grep -qE '^blob\.bin:[0-9]+:' <<<"$out"; then
75
75
  echo " FAIL [binary-record]: a binary match must not carry :lineno:line -- $out"
76
76
  fails=$((fails + 1))
@@ -101,23 +101,43 @@ else
101
101
  echo " SKIP [dangling-symlink]: ln -s failed — creating a symlink needs a privilege this account may not hold; the arm's precondition is a platform capability, so it declares the skip rather than reporting a failure."
102
102
  fi
103
103
 
104
+ # --- a '# rule:' line whose id fails the class grammar is refused at 2, naming the
105
+ # file and line; a deny-term list that is there and is no regular file is input at 3.
106
+ printf 'a-pattern\n# rule: not-upper\nb-pattern\n' > "$SANDBOX/repo/badrule.list"
107
+ out="$( cd "$SANDBOX/repo" && gate_run check-tree-terms "$CHECKS" . badrule.list 2>&1 )"; rc=$?
108
+ expect malformed-rule-id 2 'badrule.list:2:' "$rc" "$out"
109
+ if grep -qF 'not-upper' <<<"$out"; then
110
+ echo " FAIL [malformed-rule-id]: the refusal must not print the id -- $out"; fails=$((fails + 1))
111
+ fi
112
+ mkdir -p "$SANDBOX/repo/terms-dir.list"
113
+ out="$( cd "$SANDBOX/repo" \
114
+ && gate_env GATE_SDK_DENY_TERMS="$SANDBOX/repo/terms-dir.list" \
115
+ && gate_run check-tree-terms "$CHECKS" . empty.list 2>&1 )"; rc=$?
116
+ expect unreadable-term-list 3 'not a regular file' "$rc" "$out"
117
+
104
118
  # --- multi-record order over the tracked bad/ case: path order, then line order,
105
- # one record per matching *line* however many patterns hit it, and no dedup of
106
- # two identical lines. Read off the pair so the corpus has one home.
107
- out="$( cd "$CASES/bad" && gate_run check-tree-terms "$CHECKS" tree patterns.list 2>&1 )"; rc=$?
119
+ # then id order, one record per matching *line* per distinct id however many
120
+ # patterns or terms hit it, and no dedup of two identical lines. Read off the
121
+ # pair so the corpus has one home; the knob files are pinned away here, so the
122
+ # case's term list is handed over by the environment.
123
+ out="$( cd "$CASES/bad" && gate_env GATE_SDK_DENY_TERMS=terms.list \
124
+ && gate_run check-tree-terms "$CHECKS" tree patterns.list 2>&1 )"; rc=$?
108
125
  got="$(grep -E '^tree/' <<<"$out")"
109
126
  want="$(printf '%s\n' \
110
- 'tree/accounts.txt:1:' \
111
- 'tree/leak.txt:1:' \
112
- 'tree/msg-patterns.old.list:1:' \
113
- 'tree/multi.txt:1:' \
114
- 'tree/multi.txt:3:' \
115
- 'tree/multi.txt:4:' \
116
- 'tree/second-leak.txt:2:')"
127
+ 'tree/accounts.txt:1: [TEXT-DENIED]' \
128
+ 'tree/leak.txt:1: [HOME-PATH]' \
129
+ 'tree/msg-patterns.old.list:1: [HOME-PATH]' \
130
+ 'tree/multi.txt:1: [HOME-PATH]' \
131
+ 'tree/multi.txt:3: [HOME-PATH]' \
132
+ 'tree/multi.txt:4: [HOME-PATH]' \
133
+ 'tree/second-leak.txt:2: [TEXT-DENIED]' \
134
+ 'tree/terms.txt:1: [CODENAME]' \
135
+ 'tree/terms.txt:1: [HOME-PATH]' \
136
+ 'tree/terms.txt:2: [TEXT-DENIED]')"
117
137
  if [[ "$rc" -ne 1 ]]; then
118
138
  echo " FAIL [record-order]: want exit 1, got $rc -- $out"; fails=$((fails + 1))
119
- elif [[ "$(sed 's/^\([^:]*:[0-9]*:\).*/\1/' <<<"$got")" != "$want" ]]; then
120
- echo " FAIL [record-order]: record sequence is not path-then-line order:"
139
+ elif [[ "$got" != "$want" ]]; then
140
+ echo " FAIL [record-order]: record sequence is not path-then-line-then-id order:"
121
141
  printf ' %s\n' "$got"
122
142
  fails=$((fails + 1))
123
143
  fi
@@ -127,8 +147,8 @@ if [[ "$fails" -gt 0 ]]; then
127
147
  exit 1
128
148
  fi
129
149
  if [[ "$link_arm" == run ]]; then
130
- echo "check-tree-terms.test.sh: clean (the arms a case dir cannot reach or may not ship: a non-repository cwd, the env-knob resolution path through a missing required pattern file, an empty pattern set leaving the tree unchecked, a banned shape inside a tracked binary yielding a path-only record, a tracked dangling symlink skipped rather than scanned, and the bad pair's record order — 8 assertions over 6 cases)"
150
+ echo "check-tree-terms.test.sh: clean (the arms a case dir cannot reach or may not ship: a non-repository cwd, the env-knob resolution path through a missing required pattern file, an empty pattern set leaving the tree unchecked, a banned shape inside a tracked binary yielding a path-only record, a tracked dangling symlink skipped rather than scanned, a malformed rule id refused without printing it, a deny-term list that is no regular file, and the bad pair's record order — 11 assertions over 8 cases)"
131
151
  else
132
- echo "check-tree-terms.test.sh: clean (the arms a case dir cannot reach: a non-repository cwd, the env-knob resolution path through a missing required pattern file, an empty pattern set leaving the tree unchecked, a banned shape inside a tracked binary yielding a path-only record, and the bad pair's record order — 6 assertions over 5 cases; the dangling-symlink arm declared a skip above, this host refusing ln -s)"
152
+ echo "check-tree-terms.test.sh: clean (the arms a case dir cannot reach: a non-repository cwd, the env-knob resolution path through a missing required pattern file, an empty pattern set leaving the tree unchecked, a banned shape inside a tracked binary yielding a path-only record, a malformed rule id refused without printing it, a deny-term list that is no regular file, and the bad pair's record order — 9 assertions over 7 cases; the dangling-symlink arm declared a skip above, this host refusing ln -s)"
133
153
  fi
134
154
  exit 0
@@ -26,13 +26,12 @@ done
26
26
 
27
27
  # spec: gate-sdk/SPEC.md §enforcement-map — adopted-but-broken refuses: a knob
28
28
  # explicitly set to a missing path exits 2 before the first stdout byte, the
29
- # stderr line naming the knob; the settings knob also refuses a set file jq
30
- # cannot parse.
29
+ # stderr line naming the knob; a set settings file it cannot parse exits 3.
31
30
  errfile="$scratch/stderr"
32
- assert_strict() { # $1=case $2=knob-name $3=knob-value
33
- local out rc
31
+ assert_strict() { # $1=case $2=knob-name $3=knob-value [$4=want status, default 2]
32
+ local out rc want="${4:-2}"
34
33
  out="$(env "$2=$3" bash "${EMIT[@]}" 2>"$errfile")"; rc=$?
35
- [[ "$rc" -eq 2 ]] || { echo "FAIL [$1]: expected exit 2, got $rc"; fails=$((fails + 1)); }
34
+ [[ "$rc" -eq "$want" ]] || { echo "FAIL [$1]: expected exit $want, got $rc"; fails=$((fails + 1)); }
36
35
  [[ -z "$out" ]] || { echo "FAIL [$1]: expected empty stdout"; fails=$((fails + 1)); }
37
36
  grep -qF -- "$2" "$errfile" || { echo "FAIL [$1]: stderr does not name $2"; fails=$((fails + 1)); }
38
37
  }
@@ -41,7 +40,7 @@ assert_strict strict-settings CONTEXT_KIT_SETTINGS_FILE /nonexistent/settings.j
41
40
  assert_strict strict-evidence EVIDENCE_KIT_KNOB_FILE /nonexistent/evidence-config.knobs
42
41
  assert_strict strict-scandir GATE_SDK_ENFORCE_SCAN_DIR /nonexistent/scandir
43
42
  printf '{ not json\n' > "$scratch/bad-settings.json"
44
- assert_strict strict-settings-unparseable CONTEXT_KIT_SETTINGS_FILE "$scratch/bad-settings.json"
43
+ assert_strict strict-settings-unparseable CONTEXT_KIT_SETTINGS_FILE "$scratch/bad-settings.json" 3
45
44
 
46
45
  # spec: gate-sdk/SPEC.md §enforcement-map — not-adopted degrades: an unset knob
47
46
  # whose default path is absent drops exactly its own section. A scratch
@@ -25,10 +25,10 @@ fail_closed 0 check-x awk
25
25
  reached=yes
26
26
  [[ "$reached" == yes ]] || { echo " FAIL: fail_closed 0 aborted the caller"; fails=$((fails + 1)); }
27
27
 
28
- # Branch 2: non-zero status -> exit 2 + diagnostic on stderr (run in a subshell
28
+ # Branch 2: non-zero status -> exit 3 + diagnostic on stderr (run in a subshell
29
29
  # so the exit doesn't abort this test).
30
30
  out="$( ( fail_closed 2 check-x awk ) 2>&1 )"; rc=$?
31
- [[ "$rc" -eq 2 ]] || { echo " FAIL: fail_closed 2 should exit 2, exited $rc"; fails=$((fails + 1)); }
31
+ [[ "$rc" -eq 3 ]] || { echo " FAIL: fail_closed 2 should exit 3, exited $rc"; fails=$((fails + 1)); }
32
32
  grep -qF 'the check could not run' <<<"$out" \
33
33
  || { echo " FAIL: fail_closed 2 missing 'the check could not run': $out"; fails=$((fails + 1)); }
34
34
 
@@ -154,16 +154,16 @@ got="$(gate_command check-rs "$sandbox/a" | paste -sd' ' -)"
154
154
  [[ "$?" -eq 2 ]] \
155
155
  || { echo " FAIL: gate_command did not exit 2 on the arm's refusal"; fails=$((fails + 1)); }
156
156
 
157
- # fail-closed: an absent binary is exit 2, never a skip and never a pass
157
+ # fail-closed: an absent binary is exit 3, never a skip and never a pass
158
158
  ( GATE_SDK_NATIVE_BIN="$sandbox/nope" gate_command check-ported "$sandbox/a" "$sandbox/b" >/dev/null 2>&1 )
159
- [[ "$?" -eq 2 ]] \
160
- || { echo " FAIL: gate_command did not exit 2 on an absent native binary"; fails=$((fails + 1)); }
159
+ [[ "$?" -eq 3 ]] \
160
+ || { echo " FAIL: gate_command did not exit 3 on an absent native binary"; fails=$((fails + 1)); }
161
161
 
162
- # fail-closed: present but non-executable is the same harness error
162
+ # fail-closed: present but non-executable is the same tool error
163
163
  : >"$sandbox/notexec"; chmod -x "$sandbox/notexec"
164
164
  ( GATE_SDK_NATIVE_BIN="$sandbox/notexec" gate_command check-ported "$sandbox/a" "$sandbox/b" >/dev/null 2>&1 )
165
- [[ "$?" -eq 2 ]] \
166
- || { echo " FAIL: gate_command did not exit 2 on a non-executable native binary"; fails=$((fails + 1)); }
165
+ [[ "$?" -eq 3 ]] \
166
+ || { echo " FAIL: gate_command did not exit 3 on a non-executable native binary"; fails=$((fails + 1)); }
167
167
 
168
168
  if [[ "$fails" -gt 0 ]]; then
169
169
  echo "lib-gate.test: $fails assertion(s) failed"