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
@@ -39,4 +39,38 @@ leaked="$(env -u GIT_CONFIG_NOSYSTEM "$system=$hostile/system.config" GIT_CONFIG
39
39
  printf 'FAIL: a sourcing suite read host git config: %s\n' "$leaked"
40
40
  exit 1
41
41
  }
42
- echo 'LIB-TEST-HERMETIC: clean (inherited kit variables cleared, binary kept, library and later pins applied, host git config unread)'
42
+
43
+ # A name under the temp dir that is not private to this user is refused at 3 and never written:
44
+ # a link to another directory, and off native Windows a directory open to others.
45
+ mkdir -p "$hostile/tmp-link" "$hostile/target" "$hostile/tmp-open/gate-sdk-hermetic.$(id -u)"
46
+ ln -s "$hostile/target" "$hostile/tmp-link/gate-sdk-hermetic.$(id -u)"
47
+ TMPDIR="$hostile/tmp-link" bash -c 'source "$1"' bash "$GATE_SDK_TEST_LIB_DIR/test-hermetic.sh" 2>/dev/null
48
+ rc=$?
49
+ [[ "$rc" == 3 && -z "$(ls -A "$hostile/target")" ]] || {
50
+ printf 'FAIL: a linked private-dir name was used (exit %s): %s\n' "$rc" "$(ls -A "$hostile/target")"
51
+ exit 1
52
+ }
53
+ case "${OSTYPE:-}" in
54
+ msys* | cygwin* | win32*) ;;
55
+ *)
56
+ open="$hostile/tmp-open/gate-sdk-hermetic.$(id -u)"
57
+ chmod 755 "$open"
58
+ TMPDIR="$hostile/tmp-open" bash -c 'source "$1"' bash "$GATE_SDK_TEST_LIB_DIR/test-hermetic.sh" 2>/dev/null
59
+ rc=$?
60
+ [[ "$rc" == 3 && -z "$(ls -A "$open")" ]] || {
61
+ printf 'FAIL: an open private-dir name was used (exit %s)\n' "$rc"
62
+ exit 1
63
+ }
64
+ ;;
65
+ esac
66
+ fresh="$hostile/tmp-fresh"
67
+ mkdir -p "$fresh"
68
+ TMPDIR="$fresh" bash -c 'source "$1"' bash "$GATE_SDK_TEST_LIB_DIR/test-hermetic.sh" || {
69
+ echo 'FAIL: a fresh temp dir refused the private dir'
70
+ exit 1
71
+ }
72
+ [[ -f "$fresh/gate-sdk-hermetic.$(id -u)/empty.knobs" ]] || {
73
+ echo 'FAIL: the empty files are not under the private dir'
74
+ exit 1
75
+ }
76
+ echo 'LIB-TEST-HERMETIC: clean (inherited kit variables cleared, binary kept, library and later pins applied, host git config unread, a non-private temp name refused)'
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # spec: gate-sdk/SPEC.md §git-hook — the binary under a served hook's name is that hook's launcher: git starts it with no interpreter, a clean commit lands on the summary line, a red member refuses the commit by gate name, a registry with no commit-msg member leaves that hook silent, a binary that cannot be started refuses naming the path and both remedies, a knob naming a hook's own name is refused at 2, a knob-file line naming any other knob is skipped unread while one setting the launcher's own knob as no scalar is refused at 2, a registered member whose declaration resolves and cannot be read refuses either hook at 2, and beside the chain record a placed hook runs the prior hook of its name first, a failing one ending the hook with the gates unrun, while a forwarding hook runs the prior hook of its own name
3
- # spec: gate-sdk/SPEC.md §install-hooks — the arm places both hooks untracked in gate-hooks under the common git directory with an absolute core.hooksPath, so a linked worktree runs them; a re-run replaces both; an absent binary refuses at 2 and places nothing; a failed core.hooksPath write refuses at 2 ahead of the receipt; a failed blame.ignoreRevsFile write is reported with the status unmoved; a hook left behind by a replaced binary starts the binary now installed; --refresh re-places both hooks of an opted-in clone from a replaced binary with no config write, and places nothing off the work-tree top or in a clone not opted in; a clone already running hooks is chained, its live prior hooks named on stdout
3
+ # spec: gate-sdk/SPEC.md §install-hooks — the arm places both hooks untracked in gate-hooks under the common git directory with an absolute core.hooksPath, so a linked worktree runs them; a re-run replaces both; an absent binary refuses at 3 and places nothing; a failed core.hooksPath write refuses at 3 ahead of the receipt; a failed blame.ignoreRevsFile write is reported with the status unmoved; a hook left behind by a replaced binary starts the binary now installed; --refresh re-places both hooks of an opted-in clone from a replaced binary with no config write, and places nothing off the work-tree top or in a clone not opted in; a clone already running hooks is chained, its live prior hooks named on stdout
4
4
  set -uo pipefail
5
5
  source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
6
6
 
@@ -45,7 +45,7 @@ hooks="$repo/.git/gate-hooks"
45
45
  # 1. an absent binary refuses the opt-in at 2 and places nothing
46
46
  mv "$repo/$bin_rel" "$SANDBOX/held"
47
47
  out="$( cd "$repo" && "$SANDBOX/held" --install-hooks 2>&1 )"; rc=$?
48
- [[ "$rc" -eq 2 ]] || note absent-install-status "want exit 2 with no binary at the knob's path, got $rc -- $out"
48
+ [[ "$rc" -eq 3 ]] || note absent-install-status "want exit 3 with no binary at the knob's path, got $rc -- $out"
49
49
  grep -qF "no gate binary at $bin_rel" <<<"$out" || note absent-install-text "the refusal does not name the path: $out"
50
50
  [[ -e "$hooks" ]] && note absent-install-wrote "a refused opt-in left a hooks directory"
51
51
  [[ -z "$(git -C "$repo" config --get core.hooksPath)" ]] || note absent-install-config "a refused opt-in set core.hooksPath"
@@ -158,7 +158,7 @@ done
158
158
  : >"$repo/.git/config.lock"
159
159
  out="$( cd "$repo" && "./$bin_rel" --install-hooks 2>&1 )"; rc=$?
160
160
  rm -f "$repo/.git/config.lock"
