checkwright 0.24.0 → 0.25.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 (84) hide show
  1. package/README.md +3 -3
  2. package/package.json +2 -2
  3. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  4. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  5. package/payload/canon-kit/README.md +2 -0
  6. package/payload/canon-kit/SPEC.md +329 -15
  7. package/payload/canon-kit/checks/check-amendment-update-target.gate +3 -0
  8. package/payload/canon-kit/checks/check-unmarked-claim.gate +3 -0
  9. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/SPEC-thing.md +26 -0
  10. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/expect.txt +8 -0
  11. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/SPEC-widget.md +47 -0
  12. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/expect.txt +1 -0
  13. package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +82 -0
  14. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +11 -0
  15. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +3 -0
  16. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.sh +6 -0
  17. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +18 -0
  18. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/expect.txt +1 -0
  19. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.sh +6 -0
  20. package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +85 -0
  21. package/payload/canon-kit/lib/spec.sh +16 -0
  22. package/payload/canon-kit/smoke/install.sh +2 -0
  23. package/payload/canon-kit/templates/SPEC-amendment.md +17 -2
  24. package/payload/context-kit/SPEC.md +16 -5
  25. package/payload/delegation-kit/README.md +11 -1
  26. package/payload/delegation-kit/SPEC.md +392 -26
  27. package/payload/delegation-kit/bin/wait-probe.sh +184 -0
  28. package/payload/delegation-kit/gate-tests/subagent-stop-liveness.test.sh +99 -0
  29. package/payload/delegation-kit/smoke/install.sh +20 -0
  30. package/payload/delegation-kit/templates/agent-execution.md +26 -9
  31. package/payload/delegation-kit/templates/subagent-stop-liveness.sh +56 -0
  32. package/payload/gate-sdk/README.md +7 -2
  33. package/payload/gate-sdk/SPEC.md +800 -66
  34. package/payload/gate-sdk/bin/build-native.sh +66 -1
  35. package/payload/gate-sdk/bin/run-gates.sh +136 -34
  36. package/payload/gate-sdk/checks/check-action-run-shell.sh +1 -1
  37. package/payload/gate-sdk/checks/check-gate-assertions.gate +3 -0
  38. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +55 -2
  39. package/payload/gate-sdk/checks/check-tree-terms.gate +3 -0
  40. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +5 -1
  41. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +22 -0
  42. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-count.sh +11 -0
  43. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-extra.sh +14 -0
  44. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-zero.sh +7 -0
  45. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  46. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +27 -0
  47. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-qux.sh +13 -0
  48. package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +117 -0
  49. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +2 -0
  50. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kit-spec.md +6 -0
  51. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-nospec.sh +4 -0
  52. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-ungrounded.sh +5 -0
  53. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +2 -0
  54. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +1 -1
  55. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kit-spec.md +12 -0
  56. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-held.sh +1 -0
  57. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +5 -0
  58. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/multi.txt +4 -0
  59. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/second-leak.txt +2 -0
  60. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  61. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
  62. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +4 -0
  63. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.list +2 -0
  64. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.local.list +3 -0
  65. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/worktrees/vendored-note.txt +3 -0
  66. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +94 -0
  67. package/payload/gate-sdk/smoke/install.sh +23 -0
  68. package/payload/guard-kit/README.md +4 -3
  69. package/payload/guard-kit/SPEC.md +409 -57
  70. package/payload/guard-kit/bin/compare-settings-allow.sh +36 -12
  71. package/payload/guard-kit/bin/run-guard-tests.sh +22 -4
  72. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +46 -1
  73. package/payload/guard-kit/guard-tests/background-cases.tsv +14 -0
  74. package/payload/guard-kit/guard-tests/cases.tsv +41 -11
  75. package/payload/guard-kit/lib/guard.sh +213 -34
  76. package/payload/guard-kit/templates/bash-guard.sh +2 -0
  77. package/payload/guard-kit/templates/close-triage.md +10 -3
  78. package/payload/guard-kit/templates/guard-config.sh +3 -0
  79. package/payload/lifecycle-kit/SPEC.md +2 -2
  80. package/payload/lifecycle-kit/templates/lead.md +8 -0
  81. package/payload/queue-kit/SPEC.md +78 -0
  82. package/payload/site-kit/SPEC.md +12 -0
  83. package/payload/gate-sdk/checks/check-gate-assertions.sh +0 -149
  84. package/payload/gate-sdk/checks/check-tree-terms.sh +0 -67
@@ -35,4 +35,69 @@ command -v cargo >/dev/null 2>&1 || {
35
35
  exit 2
36
36
  }
37
37
 
