checkwright 0.38.0 → 0.39.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 (190) 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 +4 -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/scripts/gate-sdk-config.knobs +3 -0
  54. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/shapes.list +2 -0
  55. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/terms.list +2 -0
  56. package/payload/gate-sdk/gate-tests/check-binary-strings/good/expect.txt +1 -0
  57. package/payload/gate-sdk/gate-tests/check-binary-strings/good/out/app.elf +0 -0
  58. package/payload/gate-sdk/gate-tests/check-binary-strings/good/scripts/gate-sdk-config.knobs +3 -0
  59. package/payload/gate-sdk/gate-tests/check-binary-strings/good/shapes.list +2 -0
  60. package/payload/gate-sdk/gate-tests/check-binary-strings/good/terms.list +4 -0
  61. package/payload/gate-sdk/gate-tests/check-binary-strings.test.sh +74 -0
  62. package/payload/gate-sdk/gate-tests/check-exec-write/bad/expect.txt +13 -0
  63. package/payload/gate-sdk/gate-tests/check-exec-write/bad/scripts/gate-sdk-config.knobs +2 -0
  64. package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/caller.rs +5 -0
  65. package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/helper.rs +5 -0
  66. package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/sites.rs +19 -0
  67. package/payload/gate-sdk/gate-tests/check-exec-write/good/expect.txt +1 -0
  68. package/payload/gate-sdk/gate-tests/check-exec-write/good/scripts/gate-sdk-config.knobs +2 -0
  69. package/payload/gate-sdk/gate-tests/check-exec-write/good/src/helper.rs +5 -0
  70. package/payload/gate-sdk/gate-tests/check-exec-write/good/src/main.rs +15 -0
  71. package/payload/gate-sdk/gate-tests/check-exec-write.test.sh +69 -0
  72. package/payload/gate-sdk/gate-tests/check-identity.test.sh +2 -2
  73. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/args +2 -0
  74. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0001_init.sql +1 -0
  75. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0002_orders.sql +1 -0
  76. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0003_audit.sql +1 -0
  77. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/destructive.list +4 -0
  78. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/expect.txt +7 -0
  79. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0001_init.sql +1 -0
  80. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0002_late.sql +1 -0
  81. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0003_audit_log.sql +1 -0
  82. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0004_prune.sql +3 -0
  83. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/scripts/gate-sdk-config.knobs +2 -0
  84. package/payload/gate-sdk/gate-tests/check-migration-guard/good/args +2 -0
  85. package/payload/gate-sdk/gate-tests/check-migration-guard/good/base/0001_init.sql +1 -0
  86. package/payload/gate-sdk/gate-tests/check-migration-guard/good/base/0002_legacy.sql +1 -0
  87. package/payload/gate-sdk/gate-tests/check-migration-guard/good/destructive.list +4 -0
  88. package/payload/gate-sdk/gate-tests/check-migration-guard/good/expect.txt +1 -0
  89. package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0001_init.sql +1 -0
  90. package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0002_legacy.sql +1 -0
  91. package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0003_retire_legacy.sql +6 -0
  92. package/payload/gate-sdk/gate-tests/check-migration-guard/good/scripts/gate-sdk-config.knobs +2 -0
  93. package/payload/gate-sdk/gate-tests/check-migration-guard.test.sh +136 -0
  94. package/payload/gate-sdk/gate-tests/check-path-names/bad/expect.txt +6 -0
  95. package/payload/gate-sdk/gate-tests/check-path-names/bad/scripts/gate-sdk-config.knobs +1 -0
  96. package/payload/gate-sdk/gate-tests/check-path-names/bad/terms.list +3 -0
  97. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/ZePhYr.md +1 -0
  98. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo/a.txt +1 -0
  99. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo/zephyr.txt +1 -0
  100. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo-cli.sh +1 -0
  101. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo.rs +1 -0
  102. package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo_x.txt +1 -0
  103. package/payload/gate-sdk/gate-tests/check-path-names/good/expect.txt +1 -0
  104. package/payload/gate-sdk/gate-tests/check-path-names/good/scripts/gate-sdk-config.knobs +1 -0
  105. package/payload/gate-sdk/gate-tests/check-path-names/good/terms.list +1 -0
  106. package/payload/gate-sdk/gate-tests/check-path-names/good/tree/foobar.rs +1 -0
  107. package/payload/gate-sdk/gate-tests/check-path-names/good/tree/food/a.txt +1 -0
  108. package/payload/gate-sdk/gate-tests/check-path-names/good/tree/xfoo.txt +1 -0
  109. package/payload/gate-sdk/gate-tests/check-path-names.test.sh +66 -0
  110. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/baseline.tsv +4 -0
  111. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/expect.txt +17 -0
  112. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/scripts/gate-sdk-config.knobs +2 -0
  113. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/over.sh +5 -0
  114. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/readers.sh +16 -0
  115. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/shared-lib.sh +3 -0
  116. package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/stale.sh +4 -0
  117. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/baseline.tsv +2 -0
  118. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/expect.txt +1 -0
  119. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/scripts/gate-sdk-config.knobs +2 -0
  120. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/clean.sh +17 -0
  121. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/lib/baselined-lib.sh +4 -0
  122. package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/no-pipefail.sh +4 -0
  123. package/payload/gate-sdk/gate-tests/check-pipefail-readers.test.sh +114 -0
  124. package/payload/gate-sdk/gate-tests/check-portability-floor.test.sh +1 -1
  125. package/payload/gate-sdk/gate-tests/check-script-preflight/bad/expect.txt +10 -0
  126. package/payload/gate-sdk/gate-tests/check-script-preflight/bad/rules.list +23 -0
  127. package/payload/gate-sdk/gate-tests/check-script-preflight/bad/scripts/gate-sdk-config.knobs +2 -0
  128. package/payload/gate-sdk/gate-tests/check-script-preflight/bad/tree/submit-job.sh +13 -0
  129. package/payload/gate-sdk/gate-tests/check-script-preflight/good/expect.txt +1 -0
  130. package/payload/gate-sdk/gate-tests/check-script-preflight/good/rules.list +23 -0
  131. package/payload/gate-sdk/gate-tests/check-script-preflight/good/scripts/gate-sdk-config.knobs +2 -0
  132. package/payload/gate-sdk/gate-tests/check-script-preflight/good/tree/submit-job.sh +17 -0
  133. package/payload/gate-sdk/gate-tests/check-script-preflight.test.sh +110 -0
  134. package/payload/gate-sdk/gate-tests/check-site-count/bad/expect.txt +4 -0
  135. package/payload/gate-sdk/gate-tests/check-site-count/bad/rules.list +5 -0
  136. package/payload/gate-sdk/gate-tests/check-site-count/bad/scripts/gate-sdk-config.knobs +1 -0
  137. package/payload/gate-sdk/gate-tests/check-site-count/bad/sites.tsv +3 -0
  138. package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/new.txt +1 -0
  139. package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/over.txt +3 -0
  140. package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/under.txt +1 -0
  141. package/payload/gate-sdk/gate-tests/check-site-count/good/expect.txt +1 -0
  142. package/payload/gate-sdk/gate-tests/check-site-count/good/rules.list +5 -0
  143. package/payload/gate-sdk/gate-tests/check-site-count/good/scripts/gate-sdk-config.knobs +1 -0
  144. package/payload/gate-sdk/gate-tests/check-site-count/good/sites.tsv +2 -0
  145. package/payload/gate-sdk/gate-tests/check-site-count/good/tree/blob.bin +0 -0
  146. package/payload/gate-sdk/gate-tests/check-site-count/good/tree/pinned.txt +2 -0
  147. package/payload/gate-sdk/gate-tests/check-site-count/good/tree/plain.txt +1 -0
  148. package/payload/gate-sdk/gate-tests/check-site-count/good/tree/tests/helper.txt +2 -0
  149. package/payload/gate-sdk/gate-tests/check-site-count.test.sh +90 -0
  150. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +11 -8
  151. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +4 -1
  152. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/scripts/gate-sdk-config.knobs +1 -0
  153. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/terms.list +4 -0
  154. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/terms.txt +2 -0
  155. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  156. package/payload/gate-sdk/gate-tests/check-tree-terms/good/scripts/gate-sdk-config.knobs +1 -0
  157. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/rosters/terms.list +2 -0
  158. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/words.txt +1 -0
  159. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +36 -16
  160. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +5 -6
  161. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +8 -8
  162. package/payload/gate-sdk/gate-tests/native-git-hooks.test.sh +7 -7
  163. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +4 -4
  164. package/payload/gate-sdk/gate-tests/run-for-path.test.sh +3 -3
  165. package/payload/gate-sdk/gate-tests/run-gates-linked-worktree.test.sh +6 -6
  166. package/payload/gate-sdk/gate-tests/run-json.test.sh +52 -0
  167. package/payload/gate-sdk/gate-tests/verdict-store.test.sh +99 -0
  168. package/payload/gate-sdk/lib/gate.sh +12 -9
  169. package/payload/gate-sdk/lib/test-hermetic.sh +2 -2
  170. package/payload/gate-sdk/templates/check-skeleton.sh +2 -1
  171. package/payload/gate-sdk/templates/migration-destructive.list +10 -0
  172. package/payload/gate-sdk/templates/script-rules.list +39 -0
  173. package/payload/gate-sdk/templates/strings-shapes.list +15 -0
  174. package/payload/guard-kit/gate-tests/consumer-rules.test.sh +5 -5
  175. package/payload/guard-kit/gate-tests/door-binding-corpus.test.sh +2 -2
  176. package/payload/lifecycle-kit/gate-tests/boundary-worktree-refusal.test.sh +1 -1
  177. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry.test.sh +1 -1
  178. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +3 -3
  179. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +1 -1
  180. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +2 -2
  181. package/payload/lifecycle-kit/gate-tests/lead-journal-open.test.sh +18 -2
  182. package/payload/lifecycle-kit/gate-tests/peer-channel.test.sh +35 -6
  183. package/payload/lifecycle-kit/gate-tests/preflight-valve.test.sh +4 -4
  184. package/payload/lifecycle-kit/templates/consult.md +1 -1
  185. package/payload/lifecycle-kit/templates/stages/scope.md +1 -1
  186. package/payload/queue-kit/README.md +1 -1
  187. package/payload/queue-kit/gate-tests/check-queue-slug-liveness.test.sh +2 -2
  188. package/payload/queue-kit/gate-tests/check-task-conservation.test.sh +4 -4
  189. package/payload/site-kit/gate-tests/check-docs-liquid-parse-parser.test.sh +4 -4
  190. package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +9 -9
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of check-migration-guard's git arm, which the good/+bad/ pair cannot reach: the
3
+ # pair stands a directory in for the merge base, since a committed fixture is identical to HEAD.
4
+ # Each case runs in a sandbox repository whose history the case builds.
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
+ LIST="$SANDBOX/destructive.list"
28
+ printf '# the template floor\nDROP (TABLE|INDEX|VIEW|TRIGGER)\nALTER TABLE .* DROP\nALTER TABLE .* RENAME\n' > "$LIST"
29
+
30
+ # --- the knob empty: clean, not applicable, before any repository is needed.
31
+ mkdir -p "$SANDBOX/plain"
32
+ out="$( cd "$SANDBOX/plain" && gate_run check-migration-guard "$CHECKS" 2>&1 )"; rc=$?
33
+ expect not-applicable 0 'not applicable: no migration directory configured' "$rc" "$out"
34
+
35
+ # A fresh repository on main with two merged migrations, a topic branch checked out over it.
36
+ fresh() { # fresh <name> — prints the repository path
37
+ local r="$SANDBOX/$1"
38
+ mkdir -p "$r/db/migrations"
39
+ git -C "$r" init -q -b main
40
+ printf 'CREATE TABLE a (id INTEGER);\n' > "$r/db/migrations/0001_a.sql"
41
+ printf 'CREATE TABLE b (id INTEGER);\n' > "$r/db/migrations/0002_b.sql"
42
+ git -C "$r" add db
43
+ git -C "$r" -c user.name=t -c user.email=t@e.invalid commit -qm base
44
+ git -C "$r" checkout -qb topic
45
+ printf '%s' "$r"
46
+ }
47
+ guard() { # guard <repo> [gate args…] — the gate in <repo> over db/migrations
48
+ local r="$1"
49
+ shift
50
+ ( cd "$r" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations GATE_SDK_MIGRATION_DESTRUCTIVE="$LIST" \
51
+ && gate_run check-migration-guard "$CHECKS" "$@" 2>&1 )
52
+ }
53
+
54
+ # --- a tree whose base is its own HEAD, then an uncommitted addition counted from a subdirectory.
55
+ r="$(fresh own-head)"
56
+ out="$(guard "$r" --base HEAD)"; rc=$?
57
+ expect own-head 0 'clean (2 migration(s), 0 added, against merge base' "$rc" "$out"
58
+ printf 'CREATE TABLE c (id INTEGER);\n' > "$r/db/migrations/0003_c.sql"
59
+ out="$(guard "$r")"; rc=$?
60
+ expect untracked-addition 0 'clean (3 migration(s), 1 added, against merge base' "$rc" "$out"
61
+ out="$( cd "$r/db" && gate_env GATE_SDK_MIGRATION_DIR=migrations GATE_SDK_MIGRATION_DESTRUCTIVE="$LIST" \
62
+ && gate_run check-migration-guard "$CHECKS" 2>&1 )"; rc=$?
63
+ expect from-subdirectory 0 'clean (3 migration(s), 1 added, against merge base' "$rc" "$out"
64
+
65
+ # --- an edit, uncommitted and then committed on the branch.
66
+ r="$(fresh edit)"
67
+ printf 'CREATE TABLE a (id INTEGER, x TEXT);\n' > "$r/db/migrations/0001_a.sql"
68
+ out="$(guard "$r")"; rc=$?
69
+ expect edit-uncommitted 1 'db/migrations/0001_a.sql: [MIGRATION-EDITED]' "$rc" "$out"
70
+ git -C "$r" -c user.name=t -c user.email=t@e.invalid commit -qam edit
71
+ out="$(guard "$r")"; rc=$?
72
+ expect edit-committed 1 'db/migrations/0001_a.sql: [MIGRATION-EDITED]' "$rc" "$out"
73
+
74
+ # --- a delete and a rename.
75
+ r="$(fresh delete)"
76
+ git -C "$r" rm -q db/migrations/0002_b.sql
77
+ out="$(guard "$r")"; rc=$?
78
+ expect delete 1 'db/migrations/0002_b.sql: [MIGRATION-EDITED]' "$rc" "$out"
79
+ r="$(fresh rename)"
80
+ git -C "$r" mv db/migrations/0002_b.sql db/migrations/0002_bee.sql
81
+ out="$(guard "$r")"; rc=$?
82
+ expect rename-gone 1 'db/migrations/0002_b.sql: [MIGRATION-EDITED]' "$rc" "$out"
83
+ expect rename-order 1 'db/migrations/0002_bee.sql: [MIGRATION-ORDER] 0002 <= 0002' "$rc" "$out"
84
+
85
+ # --- a misnumbered addition.
86
+ r="$(fresh order)"
87
+ printf 'CREATE TABLE z (id INTEGER);\n' > "$r/db/migrations/0001_z.sql"
88
+ out="$(guard "$r")"; rc=$?
89
+ expect misnumbered 1 'db/migrations/0001_z.sql: [MIGRATION-ORDER] 0001 <= 0002' "$rc" "$out"
90
+
91
+ # --- a destructive addition without a reason, then with one; the list absent turns it off.
92
+ r="$(fresh destructive)"
93
+ printf 'drop table a;\n' > "$r/db/migrations/0003_drop.sql"
94
+ out="$(guard "$r")"; rc=$?
95
+ expect destructive 1 "db/migrations/0003_drop.sql:1: [MIGRATION-DESTRUCTIVE] matches 'DROP (TABLE|INDEX|VIEW|TRIGGER)'" "$rc" "$out"
96
+ printf 'drop table a; -- migration-ok: a is folded into b\n' > "$r/db/migrations/0003_drop.sql"
97
+ out="$(guard "$r")"; rc=$?
98
+ expect declared 0 'clean (3 migration(s), 1 added, against merge base' "$rc" "$out"
99
+ printf 'drop table a; -- migration-ok:\n' > "$r/db/migrations/0003_drop.sql"
100
+ out="$(guard "$r")"; rc=$?
101
+ expect empty-reason 1 'its waiver reason empty' "$rc" "$out"
102
+ out="$( cd "$r" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations GATE_SDK_MIGRATION_DESTRUCTIVE=absent.list \
103
+ && gate_run check-migration-guard "$CHECKS" 2>&1 )"; rc=$?
104
+ expect list-absent 0 'destructive check off: no list at absent.list' "$rc" "$out"
105
+
106
+ # --- a stray file is 3; an unresolved base, a malformed list and a bad argument are 2.
107
+ r="$(fresh refusals)"
108
+ printf 'notes\n' > "$r/db/migrations/README.md"
109
+ out="$(guard "$r")"; rc=$?
110
+ expect stray 3 'db/migrations/README.md: not a migration file' "$rc" "$out"
111
+ rm "$r/db/migrations/README.md"
112
+ out="$(guard "$r" --base nope)"; rc=$?
113
+ expect base-unresolved 2 "base 'nope' names no commit" "$rc" "$out"
114
+ out="$( cd "$r" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations GATE_SDK_BASE_REF=trunk \
115
+ GATE_SDK_MIGRATION_DESTRUCTIVE="$LIST" && gate_run check-migration-guard "$CHECKS" 2>&1 )"; rc=$?
116
+ expect base-knob 2 "base 'trunk' names no commit" "$rc" "$out"
117
+ printf 'DROP (TABLE\n' > "$SANDBOX/bad.list"
118
+ out="$( cd "$r" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations GATE_SDK_MIGRATION_DESTRUCTIVE="$SANDBOX/bad.list" \
119
+ && gate_run check-migration-guard "$CHECKS" 2>&1 )"; rc=$?
120
+ expect list-malformed 2 'bad.list:1:' "$rc" "$out"
121
+ out="$(guard "$r" --base main --base-dir db)"; rc=$?
122
+ expect base-and-dir 2 'takes no --base' "$rc" "$out"
123
+ out="$(guard "$r" --since main)"; rc=$?
124
+ expect usage 2 "unknown argument '--since'" "$rc" "$out"
125
+
126
+ # --- outside a work tree there is no corpus, which is refused, never clean.
127
+ out="$( cd "$SANDBOX/plain" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations \
128
+ && gate_run check-migration-guard "$CHECKS" 2>&1 )"; rc=$?
129
+ expect no-work-tree 2 'not a git repository' "$rc" "$out"
130
+
131
+ if [[ "$fails" -gt 0 ]]; then
132
+ echo "check-migration-guard.test.sh: $fails case(s) failed"
133
+ exit 1
134
+ fi
135
+ echo "check-migration-guard.test.sh: clean (the git arm's edit, delete, rename, order and destructive cases, and its exit classes — $cases cases)"
136
+ exit 0
@@ -0,0 +1,6 @@
1
+ carry a deny term as a component's stem
2
+ tree/foo: [NAMES-DENIED]
3
+ tree/foo-cli.sh: [NAMES-DENIED]
4
+ tree/foo_x.txt: [NAMES-DENIED]
5
+ tree/foo.rs: [NAMES-DENIED]
6
+ tree/ZePhYr.md: [CODENAME]
@@ -0,0 +1 @@
1
+ GATE_SDK_DENY_TERMS = terms.list
@@ -0,0 +1,3 @@
1
+ foo
2
+ # rule: CODENAME
3
+ zephyr
@@ -0,0 +1 @@
1
+ PATH-NAMES: clean (5 tracked path(s) read; no component carries one of the 1 deny term(s) as its stem)
@@ -0,0 +1 @@
1
+ GATE_SDK_DENY_TERMS = terms.list
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of check-path-names over the arms the good/+bad/ pair cannot
3
+ # reach: each expect.txt line is an independent substring assertion, so the
4
+ # absence of a record under a directory hit and the record order live here, as
5
+ # do a cwd outside any work tree and a configuration naming no live term.
6
+ #
7
+ # Run by the --run-gate-tests arm (any <tests-dir>/*.test.sh; must exit 0).
8
+ set -uo pipefail
9
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
10
+
11
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # gate-sdk/
12
+ CHECKS="$DIR/checks"
13
+ CASES="$DIR/gate-tests/check-path-names"
14
+ SANDBOX="$(mktemp -d)"
15
+ trap 'rm -rf "$SANDBOX"' EXIT
16
+
17
+ fails=0
18
+
19
+ expect() { # expect <label> <want-rc> <substring> <got-rc> <output>
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
+ # --- outside a work tree there is no tracked path set to be clean about: refused at 2.
28
+ mkdir -p "$SANDBOX/plain"
29
+ printf 'foo\n' > "$SANDBOX/plain/terms.list"
30
+ out="$( cd "$SANDBOX/plain" && gate_env GATE_SDK_DENY_TERMS=terms.list \
31
+ && gate_run check-path-names "$CHECKS" 2>&1 )"; rc=$?
32
+ expect non-repo 2 'not a git repository' "$rc" "$out"
33
+
34
+ # --- a list holding only comments and blanks configures no term: clean, not applicable.
35
+ mkdir -p "$SANDBOX/repo"
36
+ git -C "$SANDBOX/repo" init -q
37
+ printf '# rule: CODENAME\n\n' > "$SANDBOX/repo/terms.list"
38
+ out="$( cd "$SANDBOX/repo" && gate_env GATE_SDK_DENY_TERMS=terms.list \
39
+ && gate_run check-path-names "$CHECKS" 2>&1 )"; rc=$?
40
+ expect no-term 0 'not applicable: no deny term configured' "$rc" "$out"
41
+
42
+ # --- the bad pair's full record set, in order: one record at the directory hit, none for
43
+ # the term-named file under it, and nothing for the tracked list itself.
44
+ out="$( cd "$CASES/bad" && gate_env GATE_SDK_DENY_TERMS=terms.list \
45
+ && gate_run check-path-names "$CHECKS" 2>&1 )"; rc=$?
46
+ got="$(grep -E '^tree/' <<<"$out")"
47
+ want="$(printf '%s\n' \
48
+ 'tree/ZePhYr.md: [CODENAME]' \
49
+ 'tree/foo: [NAMES-DENIED]' \
50
+ 'tree/foo-cli.sh: [NAMES-DENIED]' \
51
+ 'tree/foo.rs: [NAMES-DENIED]' \
52
+ 'tree/foo_x.txt: [NAMES-DENIED]')"
53
+ if [[ "$rc" -ne 1 ]]; then
54
+ echo " FAIL [record-set]: want exit 1, got $rc -- $out"; fails=$((fails + 1))
55
+ elif [[ "$got" != "$want" ]]; then
56
+ echo " FAIL [record-set]: records are not the shortest-prefix set in path order:"
57
+ printf ' %s\n' "$got"
58
+ fails=$((fails + 1))
59
+ fi
60
+
61
+ if [[ "$fails" -gt 0 ]]; then
62
+ echo "check-path-names.test.sh: $fails case(s) failed"
63
+ exit 1
64
+ fi
65
+ echo "check-path-names.test.sh: clean (the arms a case dir cannot reach: a cwd outside a work tree, a list with no live term, and the bad pair's exact record set — 3 cases)"
66
+ exit 0
@@ -0,0 +1,4 @@
1
+ # reviewed early-exit sites, one row per file
2
+ 1 tree/over.sh
3
+ 3 tree/stale.sh
4
+ 2 tree/gone.sh
@@ -0,0 +1,17 @@
1
+ early-exit reader(s) fed under `pipefail`
2
+ tree/over.sh:4: [PIPEFAIL-EARLY-EXIT] head [auto-fix]
3
+ tree/over.sh:5: [PIPEFAIL-EARLY-EXIT] grep -q [auto-fix]
4
+ tree/readers.sh:4: [PIPEFAIL-EARLY-EXIT] grep -q [auto-fix]
5
+ tree/readers.sh:5: [PIPEFAIL-EARLY-EXIT] grep -m [auto-fix]
6
+ tree/readers.sh:6: [PIPEFAIL-EARLY-EXIT] grep -l
7
+ tree/readers.sh:7: [PIPEFAIL-EARLY-EXIT] head [auto-fix]
8
+ tree/readers.sh:8: [PIPEFAIL-EARLY-EXIT] read
9
+ tree/readers.sh:9: [PIPEFAIL-EARLY-EXIT] sed q
10
+ tree/readers.sh:10: [PIPEFAIL-EARLY-EXIT] awk exit
11
+ tree/readers.sh:11: [PIPEFAIL-EARLY-EXIT] while-read break
12
+ tree/readers.sh:14: [PIPEFAIL-EARLY-EXIT] grep -q [auto-fix]
13
+ tree/readers.sh:16: [PIPEFAIL-EARLY-EXIT] waiver reason under 1 characters [auto-fix]
14
+ tree/shared-lib.sh:3: [PIPEFAIL-EARLY-EXIT] head [auto-fix]
15
+ tree/gone.sh: [BASELINE-STALE] 0/2
16
+ tree/stale.sh: [BASELINE-STALE] 1/3
17
+ --emit pipefail-fix <path>…
@@ -0,0 +1,2 @@
1
+ GATE_SDK_PIPEFAIL_PATHS = tree
2
+ GATE_SDK_PIPEFAIL_BASELINE = baseline.tsv
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ # Two sites against a baseline row of one: both print, since which is new is unknowable.
3
+ set -o pipefail
4
+ ls | head -1
5
+ ls | grep -q y
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ # One site per early-exit reader, under pipefail from the set.
3
+ set -euo pipefail
4
+ ls | grep -q x
5
+ ls | grep -m 1 x
6
+ ls | grep -l x
7
+ ls | head -n 3
8
+ ls | read -r first
9
+ ls | sed '/x/q'
10
+ ls | awk '/x/ { print; exit }'
11
+ ls | while read -r l; do
12
+ [[ "$l" == x ]] && break
13
+ done
14
+ v="$(ls |
15
+ grep -Fxq x && echo y)"
16
+ ls | grep -q x # pipefail-ok:
@@ -0,0 +1,3 @@
1
+ # shellcheck shell=bash
2
+ # A library sets no pipefail and is linted from its first line all the same.
3
+ first() { ls | head -1; }
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ # One site against a baseline row of three: the row is stale.
3
+ set -o pipefail
4
+ ls | head -1
@@ -0,0 +1,2 @@
1
+ # reviewed early-exit sites, one row per file
2
+ 2 ./tree/lib/baselined-lib.sh
@@ -0,0 +1 @@
1
+ PIPEFAIL-READERS: clean (3 shell file(s) read, 2 linted under `pipefail`; 2 early-exit reader(s) within the baseline)
@@ -0,0 +1,2 @@
1
+ GATE_SDK_PIPEFAIL_PATHS = tree
2
+ GATE_SDK_PIPEFAIL_BASELINE = baseline.tsv
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bash
2
+ # Early-exit readers before the set, a guarded producer, a waived site, full readers, and
3
+ # early-exit text inside quotes, a here-doc and a case pattern.
4
+ ls | head -1
5
+ set -euo pipefail
6
+ { ls || true; } | head -1
7
+ ls | grep -q x # pipefail-ok: the listing is one directory, read whole before grep exits
8
+ ls | grep -c x
9
+ ls | sed -n '1,3p'
10
+ ls | awk '{ print $1 }'
11
+ echo "a | head -1"
12
+ cat <<'EOF'
13
+ ls | grep -q x
14
+ EOF
15
+ case "$1" in
16
+ a|b) ls | sort ;;
17
+ esac
@@ -0,0 +1,4 @@
1
+ # shellcheck shell=bash
2
+ # A library, linted from its first line; its two sites are within its baseline row.
3
+ first() { ls | head -1; }
4
+ quiet() { ls | read -r _; }
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ # Never sets pipefail and matches no library glob: not linted.
3
+ ls | head -1
4
+ ls | grep -q x
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of check-pipefail-readers and its fix arm over what the good/+bad/ pair
3
+ # cannot reach: an empty configuration, operands, the exit-2 and exit-3 classes, the
4
+ # whole-file knob, the prune set, and the arm rewriting a tree in place.
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-pipefail-readers"
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 path configured: clean, not applicable.
35
+ mkdir -p "$SANDBOX/empty"
36
+ out="$( cd "$SANDBOX/empty" && gate_run check-pipefail-readers "$CHECKS" 2>&1 )"; rc=$?
37
+ expect not-applicable 0 'not applicable: no shell path configured' "$rc" "$out"
38
+
39
+ # --- an operand naming nothing on disk is refused at 2.
40
+ out="$( cd "$SANDBOX/empty" && gate_run check-pipefail-readers "$CHECKS" gone.sh 2>&1 )"; rc=$?
41
+ expect absent-operand 2 'no shell file or directory at gone.sh' "$rc" "$out"
42
+
43
+ # --- an operand narrows the corpus: only its records, and no stale row for a file outside it.
44
+ out="$( cd "$CASES/bad" && gate_env GATE_SDK_PIPEFAIL_BASELINE=baseline.tsv \
45
+ && gate_run check-pipefail-readers "$CHECKS" tree/over.sh 2>&1 )"; rc=$?
46
+ expect operand 1 'tree/over.sh:5: [PIPEFAIL-EARLY-EXIT] grep -q [auto-fix]' "$rc" "$out"
47
+ refute operand-readers 'tree/readers.sh' "$out"
48
+ refute operand-stale 'BASELINE-STALE' "$out"
49
+
50
+ # --- the whole-file knob lints a file that never sets pipefail.
51
+ out="$( cd "$CASES/good" && gate_env GATE_SDK_PIPEFAIL_PATHS=tree GATE_SDK_PIPEFAIL_BASELINE=baseline.tsv GATE_SDK_PIPEFAIL_ALL=1 \
52
+ && gate_run check-pipefail-readers "$CHECKS" 2>&1 )"; rc=$?
53
+ expect all-files 1 'tree/no-pipefail.sh:3: [PIPEFAIL-EARLY-EXIT] head [auto-fix]' "$rc" "$out"
54
+
55
+ # --- a value outside 0|1 is refused at 2.
56
+ out="$( cd "$SANDBOX/empty" && gate_env GATE_SDK_PIPEFAIL_ALL=yes \
57
+ && gate_run check-pipefail-readers "$CHECKS" 2>&1 )"; rc=$?
58
+ expect all-value 2 'GATE_SDK_PIPEFAIL_ALL must be 0|1' "$rc" "$out"
59
+
60
+ # --- a span the reader cannot read is LINT-PARSE at 3, and the fix arm writes nothing to it.
61
+ mkdir -p "$SANDBOX/parse"
62
+ printf '#!/usr/bin/env bash\nset -o pipefail\necho "open\nls | head -1\n' > "$SANDBOX/parse/broken.sh"
63
+ cp "$SANDBOX/parse/broken.sh" "$SANDBOX/parse.orig"
64
+ out="$( cd "$SANDBOX/parse" && gate_run check-pipefail-readers "$CHECKS" broken.sh 2>&1 )"; rc=$?
65
+ expect lint-parse 3 'broken.sh:3: [LINT-PARSE]' "$rc" "$out"
66
+ out="$( cd "$SANDBOX/parse" && gate_arm_run --emit pipefail-fix broken.sh 2>&1 )"; rc=$?
67
+ expect fix-unparsed 3 'could not rewrite' "$rc" "$out"
68
+ cmp -s "$SANDBOX/parse/broken.sh" "$SANDBOX/parse.orig" \
69
+ || { echo " FAIL [fix-unparsed]: the arm wrote to an unparseable file"; fails=$((fails + 1)); }
70
+
71
+ # --- a baseline: absent is refused at 2, a malformed row is exit 3 naming its line.
72
+ mkdir -p "$SANDBOX/base"
73
+ printf '#!/usr/bin/env bash\nset -o pipefail\nls | head -1\n' > "$SANDBOX/base/one.sh"
74
+ out="$( cd "$SANDBOX/base" && gate_env GATE_SDK_PIPEFAIL_PATHS=. GATE_SDK_PIPEFAIL_BASELINE=missing.tsv \
75
+ && gate_run check-pipefail-readers "$CHECKS" 2>&1 )"; rc=$?
76
+ expect baseline-absent 2 'missing.tsv' "$rc" "$out"
77
+ printf '# rows\none\tone.sh\n' > "$SANDBOX/base/bad.tsv"
78
+ out="$( cd "$SANDBOX/base" && gate_env GATE_SDK_PIPEFAIL_PATHS=. GATE_SDK_PIPEFAIL_BASELINE=bad.tsv \
79
+ && gate_run check-pipefail-readers "$CHECKS" 2>&1 )"; rc=$?
80
+ expect baseline-malformed 3 'bad.tsv:2' "$rc" "$out"
81
+
82
+ # --- a directory in the prune set is never walked.
83
+ mkdir -p "$SANDBOX/prune/node_modules/pkg"
84
+ cp "$SANDBOX/base/one.sh" "$SANDBOX/prune/node_modules/pkg/one.sh"
85
+ out="$( cd "$SANDBOX/prune" && gate_env GATE_SDK_PIPEFAIL_PATHS=. \
86
+ && gate_run check-pipefail-readers "$CHECKS" 2>&1 )"; rc=$?
87
+ expect prune 0 'clean (0 shell file(s) read' "$rc" "$out"
88
+
89
+ # --- the fix arm rewrites every auto-fix site in place, keeps the mode, and leaves the hand fixes.
90
+ mkdir -p "$SANDBOX/fix"
91
+ cp "$CASES/bad/tree/readers.sh" "$CASES/bad/tree/over.sh" "$SANDBOX/fix/"
92
+ chmod 755 "$SANDBOX/fix/readers.sh"
93
+ out="$( cd "$SANDBOX/fix" && gate_arm_run --emit pipefail-fix . 2>&1 )"; rc=$?
94
+ expect fix-run 0 'readers.sh:5: fixed' "$rc" "$out"
95
+ expect fix-other 0 'over.sh:4: fixed' "$rc" "$out"
96
+ [[ -x "$SANDBOX/fix/readers.sh" ]] \
97
+ || { echo " FAIL [fix-mode]: the rewrite dropped the file's mode"; fails=$((fails + 1)); }
98
+ grep -qxF "ls | grep x | sed -n '1,1p'" "$SANDBOX/fix/readers.sh" \
99
+ || { echo " FAIL [fix-text]: grep -m 1 was not rewritten to a sed range"; fails=$((fails + 1)); }
100
+ out="$( cd "$SANDBOX/fix" && gate_env GATE_SDK_PIPEFAIL_PATHS=. \
101
+ && gate_run check-pipefail-readers "$CHECKS" 2>&1 )"; rc=$?
102
+ expect fix-leaves 1 'readers.sh:11: [PIPEFAIL-EARLY-EXIT] while-read break' "$rc" "$out"
103
+ refute fix-leaves '[auto-fix]' "$out"
104
+
105
+ # --- with no path configured the arm has nothing to rewrite.
106
+ out="$( cd "$SANDBOX/empty" && gate_arm_run --emit pipefail-fix 2>&1 )"; rc=$?
107
+ expect fix-empty 0 'nothing to rewrite' "$rc" "$out"
108
+
109
+ if [[ "$fails" -gt 0 ]]; then
110
+ echo "check-pipefail-readers.test.sh: $fails case(s) failed"
111
+ exit 1
112
+ fi
113
+ echo "check-pipefail-readers.test.sh: clean (configuration, operands, exit classes, the whole-file knob, pruning and the fix arm — $cases cases)"
114
+ exit 0
@@ -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