161
- [[ "$rc" -eq 2 ]] || note unwired-status "want exit 2 when core.hooksPath cannot be written, got $rc -- $out"
161
+ [[ "$rc" -eq 3 ]] || note unwired-status "want exit 3 when core.hooksPath cannot be written, got $rc -- $out"
162
162
  grep -qF 'could not set core.hooksPath' <<<"$out" || note unwired-text "the refusal does not name the key: $out"
163
163
  grep -qF 'Active hooks:' <<<"$out" && note unwired-receipt "a refused opt-in printed its receipt: $out"
164
164
 
@@ -186,7 +186,7 @@ for pair in "commit-msg:check-probe-msg" "pre-commit:check-probe-word"; do
186
186
  else
187
187
  out="$( cd "$repo" && "./$bin_rel" --git-hook pre-commit 2>&1 )"; rc=$?
188
188
  fi
189
- [[ "$rc" -eq 2 ]] || note "unreadable-$hook-status" "want exit 2 over an unreadable resolved member, got $rc -- $out"
189
+ [[ "$rc" -eq 3 ]] || note "unreadable-$hook-status" "want exit 3 over an unreadable resolved member, got $rc -- $out"
190
190
  grep -qF "$hook: cannot read the declaration scripts/${pair##*:}.sh" <<<"$out" || note "unreadable-$hook-text" "the refusal does not name the declaration: $out"
191
191
  fi
192
192
  chmod 755 "$member"
@@ -222,7 +222,7 @@ EOF
222
222
  export GATE_SDK_LOCAL_KNOB_FILE="$overlay_pin"
223
223
  fi
224
224
 
225
- # 15. --refresh re-places both hooks from a replaced binary and does nothing else; off the work-tree top it places nothing, and an absent binary refuses at 2
225
+ # 15. --refresh re-places both hooks from a replaced binary and does nothing else; off the work-tree top it places nothing, and an absent binary refuses at 3
226
226
  digest() { git hash-object --no-filters -- "$1"; }
227
227
  stale_hooks() { for h in pre-commit commit-msg; do rm -f "$hooks/$h$sfx"; printf 'stale\n' >"$hooks/$h$sfx"; done; }
228
228
  stale_hooks
@@ -233,7 +233,7 @@ out="$( cd "$repo/scripts" && "../$bin_rel" --install-hooks --refresh 2>&1 )"; r
233
233
  [[ "$(cat "$hooks/pre-commit$sfx")" == stale ]] || note refresh-subdir-placed "a refresh off the work-tree top re-placed a hook"
234
234
  mv "$repo/$bin_rel" "$SANDBOX/held"
235
235
  out="$( cd "$repo" && "$SANDBOX/held" --install-hooks --refresh 2>&1 )"; rc=$?
236
- [[ "$rc" -eq 2 ]] || note refresh-absent-status "want exit 2 from a refresh with no binary at the knob's path, got $rc -- $out"
236
+ [[ "$rc" -eq 3 ]] || note refresh-absent-status "want exit 3 from a refresh with no binary at the knob's path, got $rc -- $out"
237
237
  grep -qF "no gate binary at $bin_rel" <<<"$out" || note refresh-absent-text "the refusal does not name the path: $out"
238
238
  mv "$SANDBOX/held" "$repo/$bin_rel"
239
239
  before="$(git -C "$repo" config --list --local)"
@@ -290,5 +290,5 @@ if [[ -z "$sfx" ]]; then
290
290
  fi
291
291
 
292
292
  [[ "$fails" -eq 0 ]] || { echo "native-git-hooks.test: $fails assertion(s) failed"; exit 1; }
293
- echo "native-git-hooks.test: clean (--install-hooks places both hooks untracked under the common git directory, absolute in core.hooksPath, refusing with nothing placed when the binary is absent; git starts the placed binary as each hook with no interpreter: a clean commit lands on the summary line, a red member refuses by gate name from the main checkout and from a linked worktree, the commit-msg hook is silent until a member registers at its tier and reaches one with no re-install; a hook outliving a replaced binary starts the installed one, an unstartable binary refuses naming the path and both remedies, a knob naming a hook is refused at 2, a re-run replaces both, a knob-file line naming a knob the launcher does not know is left to the installed build, --refresh re-places an opted-in clone's hooks and nothing else, a failed core.hooksPath write refuses at 2 with no receipt, a failed blame.ignoreRevsFile write is reported at exit 0, an unreadable resolved member refuses either hook at 2, and a clone already running hooks keeps them, a prior pre-commit ahead of the gates and a prior post-commit through its forwarding hook, a failing prior hook refusing the commit with the gates unrun)"
293
+ echo "native-git-hooks.test: clean (--install-hooks places both hooks untracked under the common git directory, absolute in core.hooksPath, refusing with nothing placed when the binary is absent; git starts the placed binary as each hook with no interpreter: a clean commit lands on the summary line, a red member refuses by gate name from the main checkout and from a linked worktree, the commit-msg hook is silent until a member registers at its tier and reaches one with no re-install; a hook outliving a replaced binary starts the installed one, an unstartable binary refuses naming the path and both remedies, a knob naming a hook is refused at 2, a re-run replaces both, a knob-file line naming a knob the launcher does not know is left to the installed build, --refresh re-places an opted-in clone's hooks and nothing else, a failed core.hooksPath write refuses at 3 with no receipt, a failed blame.ignoreRevsFile write is reported at exit 0, an unreadable resolved member refuses either hook at 3, and a clone already running hooks keeps them, a prior pre-commit ahead of the gates and a prior post-commit through its forwarding hook, a failing prior hook refusing the commit with the gates unrun)"
294
294
  exit 0
@@ -50,13 +50,13 @@ err="$(<"$scratch/err.txt")"
50
50
  [[ -z "$err" ]] || { echo "FAIL [stdout-argv]: stderr was '$err'"; fails=$((fails + 1)); }
51
51
  [[ "$rc" -eq 0 ]] || { echo "FAIL [stdout-argv]: expected exit 0, got $rc"; fails=$((fails + 1)); }
52
52
 
53
- # Arm 2 — the stderr the split must not discard: an absent binary is gate_command's exit 2, whose
53
+ # Arm 2 — the stderr the split must not discard: an absent binary is gate_command's exit 3, whose
54
54
  # diagnostic body is stderr. Deleting the capture rather than splitting it would empty this report.
55
55
  gate_command_argv "$scratch/absent-bin" >/dev/null; rc=$?
56
56
  err="$(<"$scratch/err.txt")"
