checkwright 0.38.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/payload/artifact/aarch64-apple-darwin/checkwright-gates +0 -0
- package/payload/artifact/aarch64-apple-darwin/checkwright-gates.sha256 +1 -1
- package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe +0 -0
- package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -1
- package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
- package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates +0 -0
- package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates.sha256 +1 -1
- package/payload/artifact/x86_64-apple-darwin/checkwright-gates +0 -0
- package/payload/artifact/x86_64-apple-darwin/checkwright-gates.sha256 +1 -1
- package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe +0 -0
- package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -1
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
- package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates.sha256 +1 -1
- package/payload/canon-kit/gate-tests/check-amendment-queue.test.sh +3 -3
- package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +3 -3
- package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +2 -2
- package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +3 -3
- package/payload/canon-kit/gate-tests/check-prose-bounds.test.sh +1 -1
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +2 -2
- package/payload/canon-kit/gate-tests/check-provenance-seam/good/TASK-QUEUE.md +4 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/good/widget-toolkit/SPEC.md +1 -1
- package/payload/canon-kit/gate-tests/check-todo-task-liveness.test.sh +1 -1
- package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +7 -7
- package/payload/context-kit/gate-tests/check-surface-ratchet.test.sh +7 -6
- package/payload/delegation-kit/README.md +1 -1
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +2 -2
- package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +2 -2
- package/payload/evidence-kit/gate-tests/pre-hook.test.sh +5 -5
- package/payload/evidence-kit/gate-tests/producer-lock.test.sh +7 -7
- package/payload/evidence-kit/gate-tests/statement-store.test.sh +5 -5
- package/payload/evidence-kit/gate-tests/verify-gate-run-strict.test.sh +5 -4
- package/payload/gate-sdk/README.md +7 -0
- package/payload/gate-sdk/bin/build-native.sh +5 -4
- package/payload/gate-sdk/bin/run-gates.ps1 +8 -7
- package/payload/gate-sdk/bin/run-gates.sh +10 -8
- package/payload/gate-sdk/checks/check-binary-strings.gate +4 -0
- package/payload/gate-sdk/checks/check-exec-write.gate +4 -0
- package/payload/gate-sdk/checks/check-migration-guard.gate +4 -0
- package/payload/gate-sdk/checks/check-path-names.gate +4 -0
- package/payload/gate-sdk/checks/check-pipefail-readers.gate +4 -0
- package/payload/gate-sdk/checks/check-script-preflight.gate +4 -0
- package/payload/gate-sdk/checks/check-site-count.gate +4 -0
- package/payload/gate-sdk/checks/check-tree-terms.gate +1 -1
- package/payload/gate-sdk/gate-tests/binary-only-recipe.test.sh +2 -2
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +11 -11
- package/payload/gate-sdk/gate-tests/check-binary-strings/bad/expect.txt +4 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/bad/out/app.elf +0 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/bad/out/notes.bin +0 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/bad/scripts/gate-sdk-config.knobs +3 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/bad/shapes.list +2 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/bad/terms.list +2 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/good/out/app.elf +0 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/good/scripts/gate-sdk-config.knobs +3 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/good/shapes.list +2 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings/good/terms.list +4 -0
- package/payload/gate-sdk/gate-tests/check-binary-strings.test.sh +74 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/bad/expect.txt +13 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/bad/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/caller.rs +5 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/helper.rs +5 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/sites.rs +19 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/good/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/good/src/helper.rs +5 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/good/src/main.rs +15 -0
- package/payload/gate-sdk/gate-tests/check-exec-write.test.sh +69 -0
- package/payload/gate-sdk/gate-tests/check-identity.test.sh +2 -2
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0001_init.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0002_orders.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/base/0003_audit.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/destructive.list +4 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/expect.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0001_init.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0002_late.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0003_audit_log.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0004_prune.sql +3 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/bad/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/base/0001_init.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/base/0002_legacy.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/destructive.list +4 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0001_init.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0002_legacy.sql +1 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0003_retire_legacy.sql +6 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard/good/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-migration-guard.test.sh +136 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/expect.txt +6 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/terms.list +3 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/ZePhYr.md +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo/a.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo/zephyr.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo-cli.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo.rs +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/bad/tree/foo_x.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/good/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/good/terms.list +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/good/tree/foobar.rs +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/good/tree/food/a.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names/good/tree/xfoo.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-path-names.test.sh +66 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/baseline.tsv +4 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/expect.txt +17 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/over.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/readers.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/shared-lib.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/bad/tree/stale.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/baseline.tsv +2 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/clean.sh +17 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/lib/baselined-lib.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers/good/tree/no-pipefail.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-pipefail-readers.test.sh +114 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor.test.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-script-preflight/bad/expect.txt +10 -0
- package/payload/gate-sdk/gate-tests/check-script-preflight/bad/rules.list +23 -0
- package/payload/gate-sdk/gate-tests/check-script-preflight/bad/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-script-preflight/bad/tree/submit-job.sh +13 -0
- package/payload/gate-sdk/gate-tests/check-script-preflight/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-script-preflight/good/rules.list +23 -0
- package/payload/gate-sdk/gate-tests/check-script-preflight/good/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-script-preflight/good/tree/submit-job.sh +17 -0
- package/payload/gate-sdk/gate-tests/check-script-preflight.test.sh +110 -0
- package/payload/gate-sdk/gate-tests/check-site-count/bad/expect.txt +4 -0
- package/payload/gate-sdk/gate-tests/check-site-count/bad/rules.list +5 -0
- package/payload/gate-sdk/gate-tests/check-site-count/bad/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-site-count/bad/sites.tsv +3 -0
- package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/new.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/over.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-site-count/bad/tree/under.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-site-count/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-site-count/good/rules.list +5 -0
- package/payload/gate-sdk/gate-tests/check-site-count/good/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-site-count/good/sites.tsv +2 -0
- package/payload/gate-sdk/gate-tests/check-site-count/good/tree/blob.bin +0 -0
- package/payload/gate-sdk/gate-tests/check-site-count/good/tree/pinned.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-site-count/good/tree/plain.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-site-count/good/tree/tests/helper.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-site-count.test.sh +90 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +11 -8
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +4 -1
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/terms.list +4 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/terms.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/rosters/terms.list +2 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/words.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +36 -16
- package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +5 -6
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +8 -8
- package/payload/gate-sdk/gate-tests/native-git-hooks.test.sh +7 -7
- package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +4 -4
- package/payload/gate-sdk/gate-tests/run-for-path.test.sh +3 -3
- package/payload/gate-sdk/gate-tests/run-gates-linked-worktree.test.sh +6 -6
- package/payload/gate-sdk/gate-tests/run-json.test.sh +52 -0
- package/payload/gate-sdk/gate-tests/verdict-store.test.sh +99 -0
- package/payload/gate-sdk/lib/gate.sh +12 -9
- package/payload/gate-sdk/lib/test-hermetic.sh +2 -2
- package/payload/gate-sdk/templates/check-skeleton.sh +2 -1
- package/payload/gate-sdk/templates/migration-destructive.list +10 -0
- package/payload/gate-sdk/templates/script-rules.list +39 -0
- package/payload/gate-sdk/templates/strings-shapes.list +15 -0
- package/payload/guard-kit/gate-tests/consumer-rules.test.sh +5 -5
- package/payload/guard-kit/gate-tests/door-binding-corpus.test.sh +2 -2
- package/payload/lifecycle-kit/gate-tests/boundary-worktree-refusal.test.sh +1 -1
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry.test.sh +1 -1
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +3 -3
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +1 -1
- package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +2 -2
- package/payload/lifecycle-kit/gate-tests/lead-journal-open.test.sh +18 -2
- package/payload/lifecycle-kit/gate-tests/peer-channel.test.sh +35 -6
- package/payload/lifecycle-kit/gate-tests/preflight-valve.test.sh +4 -4
- package/payload/lifecycle-kit/templates/consult.md +1 -1
- package/payload/lifecycle-kit/templates/stages/scope.md +1 -1
- package/payload/queue-kit/README.md +1 -1
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness.test.sh +2 -2
- package/payload/queue-kit/gate-tests/check-task-conservation.test.sh +4 -4
- package/payload/site-kit/gate-tests/check-docs-liquid-parse-parser.test.sh +4 -4
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +9 -9
|
@@ -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
|
+
# 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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,
|
|
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
|
|
289
|
+
exit 3
|
|
287
290
|
fi
|
|
288
|
-
"$bin" --emit gate-argv "$d/$g.gate" || exit
|
|
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
|
|
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
|
|
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
|
|
@@ -55,13 +55,13 @@ gate_env() { # $1.. = NAME=VALUE — a case's environment, applied in the calle
|
|
|
55
55
|
return 0
|
|
56
56
|
}
|
|
57
57
|
|
|
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
|
|
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 3, a tool error, the verdict the dispatcher gives it.
|
|
59
59
|
gate_arm_run() { # $1=arm flag $2.. = the arm's own argv
|
|
60
60
|
local _ar_bin
|
|
61
61
|
# shellcheck source=./gate.sh
|
|
62
62
|
source "$GATE_SDK_TEST_LIB_DIR/gate.sh"
|
|
63
63
|
_ar_bin="$(gate_native_bin)"
|
|
64
|
-
[[ -x "$_ar_bin" ]] || return
|
|
64
|
+
[[ -x "$_ar_bin" ]] || return 3
|
|
65
65
|
"$_ar_bin" "$@"
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -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
|
|
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+.-]*://
|
|
@@ -265,7 +265,7 @@ has "derive-nocases-named" "$tmp/out" "GUARD_KIT_CONSUMER_VARIANT_LIMITS"
|
|
|
265
265
|
eq "derive-nofile-status" "$(lane "$(derive_knobs nofile no-such-limits.tsv)")" 2
|
|
266
266
|
has "derive-nofile-named" "$tmp/out" "GUARD_KIT_CONSUMER_VARIANT_LIMITS"
|
|
267
267
|
printf 'block\tcd_compound\tsq-lead\n' >"$tmp/cwd/lane-bad-limits.tsv"
|
|
268
|
-
eq "derive-unreadable-status" "$(lane "$(derive_knobs unreadable lane-bad-limits.tsv)")"
|
|
268
|
+
eq "derive-unreadable-status" "$(lane "$(derive_knobs unreadable lane-bad-limits.tsv)")" 3
|
|
269
269
|
has "derive-unreadable-named" "$tmp/out" "GUARD_KIT_CONSUMER_VARIANT_LIMITS"
|
|
270
270
|
|
|
271
271
|
# --- the variant lane reads the fifth positional: a limit row nothing needs is a mismatch, and a
|
|
@@ -278,14 +278,14 @@ limits() { # $1=name $2..=rows — a limits table of those rows, its path echoe
|
|
|
278
278
|
}
|
|
279
279
|
eq "limits-stale-status" "$(lane "$tmp/lane-off.knobs" "$(limits stale 'fallthrough\tcd_compound\tsq-lead')")" 1
|
|
280
280
|
has "limits-stale-named" "$tmp/out" "limit row 'cd_compound sq-lead' admits a re-spelling that no longer fails"
|
|
281
|
-
eq "limits-floor-status" "$(lane "$tmp/lane-off.knobs" "$(limits floor 'block\tcd_compound\tsq-lead')")"
|
|
282
|
-
eq "limits-transform-status" "$(lane "$tmp/lane-off.knobs" "$(limits transform 'allow\tcd_compound\tsq')")"
|
|
283
|
-
eq "limits-twice-status" "$(lane "$tmp/lane-off.knobs" "$(limits twice 'allow\tcd_compound\tsq-lead' 'fallthrough\tcd_compound\tsq-lead')")"
|
|
281
|
+
eq "limits-floor-status" "$(lane "$tmp/lane-off.knobs" "$(limits floor 'block\tcd_compound\tsq-lead')")" 3
|
|
282
|
+
eq "limits-transform-status" "$(lane "$tmp/lane-off.knobs" "$(limits transform 'allow\tcd_compound\tsq')")" 3
|
|
283
|
+
eq "limits-twice-status" "$(lane "$tmp/lane-off.knobs" "$(limits twice 'allow\tcd_compound\tsq-lead' 'fallthrough\tcd_compound\tsq-lead')")" 3
|
|
284
284
|
eq "limits-missing-status" "$(lane "$tmp/lane-off.knobs" "$tmp/no-such-limits.tsv")" 2
|
|
285
285
|
|
|
286
286
|
if [[ "$fails" -gt 0 ]]; then
|
|
287
287
|
echo "consumer-rules.test: $fails of $checks assertion(s) failed"
|
|
288
288
|
exit 1
|
|
289
289
|
fi
|
|
290
|
-
echo "consumer-rules.test: ok ($checks assertions; the consumer command reads the payload bytes as received with the working directory and environment inherited, a block and a decision are relayed verbatim ahead of the generic ruleset, an empty result falls through to it, a fault — non-zero-non-2 exit, unparseable or non-object stdout, a command that cannot start — rides the ruleset's own answer and never silences it, an empty knob runs no stage; --guard-json field reads bytes verbatim, view prints the named view through the tool's reader, nothing for a tool no reader serves, and words prints the word read's values a segment a line, nothing where the read answers nothing, and refuses an operand; a raw control byte is blocked by name before any rule; --run-guard-tests' consumer lane drives the consumer's rows against its command from the arm's working directory, reds a mismatch either way, is silent where no table is named, and refuses a table with no command or no file at exit 2, and derives its rows' re-spellings only under a named limits table, held from both sides and refused at exit 2 with
|
|
290
|
+
echo "consumer-rules.test: ok ($checks assertions; the consumer command reads the payload bytes as received with the working directory and environment inherited, a block and a decision are relayed verbatim ahead of the generic ruleset, an empty result falls through to it, a fault — non-zero-non-2 exit, unparseable or non-object stdout, a command that cannot start — rides the ruleset's own answer and never silences it, an empty knob runs no stage; --guard-json field reads bytes verbatim, view prints the named view through the tool's reader, nothing for a tool no reader serves, and words prints the word read's values a segment a line, nothing where the read answers nothing, and refuses an operand; a raw control byte is blocked by name before any rule; --run-guard-tests' consumer lane drives the consumer's rows against its command from the arm's working directory, reds a mismatch either way, is silent where no table is named, and refuses a table with no command or no file at exit 2, and derives its rows' re-spellings only under a named limits table, held from both sides and refused with no cases table or no table file at exit 2 and with an unparseable table at exit 3; its variant lane counts the four tables' derived rows, reds a limit row nothing needs and refuses a limits table with no file at exit 2 and one it cannot parse at exit 3)"
|
|
291
291
|
exit 0
|
|
@@ -54,7 +54,7 @@ want "absent-entry" "no/such/page.md" 2 "resolves to neither a tracked file nor
|
|
|
54
54
|
printf 'untracked\n' >"$tmp/loose.md"
|
|
55
55
|
want "untracked-entry" "loose.md" 2 "resolves to neither a tracked file nor a directory"
|
|
56
56
|
|
|
57
|
-
# --- an unreadable configured surface: exit
|
|
57
|
+
# --- an unreadable configured surface: exit 3 rather than a clean over a corpus
|
|
58
58
|
# the gate could not read. Skipped for a caller that reads a mode-000 file anyway.
|
|
59
59
|
mkdir -p "$tmp/locked"
|
|
60
60
|
printf 'bash gate-sdk/bin/run-gates.sh --run-demo\n' >"$tmp/locked/page.md"
|
|
@@ -64,7 +64,7 @@ chmod 000 "$tmp/locked/page.md"
|
|
|
64
64
|
if head -c1 "$tmp/locked/page.md" >/dev/null 2>&1; then
|
|
65
65
|
echo " note: skipping the unreadable-surface case — this caller reads a mode-000 file"
|
|
66
66
|
else
|
|
67
|
-
want "unreadable-surface" "locked"
|
|
67
|
+
want "unreadable-surface" "locked" 3 "unreadable corpus file"
|
|
68
68
|
fi
|
|
69
69
|
chmod 644 "$tmp/locked/page.md"
|
|
70
70
|
|
|
@@ -215,7 +215,7 @@ seed "$refused"
|
|
|
215
215
|
printf 'gitdir: %s/absent\n' "$refused" >"$refused/.git"
|
|
216
216
|
before="$(state_of "$refused")"
|
|
217
217
|
out="$(run_enter "$refused" scope)"; rc=$?
|
|
218
|
-
[[ "$rc" -eq
|
|
218
|
+
[[ "$rc" -eq 3 && "$out" == *"marks a repository"* ]] || note refused "a refused repository skipped the worktree check (want exit 3 naming the mark): rc=$rc $out"
|
|
219
219
|
[[ "$(state_of "$refused")" == "$before" ]] || note refused-write "the refused entry wrote the state file"
|
|
220
220
|
|
|
221
221
|
[[ "$fails" -eq 0 ]] || { echo "boundary-worktree-refusal.test: $fails assertion(s) failed"; exit 1; }
|
|
@@ -56,7 +56,7 @@ expect 2 "$rc" "a missing message file fails closed"
|
|
|
56
56
|
(gate_run check-dispatch-entry "$DIR/checks" "$tmp/msg.txt" "$tmp/one.txt" >/dev/null 2>&1); rc=$?
|
|
57
57
|
expect 2 "$rc" "two arguments is a usage error"
|
|
58
58
|
(gate_run check-dispatch-entry "$DIR/checks" "$tmp/msg.txt" "$tmp/nope.txt" "$tmp/head.txt" "$tmp/head.txt" "$tmp/work.txt" >/dev/null 2>&1); rc=$?
|
|
59
|
-
expect
|
|
59
|
+
expect 3 "$rc" "an unreadable marker fails closed"
|
|
60
60
|
|
|
61
61
|
if [[ "$fails" -gt 0 ]]; then
|
|
62
62
|
echo "check-dispatch-entry.test: $fails assertion(s) failed"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# good/bad pair cannot hold: (A) a malformed disposition line reds on grammar;
|
|
4
4
|
# (B) a Lessons entry still present in the worktree is not a removal, so it
|
|
5
5
|
# needs no stamp; (C) a stored prefix matches a longer lead line (prefix join);
|
|
6
|
-
# (D-F) bare mode is clean outside a repository and exit
|
|
6
|
+
# (D-F) bare mode is clean outside a repository and exit 3 in one git refuses,
|
|
7
7
|
# a nested one git skips included.
|
|
8
8
|
#
|
|
9
9
|
# Run by the --run-gate-tests arm (any <tests-dir>/*.test.sh; must exit 0).
|
|
@@ -64,13 +64,13 @@ bare_case "D no-repository" "$SANDBOX/none" 0 "no git repository"
|
|
|
64
64
|
# E: bare mode in a repository git refuses is the crosser's refusal, never that clean answer.
|
|
65
65
|
mkdir -p "$SANDBOX/refused"
|
|
66
66
|
printf 'gitdir: %s/absent\n' "$SANDBOX/refused" >"$SANDBOX/refused/.git"
|
|
67
|
-
bare_case "E refused-repository" "$SANDBOX/refused"
|
|
67
|
+
bare_case "E refused-repository" "$SANDBOX/refused" 3 "marks a repository"
|
|
68
68
|
|
|
69
69
|
# F: a nested repository git skips is refused too, though git answers the enclosing one at exit 0.
|
|
70
70
|
git init -q "$SANDBOX/outer"
|
|
71
71
|
mkdir -p "$SANDBOX/outer/inner/.git"
|
|
72
72
|
printf 'garbage\n' >"$SANDBOX/outer/inner/.git/HEAD"
|
|
73
|
-
bare_case "F nested-skipped-repository" "$SANDBOX/outer/inner"
|
|
73
|
+
bare_case "F nested-skipped-repository" "$SANDBOX/outer/inner" 3 "marks a repository beneath it"
|
|
74
74
|
|
|
75
75
|
if [[ "$fails" -gt 0 ]]; then
|
|
76
76
|
echo "check-lesson-disposition.test.sh: $fails case(s) failed"
|
|
@@ -44,7 +44,7 @@ cat >"$u/AGENT.md" <<'EOF'
|
|
|
44
44
|
<!-- lifecycle-kit:begin -->
|
|
45
45
|
The block opened but the end marker is gone.
|
|
46
46
|
EOF
|
|
47
|
-
check_case "unpaired-marker-failclosed" "$u"
|
|
47
|
+
check_case "unpaired-marker-failclosed" "$u" 3 "end marker missing"
|
|
48
48
|
|
|
49
49
|
# --- agent-file-missing: the configured target does not exist (fail-closed) ---
|
|
50
50
|
m="$SANDBOX/missing"; mkdir -p "$m"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# matching none), the widened arm over git-object-shaped tokens in the OTHER four
|
|
11
11
|
# fields, which the hermetic pair cannot reach for the same reason, and its valve;
|
|
12
12
|
# plus the two inert shapes (no record at all, a header-only record), and a
|
|
13
|
-
# repository git refuses, which exits
|
|
13
|
+
# repository git refuses, which exits 3 rather than degrading to grammar only.
|
|
14
14
|
#
|
|
15
15
|
# Run by the --run-gate-tests arm (any <tests-dir>/*.test.sh; must exit 0).
|
|
16
16
|
set -uo pipefail
|
|
@@ -139,7 +139,7 @@ check_case "valve-no-reason-still-probes" "$noreason" 1 "token names no object i
|
|
|
139
139
|
refused="$SANDBOX/refused"; mkdir -p "$refused"
|
|
140
140
|
printf 'gitdir: %s/absent\n' "$refused" >"$refused/.git"
|
|
141
141
|
write_record "$refused" "$(printf 'a%.0s' {1..40})"
|
|
142
|
-
check_case "refused-repository" "$refused"
|
|
142
|
+
check_case "refused-repository" "$refused" 3 "marks a repository"
|
|
143
143
|
|
|
144
144
|
if [[ "$fails" -gt 0 ]]; then
|
|
145
145
|
echo "check-survey-record.test.sh: $fails case(s) failed"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# spec: lifecycle-kit/SPEC.md §bin/enter-stage.sh — --open-lead-journal end-to-end through a sandboxed enter-stage: the heading keyed on fields 2 through the last of the last stamp, creation with its directory, append after an undisposed segment, a disposed segment dropped, the idempotent no-op, --simulate writing nothing, the surplus refusal, the none key on a stampless state file, the session-role marker (written, rewritten on the journal no-op, left alone when held, skipped where the id does not derive, simulated unwritten, never written on a refusal), and no stamp ever appended
|
|
2
|
+
# spec: lifecycle-kit/SPEC.md §bin/enter-stage.sh — --open-lead-journal end-to-end through a sandboxed enter-stage: the heading keyed on fields 2 through the last of the last stamp, creation with its directory, append after an undisposed segment, a disposed segment dropped, the idempotent no-op, --simulate writing nothing, the surplus refusal, the none key on a stampless state file, the session-role marker (written, naming a resumed lead beside a newer stage child, rewritten on the journal no-op, left alone when held, skipped where the id does not derive, simulated unwritten, never written on a refusal), and no stamp ever appended
|
|
3
3
|
set -uo pipefail
|
|
4
4
|
source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
|
|
5
5
|
|
|
@@ -83,6 +83,22 @@ out="$( cd "$sk" && unset LIFECYCLE_KIT_SESSION_ID CLAUDE_CODE_SESSION_ID CLAUDE
|
|
|
83
83
|
[[ -e "$sk/scratch/session-role" ]] && note marker-skip-file "an underived id wrote a marker"
|
|
84
84
|
grep -qF 'skipped the session-role marker' <<<"$out" || note marker-skip-report "the skip is not named: $out"
|
|
85
85
|
|
|
86
|
+
# --- a resumed lead: the harness's child flag set beside the lead's own uuid, a stage child's
|
|
87
|
+
# transcript newer than the lead's, and the marker still names the lead ---
|
|
88
|
+
rl="$SANDBOX/resumed-lead"
|
|
89
|
+
seed "$rl" stamps
|
|
90
|
+
lead_uuid=11112222-3333-4444-5555-666677778888
|
|
91
|
+
mkdir -p "$rl/sessions/$lead_uuid/subagents"
|
|
92
|
+
touch -t 202001010000 "$rl/sessions/$lead_uuid.jsonl"
|
|
93
|
+
touch -t 202001010001 "$rl/sessions/$lead_uuid/subagents/agent-aaaabbbb0000.jsonl"
|
|
94
|
+
out="$( cd "$rl" && unset LIFECYCLE_KIT_SESSION_ID \
|
|
95
|
+
&& gate_env GATE_SDK_TMP_DIR="$rl/scratch" LIFECYCLE_KIT_SESSIONS_DIR="$rl/sessions" \
|
|
96
|
+
CLAUDE_CODE_SESSION_ID="$lead_uuid" CLAUDE_CODE_CHILD_SESSION=1 \
|
|
97
|
+
&& gate_arm_run --enter-stage --open-lead-journal 2>&1 )"; rc=$?
|
|
98
|
+
[[ "$rc" -eq 0 ]] || note marker-resumed-lead "want exit 0, got $rc -- $out"
|
|
99
|
+
[[ "$(cat "$rl/scratch/session-role" 2>/dev/null)" == "lead 11112222" ]] \
|
|
100
|
+
|| note marker-resumed-lead-id "the marker does not name the lead: $(cat "$rl/scratch/session-role" 2>/dev/null)"
|
|
101
|
+
|
|
86
102
|
# --- --simulate relays the marker line and path under its prefix and writes no marker ---
|
|
87
103
|
ms="$SANDBOX/marker-simulate"
|
|
88
104
|
seed "$ms" stamps
|
|
@@ -156,5 +172,5 @@ out="$(run_open "$no" --open-lead-journal)"; rc=$?
|
|
|
156
172
|
|| note none-heading "a stampless state file did not key on none: $(cat "$no/scratch/lead-journal.md" 2>/dev/null)"
|
|
157
173
|
|
|
158
174
|
[[ "$fails" -eq 0 ]] || { echo "lead-journal-open.test: $fails assertion(s) failed"; exit 1; }
|
|
159
|
-
echo "lead-journal-open.test: clean (--open-lead-journal creates its keyed heading, appends after an undisposed segment, drops a disposed one, no-ops at the same cursor, simulates read-only under its prefix, refuses a surplus argument with nothing written, keys on none without a stamp, writes the session-role marker, rewrites it on the no-op, leaves a held one alone, skips it at exit 0 where the id does not derive, simulates it unwritten, and never stamps)"
|
|
175
|
+
echo "lead-journal-open.test: clean (--open-lead-journal creates its keyed heading, appends after an undisposed segment, drops a disposed one, no-ops at the same cursor, simulates read-only under its prefix, refuses a surplus argument with nothing written, keys on none without a stamp, writes the session-role marker, names a resumed lead in it beside a newer stage child, rewrites it on the no-op, leaves a held one alone, skips it at exit 0 where the id does not derive, simulates it unwritten, and never stamps)"
|
|
160
176
|
exit 0
|