38
- cargo build --release --manifest-path "$CRATE/Cargo.toml" "$@"
38
+ # spec: gate-sdk/SPEC.md §build-native — the released artifact carries no builder path. rustc
39
+ # records a panic location per crate it compiles, and a dependency's is absolute under the cargo
40
+ # home, so an unremapped binary ships the builder's home directory to every adopter.
41
+ BN_REMAP=()
42
+ for _bn_from in "${CARGO_HOME:-$HOME/.cargo}" "${HOME:-}"; do
43
+ # spec: gate-sdk/SPEC.md §build-native — a remap of `/` would rewrite every absolute path in
44
+ # the binary, so an empty or root prefix contributes no flag rather than a catastrophic one
45
+ [[ -n "$_bn_from" && "$_bn_from" != "/" ]] || continue
46
+ BN_REMAP+=("--remap-path-prefix=${_bn_from%/}=/builder")
47
+ done
48
+ unset _bn_from
49
+ # spec: gate-sdk/SPEC.md §build-native — appended to the caller's RUSTFLAGS rather than replacing
50
+ # them, or a caller passing its own flags would silently lose them to this one
51
+ RUSTFLAGS="${RUSTFLAGS:+$RUSTFLAGS }${BN_REMAP[*]}"
52
+ export RUSTFLAGS
53
+
54
+ cargo build --release --manifest-path "$CRATE/Cargo.toml" "$@" || exit $?
55
+
56
+ # spec: gate-sdk/SPEC.md §build-native — the remap is verified on the artifact rather than trusted
57
+ # from the flag: this is the one place every shipped build passes through, and a leak that reaches
58
+ # a consumer's tracked tree reds their first battery instead of this one
59
+ BN_OUT="$CRATE/target"
60
+ for _bn_i in "$@"; do
61
+ case "$_bn_i" in
62
+ --target=*) BN_OUT="$CRATE/target/${_bn_i#--target=}" ;;
63
+ --target) _bn_want_target=1 ;;
64
+ *) [[ "${_bn_want_target:-}" == 1 ]] && { BN_OUT="$CRATE/target/$_bn_i"; _bn_want_target=0; } ;;
65
+ esac
66
+ done
67
+ unset _bn_i _bn_want_target
68
+ BN_ART="$BN_OUT/release/$(basename "$(gate_native_bin)")"
69
+ [[ -f "$BN_ART" ]] || {
70
+ echo "build-native: cargo reported success but no artifact is at $BN_ART" >&2
71
+ echo " help: the artifact path is derived from the crate dir and any --target; if this build" >&2
72
+ echo " emits somewhere else, that derivation is what needs fixing." >&2
73
+ exit 2
74
+ }
75
+
76
+ # spec: gate-sdk/SPEC.md §build-native — the banned set is the consumer's own resolved pattern
77
+ # roster, the same one check-tree-terms and check-commit-msg read, so the artifact is held to the
78
+ # tree's leak ban rather than to a second vocabulary this tool would have to carry
79
+ # spec: gate-sdk/SPEC.md §Fail-closed contract — the resolver's status is read from the command
80
+ # substitution and not from `mapfile`, whose own status says nothing about the producer's
81
+ BN_PATLIST="$(gate_msg_pattern_files)" || {
82
+ echo "build-native: the banned-pattern set could not be resolved, so the artifact cannot be" >&2
83
+ echo " verified — treating the build as failed (not clean)." >&2
84
+ exit 2
85
+ }
86
+ BN_PATFILES=()
87
+ while IFS= read -r _bn_f; do [[ -n "$_bn_f" ]] && BN_PATFILES+=("$_bn_f"); done <<<"$BN_PATLIST"
88
+ unset _bn_f
89
+ if [[ ${#BN_PATFILES[@]} -gt 0 ]]; then
90
+ BN_PATS="$(grep -hEv '^[[:space:]]*(#|$)' "${BN_PATFILES[@]}")"
91
+ BN_HITS=""
92
+ [[ -n "$BN_PATS" ]] && BN_HITS="$(printf '%s\n' "$BN_PATS" | grep -aoEhf - "$BN_ART" | sort -u)"
93
+ if [[ -n "$BN_HITS" ]]; then
94
+ echo "build-native: the built artifact carries a banned pattern — it must not be shipped:" >&2
95
+ printf ' %s\n' "$BN_ART" >&2
96
+ while IFS= read -r _bn_h; do printf ' %s\n' "$_bn_h" >&2; done <<<"$BN_HITS"
97
+ unset _bn_h
98
+ echo " help: this build path lost its --remap-path-prefix flags, or a prefix outside" >&2
99
+ echo " CARGO_HOME and HOME reached the binary. gate-sdk/SPEC.md §build-native owns" >&2
100
+ echo " the remap and why every shipped build passes through this script." >&2
101
+ exit 2
102
+ fi
103
+ fi
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bash
2
- # spec: gate-sdk/SPEC.md §run-gates — aggregate gate runner; --for scopes it to gates coupling to given paths
2
+ # spec: gate-sdk/SPEC.md §run-gates — aggregate gate runner; --for scopes it to gates coupling to given paths, --only to gates named on argv
3
3
  #
4
- # usage: run-gates.sh [gates-dir] run every registered gate
5
- # run-gates.sh --for <path>... run only gates coupling to those paths
4
+ # usage: run-gates.sh [gates-dir] | --only <name>... | --for <path>... | --emit <arm> [args...] | -h | --help
5
+ # every arm, its refusals and the knobs print from the tool itself: run-gates.sh --help
6
6
  # timings → $GATE_SDK_TMP_DIR/gate-timings.txt (default .tmp/); a measurement, never committed
7
7
  set -uo pipefail
8
8
 
@@ -16,39 +16,116 @@ REPO_ROOT="$(git rev-parse --show-toplevel)" || {
16
16
  }
17
17
  cd "$REPO_ROOT" || exit 2
18
18
 
19
- # spec: gate-sdk/SPEC.md §The non-gate arm — the emitter front-end: a ported arm receives no
20
- # configuration, so a caller already sourcing this library resolves its bridged knobs and invokes
21
- # it. The arm name is an operand here and a suffix in the crate, governed separately.
22
- if [[ "${1:-}" == --emit ]]; then
23
- shift
24
- EMIT_ARM_NAME="${1:-}"
25
- [[ -n "$EMIT_ARM_NAME" ]] || { echo "run-gates: --emit needs an arm name" >&2; exit 2; }
26
- EMIT_ARM="--emit-$EMIT_ARM_NAME"
27
- shift
28
- EMIT_ARGS=("$@")
29
- EMIT_BIN="$(gate_native_bin)"
30
- if [[ ! -x "$EMIT_BIN" ]]; then
31
- printf 'run-gates: --emit dispatches to the native binary, but %s is absent or not ' "$EMIT_BIN" >&2
32
- printf 'executable — the projection could not be emitted. Build it: bash gate-sdk/bin/build-native.sh\n' >&2
33
- exit 2
34
- fi
35
- EMIT_ENV="$(gate_knob_env "$EMIT_ARM")" || exit 2
36
- EMIT_ELEMS=()
37
- [[ -n "$EMIT_ENV" ]] && mapfile -t EMIT_ELEMS <<<"$EMIT_ENV"
38
- exec env ${EMIT_ELEMS[@]+"${EMIT_ELEMS[@]}"} "$EMIT_BIN" "$EMIT_ARM" ${EMIT_ARGS[@]+"${EMIT_ARGS[@]}"}
39
- fi
19
+ # spec: gate-sdk/SPEC.md §run-gates — the one usage text, the stdout body of a help request and
20
+ # the stderr body of an unrecognized-option refusal, per §The bin/-tool contract
21
+ usage() {
22
+ cat <<'EOF'
23
+ usage: run-gates.sh [gates-dir] run every registered gate
24
+ run-gates.sh --only <name> [<name>...] run only the named registered gates
25
+ run-gates.sh --for <path> [<path>...] run only gates coupling to those paths
26
+ run-gates.sh --emit <arm> [args...] dispatch a ported non-gate emitter arm
27
+ run-gates.sh -h | --help this text, on stdout, exit 0
28
+
29
+ --only runs the named members in registry order whatever order they were
30
+ typed; duplicates collapse, and an unregistered name is a refusal.
31
+ The [gates-dir] positional is unavailable in this form — point
32
+ GATE_SDK_GATES_DIR at another registry instead.
33
+ --for selects by coupling: every gate whose effective trigger matches one
34
+ of the given repo-relative paths, exactly as the generated hook
35
+ would. A path no gate couples to is a note, not a failure.
36
+ --emit dispatches the named non-gate arm of the native binary, handing it
37
+ every remaining argument.
38
+ -- ends option processing, so a gates-dir spelled with a leading dash
39
+ is still reachable.
40
+
41
+ GATE_SDK_VERBOSE (any non-empty value) restores the per-gate banner roll the
42
+ quiet-green output contract suppresses; per-gate timings land in
43
+ $GATE_SDK_TMP_DIR/gate-timings.txt (default .tmp/).
44
+ EOF
45
+ }
46
+
47
+ unrecognized_option() {
48
+ printf 'run-gates: unrecognized option: %s\n' "$1" >&2
49
+ usage >&2
50
+ exit 2
51
+ }
40
52
 
41
53
  FOR_PATHS=()
42
- if [[ "${1:-}" == --for ]]; then
43
- shift
44
- FOR_PATHS=("$@")
45
- [[ ${#FOR_PATHS[@]} -gt 0 ]] || { echo "run-gates: --for needs at least one path" >&2; exit 2; }
46
- set --
47
- fi
54
+ ONLY_NAMES=()
55
+ # spec: gate-sdk/SPEC.md §run-gates — the argument grammar: every arm is decided off the first
56
+ # argument alone, so the option arms are exclusive and a leading '-' that names none of them is a
57
+ # refusal rather than a gates-dir
58
+ case "${1-}" in
59
+ -h | --help)
60
+ usage
61
+ exit 0
62
+ ;;
63
+ # spec: gate-sdk/SPEC.md §The non-gate arm — the emitter front-end: a ported arm receives no
64
+ # configuration, so a caller already sourcing this library resolves its bridged knobs and invokes
65
+ # it. The arm name is an operand here and a suffix in the crate, governed separately.
66
+ --emit)
67
+ shift
68
+ EMIT_ARM_NAME="${1:-}"
69
+ [[ -n "$EMIT_ARM_NAME" ]] || { echo "run-gates: --emit needs an arm name" >&2; exit 2; }
70
+ EMIT_ARM="--emit-$EMIT_ARM_NAME"
71
+ shift
72
+ EMIT_ARGS=("$@")
73
+ EMIT_BIN="$(gate_native_bin)"
74
+ if [[ ! -x "$EMIT_BIN" ]]; then
75
+ printf 'run-gates: --emit dispatches to the native binary, but %s is absent or not ' "$EMIT_BIN" >&2
76
+ printf 'executable — the projection could not be emitted. Build it: bash gate-sdk/bin/build-native.sh\n' >&2
77
+ exit 2
78
+ fi
79
+ EMIT_ENV="$(gate_knob_env "$EMIT_ARM")" || exit 2
80
+ EMIT_ELEMS=()
81
+ [[ -n "$EMIT_ENV" ]] && mapfile -t EMIT_ELEMS <<<"$EMIT_ENV"
82
+ exec env ${EMIT_ELEMS[@]+"${EMIT_ELEMS[@]}"} "$EMIT_BIN" "$EMIT_ARM" ${EMIT_ARGS[@]+"${EMIT_ARGS[@]}"}
83
+ ;;
84
+ --for)
85
+ shift
86
+ FOR_PATHS=("$@")
87
+ [[ ${#FOR_PATHS[@]} -gt 0 ]] || { echo "run-gates: --for needs at least one path" >&2; exit 2; }
88
+ set --
89
+ ;;
90
+ # spec: gate-sdk/SPEC.md §run-gates — a name beginning with '-' is an unrecognized option
91
+ # wherever it stands in the list, so `--only --for` refuses at the name instead of taking it
92
+ # for a gate and reporting it unregistered
93
+ --only)
94
+ shift
95
+ ONLY_NAMES=("$@")
96
+ [[ ${#ONLY_NAMES[@]} -gt 0 ]] || { echo "run-gates: --only needs at least one gate name" >&2; exit 2; }
97
+ for only_name in "${ONLY_NAMES[@]}"; do
98
+ case "$only_name" in -*) unrecognized_option "$only_name" ;; esac
99
+ done
100
+ set --
101
+ ;;
102
+ --)
103
+ shift
104
+ ;;
105
+ -*)
106
+ unrecognized_option "$1"
107
+ ;;
108
+ esac
48
109
 
49
- GATES_DIR="${1:-$(gate_sdk_gates_dir)}"
110
+ GATES_DIR_ARG="${1-}"
111
+ GATES_DIR="${GATES_DIR_ARG:-$(gate_sdk_gates_dir)}"
50
112
  LIST="$GATES_DIR/gates.list"
51
- [[ -f "$LIST" ]] || { echo "run-gates: no registry at $LIST" >&2; exit 2; }
113
+ # spec: gate-sdk/SPEC.md §run-gates — the --only steer: a positional that is really a member of the
114
+ # default registry earns the remedy beside the refusal, never a run it did not ask for
115
+ if [[ ! -f "$LIST" ]]; then
116
+ echo "run-gates: no registry at $LIST" >&2
117
+ DEFAULT_LIST="$(gate_sdk_gates_dir)/gates.list"
118
+ if [[ -n "$GATES_DIR_ARG" && -f "$DEFAULT_LIST" ]]; then
119
+ mapfile -t DEFAULT_MEMBERS < <(gates_list_members "$DEFAULT_LIST")
120
+ for m in ${DEFAULT_MEMBERS[@]+"${DEFAULT_MEMBERS[@]}"}; do
121
+ [[ "$m" == "$GATES_DIR_ARG" ]] || continue
122
+ printf "run-gates: '%s' is a gate registered in %s, not a gates dir — run it with: run-gates.sh --only %s\n" \
123
+ "$GATES_DIR_ARG" "$DEFAULT_LIST" "$GATES_DIR_ARG" >&2
124
+ break
125
+ done
126
+ fi
127
+ exit 2
128
+ fi
52
129
 
53
130
  mapfile -t MEMBERS < <(gates_list_members "$LIST")
54
131
  [[ ${#MEMBERS[@]} -gt 0 ]] || { echo "run-gates: $LIST names no gates" >&2; exit 2; }
@@ -56,7 +133,7 @@ mapfile -t MEMBERS < <(gates_list_members "$LIST")
56
133
  RESOLVE_DIRS=("$GATES_DIR")
57
134
  while IFS= read -r k; do RESOLVE_DIRS+=("$k/checks"); done < <(gate_kit_roots)
58
135
 
59
- # spec: gate-sdk/SPEC.md §run-gates — --for selection: hook-identical match per member; RUN_LIST + RUN_ARGSTR (index-aligned, newline-joined staged-mode args) carry the result
136
+ # spec: gate-sdk/SPEC.md §run-gates — where both selectors land their result: RUN_LIST + RUN_ARGSTR (index-aligned; newline-joined staged-mode args under --for, empty for every member under --only, which names gates and has no paths to hand one)
60
137
  RUN_LIST=()
61
138
  RUN_ARGSTR=()
62
139
 
@@ -114,8 +191,33 @@ select_for() {
114
191
  done
115
192
  }
116
193
 
194
+ # spec: gate-sdk/SPEC.md §run-gates — --only selection: set-shaped and registry-ordered, so two
195
+ # names give one transcript whichever way they were typed; an unregistered name is a refusal
196
+ # because a name is a claim about the registry, never a fact about the tree
197
+ select_only() {
198
+ local n c found
199
+ for n in "${ONLY_NAMES[@]}"; do
200
+ found=0
201
+ for c in "${MEMBERS[@]}"; do [[ "$c" == "$n" ]] && { found=1; break; }; done
202
+ (( found )) || {
203
+ echo "run-gates: --only: '$n' is not registered in $LIST" >&2
204
+ exit 2
205
+ }
206
+ done
207
+ for c in "${MEMBERS[@]}"; do
208
+ for n in "${ONLY_NAMES[@]}"; do
209
+ [[ "$c" == "$n" ]] || continue
210
+ RUN_LIST+=("$c"); RUN_ARGSTR+=("")
211
+ break
212
+ done
213
+ done
214
+ }
215
+
117
216
  RUN_MEMBERS=("${MEMBERS[@]}")
118
- if [[ ${#FOR_PATHS[@]} -gt 0 ]]; then
217
+ if [[ ${#ONLY_NAMES[@]} -gt 0 ]]; then
218
+ select_only
219
+ RUN_MEMBERS=("${RUN_LIST[@]}")
220
+ elif [[ ${#FOR_PATHS[@]} -gt 0 ]]; then
119
221
  select_for
120
222
  RUN_MEMBERS=("${RUN_LIST[@]}")
121
223
  if [[ ${#RUN_MEMBERS[@]} -eq 0 ]]; then
@@ -5,7 +5,7 @@
5
5
  # spec: gate-sdk/SPEC.md §check-action-run-shell — every GitHub Actions `run:` literal block scalar in an Actions-shaped YAML file is ShellCheck-clean at -S warning under the dialect the step actually runs
6
6
  #
7
7
  # usage: check-action-run-shell.sh [scan-root]
8
- # scan-root: the walked tree (default '.'). Requires GNU awk (3-arg match).
8
+ # scan-root: the walked tree (default '.').
9
9
  set -uo pipefail
10
10
 
11
11
  SDK="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -0,0 +1,3 @@
1
+ # graph: couples=kit:SPEC.md,scripts/*.sh,kit:*.sh,native/src/gates/*.rs,kit:checks/*.sh,kit:checks/*.gate dir=bi valve=none tier=align-only
2
+ # install: zero-config
3
+ # spec: gate-sdk/SPEC.md §check-gate-assertions — couple each §<gate> enumerated-assertion span+count to the gate code's `# assertion` markers
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # graph: couples=scripts/gates.list,kit:checks/*,gate-sdk/SPEC.md,native/*,.github/workflows/publish.yml dir=one valve=none tier=precommit
2
+ # graph: couples=scripts/gates.list,kit:checks/*,gate-sdk/SPEC.md,kit:SPEC.md,native/*,.github/workflows/publish.yml dir=one valve=none tier=precommit
3
3
  # install: on-surface
4
4
  # no-port: gate-sdk/SPEC.md §The port-candidate criteria — exception class (a), permanent: the gate audits the dispatch relation, so a compiled form could check its own roster through the very binary in question
5
5
  # spec: gate-sdk/SPEC.md §check-gate-substrate-parity — one declaration per member, descriptor/subcommand parity both ways, a recorded disposition for every substrate-sensitive member, no implementation source inside the vendoring set, and one owner for the target roster the artifact path derives from
@@ -45,6 +45,21 @@ fail_closed "$st" check-gate-substrate-parity awk
45
45
 
46
46
  findings=()
47
47
 
48
+ # spec: gate-sdk/SPEC.md §check-gate-substrate-parity — assertion H opens the section the
49
+ # declaration's own pointer names, so the depth is the matched heading's own and the body runs
50
+ # to the next heading at that depth or shallower: the two live heading levels need no special case
51
+ spec_section_body() {
52
+ awk -v want="$2" '
53
+ function level(s) { match(s, /^#+/); return RLENGTH }
54
+ /^#+[[:space:]]/ {
55
+ if (inb && level($0) <= lvl) inb = 0
56
+ t = $0; sub(/^#+[[:space:]]*/, "", t); sub(/[[:space:]]+$/, "", t)
57
+ if (!inb && t == want) { inb = 1; lvl = level($0); next }
58
+ }
59
+ inb { print }
60
+ ' "$1"
61
+ }
62
+
48
63
  CRATE="$(gate_native_crate)"
49
64
  # spec: gate-sdk/SPEC.md §check-gate-substrate-parity — the publishing test is `gate_authoring_tree`
50
65
  # (§lib/gate.sh), computed once and read twice: by assertion B's consumer-declared scope clause and
@@ -78,6 +93,10 @@ dispatching=0
78
93
  declpaths_shell=0
79
94
  noport_declared=0
80
95
  portuntil_declared=0
96
+ # spec: gate-sdk/SPEC.md §check-gate-substrate-parity — assertion H's one new datum: the count of
97
+ # held declarations whose ground was verified, read by the session choosing the next cohort cut,
98
+ # for which a zero in a tree that declares holds is the vacuous-pass tell
99
+ portuntil_grounded=0
81
100
  for m in "${MEMBERS[@]}"; do
82
101
  for d in "${RESOLVE_DIRS[@]}"; do
83
102
  if [[ -f "$d/$m.sh" && -f "$d/$m.gate" ]]; then
@@ -124,6 +143,35 @@ for m in "${MEMBERS[@]}"; do
124
143
  slug="${slug#*port-until:}"
125
144
  [[ -n "${slug//[[:space:]]/}" ]] \
126
145
  || findings+=("hold declaration with no slug: $src carries a bare '# port-until:' line — the slug names the live queue entry that owns the blocker, and is the field's whole payload")
146
+
147
+ # assertion H: a held declaration's ground is reachable in one hop — the section
148
+ # the declaration's own `# spec:` field names states the hold, so a reader arriving
149
+ # at the declaration reaches the ground without resolving anything else
150
+ # spec: gate-sdk/SPEC.md §check-gate-substrate-parity
151
+ specfield="$(grep -E '^#[[:space:]]*spec:' "$src" | head -n 1)"
152
+ target="${specfield#*spec:}"
153
+ target="${target%% — *}"
154
+ target="${target#"${target%%[![:space:]]*}"}"
155
+ target="${target%"${target##*[![:space:]]}"}"
156
+ if [[ -z "$specfield" || "$target" != *§* ]]; then
157
+ findings+=("hold ground unreachable: $src carries '# port-until:' but no '# spec:' header field naming a section — a held member's ground lives in its own SPEC section, one hop from the declaration")
158
+ else
159
+ specpath="${target%%§*}"
160
+ spechead="${target#*§}"
161
+ specpath="${specpath%"${specpath##*[![:space:]]}"}"
162
+ spechead="${spechead#"${spechead%%[![:space:]]*}"}"
163
+ if [[ ! -r "$specpath" ]]; then
164
+ echo "check-gate-substrate-parity: $src points its '# spec:' field at $specpath, which is unreadable — assertion H could not read its corpus; treating as failure (not clean)" >&2
165
+ exit 2
166
+ fi
167
+ body="$(spec_section_body "$specpath" "$spechead")"; st=$?
168
+ fail_closed "$st" check-gate-substrate-parity "awk section($specpath)"
169
+ if grep -q 'port-until' <<<"$body"; then
170
+ portuntil_grounded=$((portuntil_grounded + 1))
171
+ else
172
+ findings+=("hold ground not in the pointed-at section: $src declares '# port-until:' and points at $specpath §$spechead, whose body never names the field — the section a reader reaches from the declaration is where the hold's ground lives")
173
+ fi
174
+ fi
127
175
  fi
128
176
  [[ "$noport" -gt 0 && "$portuntil" -gt 0 ]] \
129
177
  && findings+=("contradictory port declarations: $src carries both '# no-port:' and '# port-until:' — permanent and temporarily-held are opposite verdicts about the same member")
@@ -385,6 +433,11 @@ if [[ ${#findings[@]} -gt 0 ]]; then
385
433
  echo " take yet, and names the live queue entry owning the blocker. Same domain and"
386
434
  echo " cardinality as '# no-port:', and never both on one declaration — permanent and"
387
435
  echo " temporarily-held are opposite verdicts about the same member."
436
+ echo " help: a held member's ground lives in its own SPEC section, one hop from the"
437
+ echo " declaration — give the declaration a '# spec: <path> §<section>' field and"
438
+ echo " state the hold in that section, naming 'port-until'. A ground reachable"
439
+ echo " only through a queue entry or a shared worked-example passage is the one"
440
+ echo " placement the field must not normalise."
388
441
  exit 1
389
442
  fi
390
443
 
@@ -393,5 +446,5 @@ if [[ "$roster_read" == 1 ]]; then
393
446
  else
394
447
  roster="${#DESCRIPTORS[@]} descriptor(s), no binary at $BIN so no subcommand roster to compare"
395
448
  fi
396
- echo "GATE-SUBSTRATE-PARITY: clean ($declared member(s) with one declaration each, $dispatching of them dispatching to the binary; $noport_declared of the $declpaths_shell shell declaration(s) declare '# no-port:' with a cause and $portuntil_declared declare '# port-until:' with a slug, neither on any descriptor nor both on one declaration; $roster; $sensitive substrate-sensitive member(s) all dispositioned; $impl_scanned implementation source(s) free of manifest-class annotation; $kit_scanned kit root(s) scanned for an implementation sibling, crate root $CRATE outside every kit root; target roster $roster_state at $ROSTER with $roster_targets well-formed target(s); publish workflow $wf_state at $WORKFLOW, $wf_matrix matrix declaration(s) roster-derived across $wf_jobs job(s) with one producer per digest)"
449
+ echo "GATE-SUBSTRATE-PARITY: clean ($declared member(s) with one declaration each, $dispatching of them dispatching to the binary; $noport_declared of the $declpaths_shell shell declaration(s) declare '# no-port:' with a cause and $portuntil_declared declare '# port-until:' with a slug, neither on any descriptor nor both on one declaration; $portuntil_grounded of those held declaration(s) reach their ground in one hop, the section their own '# spec:' field names stating the hold; $roster; $sensitive substrate-sensitive member(s) all dispositioned; $impl_scanned implementation source(s) free of manifest-class annotation; $kit_scanned kit root(s) scanned for an implementation sibling, crate root $CRATE outside every kit root; target roster $roster_state at $ROSTER with $roster_targets well-formed target(s); publish workflow $wf_state at $WORKFLOW, $wf_matrix matrix declaration(s) roster-derived across $wf_jobs job(s) with one producer per digest)"
397
450
  exit 0
@@ -0,0 +1,3 @@
1
+ # graph: couples=scripts/msg-patterns.list dir=one valve=none tier=precommit trigger=*
2
+ # install: zero-config
3
+ # spec: gate-sdk/SPEC.md §check-tree-terms — no tracked file matches the banned-pattern set (the tracked-files half of the leak guard; the pattern files and their templates are self-exempt)
@@ -1 +1,5 @@
1
- missing marker(s): B
1
+ scripts/SPEC.md §check-foo: marker set [A] != contract span [A,B]; missing marker(s): B
2
+ scripts/SPEC.md §check-extra: marker set [A,B,C] != contract span [A,B]; extra marker(s): C
3
+ scripts/SPEC.md §check-count: count-word says 3 but the (X) span enumerates 2 label(s) [1,2] — the contract is internally inconsistent
4
+ scripts/SPEC.md §check-nowhere: enumerated contract but no gate code resolves for 'check-nowhere' (heading must name the script)
5
+ scripts/SPEC.md §check-zero: contract enumerates [A,B] but scripts/check-zero.sh carries zero `# assertion` markers (retrofit obligation)
@@ -11,3 +11,25 @@ gate verifies about foo; (B) the second thing the gate verifies about foo.
11
11
 
12
12
  Invariant: baz is checked on three checks: (1) the first; (2) the second; (3)
13
13
  the third.
14
+
15
+ ### check-extra
16
+
17
+ Invariant: extra is held on two axes: (A) the first thing; (B) the second thing
18
+ — and the code grew a third marker the contract never gained, which is the
19
+ drift an internal count-vs-span check cannot see.
20
+
21
+ ### check-count
22
+
23
+ Invariant: count is checked on three checks: (1) the first; (2) the second — the
24
+ count-word and the label span disagree, so the contract is internally
25
+ inconsistent whatever the code carries.
26
+
27
+ ### check-nowhere
28
+
29
+ Invariant: nowhere is held on two assertions: (A) the first thing; (B) the
30
+ second thing — but no gate code resolves for the name this heading carries.
31
+
32
+ ### check-zero
33
+
34
+ Invariant: zero is held on two axes: (A) the first thing; (B) the second thing —
35
+ and its code carries no marker at all, which is the retrofit obligation.
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+ # Synthetic gate for the check-gate-assertions bad-case fixture: its marker set
3
+ # matches the contract span exactly, so the only finding is the contract's own
4
+ # internal count-word-vs-span inconsistency.
5
+ set -uo pipefail
6
+
7
+ # assertion 1: the first count check
8
+ echo "checking count 1"
9
+
10
+ # assertion 2: the second count check
11
+ echo "checking count 2"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bash
2
+ # Synthetic gate for the check-gate-assertions bad-case fixture: the contract
3
+ # enumerates (A)+(B) and the code grew a third marker nobody wrote into the span.
4
+ # Must be REJECTED with an extra-marker finding.
5
+ set -uo pipefail
6
+
7
+ # assertion A: first thing the gate verifies about extra
8
+ echo "checking extra axis A"
9
+
10
+ # assertion B: second thing the gate verifies about extra
11
+ echo "checking extra axis B"
12
+
13
+ # assertion C: a third assertion the code grew with no contract label
14
+ echo "checking extra axis C"
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ # Synthetic gate for the check-gate-assertions bad-case fixture: an enumerated
3
+ # contract exists but the code carries no marker at all -- the retrofit
4
+ # obligation, distinct from a marker set that merely disagrees.
5
+ set -uo pipefail
6
+
7
+ echo "checking zero, with nothing marked"
@@ -1 +1 @@
1
- GATE-ASSERTIONS: clean (2 of 2 enumerated contract(s) coupled)
1
+ GATE-ASSERTIONS: clean (3 of 3 enumerated contract(s) coupled)
@@ -18,3 +18,30 @@ filter excludes non-enumerated contracts).
18
18
  Invariant: baz is checked on three checks: (1) the first; (2) the second; (3)
19
19
  the third — the count-word and the label span agree, so baz is a covered
20
20
  contract.
21
+
22
+ ### check-qux
23
+
24
+ Invariant: qux is held on two axes: (A) the first thing; (B) the second thing —
25
+ and its markers carry the `//` leader, the one every descriptor-declared
26
+ member's implementation module uses, so this contract proves the grammar reads a
27
+ code marker under either leader and under indentation.
28
+
29
+ ### check-noun-filtered
30
+
31
+ Invariant: this one is settled on three grounds: (A) a labelled span is present;
32
+ (B) a second label follows it. The count-word's noun is not an enumeration noun,
33
+ so discovery excludes the heading — proved by greenness, since no gate code
34
+ resolves for this name and an unfiltered heading would red.
35
+
36
+ ### check-paren-filtered
37
+
38
+ Invariant: this one holds on two axes (each described in the paragraph below):
39
+ (A) a labelled span is present; (B) a second label follows it. The first
40
+ parenthetical after the count-word is not a single-char label, so discovery
41
+ excludes the heading — again proved by greenness.
42
+
43
+ ### check-single-filtered
44
+
45
+ Invariant: this one holds on two axes: (A) the only labelled item in the span.
46
+ Fewer than two distinct labels are enumerated, so discovery excludes the heading
47
+ — greenness proves the arity filter, not the resolver.
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ # Synthetic gate for the check-gate-assertions good-case fixture. Its markers use
3
+ # the `//` leader rather than `#`, and the second is indented the way a module
4
+ # body's marker is: the leader is the substrate's and the marker is a code marker
5
+ # either way, so both spellings must be read.
6
+ set -uo pipefail
7
+
8
+ : <<'MARKERS'
9
+ // assertion A: the first thing the gate verifies about qux
10
+ // assertion B: the second thing the gate verifies about qux
11
+ MARKERS
12
+
13
+ echo "checking qux"
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of check-gate-assertions over the arms the good/+bad/ pair cannot
3
+ # reach. Both cases pass a second positional, which short-circuits resolution to the
4
+ # scripts-dir-plus-`.sh` branch, so the registry walk, the descriptor-to-module
5
+ # redirection and the no-crate skip are reached by no case at all — and the `args`
6
+ # file carries positionals only, so no case can set the knobs those arms resolve
7
+ # through. The instrument is a throwaway mini-consumer, on the precedent
8
+ # check-graph's own tree test set: it is preferred to a per-case config file because
9
+ # it reaches the no-crate arm, which needs a tree with no crate manifest, a state a
10
+ # case dir inside this repository cannot have.
11
+ #
12
+ # Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
13
+ set -uo pipefail
14
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
15
+
16
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # gate-sdk/
17
+ CHECKS="$DIR/checks"
18
+ SANDBOX="$(mktemp -d)"
19
+ trap 'rm -rf "$SANDBOX"' EXIT
20
+
21
+ fails=0
22
+
23
+ expect() { # expect <label> <want-rc> <substring> <got-rc> <output>
24
+ if [[ "$4" -ne "$2" ]]; then
25
+ echo " FAIL [$1]: want exit $2, got $4 -- $5"; fails=$((fails + 1))
26
+ elif ! grep -qF -- "$3" <<<"$5"; then
27
+ echo " FAIL [$1]: exit $2 but output lacks '$3': $5"; fails=$((fails + 1))
28
+ fi
29
+ }
30
+
31
+ # A mini-consumer: two kit roots, each with its own SPEC.md, so the kit-roots walk
32
+ # has more than one spec to union; a gates dir with no SPEC.md of its own, so the
33
+ # optional consumer spec is proved optional; one `.gate`-declared member whose
34
+ # markers live in its implementation module, and one shell-declared member whose
35
+ # markers live in the script.
36
+ C="$SANDBOX/consumer"
37
+ mkdir -p "$C/scripts" "$C/kit-a/checks" "$C/kit-b/checks" "$C/native/src/gates"
38
+ cat > "$C/kit-a/SPEC.md" <<'EOF'
39
+ # kit-a
40
+
41
+ ### check-alpha
42
+
43
+ Invariant: alpha holds on two axes: (A) the first; (B) the second.
44
+ EOF
45
+ cat > "$C/kit-b/SPEC.md" <<'EOF'
46
+ # kit-b
47
+
48
+ ### check-beta
49
+
50
+ Invariant: beta holds on two checks: (A) the first; (B) the second.
51
+ EOF
52
+ printf '# graph: couples=X dir=one valve=none tier=precommit\n' > "$C/kit-a/checks/check-alpha.gate"
53
+ cat > "$C/kit-b/checks/check-beta.sh" <<'EOF'
54
+ #!/usr/bin/env bash
55
+ # assertion A: the first beta check
56
+ # assertion B: the second beta check
57
+ EOF
58
+ cat > "$C/native/src/gates/alpha.rs" <<'EOF'
59
+ // assertion A: the first alpha axis
60
+ // assertion B: the second alpha axis, its marker indented as a module body's is
61
+ EOF
62
+ printf '[package]\nname = "checkwright-gates"\n' > "$C/native/Cargo.toml"
63
+
64
+ kitdirs="$C/kit-a $C/kit-b"
65
+
66
+ # --- the registry resolution arm, the descriptor-to-module redirection and the
67
+ # multi-SPEC kit-roots walk, all of which need the no-positional invocation ---
68
+ out="$( cd "$C" \
69
+ && gate_env GATE_SDK_KIT_DIRS="$kitdirs" GATE_SDK_GATES_DIR=scripts GATE_SDK_NATIVE_CRATE=native \
70
+ && gate_run check-gate-assertions "$CHECKS" 2>&1 )"; rc=$?
71
+ expect registry-resolution 0 'GATE-ASSERTIONS: clean (2 of 2 enumerated contract(s) coupled)' "$rc" "$out"
72
+
73
+ # --- the redirection is load-bearing, not vacuous: drift the module's marker set
74
+ # and the red must name the module path the crate's own naming convention derives ---
75
+ printf '// assertion A: the only surviving alpha marker\n' > "$C/native/src/gates/alpha.rs"
76
+ out="$( cd "$C" \
77
+ && gate_env GATE_SDK_KIT_DIRS="$kitdirs" GATE_SDK_GATES_DIR=scripts GATE_SDK_NATIVE_CRATE=native \
78
+ && gate_run check-gate-assertions "$CHECKS" 2>&1 )"; rc=$?
79
+ expect module-redirection 1 'missing marker(s): B' "$rc" "$out"
80
+ if ! grep -qF 'native/src/gates/alpha.rs' <<<"$out" && ! grep -qF '§check-alpha' <<<"$out"; then
81
+ echo " FAIL [module-redirection]: the red named neither the module nor the member -- $out"
82
+ fails=$((fails + 1))
83
+ fi
84
+
85
+ # --- the no-crate skip and its clean-line segment: a vendored consumer receives the
86
+ # descriptor and never the crate, so the member is declared out of reach and counted
87
+ # rather than reddened. Restored to a coupled module first, so the skip is what
88
+ # clears it and not the drift above.
89
+ cat > "$C/native/src/gates/alpha.rs" <<'EOF'
90
+ // assertion A: the first alpha axis
91
+ // assertion B: the second alpha axis
92
+ EOF
93
+ rm "$C/native/Cargo.toml"
94
+ out="$( cd "$C" \
95
+ && gate_env GATE_SDK_KIT_DIRS="$kitdirs" GATE_SDK_GATES_DIR=scripts GATE_SDK_NATIVE_CRATE=native \
96
+ && gate_run check-gate-assertions "$CHECKS" 2>&1 )"; rc=$?
97
+ expect no-crate-skip 0 'declared out of reach with no crate at native/Cargo.toml' "$rc" "$out"
98
+ expect no-crate-count 0 'clean (1 of 2 enumerated contract(s) coupled, 1 declared out of reach' "$rc" "$out"
99
+ expect no-crate-named 0 'check-alpha' "$rc" "$out"
100
+
101
+ # --- the two fail-closed entry arms, neither of which any case dir can reach:
102
+ # a named spec that does not exist, and a tree carrying no SPEC.md at all ---
103
+ out="$( cd "$C" && gate_run check-gate-assertions "$CHECKS" absent-spec.md 2>&1 )"; rc=$?
104
+ expect spec-not-found 2 'not found: absent-spec.md' "$rc" "$out"
105
+
106
+ mkdir -p "$SANDBOX/bare/scripts" "$SANDBOX/bare/kit-c"
107
+ out="$( cd "$SANDBOX/bare" \
108
+ && gate_env GATE_SDK_KIT_DIRS="$SANDBOX/bare/kit-c" GATE_SDK_GATES_DIR=scripts \
109
+ && gate_run check-gate-assertions "$CHECKS" 2>&1 )"; rc=$?
110
+ expect no-spec-at-all 2 'no SPEC.md found' "$rc" "$out"
111
+
112
+ if [[ "$fails" -gt 0 ]]; then
113
+ echo "check-gate-assertions.test.sh: $fails case(s) failed"
114
+ exit 1
115
+ fi
116
+ echo "check-gate-assertions.test.sh: clean (the arms a case dir cannot reach: the registry resolution walk over two kit SPECs, the descriptor-to-module redirection and its load-bearing red, the no-crate skip with its clean-line segment, and the two fail-closed entry arms — 8 assertions over 5 invocations)"
117
+ exit 0
@@ -17,3 +17,5 @@ malformed target triple: 'notatriple'
17
17
  matrix declaration not roster-derived: publish.yml
18
18
  digest recomputed: job 'build'
19
19
  digest computed by a consumer: job 'release'
20
+ hold ground unreachable: scripts/check-nospec.sh
21
+ hold ground not in the pointed-at section: scripts/check-ungrounded.sh