57
57
  assert_has dispatch-err 'absent or not executable' "$err"
58
58
  assert_has dispatch-err 'build-native.sh' "$err"
59
- [[ "$rc" -eq 2 ]] || { echo "FAIL [dispatch-err]: expected exit 2, got $rc"; fails=$((fails + 1)); }
59
+ [[ "$rc" -eq 3 ]] || { echo "FAIL [dispatch-err]: expected exit 3, got $rc"; fails=$((fails + 1)); }
60
60
 
61
61
  # Arm 3 — the arm's own tails over a hermetic registry, run through the real binary: a shell member
62
62
  # that passes earns the exact green phrase, and a `.gate` naming a subcommand the binary does not
@@ -87,10 +87,10 @@ mkdir -p "$red"
87
87
  printf 'check-noisy\n' > "$red/gates.list"
88
88
  cp "$scratch/check-noisy.gate" "$red/check-noisy.gate"
89
89
  out="$(run_battery "$red")"; rc=$?
90
- assert_has arm-red ' FAIL: check-noisy (dispatch harness error, exit 2)' "$out"
90
+ assert_has arm-red ' FAIL: check-noisy (dispatch harness error, exit 3)' "$out"
91
91
  assert_has arm-red 'no such gate subcommand' "$out"
92
92
  assert_has arm-red '1 of 1 gates FAILED: check-noisy' "$out"
93
- [[ "$rc" -eq 1 ]] || { echo "FAIL [arm-red]: expected exit 1, got $rc"; fails=$((fails + 1)); }
93
+ [[ "$rc" -eq 3 ]] || { echo "FAIL [arm-red]: expected exit 3 (an errored member alone is the error verdict), got $rc"; fails=$((fails + 1)); }
94
94
 
95
95
  [[ "$fails" -eq 0 ]] || { echo "run-dispatch-streams.test: $fails assertion(s) failed"; exit 1; }
96
96
  echo "run-dispatch-streams.test: clean (argv taken from stdout alone as the two-element binary form; the exit-2 diagnostic body still reaches the caller; the arm's green phrase and dispatch-harness-error tail hold over a hermetic registry)"
@@ -87,16 +87,16 @@ GATE_SDK_GATES_DIR="$scratch" GATE_SDK_KIT_DIRS="$scratch" \
87
87
  GATE_SDK_TMP_DIR="$scratch/.tmp" bash "$RUN" --for >/dev/null 2>&1
88
88
  [[ $? -eq 2 ]] || { echo "FAIL [usage]: --for with no path should exit 2"; fails=$((fails + 1)); }
89
89
 
90
- # A member that resolves and cannot be read refuses the selection at exit 2, never a
90
+ # A member that resolves and cannot be read fails the selection at exit 3, never a
91
91
  # narrower one; a host that reads through the mode cannot build the case.
92
92
  chmod 000 "$scratch/g_glob.sh"
93
93
  if ! head -c 1 "$scratch/g_glob.sh" >/dev/null 2>&1; then
94
94
  out="$(run_for alpha/foo.txt)"; rc=$?
95
- [[ "$rc" -eq 2 ]] || { echo "FAIL [unreadable]: expected exit 2, got $rc -- $out"; fails=$((fails + 1)); }
95
+ [[ "$rc" -eq 3 ]] || { echo "FAIL [unreadable]: expected exit 3, got $rc -- $out"; fails=$((fails + 1)); }
96
96
  assert_has unreadable "run-gates: --for cannot read the declaration" "$out"
97
97
  fi
98
98
  chmod 755 "$scratch/g_glob.sh"
99
99
 
100
100
  [[ "$fails" -eq 0 ]] || { echo "run-for-path.test: $fails assertion(s) failed"; exit 1; }
101
- echo "run-for-path.test: clean (--for selects by shared matcher; trigger='*' universal, mode=staged pathspec passes args, ungoverned path noted and its empty selection logged or its bad result selection refused, an unreadable resolved member refused at 2)"
101
+ echo "run-for-path.test: clean (--for selects by shared matcher; trigger='*' universal, mode=staged pathspec passes args, ungoverned path noted and its empty selection logged or its bad result selection refused, an unreadable resolved member failing at 3)"
102
102
  exit 0
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # spec: gate-sdk/SPEC.md §The harness-integration arm — a fail-open arm run inside a linked worktree with no binary of its own dispatches to the main checkout's binary: the fork ban, the workflow-state guard and the shell guard fire from the worktree; with both binaries absent the hook still declines at 0; a verdict-bearing arm still reports the binary absent at 2; an absolute pin naming nothing takes no fallback; and a capture write lands in the main checkout (gate-sdk/SPEC.md §The workflow directory)
2
+ # spec: gate-sdk/SPEC.md §The harness-integration arm — a fail-open arm run inside a linked worktree with no binary of its own dispatches to the main checkout's binary: the fork ban, the workflow-state guard and the shell guard fire from the worktree; with both binaries absent the hook still declines at 0; a verdict-bearing arm still reports the binary absent at 3; an absolute pin naming nothing takes no fallback; and a capture write lands in the main checkout (gate-sdk/SPEC.md §The workflow directory)
3
3
  set -uo pipefail
4
4
  source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
5
5
 
@@ -50,9 +50,9 @@ out="$(in_wt '{"tool_name":"Bash","tool_input":{"command":"cd deploy && ls"}}' b
50
50
  [[ "$rc" -eq 2 ]] || note guard-status "want exit 2 from the shell guard on a blocked command, got $rc -- $out"
51
51
  grep -qF "shell-guard: don't use 'cd'" <<<"$out" || note guard-text "the shell guard's block text is missing: $out"
52
52
 
53
- # 5. a verdict-bearing arm links nothing onto a door path git does not ignore: exit 2, naming why
53
+ # 5. a verdict-bearing arm links nothing onto a door path git does not ignore: exit 3, naming why
54
54
  out="$(in_wt '' bash gate-sdk/bin/run-gates.sh --emit knob-roster)"; rc=$?
55
- [[ "$rc" -eq 2 ]] || note emit-status "want exit 2 from --emit with an unignored door path, got $rc -- $out"
55
+ [[ "$rc" -eq 3 ]] || note emit-status "want exit 3 from --emit with an unignored door path, got $rc -- $out"
56
56
  grep -qF 'is not gitignored here' <<<"$out" || note emit-text "--emit did not name the unignored door: $out"
