checkwright 0.40.0 → 0.42.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/README.md +2 -0
- 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/gate-sdk/gate-tests/binary-only-recipe.test.sh +16 -1
- package/payload/gate-sdk/gate-tests/check-exec-write/bad/expect.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/sites.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-migration-guard.test.sh +36 -2
- package/payload/gate-sdk/gate-tests/child-locale.test.sh +94 -0
- package/payload/gate-sdk/gate-tests/lib-test-hermetic.test.sh +6 -1
- package/payload/gate-sdk/gate-tests/verdict-store.test.sh +23 -2
- package/payload/gate-sdk/lib/test-hermetic.sh +2 -1
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ From your repository's root, in a new project or an existing one with every chan
|
|
|
20
20
|
|
|
21
21
|
With Node already present the same install is one command, `npx checkwright init` — same payload, same `init`, same `checkwright.lock`; only the fetch differs, and on Windows the [`PATH` block](https://checkwright.dev/install.html#windows) runs first. `npx checkwright init --profile prose` picks a profile ([Choosing a profile](#choosing-a-profile) below), and `npx checkwright demo` shows the adoption arc in a scratch repository first, without touching yours ([what it runs](https://checkwright.dev/install.html#install)).
|
|
22
22
|
|
|
23
|
+
The kits, their `.gate` descriptors and a `gates.list` ship only in this package and the Release tarball that carries the same payload. A Release's per-target archive, `checkwright-gates-<version>-<target>.tar.gz`, holds the gate binary and its sidecar alone, and from the first release after v0.41.0 the Release carries the archive's own `.sha256` and build attestation beside it. On its own the archive runs one compiled-in gate and has no set to `--run`. A CI job holding only the binary runs one gate directly, or a set through a registry it builds from the tarball's descriptors ([Binary-only CI](https://checkwright.dev/binary-only.html)).
|
|
24
|
+
|
|
23
25
|
`init` vendors the selected profile's kit directories, writes a `gates.list` seeded with each kit's starting gates alongside the config seam those kits need and a CI workflow, and makes **one commit** naming the install and the version. That commit runs the clone's own hooks, and if one refuses it the files stay staged and the setup commands still print. It ends by printing the commands that finish the setup, each with its reason — deliberately not copied here, because what `init` prints is `init`'s to say ([`installer/SPEC.md` §init](SPEC.md#init)).
|
|
24
26
|
|
|
25
27
|
Re-running is idempotent and non-destructive. `init` reads the per-file hash `checkwright.lock` recorded: a file still at its recorded hash is rewritten, and one you have changed since is **reported rather than overwritten** unless you pass `--force`. `--dry-run` prints the file plan and the manifest and writes nothing.
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"checkwright-pwsh": "bin/checkwright.ps1"
|
|
5
5
|
},
|
|
6
6
|
"checkwright": {
|
|
7
|
-
"commit": "
|
|
7
|
+
"commit": "8365b88e2003c289e2c35fd680d6a60399c9aa90",
|
|
8
8
|
"spec_base_url": "https://checkwright.dev"
|
|
9
9
|
},
|
|
10
10
|
"description": "Reproducible checks that catch unsupported claims in coding-agent delivery before merge: a task marked done with no recorded test run, a skipped lifecycle stage, a spec naming a file the tree lacks. They prove the evidence a claim rests on exists, not that the code is correct.",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"type": "git",
|
|
31
31
|
"url": "git+https://github.com/checkwright/checkwright.git"
|
|
32
32
|
},
|
|
33
|
-
"version": "0.
|
|
33
|
+
"version": "0.42.0"
|
|
34
34
|
}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2bc3f2bab028f7aa68e77f015004a9559766fd29a41bad26492e04c558823424 checkwright-gates
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
5ae179dab4d6e99b7c1c55da6bb2644816051c8e842a97ef882f1b873c5af930 *checkwright-gates.exe
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b1225e54bcaa398c9ffe18bac0a1f0066645cf7651d3fb84f889b91c87701b2b checkwright-gates
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
013e7373d3f18dd8e738cee378af074204e616b9ca6f2095932097ee5b21ea99 checkwright-gates
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
bccdd0cefd4798262e1cb3745a478d9e599ff7d0adf612982a3a6c0c99858d1d checkwright-gates
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d52a1d2d592c4063027cd1c2e744262570b8c399e72266e675edee981f66edbe *checkwright-gates.exe
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
67aebe3c8e06d171ef66e44e124e022e2f6087d7faba00493601dfbc33bc938e checkwright-gates
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f91dd697fa2ae072232b06bfe134b9b6a8d853c52be812372d725deef1f672cb checkwright-gates
|
|
@@ -95,6 +95,21 @@ assert_rc "run" "$rc" 0 "$out"
|
|
|
95
95
|
[[ -s "$sarif" ]] || { echo "FAIL [run]: no SARIF log at $sarif"; fails=$((fails + 1)); }
|
|
96
96
|
assert_clean run
|
|
97
97
|
|
|
98
|
+
# spec: gate-sdk/SPEC.md §run-gates — one usage spelling, the bare dir kept as its alias
|
|
99
|
+
out="$(cd "$repo" && container GATE_SDK_TMP_DIR="$scratch/run" "$BIN" --run "$gates" 2>&1)"; rc=$?
|
|
100
|
+
assert_rc "run, bare dir alias" "$rc" 0 "$out"
|
|
101
|
+
out="$(container "$BIN" --run --help 2>&1)"; rc=$?
|
|
102
|
+
assert_rc "run, help" "$rc" 0 "$out"
|
|
103
|
+
head -n1 <<<"$out" | grep -qF -- '--run [--json] [--gates-dir <dir>]' \
|
|
104
|
+
|| { echo "FAIL [run, help]: the usage line does not spell --gates-dir <dir>"; head -n1 <<<"$out"; fails=$((fails + 1)); }
|
|
105
|
+
|
|
106
|
+
# spec: gate-sdk/SPEC.md §Output contract — outside a git repository the run is refused at 2, its
|
|
107
|
+
# document the error one, rather than a pass carrying no tree
|
|
108
|
+
out="$(cd "$scratch/nogit" && container GATE_SDK_TMP_DIR="$scratch/run" "$BIN" --run --json --gates-dir "$gates" 2>&1)"; rc=$?
|
|
109
|
+
assert_rc "run, no worktree" "$rc" 2 "$out"
|
|
110
|
+
grep -qF 'run-gates: not inside a git repository' <<<"$out" && grep -qF '"refused"' <<<"$out" \
|
|
111
|
+
|| { echo "FAIL [run, no worktree]: no refusal line and refused error document"; printf '%s\n' "$out"; fails=$((fails + 1)); }
|
|
112
|
+
|
|
98
113
|
# spec: gate-sdk/SPEC.md §The install disposition — a registered member scans from the tree's root, so
|
|
99
114
|
# an action gate is scoped inside the battery by a member of the adopter's own calling the direct form
|
|
100
115
|
printf 'check-action-pinning\n' > "$gates/gates.list"
|
|
@@ -121,5 +136,5 @@ grep -qF '(unresolved)' <<<"$out" || { echo "FAIL [run, no descriptor]: no membe
|
|
|
121
136
|
assert_clean "run, no descriptor"
|
|
122
137
|
|
|
123
138
|
[[ "$fails" -eq 0 ]] || { echo "binary-only-recipe.test: $fails assertion(s) failed"; exit 1; }
|
|
124
|
-
echo "binary-only-recipe.test: clean (the direct form's four kit-free gates green on a read-only checkout, a finding at exit 1, a missing knob file and a worktree-less tree at exit 2, the root positional narrowing an action gate's scan to the owned directory, a knob file outside the checkout read, a top-level checks/ directory scanned once GATE_SDK_KIT_DIRS names the kit set, and --run over an out-of-tree registry writing its SARIF log outside a checkout left clean, an action gate scoped there by a member of the adopter's own, its members unresolved once its descriptors are gone)"
|
|
139
|
+
echo "binary-only-recipe.test: clean (the direct form's four kit-free gates green on a read-only checkout, a finding at exit 1, a missing knob file and a worktree-less tree at exit 2, the root positional narrowing an action gate's scan to the owned directory, a knob file outside the checkout read, a top-level checks/ directory scanned once GATE_SDK_KIT_DIRS names the kit set, and --run over an out-of-tree registry writing its SARIF log outside a checkout left clean, the bare dir its alias, its usage spelling --gates-dir <dir>, refused at exit 2 outside a worktree, an action gate scoped there by a member of the adopter's own, its members unresolved once its descriptors are gone)"
|
|
125
140
|
exit 0
|
|
@@ -15,7 +15,7 @@ malformed target triple: 'notatriple'
|
|
|
15
15
|
matrix declaration not roster-derived: publish.yml
|
|
16
16
|
digest recomputed: job 'build'
|
|
17
17
|
digest computed by a consumer: job 'release'
|
|
18
|
-
digest recomputed: job 'artifact' in ci.yml
|
|
18
|
+
digest recomputed: job 'artifact' in ci.yml carries 2 digest emissions
|
|
19
19
|
hold ground unreachable: scripts/check-nospec.sh
|
|
20
20
|
hold ground not in the pointed-at section: scripts/check-ungrounded.sh
|
|
21
21
|
stale unregistered declaration: scripts/gates.list declares 'check-alpha' unregistered and registers it
|
|
@@ -211,7 +211,7 @@ expect precedence-dup 1 'db/migrations/0003_b.sql: [MIGRATION-DUP] 0003 also 000
|
|
|
211
211
|
expect precedence-clash 1 'db/migrations/0003_a.sql: [MIGRATION-CLASH] 0003 refs/heads/sib 0003_q.sql' "$rc" "$out"
|
|
212
212
|
refute precedence-one 'db/migrations/0003_b.sql: [MIGRATION-CLASH]' "$out"
|
|
213
213
|
|
|
214
|
-
# --- the ref set: a detached HEAD excludes no ref, an orphan is skipped, `none` turns the check
|
|
214
|
+
# --- the ref set: a detached HEAD excludes no ref, an orphan is skipped and named, `none` turns the check
|
|
215
215
|
# off, a glob narrows it, and a glob opening with '-' is refused at 2.
|
|
216
216
|
r="$(fresh detached)"
|
|
217
217
|
on "$r" topic 0003_c.sql 'CREATE TABLE c (id INTEGER);'
|
|
@@ -231,7 +231,41 @@ git -C "$r" fetch -q "$o" main:refs/heads/lone
|
|
|
231
231
|
printf 'CREATE TABLE m (id INTEGER);\n' > "$r/db/migrations/0003_mine.sql"
|
|
232
232
|
out="$(guard "$r")"; rc=$?
|
|
233
233
|
expect orphan 0 'clean (3 migration(s), 1 added, against merge base' "$rc" "$out"
|
|
234
|
-
expect orphan-
|
|
234
|
+
expect orphan-named 0 ', 0 other ref(s) read, 1 unrelated ref(s) skipped: refs/heads/lone)' "$rc" "$out"
|
|
235
|
+
|
|
236
|
+
# --- an unrelated ref under each GATE_SDK_MIGRATION_UNRELATED_REFS value: named on a red run's
|
|
237
|
+
# header under the default, refused at 3 under `error`, and an unknown value refused at 2.
|
|
238
|
+
unrelated() { # unrelated <repo> <value> — the gate in <repo> under GATE_SDK_MIGRATION_UNRELATED_REFS=<value>
|
|
239
|
+
( cd "$1" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations GATE_SDK_MIGRATION_DESTRUCTIVE="$LIST" \
|
|
240
|
+
GATE_SDK_MIGRATION_UNRELATED_REFS="$2" && gate_run check-migration-guard "$CHECKS" 2>&1 )
|
|
241
|
+
}
|
|
242
|
+
out="$(unrelated "$r" error)"; rc=$?
|
|
243
|
+
expect orphan-error 3 '1 ref(s) share no merge base with the base ref, so their additions cannot be read: refs/heads/lone' "$rc" "$out"
|
|
244
|
+
expect orphan-remedy 3 'fetch the history their merge base needs, or narrow GATE_SDK_MIGRATION_REFS past them' "$rc" "$out"
|
|
245
|
+
refute orphan-error-clean 'clean (' "$out"
|
|
246
|
+
out="$(unrelated "$r" strict)"; rc=$?
|
|
247
|
+
expect unrelated-unknown 2 "GATE_SDK_MIGRATION_UNRELATED_REFS must be off|error (got 'strict')" "$rc" "$out"
|
|
248
|
+
printf 'CREATE TABLE z (id INTEGER);\n' > "$r/db/migrations/0001_z.sql"
|
|
249
|
+
out="$(unrelated "$r" off)"; rc=$?
|
|
250
|
+
expect orphan-red-header 1 ', 1 unrelated ref(s) skipped: refs/heads/lone:' "$rc" "$out"
|
|
251
|
+
rm "$r/db/migrations/0001_z.sql"
|
|
252
|
+
|
|
253
|
+
# --- a shallow clone: a sibling forked before the base's last commit has its merge base cut, so it
|
|
254
|
+
# is named rather than read.
|
|
255
|
+
o="$(fresh shallow-src)"
|
|
256
|
+
git -C "$o" checkout -q main
|
|
257
|
+
on "$o" sib 0003_t.sql 'CREATE TABLE t (id INTEGER);'
|
|
258
|
+
git -C "$o" checkout -q main
|
|
259
|
+
printf 'later\n' > "$o/LATER"
|
|
260
|
+
git -C "$o" add LATER && git -C "$o" -c user.name=t -c user.email=t@e.invalid commit -qm later
|
|
261
|
+
r="$SANDBOX/shallow"
|
|
262
|
+
git clone -q --depth 1 --no-single-branch --branch main "file://$o" "$r"
|
|
263
|
+
git -C "$r" branch -q sib origin/sib && git -C "$r" checkout -qb topic
|
|
264
|
+
printf 'CREATE TABLE m (id INTEGER);\n' > "$r/db/migrations/0003_mine.sql"
|
|
265
|
+
out="$(guard "$r")"; rc=$?
|
|
266
|
+
expect shallow-named 0 ', 0 other ref(s) read, 1 unrelated ref(s) skipped: refs/heads/sib)' "$rc" "$out"
|
|
267
|
+
out="$(unrelated "$r" error)"; rc=$?
|
|
268
|
+
expect shallow-error 3 'refs/heads/sib' "$rc" "$out"
|
|
235
269
|
r="$SANDBOX/clash"
|
|
236
270
|
refs() { # refs <value> — the gate in the clash repository under GATE_SDK_MIGRATION_REFS=<value>
|
|
237
271
|
( cd "$r" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations GATE_SDK_MIGRATION_DESTRUCTIVE="$LIST" \
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: gate-sdk/SPEC.md §Fail-closed contract — under a non-C LC_ALL a roster tool the binary runs takes the C locale, a native gate's git included, while a consumer shell member keeps the exported value; under --init the commit's placed hook takes the caller's LC_ALL back, so a hook gate and a chained consumer hook record the caller's value, empty or unset as the caller had it
|
|
3
|
+
set -uo pipefail
|
|
4
|
+
source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
|
|
5
|
+
|
|
6
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
|
7
|
+
# shellcheck source=../lib/gate.sh
|
|
8
|
+
source "$HERE/gate-sdk/lib/gate.sh"
|
|
9
|
+
PINNED="$GATE_SDK_NATIVE_BIN"
|
|
10
|
+
[[ -x "$PINNED" ]] || { echo "child-locale.test: the gate binary $PINNED is absent — build it first"; exit 2; }
|
|
11
|
+
unset GATE_SDK_NATIVE_BIN GATE_SDK_GATES_DIR GATE_SDK_KIT_DIRS GATE_SDK_ROOT GATE_SDK_VERBOSE
|
|
12
|
+
|
|
13
|
+
if [[ -n "$(gate_exe_suffix)" ]]; then
|
|
14
|
+
echo "child-locale.test: clean (skipped — its git wrapper and hook gates are sh scripts, which a host with an executable suffix cannot start)"
|
|
15
|
+
exit 0
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
SANDBOX="$(mktemp -d)"
|
|
19
|
+
trap 'rm -rf "$SANDBOX"' EXIT
|
|
20
|
+
LOCALE=el_GR.UTF-8
|
|
21
|
+
|
|
22
|
+
fails=0
|
|
23
|
+
note() { echo " FAIL [$1]: $2"; fails=$((fails + 1)); }
|
|
24
|
+
|
|
25
|
+
recorder() {
|
|
26
|
+
printf '#!/bin/sh\n# graph: couples=%s dir=one valve=none tier=precommit\n%sprintf '"'"'%%s\\n'"'"' "${LC_ALL-<unset>}" >>"%s"\necho "%s: clean"\n' "$1" "$2" "$3" "$4"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# 1. a native gate's git and the runner's take C, and a consumer shell member keeps the exported value
|
|
30
|
+
real_git="$(command -v git)"
|
|
31
|
+
wrap="$SANDBOX/wrap"
|
|
32
|
+
mkdir -p "$wrap"
|
|
33
|
+
printf '#!/bin/sh\nprintf '"'"'%%s\\n'"'"' "${LC_ALL-<unset>}" >>"%s"\nexec "%s" "$@"\n' "$SANDBOX/git-rec" "$real_git" >"$wrap/git"
|
|
34
|
+
chmod +x "$wrap/git"
|
|
35
|
+
run="$SANDBOX/run"
|
|
36
|
+
mkdir -p "$run/scripts"
|
|
37
|
+
printf 'check-exec-bit\ncheck-print-locale\n' >"$run/scripts/gates.list"
|
|
38
|
+
cp "$HERE/gate-sdk/checks/check-exec-bit.gate" "$run/scripts/"
|
|
39
|
+
recorder '*.txt' '' "$SANDBOX/member-rec" PRINT-LOCALE >"$run/scripts/check-print-locale.sh"
|
|
40
|
+
chmod +x "$run/scripts/check-print-locale.sh"
|
|
41
|
+
git -C "$run" init -q -b main
|
|
42
|
+
git -C "$run" add -A
|
|
43
|
+
git -C "$run" -c user.email=t@example.invalid -c user.name=t commit -qm seed
|
|
44
|
+
out="$( cd "$run" && PATH="$wrap:$PATH" LC_ALL="$LOCALE" "$PINNED" --run 2>&1 )"; rc=$?
|
|
45
|
+
[[ "$rc" -eq 0 ]] || note run-status "want exit 0 from --run, got $rc -- $out"
|
|
46
|
+
grep -qF 'All 2 gates passed.' <<<"$out" || note run-summary "the native gate and the member did not both run: $out"
|
|
47
|
+
git_rec="$(cat "$SANDBOX/git-rec" 2>/dev/null)"
|
|
48
|
+
[[ -n "$git_rec" ]] || note git-recorded "the wrapper recorded no git the binary ran: $out"
|
|
49
|
+
[[ -z "$(grep -vxF C <<<"$git_rec")" ]] || note git-locale "a git the binary ran kept a locale other than C: $git_rec"
|
|
50
|
+
[[ "$(cat "$SANDBOX/member-rec" 2>/dev/null)" == "$LOCALE" ]] || note member-locale "want the consumer member to keep $LOCALE, got: $(cat "$SANDBOX/member-rec" 2>/dev/null)"
|
|
51
|
+
|
|
52
|
+
# 2. --init's commit runs the placed hook, whose gate and chained consumer hook record the caller's LC_ALL
|
|
53
|
+
pkg="$SANDBOX/pkg"
|
|
54
|
+
mkdir -p "$pkg/payload/artifact/t" "$pkg/payload/a-kit/checks" "$SANDBOX/home"
|
|
55
|
+
printf '{"name":"scratch","version":"1.2.3"}\n' >"$pkg/package.json"
|
|
56
|
+
printf 'starter\ta-kit\n' >"$pkg/profiles.list"
|
|
57
|
+
cp "$PINNED" "$pkg/payload/artifact/t/checkwright-gates"
|
|
58
|
+
recorder checkwright.lock $'# install: zero-config\n' '$REC/gate' REC >"$pkg/payload/a-kit/checks/check-rec.sh"
|
|
59
|
+
chmod +x "$pkg/payload/a-kit/checks/check-rec.sh"
|
|
60
|
+
|
|
61
|
+
init_case() {
|
|
62
|
+
local label="$1" want="$2"; shift 2
|
|
63
|
+
local repo="$SANDBOX/init-$label" rec="$SANDBOX/rec-$label"
|
|
64
|
+
mkdir -p "$repo/scripts" "$repo/native/target/release" "$rec"
|
|
65
|
+
printf 'native/target/\n' >"$repo/.gitignore"
|
|
66
|
+
printf 'check-rec\n' >"$repo/scripts/gates.list"
|
|
67
|
+
cp "$pkg/payload/a-kit/checks/check-rec.sh" "$repo/scripts/"
|
|
68
|
+
cp "$PINNED" "$repo/native/target/release/checkwright-gates"
|
|
69
|
+
git -C "$repo" init -q -b main
|
|
70
|
+
git -C "$repo" config user.email t@example.invalid
|
|
71
|
+
git -C "$repo" config user.name t
|
|
72
|
+
git -C "$repo" add -A
|
|
73
|
+
git -C "$repo" commit -qm seed
|
|
74
|
+
printf '#!/bin/sh\nprintf '"'"'%%s\\n'"'"' "${LC_ALL-<unset>}" >>"$REC/chained"\n' >"$repo/.git/hooks/pre-commit"
|
|
75
|
+
chmod +x "$repo/.git/hooks/pre-commit"
|
|
76
|
+
local out rc
|
|
77
|
+
out="$( cd "$repo" && ./native/target/release/checkwright-gates --install-hooks 2>&1 )"; rc=$?
|
|
78
|
+
[[ "$rc" -eq 0 ]] || { note "$label-hooks" "want exit 0 from --install-hooks, got $rc -- $out"; return; }
|
|
79
|
+
out="$( cd "$repo" && env "$@" HOME="$SANDBOX/home" XDG_CONFIG_HOME="$SANDBOX/home" GATE_SDK_UPDATE_CHECK=off \
|
|
80
|
+
REC="$rec" "$pkg/payload/artifact/t/checkwright-gates" --init 2>&1 )"; rc=$?
|
|
81
|
+
[[ "$rc" -eq 0 ]] || { note "$label-init" "want exit 0 from --init, got $rc -- $out"; return; }
|
|
82
|
+
[[ "$(git -C "$repo" rev-list --count HEAD)" -eq 2 ]] || note "$label-commit" "--init committed nothing: $out"
|
|
83
|
+
local f
|
|
84
|
+
for f in gate chained; do
|
|
85
|
+
[[ -f "$rec/$f" && "$(cat "$rec/$f")" == "$want" ]] || note "$label-$f" "want the hook's $f to record '$want', got: $(cat "$rec/$f" 2>/dev/null || echo '<no record>')"
|
|
86
|
+
done
|
|
87
|
+
}
|
|
88
|
+
init_case value "$LOCALE" LC_ALL="$LOCALE"
|
|
89
|
+
init_case empty '' LC_ALL=
|
|
90
|
+
init_case unset '<unset>' -u LC_ALL
|
|
91
|
+
|
|
92
|
+
[[ "$fails" -eq 0 ]] || { echo "child-locale.test: $fails assertion(s) failed"; exit 1; }
|
|
93
|
+
echo "child-locale.test: clean (under a non-C LC_ALL a native gate's git and the runner's take C while a consumer shell member keeps the exported value; --init's commit runs the placed hook in the caller's locale, its gate and a chained consumer hook recording the caller's value, empty or unset as the caller had it)"
|
|
94
|
+
exit 0
|
|
@@ -73,4 +73,9 @@ TMPDIR="$fresh" bash -c 'source "$1"' bash "$GATE_SDK_TEST_LIB_DIR/test-hermetic
|
|
|
73
73
|
echo 'FAIL: the empty files are not under the private dir'
|
|
74
74
|
exit 1
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
twice="$(TMPDIR="$fresh" bash -ec 'source "$1"; source "$1"; echo twice' bash "$GATE_SDK_TEST_LIB_DIR/test-hermetic.sh")"
|
|
77
|
+
[[ "$twice" == twice ]] || {
|
|
78
|
+
echo 'FAIL: a second source under errexit died on the private dir already present'
|
|
79
|
+
exit 1
|
|
80
|
+
}
|
|
81
|
+
echo 'LIB-TEST-HERMETIC: clean (inherited kit variables cleared, binary kept, library and later pins applied, host git config unread, a non-private temp name refused, a second source under errexit survived)'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# spec: gate-sdk/SPEC.md §run-gates — the verdict store end to end through the front end: a
|
|
3
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,
|
|
4
|
+
# --verdict-lookup answers it there and answers absent under another digest, --verdict-key prints
|
|
5
|
+
# that key, a tree that moves while
|
|
5
6
|
# members run or a modified tree keeps nothing, and an unset store is refused with its error
|
|
6
7
|
# document. Run by the --run-gate-tests arm.
|
|
7
8
|
set -uo pipefail
|
|
@@ -65,6 +66,24 @@ got="$(lookup GATE_SDK_VERDICT_STORE="$store")"; rc=$?
|
|
|
65
66
|
[[ "$rc" -eq 0 && "$got" == '{"contract":"1.0.0","verdict":"pass"}' ]] || fail "lookup pass" "exit $rc: $got"
|
|
66
67
|
pass_key=("${key[@]}")
|
|
67
68
|
|
|
69
|
+
# verdict_key [args] — the front end's --verdict-key on the scratch registry, its document alone
|
|
70
|
+
verdict_key() {
|
|
71
|
+
(cd "$repo" && env GATE_SDK_GATES_DIR="$gates" GATE_SDK_KIT_DIRS="$gates" bash "$RUN" --verdict-key "$@" 2>/dev/null)
|
|
72
|
+
}
|
|
73
|
+
# spec: gate-sdk/SPEC.md §run-gates — --verdict-key prints the key the run stored under, and its
|
|
74
|
+
# three fields handed to --verdict-lookup answer the stored verdict
|
|
75
|
+
doc="$(verdict_key)"; rc=$?
|
|
76
|
+
key=(
|
|
77
|
+
"$(grep -oE '"treeId":"[0-9a-f]+"' <<<"$doc" | grep -oE '[0-9a-f]{40,64}')"
|
|
78
|
+
"$(grep -oE '"tool":\{"version":"[^"]+"' <<<"$doc" | sed 's/.*"version":"//; s/"$//')"
|
|
79
|
+
"$(grep -oE '"gateSet":"[0-9a-f]+"' <<<"$doc" | grep -oE '[0-9a-f]{64}')"
|
|
80
|
+
)
|
|
81
|
+
[[ "$rc" -eq 0 && "${key[*]}" == "${pass_key[*]}" ]] || fail "verdict-key" "exit $rc: the key differs from the run's: ${key[*]} vs ${pass_key[*]}" "$doc"
|
|
82
|
+
got="$(lookup GATE_SDK_VERDICT_STORE="$store")"; rc=$?
|
|
83
|
+
[[ "$rc" -eq 0 && "$got" == '{"contract":"1.0.0","verdict":"pass"}' ]] || fail "verdict-key lookup" "exit $rc: $got"
|
|
84
|
+
got="$(verdict_key --json)"; rc=$?
|
|
85
|
+
[[ "$rc" -eq 2 && "$got" == '{"contract":"1.0.0","error":"usage"}' ]] || fail "verdict-key operand" "exit $rc: $got"
|
|
86
|
+
|
|
68
87
|
printf 'r\n' > "$repo/red"
|
|
69
88
|
git -C "$repo" add red
|
|
70
89
|
git -C "$repo" -c user.name=t -c user.email=t@e.invalid commit -qm red
|
|
@@ -89,11 +108,13 @@ printf 'b\n' >> "$repo/a.txt"
|
|
|
89
108
|
out="$(battery GATE_SDK_VERDICT_STORE="$scratch/modified")"; rc=$?
|
|
90
109
|
[[ "$rc" -eq 1 ]] || fail "modified run" "expected exit 1, got $rc" "$out"
|
|
91
110
|
[[ ! -e "$scratch/modified" ]] || fail "modified run" "a modified tree kept a verdict" "$(ls -A "$scratch/modified")"
|
|
111
|
+
got="$(verdict_key)"; rc=$?
|
|
112
|
+
[[ "$rc" -eq 2 && "$got" == '{"contract":"1.0.0","error":"refused"}' ]] || fail "verdict-key modified" "a modified tree has no key: exit $rc: $got"
|
|
92
113
|
|
|
93
114
|
key=("${pass_key[@]}")
|
|
94
115
|
got="$(lookup)"; rc=$?
|
|
95
116
|
[[ "$rc" -eq 2 && "$got" == '{"contract":"1.0.0","error":"refused"}' ]] || fail "unset store" "exit $rc: $got"
|
|
96
117
|
|
|
97
118
|
[[ "$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)"
|
|
119
|
+
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, --verdict-key printed the stored key, refused a modified tree and an unknown operand at exit 2, 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
120
|
exit 0
|
|
@@ -10,7 +10,8 @@ case "${OSTYPE:-}" in msys* | cygwin* | win32*) _th_sep=';' ;; esac
|
|
|
10
10
|
# spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — the empty files live in a directory private to this
|
|
11
11
|
# user, made mode 700 and owner-checked before use; a name that is not private is refused, never used
|
|
12
12
|
_th_dir="${TMPDIR:-/tmp}/gate-sdk-hermetic.$(id -u)"
|
|
13
|
-
|
|
13
|
+
# spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — a name already present is left to the checks below, never an errexit death
|
|
14
|
+
mkdir -m 700 "$_th_dir" 2>/dev/null || :
|
|
14
15
|
_th_why=
|
|
15
16
|
if [[ -L "$_th_dir" || ! -d "$_th_dir" ]]; then
|
|
16
17
|
_th_why='is not a directory'
|