57
57
  grep -qF 'Build it' <<<"$out" && note emit-remedy "the worktree refusal told the session to build: $out"
58
58
  [[ -e "$wt/native/target/release/checkwright-gates$(gate_exe_suffix)" ]] && note emit-linked "a binary was linked onto an unignored door path"
@@ -98,7 +98,7 @@ grep -qF 'is absent or not executable' <<<"$out" || note control-text "the absen
98
98
  git -C "$main" worktree remove --force "$wt"
99
99
 
100
100
  # 8-9. a tree tracking the crate source: a main binary whose source stamp is the worktree's is linked
101
- # and runs, one line of skew refuses at 2 without linking, and neither builds
101
+ # and runs, one line of skew refuses at 3 without linking, and neither builds
102
102
  crate="$SANDBOX/crate"
103
103
  mkdir -p "$crate/gate-sdk"
104
104
  cp -R "$HERE/gate-sdk/bin" "$HERE/gate-sdk/lib" "$crate/gate-sdk/"
@@ -125,12 +125,12 @@ out="$( cd "$cwt" && unset GATE_SDK_NATIVE_BIN && bash gate-sdk/bin/run-gates.sh
125
125
  rm -f "$door"
126
126
  printf '// skew\n' >>"$cwt/native/src/main.rs"
127
127
  out="$( cd "$cwt" && unset GATE_SDK_NATIVE_BIN && bash gate-sdk/bin/run-gates.sh --emit knob-values GATE_SDK_NATIVE_BIN 2>&1 )"; rc=$?
128
- [[ "$rc" -eq 2 ]] || note skew-status "want exit 2 on a skewed crate, got $rc -- $out"
128
+ [[ "$rc" -eq 3 ]] || note skew-status "want exit 3 on a skewed crate, got $rc -- $out"
129
129
  grep -qF "was not built from this worktree's crate source" <<<"$out" || note skew-text "the refusal did not name the skew: $out"
130
130
  [[ -e "$door" ]] && note skew-link "a skewed main binary was linked"
131
131
  [[ -e "$cwt/native/target/release/deps" ]] && note skew-build "a build ran in the worktree"
132
132
  git -C "$crate" worktree remove --force "$cwt"
133
133
 
134
134
  [[ "$fails" -eq 0 ]] || { echo "run-gates-linked-worktree.test: $fails assertion(s) failed"; exit 1; }
135
- echo "run-gates-linked-worktree.test: clean (from a linked worktree with no binary the fork ban, the workflow-state guard and the shell guard fire through the main checkout's binary; a verdict arm links the main binary only onto a gitignored door and, where crate source is tracked, only on a matching source stamp, refusing at 2 with the reason otherwise and never building; an absolute pin naming nothing takes no fallback; with both absent the hook declines at 0; a kfric line and a fallback lesson written from the worktree land in the main checkout, and from the main checkout in its own)"
135
+ echo "run-gates-linked-worktree.test: clean (from a linked worktree with no binary the fork ban, the workflow-state guard and the shell guard fire through the main checkout's binary; a verdict arm links the main binary only onto a gitignored door and, where crate source is tracked, only on a matching source stamp, refusing at 3 with the reason otherwise and never building; an absolute pin naming nothing takes no fallback; with both absent the hook declines at 0; a kfric line and a fallback lesson written from the worktree land in the main checkout, and from the main checkout in its own)"
136
136
  exit 0
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env bash
2
+ # spec: gate-sdk/SPEC.md §run-gates — `--run --json` end to end through the front end: on a registry
3
+ # with one passing and one failing member, stdout is the one run document whose verdict is fail,
4
+ # stderr carries the failing member's banner, and the status is 1. Run by the --run-gate-tests arm.
5
+ set -uo pipefail
6
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
7
+
8
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
9
+ RUN="$ROOT/gate-sdk/bin/run-gates.sh"
10
+ [[ -x "$RUN" ]] || { echo "run-json.test: runner not found: $RUN"; exit 2; }
11
+
12
+ scratch="$(cd -P "$(mktemp -d)" && pwd -P)"
13
+ trap 'rm -rf "$scratch"' EXIT
14
+
15
+ fails=0
16
+ fail() { echo "FAIL [$1]: $2"; [[ -n "${3:-}" ]] && printf '%s\n' "$3"; fails=$((fails + 1)); }
17
+
18
+ repo="$scratch/repo" gates="$scratch/gates"
19
+ mkdir -p "$repo" "$gates"
20
+ printf 'a\n' > "$repo/a.txt"
21
+ git -C "$repo" init -q
22
+ git -C "$repo" add -A
23
+ git -C "$repo" -c user.name=t -c user.email=t@e.invalid commit -qm base
24
+
25
+ { printf '#!/usr/bin/env bash\n'
26
+ printf '# graph: couples=a.txt dir=one valve=none tier=precommit\n'
27
+ printf 'echo "A: clean (one file)"\n'
28
+ } > "$gates/a.sh"
29
+ { printf '#!/usr/bin/env bash\n'
30
+ printf '# graph: couples=a.txt dir=one valve=none tier=precommit\n'
31
+ printf 'echo "a.txt:1: red"; exit 1\n'
32
+ } > "$gates/b.sh"
33
+ chmod +x "$gates/a.sh" "$gates/b.sh"
34
+ printf 'a\nb\n' > "$gates/gates.list"
35
+
36
+ out="$(cd "$repo" && env GATE_SDK_GATES_DIR="$gates" GATE_SDK_KIT_DIRS="$gates" GATE_SDK_TMP_DIR="$scratch/tmp" \
37
+ bash "$RUN" --run --json 2>"$scratch/stderr")"; rc=$?
38
+ err="$(cat "$scratch/stderr")"
39
+
40
+ [[ "$rc" -eq 1 ]] || fail "status" "expected exit 1, got $rc" "$err"
41
+ lines="$(printf '%s\n' "$out" | grep -c '')"
42
+ [[ "$lines" -eq 1 ]] || fail "one document" "stdout holds $lines lines, not the document alone" "$out"
43
+ [[ "$out" == '{"contract":"1.0.0",'*'}' ]] || fail "one document" "stdout is not one contract 1.0.0 object" "$out"
44
+ [[ "$out" == *'"members":[{"exit":0,"kind":"pass","name":"a"},{"exit":1,"kind":"fail","name":"b"}],"omitted":[],'* ]] \
45
+ || fail "members" "the members are not a pass then a fail in gate-set order" "$out"
46
+ [[ "$out" == *'"scope":"registry","verdict":"fail"}' ]] || fail "verdict" "the verdict is not fail on a registry run" "$out"
47
+ [[ "$err" == *'===== b ====='* && "$err" == *'FAIL: b (exit 1)'* ]] || fail "stderr" "stderr lacks the failing member's banner" "$err"
48
+ [[ "$err" == *'1 of 2 gates FAILED: b'* ]] || fail "stderr" "stderr lacks the summary" "$err"
49
+
50
+ [[ "$fails" -eq 0 ]] || { echo "run-json.test: $fails assertion(s) failed"; exit 1; }
51
+ echo "run-json.test: clean (--run --json printed one contract 1.0.0 document on stdout with a pass and a fail member and the verdict fail, the transcript and summary on stderr, at exit 1)"
52
+ exit 0
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env bash
2
+ # spec: gate-sdk/SPEC.md §run-gates — the verdict store end to end through the front end: a
3
+ # registry run on a clean tree keeps its verdict under the key its SARIF log's provenance carries,
4
+ # --verdict-lookup answers it there and answers absent under another digest, a tree that moves while
5
+ # members run or a modified tree keeps nothing, and an unset store is refused with its error
6
+ # document. Run by the --run-gate-tests arm.
7
+ set -uo pipefail
8
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
9
+
10
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
+ RUN="$ROOT/gate-sdk/bin/run-gates.sh"
12
+ [[ -x "$RUN" ]] || { echo "verdict-store.test: runner not found: $RUN"; exit 2; }
13
+
14
+ scratch="$(cd -P "$(mktemp -d)" && pwd -P)"
15
+ trap 'rm -rf "$scratch"' EXIT
16
+
17
+ fails=0
18
+ fail() { echo "FAIL [$1]: $2"; [[ -n "${3:-}" ]] && printf '%s\n' "$3"; fails=$((fails + 1)); }
19
+
20
+ repo="$scratch/repo" gates="$scratch/gates" store="$scratch/store" sarif="$scratch/run.sarif"
21
+ mkdir -p "$repo" "$gates"
22
+ printf 'a\n' > "$repo/a.txt"
23
+ git -C "$repo" init -q
24
+ git -C "$repo" add -A
25
+ git -C "$repo" -c user.name=t -c user.email=t@e.invalid commit -qm base
26
+
27
+ # One member, red exactly where the tree holds a file named red.
28
+ { printf '#!/usr/bin/env bash\n'
29
+ printf '# graph: couples=a.txt dir=one valve=none tier=precommit\n'
30
+ printf '[[ -n "${MOVE_TREE:-}" ]] && { printf "m\\n" >> a.txt; git -c user.name=t -c user.email=t@e.invalid commit -qam moved; }\n'
31
+ printf '[[ -e red ]] && { echo "red: present"; exit 1; }\n'
32
+ printf 'echo "g: clean (no red file)"\n'
33
+ } > "$gates/g.sh"
34
+ chmod +x "$gates/g.sh"
35
+ printf 'g\n' > "$gates/gates.list"
36
+
37
+ # battery <VAR=value>... — the front end's --run on the scratch registry, extra environment first
38
+ battery() {
39
+ (cd "$repo" && env GATE_SDK_GATES_DIR="$gates" GATE_SDK_KIT_DIRS="$gates" GATE_SDK_TMP_DIR="$scratch/tmp" \
40
+ GATE_SDK_SARIF_FILE="$sarif" "$@" bash "$RUN" --run 2>&1)
41
+ }
42
+ lookup() {
43
+ (cd "$repo" && env "$@" bash "$RUN" --verdict-lookup "${key[@]}" 2>/dev/null)
44
+ }
45
+ # The key the run's provenance carries: treeId, tool.version and gateSet, read off the log.
46
+ read_key() {
47
+ local log
48
+ log="$(cat "$sarif")"
49
+ key=(
50
+ "$(grep -oE '"treeId": "[0-9a-f]+"' <<<"$log" | grep -oE '[0-9a-f]{40,64}')"
51
+ "$(awk '/"provenance": \{/ { p = 1 } p && /"tool": \{/ { t = 1 } t && /"version":/ { gsub(/[",]/, "", $2); print $2; exit } t && /\}/ { t = 0 }' <<<"$log")"
52
+ "$(grep -oE '"gateSet": "[0-9a-f]+"' <<<"$log" | grep -oE '[0-9a-f]{64}')"
53
+ )
54
+ }
55
+
56
+ out="$(battery GATE_SDK_VERDICT_STORE="$store")"; rc=$?
57
+ [[ "$rc" -eq 0 ]] || fail "pass run" "expected exit 0, got $rc" "$out"
58
+ read_key
59
+ # spec: gate-sdk/SPEC.md §run-gates — an unstamped binary keeps nothing, so it fails here rather
60
+ # than passing on an empty store
61
+ [[ -n "${key[1]}" ]] || fail "stamp" "the provenance carries no tool.version: the binary is unstamped"
62
+ [[ -n "${key[0]}" && -n "${key[2]}" ]] || fail "key" "the provenance carries no treeId or gateSet" "$(cat "$sarif")"
63
+
64
+ got="$(lookup GATE_SDK_VERDICT_STORE="$store")"; rc=$?
65
+ [[ "$rc" -eq 0 && "$got" == '{"contract":"1.0.0","verdict":"pass"}' ]] || fail "lookup pass" "exit $rc: $got"
66
+ pass_key=("${key[@]}")
67
+
68
+ printf 'r\n' > "$repo/red"
69
+ git -C "$repo" add red
70
+ git -C "$repo" -c user.name=t -c user.email=t@e.invalid commit -qm red
71
+ out="$(battery GATE_SDK_VERDICT_STORE="$store")"; rc=$?
72
+ [[ "$rc" -eq 1 ]] || fail "fail run" "expected exit 1, got $rc" "$out"
73
+ read_key
74
+ got="$(lookup GATE_SDK_VERDICT_STORE="$store")"; rc=$?
75
+ [[ "$rc" -eq 0 && "$got" == '{"contract":"1.0.0","verdict":"fail"}' ]] || fail "lookup fail" "a stored fail is an answer at 0: exit $rc: $got"
76
+
77
+ key=("${pass_key[0]}" "${pass_key[1]}" "$(printf 'f%.0s' {1..64})")
78
+ got="$(lookup GATE_SDK_VERDICT_STORE="$store")"; rc=$?
79
+ [[ "$rc" -eq 0 && "$got" == '{"contract":"1.0.0","verdict":"absent"}' ]] || fail "another digest" "exit $rc: $got"
80
+
81
+ # spec: gate-sdk/SPEC.md §run-gates — a commit landing while members run moves the tree under the
82
+ # run, so its outcomes key nothing
83
+ out="$(battery GATE_SDK_VERDICT_STORE="$scratch/moved" MOVE_TREE=1)"; rc=$?
84
+ [[ "$rc" -eq 1 ]] || fail "moved run" "expected exit 1, got $rc" "$out"
85
+ [[ ! -e "$scratch/moved" ]] || fail "moved run" "a run whose tree moved kept a verdict" "$(ls -A "$scratch/moved")"
86
+ grep -q 'moved while members ran; nothing stored' <<<"$out" || fail "moved run" "no line names the unkept verdict" "$out"
87
+
88
+ printf 'b\n' >> "$repo/a.txt"
89
+ out="$(battery GATE_SDK_VERDICT_STORE="$scratch/modified")"; rc=$?
90
+ [[ "$rc" -eq 1 ]] || fail "modified run" "expected exit 1, got $rc" "$out"
91
+ [[ ! -e "$scratch/modified" ]] || fail "modified run" "a modified tree kept a verdict" "$(ls -A "$scratch/modified")"
92
+
93
+ key=("${pass_key[@]}")
94
+ got="$(lookup)"; rc=$?
95
+ [[ "$rc" -eq 2 && "$got" == '{"contract":"1.0.0","error":"refused"}' ]] || fail "unset store" "exit $rc: $got"
96
+
97
+ [[ "$fails" -eq 0 ]] || { echo "verdict-store.test: $fails assertion(s) failed"; exit 1; }
98
+ echo "verdict-store.test: clean (a registry run on a clean tree kept its pass and its fail under the SARIF log's key, --verdict-lookup answered each at exit 0 and absent under another digest, a tree moved mid-run and a modified tree kept nothing, and an unset store was refused at exit 2 with its error document)"
99
+ exit 0
@@ -2,13 +2,13 @@
2
2
  # spec: gate-sdk/SPEC.md §lib/gate.sh — sourced library: values + adapters, never gate structure
3
3
  # no-port: gate-sdk/SPEC.md §lib/gate.sh, its port disposition — two grounds. Its API is shell functions sourced into bash callers (CI steps, the installer smoke, the author template, the front-ends and the test harness), and a binary arm cannot be sourced into bash; and its pre-binary accessors answer before any binary exists, the bootstrap cause bin/build-native.sh declares on. Structural, not a sizing judgment.
4
4
 
5
- # spec: gate-sdk/SPEC.md §Fail-closed contract — non-zero capture status means the check could not run; exit 2, never a false clean
5
+ # spec: gate-sdk/SPEC.md §Fail-closed contract — non-zero capture status means the check could not run; exit 3, a tool error, never a false clean
6
6
  fail_closed() {
7
7
  if [[ "$1" -ne 0 ]]; then
8
8
  printf '%s: %s exited %s — the check could not run; treating as ' \
9
9
  "$2" "$3" "$1" >&2
10
10
  printf 'failure (not clean)\n' >&2
11
- exit 2
11
+ exit 3
12
12
  fi
13
13
  }
14
14
 
@@ -215,8 +215,11 @@ gate_prune_load() {
215
215
  [[ -n "${_gate_prune_loaded:-}" ]] && return 0
216
216
  local out n el
217
217
  out="$(gate_knob_values GATE_SDK_PRUNE_DIRS GATE_SDK_PRUNE_EXTRA_DIRS)" || {
218
+ n=$?
218
219
  echo "gate-sdk: the prune set could not be read from the gate binary; treating as failure (not clean)" >&2
219
- exit 2
220
+ # spec: gate-sdk/SPEC.md §Output contract — the binary's refusal of a malformed knob stays 2; every other failure to answer is a tool error
221
+ [[ "$n" -eq 2 ]] && exit 2
222
+ exit 3
220
223
  }
221
224
  _gate_prune=()
222
225
  GATE_GREP_EXCLUDES=()
@@ -268,7 +271,7 @@ gate_resolve() {
268
271
  return 1
269
272
  }
270
273
 
271
- # spec: gate-sdk/SPEC.md §lib/gate.sh — resolve a gate name to its *invocation argv*, one element per line; a `.gate` declaration's is the binary's `--emit gate-argv` answer. An absent or non-executable binary, or the arm's refusal, is a harness error — exit 2, never a skip and never a pass (§Fail-closed contract).
274
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — resolve a gate name to its *invocation argv*, one element per line; a `.gate` declaration's is the binary's `--emit gate-argv` answer. An absent or non-executable binary is a tool error at exit 3, and the arm's own refusal or error exits at its status — never a skip and never a pass (§Fail-closed contract).
272
275
  gate_command() {
273
276
  local g="$1" d bin
274
277
  shift
@@ -283,9 +286,9 @@ gate_command() {
283
286
  printf 'gate_command: %s dispatches to the native binary, but %s is ' "$g" "$bin" >&2
284
287
  printf 'absent or not executable — the gate could not run; treating as ' >&2
285
288
  printf 'failure (not clean). Build it: bash gate-sdk/bin/build-native.sh\n' >&2
286
- exit 2
289
+ exit 3
287
290
  fi
288
- "$bin" --emit gate-argv "$d/$g.gate" || exit 2
291
+ "$bin" --emit gate-argv "$d/$g.gate" || exit
289
292
  return 0
290
293
  fi
291
294
  done
@@ -358,13 +361,13 @@ gate_kit_roots() {
358
361
  gate_check_dirs() {
359
362
  gate_sdk_gates_dir
360
363
  local k roots
361
- roots="$(gate_kit_roots)" || return 2
364
+ roots="$(gate_kit_roots)" || return
362
365
  while IFS= read -r k; do
363
366
  [[ -n "$k" ]] && printf '%s/checks\n' "$k"
364
367
  done <<<"$roots"
365
368
  }
366
369
 
367
- # spec: gate-sdk/SPEC.md §check-commit-msg — resolve the banned-pattern file set shared by check-commit-msg and check-tree-terms: explicit positional args win; otherwise GATE_SDK_MSG_PATTERN_FILES (tracked, must exist — fail-closed) plus GATE_SDK_MSG_PATTERN_FILES_LOCAL (gitignored, skipped when absent). Both are whitespace lists split with no expansion. Emits one existing readable file path per line; returns 2 when a required tracked file is missing.
370
+ # spec: gate-sdk/SPEC.md §check-commit-msg — resolve the banned-pattern file set shared by check-commit-msg and check-tree-terms: explicit positional args win; otherwise GATE_SDK_MSG_PATTERN_FILES (tracked, must exist — fail-closed) plus GATE_SDK_MSG_PATTERN_FILES_LOCAL (gitignored, skipped when absent). Both are whitespace lists split with no expansion. Emits one existing readable file path per line; returns 2 when a required tracked file is missing and 3 when one is unreadable.
368
371
  gate_msg_pattern_files() {
369
372
  if [[ $# -gt 0 ]]; then
370
373
  printf '%s\n' "$@"
@@ -376,7 +379,7 @@ gate_msg_pattern_files() {
376
379
  read -ra local_files <<<"$(_gate_prebinary_knob GATE_SDK_MSG_PATTERN_FILES_LOCAL "$dir/msg-patterns.local.list")"
377
380
  for f in ${required[@]+"${required[@]}"}; do
378
381
  [[ -f "$f" ]] || { echo "gate_msg_pattern_files: required tracked pattern file missing: $f" >&2; return 2; }
379
- [[ -r "$f" ]] || { echo "gate_msg_pattern_files: pattern file not readable: $f" >&2; return 2; }
382
+ [[ -r "$f" ]] || { echo "gate_msg_pattern_files: pattern file not readable: $f" >&2; return 3; }
380
383
  printf '%s\n' "$f"
381
384
  done
382
385
  for f in ${local_files[@]+"${local_files[@]}"}; do
@@ -5,9 +5,28 @@
5
5
  # shellcheck disable=SC2164 # the anchor is the contract's bare builtin, which check-path-dialect clears only as the whole line; a failed chdir leaves the cwd where it was
6
6
  cd "$(pwd -P)"
7
7
  _th_root="$(cd "${BASH_SOURCE[0]%/*}/../.." && pwd)"
8
- _th_empty="${TMPDIR:-/tmp}/gate-sdk-hermetic-empty.sh"
8
+ _th_sep=:
9
+ case "${OSTYPE:-}" in msys* | cygwin* | win32*) _th_sep=';' ;; esac
10
+ # spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — the empty files live in a directory private to this
11
+ # user, made mode 700 and owner-checked before use; a name that is not private is refused, never used
12
+ _th_dir="${TMPDIR:-/tmp}/gate-sdk-hermetic.$(id -u)"
13
+ mkdir -m 700 "$_th_dir" 2>/dev/null
14
+ _th_why=
15
+ if [[ -L "$_th_dir" || ! -d "$_th_dir" ]]; then
16
+ _th_why='is not a directory'
17
+ elif [[ ! -O "$_th_dir" ]]; then
18
+ _th_why='is owned by another user'
19
+ elif [[ "$_th_sep" == : ]]; then
20
+ case "$(ls -ld "$_th_dir")" in d???------*) ;; *) _th_why='is open to group or other' ;; esac
21
+ fi
22
+ if [[ -n "$_th_why" ]]; then
23
+ printf 'test-hermetic.sh: %s %s, so nothing is written there; remove it, or point TMPDIR at a directory of your own\n' \
24
+ "$_th_dir" "$_th_why" >&2
25
+ exit 3
26
+ fi
27
+ _th_empty="$_th_dir/empty.sh"
9
28
  : >"$_th_empty"
10
- _th_empty_knobs="${TMPDIR:-/tmp}/gate-sdk-hermetic-empty.knobs"
29
+ _th_empty_knobs="$_th_dir/empty.knobs"
11
30
  : >"$_th_empty_knobs"
12
31
  for _th_kit in "$_th_root"/gate-sdk "$_th_root"/*-kit; do
13
32
  [[ -d "$_th_kit" ]] || continue
@@ -20,12 +39,10 @@ for _th_kit in "$_th_root"/gate-sdk "$_th_root"/*-kit; do
20
39
  [[ "$_th_var" == GATE_SDK ]] || export "${_th_var}_LOCAL_KNOB_FILE=${_th_empty_knobs}"
21
40
  done
22
41
  # spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — the temp dir the suite is handed heads the git ceiling list
23
- _th_sep=:
24
- case "${OSTYPE:-}" in msys* | cygwin* | win32*) _th_sep=';' ;; esac
25
42
  _th_tmp="$(cd -P "${TMPDIR:-/tmp}" && pwd -P)"
26
43
  export GIT_CEILING_DIRECTORIES="${_th_tmp}${GIT_CEILING_DIRECTORIES:+${_th_sep}${GIT_CEILING_DIRECTORIES}}"
27
44
  # spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — git reads no host global config, and no system config off native Windows
28
- _th_git_global="${TMPDIR:-/tmp}/gate-sdk-hermetic-empty.gitconfig"
45
+ _th_git_global="$_th_dir/empty.gitconfig"
29
46
  : >"$_th_git_global"
30
47
  export GIT_CONFIG_GLOBAL="$_th_git_global"
31
48
  [[ "$_th_sep" == ';' ]] || export GIT_CONFIG_NOSYSTEM=1
@@ -44,7 +61,7 @@ if [[ -z "${GATE_SDK_NATIVE_BIN:-}" ]]; then
44
61
  fi
45
62
  # spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — gate-sdk's overlay is pinned after the binary read above, outside its already-set guard
46
63
  export GATE_SDK_LOCAL_KNOB_FILE="$_th_empty_knobs"
47
- unset _th_name _th_root _th_empty _th_empty_knobs _th_kit _th_var _th_bin _th_sep _th_tmp _th_git_global
64
+ unset _th_name _th_root _th_empty _th_empty_knobs _th_kit _th_var _th_bin _th_sep _th_tmp _th_git_global _th_dir _th_why
48
65
 
49
66
  # spec: gate-sdk/SPEC.md §run-gate-tests — invoke a gate through its declared dispatch rather
50
67
  # than by script path, so a bespoke test names a gate and never a substrate: gate_command
@@ -55,13 +72,13 @@ gate_env() { # $1.. = NAME=VALUE — a case's environment, applied in the calle
55
72
  return 0
56
73
  }
57
74
 
58
- # spec: gate-sdk/SPEC.md §The non-gate arm — the arm counterpart of gate_run below: invoke an arm through the binary rather than through bin/run-gates.sh. That front-end cds to the git toplevel and refuses outside a repository, and a hermetic harness drives its subject from a non-git sandbox cwd, so the harness locates the binary itself — the sanctioned second caller, not a second entry point into the emission path. An absent binary is exit 2, the verdict the dispatcher gives it.
75
+ # spec: gate-sdk/SPEC.md §The non-gate arm — the arm counterpart of gate_run below: invoke an arm through the binary rather than through bin/run-gates.sh. That front-end cds to the git toplevel and refuses outside a repository, and a hermetic harness drives its subject from a non-git sandbox cwd, so the harness locates the binary itself — the sanctioned second caller, not a second entry point into the emission path. An absent binary is exit 3, a tool error, the verdict the dispatcher gives it.
59
76
  gate_arm_run() { # $1=arm flag $2.. = the arm's own argv
60
77
  local _ar_bin
61
78
  # shellcheck source=./gate.sh
62
79
  source "$GATE_SDK_TEST_LIB_DIR/gate.sh"
63
80
  _ar_bin="$(gate_native_bin)"
64
- [[ -x "$_ar_bin" ]] || return 2
81
+ [[ -x "$_ar_bin" ]] || return 3
65
82
  "$_ar_bin" "$@"
66
83
  }
67
84
 
@@ -8,8 +8,9 @@ SDK="${GATE_SDK_ROOT:-"${BASH_SOURCE[0]%/*}/../gate-sdk"}"
8
8
  # shellcheck source=../lib/gate.sh
9
9
  source "$SDK/lib/gate.sh"
10
10
 
11
+ [[ $# -le 1 ]] || { echo "check-skeleton: takes at most one file" >&2; exit 2; } # exit 2: the request refused as given — the caller fixes it
11
12
  FILE="${1:-README.md}"
12
- [[ -f "$FILE" ]] || { echo "check-skeleton: not found: $FILE" >&2; exit 2; } # exit 2: harness/usage error
13
+ [[ -f "$FILE" ]] || { echo "check-skeleton: not found: $FILE" >&2; exit 3; } # exit 3: a tool or input error — something the tool reads could not be read
13
14
 
14
15
  out="$(grep -Hn -- 'never-matching-placeholder' "$FILE")"; st=$?
15
16
  [[ "$st" -le 1 ]] || fail_closed "$st" check-skeleton grep # grep exit 1 is no match, a verdict
@@ -0,0 +1,10 @@
1
+ # migration-destructive.list — destructive-statement template for check-migration-guard.
2
+ # gate-sdk/SPEC.md §check-migration-guard. One POSIX ERE per line; '#' comments and
3
+ # blank lines are ignored. Copy to your gates dir as migration-destructive.list and
4
+ # point GATE_SDK_MIGRATION_DIR at your migration directory. An ERE matches a
5
+ # statement with its comments and quoted strings stripped, each whitespace run read
6
+ # as one space, and upper-cased. A deliberate destructive statement takes
7
+ # '-- migration-ok: <reason>' on one of its lines.
8
+ DROP (TABLE|INDEX|VIEW|TRIGGER)
9
+ ALTER TABLE .* DROP
10
+ ALTER TABLE .* RENAME
@@ -0,0 +1,39 @@
1
+ # script-rules.list — rules template for check-script-preflight.
2
+ # gate-sdk/SPEC.md §check-script-preflight. Copy to your gates dir as
3
+ # script-rules.list, name your scripts in GATE_SDK_SCRIPT_FILES, and uncomment
4
+ # the blocks you want, each bound to your own commands, paths and grammars.
5
+ #
6
+ # A block opens with 'rule <ID> <kind>' and takes the indented '<key> <value>'
7
+ # lines after it; '#' lines and blank lines are ignored. An ERE value is a search,
8
+ # so anchor it with ^ and $ to match the whole text. A site a rule cannot see is
9
+ # cleared by '# <waiver>: <reason>' on any physical line of its logical line.
10
+
11
+ # The shortest waiver reason, in characters; the default is 1.
12
+ # waiver-min 10
13
+
14
+ # Commands whose here-doc or quoted operand is read as a script of its own.
15
+ # body sbatch
16
+
17
+ # command: every invocation of cmd is refused unless an allow ERE matches its
18
+ # text, a before ERE matches the code ahead of it on its line, or a waiver clears it.
19
+ # rule KILL-BY-PARENT command
20
+ # cmd pkill
21
+ # allow ^pkill -P "[$][A-Za-z_][A-Za-z0-9_]*"$
22
+ # before ^timeout [0-9]+ $
23
+ # waiver kill-ok
24
+
25
+ # forbidden-token: a line's code holding any token is refused.
26
+ # rule SHARED-MOUNT forbidden-token
27
+ # token /mnt/shared
28
+ # waiver mount-ok
29
+
30
+ # early-exit: a reader that stops early, fed under pipefail.
31
+ # rule PIPEFAIL-READER early-exit
32
+ # waiver pipefail-ok
33
+
34
+ # id-grammar: each listed flag's value in an invocation of cmd must match grammar.
35
+ # rule OWNER-ID id-grammar
36
+ # cmd submit
37
+ # flag --owner
38
+ # grammar ^[a-z][a-z0-9_]{2,31}$
39
+ # waiver owner-ok
@@ -0,0 +1,15 @@
1
+ # strings-shapes.list — starter leak-shape roster for check-binary-strings.
2
+ # gate-sdk/SPEC.md §check-binary-strings. One POSIX ERE per line, matched against
3
+ # each printable string a named build output ships; '#' comments and blank lines
4
+ # are ignored, and a '# rule: <ID>' line names the rule id of every shape after it.
5
+ # Copy to your gates dir as strings-shapes.list and name your shipped outputs in
6
+ # GATE_SDK_STRINGS_FILES; delete a shape your binaries carry by design.
7
+
8
+ # rule: HOME-PATH
9
+ /(home|root|Users)/
10
+
11
+ # rule: REGISTRY-PATH
12
+ \.cargo/registry/
13
+
14
+ # rule: URL
15
+ [A-Za-z][A-Za-z0-9+.-]*://