checkwright 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/package.json +2 -2
  2. package/payload/artifact/aarch64-apple-darwin/checkwright-gates +0 -0
  3. package/payload/artifact/aarch64-apple-darwin/checkwright-gates.sha256 +1 -1
  4. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe +0 -0
  5. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -1
  6. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates +0 -0
  7. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  8. package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates +0 -0
  9. package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates.sha256 +1 -1
  10. package/payload/artifact/x86_64-apple-darwin/checkwright-gates +0 -0
  11. package/payload/artifact/x86_64-apple-darwin/checkwright-gates.sha256 +1 -1
  12. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe +0 -0
  13. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -1
  14. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  15. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  16. package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates +0 -0
  17. package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates.sha256 +1 -1
  18. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/expect.txt +1 -0
  19. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/out/short.bin +0 -0
  20. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/scripts/gate-sdk-config.knobs +1 -1
  21. package/payload/gate-sdk/gate-tests/check-binary-strings/bad/terms.list +2 -0
  22. package/payload/gate-sdk/gate-tests/check-binary-strings/good/expect.txt +1 -1
  23. package/payload/gate-sdk/gate-tests/check-binary-strings/good/out/app.elf +0 -0
  24. package/payload/gate-sdk/gate-tests/check-binary-strings/good/shapes.list +2 -0
  25. package/payload/gate-sdk/gate-tests/check-binary-strings/good/terms.list +1 -1
  26. package/payload/gate-sdk/gate-tests/check-exec-write/bad/expect.txt +1 -0
  27. package/payload/gate-sdk/gate-tests/check-exec-write/bad/src/sites.rs +2 -0
  28. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/expect.txt +1 -0
  29. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0005_accounts.sql +2 -0
  30. package/payload/gate-sdk/gate-tests/check-migration-guard/bad/migrations/0005_users.sql +2 -0
  31. package/payload/gate-sdk/gate-tests/check-migration-guard/good/expect.txt +1 -1
  32. package/payload/gate-sdk/gate-tests/check-migration-guard/good/migrations/0004_index_accounts.sql +2 -0
  33. package/payload/gate-sdk/gate-tests/check-migration-guard.test.sh +142 -1
  34. package/payload/gate-sdk/gate-tests/check-pipefail-readers.test.sh +14 -1
  35. package/payload/gate-sdk/gate-tests/lib-test-hermetic.test.sh +35 -1
  36. package/payload/gate-sdk/lib/test-hermetic.sh +23 -6
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "checkwright-pwsh": "bin/checkwright.ps1"
5
5
  },
6
6
  "checkwright": {
7
- "commit": "892e3205c56b5fc4d86189219d1d774a74fd1b06",
7
+ "commit": "2e3829b7949e2d8913f5f107c1ff3112ad4f4e45",
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.39.0"
33
+ "version": "0.40.0"
34
34
  }
@@ -1 +1 @@
1
- 86e0016a79259df3d8d4858427c6cffc2b2019f8acd8303432cd2fb00fd1407e checkwright-gates
1
+ e09b5ef676ed78a181428c727f6d447e84be570c9468d78e8e282d026bcb8b25 checkwright-gates
@@ -1 +1 @@
1
- 6a1c469eff394cd85836f6f7fb54229d745ae2e1f5bba34ffa3cf1b903147e3c *checkwright-gates.exe
1
+ a5445cb0f0e4d56b7ea2aa7acdcc1ebde79bc9b061a93f241f570c2647e63285 *checkwright-gates.exe
@@ -1 +1 @@
1
- 4a549a4b73980ad9e5dfdbaf2d50bbafd54a11f76cb9c894b24ffbfce1e55e13 checkwright-gates
1
+ e0cd948fa96395b0a06c3cf625f3cc2e0957b7486f18d41dcd315de9eaa2de4f checkwright-gates
@@ -1 +1 @@
1
- bfe700ee5b61391413ffc1413296c47f59bc574cb1139e658d8badb12eafc1b1 checkwright-gates
1
+ adc1fda79f55afe532a9dcb51a8f0164cf46f03ce97c3b8366b6a31167bbd9bb checkwright-gates
@@ -1 +1 @@
1
- 0397efb3d03bd967a535896b23c5f7dcb4350fcccaa205a581dc8231b07fbd94 checkwright-gates
1
+ 7c825970054bf02e71fad210231af4dd9948bb862bd25cf541fd4492c98e9133 checkwright-gates
@@ -1 +1 @@
1
- ad05dc0ad3a1d300192d3eb21d3c7bdf16fb02fed998a0cddfcf5631120735a7 *checkwright-gates.exe
1
+ 14ce4c25e15fc6071c5c541846814dc259c04252fcdb40ce348c3393201b5bdd *checkwright-gates.exe
@@ -1 +1 @@
1
- 2079dd8e6489b397d0de8f5b67a27b0816e0a468e5d63af42fd8c62fc7232be1 checkwright-gates
1
+ 2bfa0ab369c5435f913e62913a37354b9204464a5098a5f671664a15f94e32d5 checkwright-gates
@@ -1 +1 @@
1
- f4b996865880fc42a5683cac7c8e7eddd44fff6b106925991c0e7537a689080b checkwright-gates
1
+ 34ac325b19d6bb2c160746642b33893ef157d4e34e95acdee9c2fe7af47b186f checkwright-gates
@@ -2,3 +2,4 @@ carry a deny term or a leak shape
2
2
  out/app.elf@83: [HOME-PATH] shape 1
3
3
  out/app.elf@115: [CODENAME] term 1
4
4
  out/notes.bin@11: [CODENAME] term 1
5
+ out/short.bin@1: [CODENAME] term 2
@@ -1,3 +1,3 @@
1
- GATE_SDK_STRINGS_FILES = out/app.elf out/notes.bin
1
+ GATE_SDK_STRINGS_FILES = out/app.elf out/notes.bin out/short.bin
2
2
  GATE_SDK_STRINGS_SHAPES = shapes.list
3
3
  GATE_SDK_DENY_TERMS = terms.list
@@ -1,2 +1,4 @@
1
1
  # rule: CODENAME
2
2
  zephyr
3
+ # A three-byte term, alone in a three-byte run.
4
+ qux
@@ -1 +1 @@
1
- BINARY-STRINGS: clean (1 build output(s) scanned; none carry the 2 deny term(s) or 1 shape(s))
1
+ BINARY-STRINGS: clean (1 build output(s) scanned; none carry the 2 deny term(s) or 2 shape(s))
@@ -1,2 +1,4 @@
1
1
  # rule: HOME-PATH
2
2
  /(home|root|Users)/
3
+ # A two-byte run carries this shape, and a run shorter than the floor is no string.
4
+ qu
@@ -1,4 +1,4 @@
1
1
  # rule: CODENAME
2
2
  zephyr
3
- # A three-byte term: its only occurrence is a run too short to be a string.
3
+ # The shortest term, three bytes, sets the string floor at 3.
4
4
  qux
@@ -11,3 +11,4 @@ src/sites.rs:15: [EXEC-WRITE] creat
11
11
  src/sites.rs:16: [EXEC-WRITE] copy
12
12
  src/sites.rs:17: [EXEC-WRITE] chmod
13
13
  src/sites.rs:18: [EXEC-WRITE] S_IXUSR
14
+ src/sites.rs:19: [EXEC-WRITE] copy
@@ -16,4 +16,6 @@ pub fn every_site(p: &str, fd: i32, mode: u32) {
16
16
  let _ = fs::copy(p, "out");
17
17
  let _ = Command::new("chmod").arg("+x").arg(p);
18
18
  let _ = libc::S_IXUSR;
19
+ let _ = std::fs ::
20
+ copy(p, "spaced");
19
21
  }
@@ -3,5 +3,6 @@ migrations/0002_orders.sql: [MIGRATION-EDITED]
3
3
  migrations/0003_audit.sql: [MIGRATION-EDITED]
4
4
  migrations/0003_audit_log.sql: [MIGRATION-ORDER] 0003 <= 0003
5
5
  migrations/0002_late.sql: [MIGRATION-ORDER] 0002 <= 0003
6
+ migrations/0005_users.sql: [MIGRATION-DUP] 0005 also 0005_accounts.sql
6
7
  migrations/0004_prune.sql:1: [MIGRATION-DESTRUCTIVE] matches 'DROP (TABLE|INDEX|VIEW|TRIGGER)'
7
8
  migrations/0004_prune.sql:2: [MIGRATION-DESTRUCTIVE] matches 'ALTER TABLE .* DROP', its waiver reason empty
@@ -0,0 +1,2 @@
1
+ -- Two additions above the base's highest sharing one number: the first by name stands.
2
+ CREATE TABLE accounts (id INTEGER PRIMARY KEY);
@@ -0,0 +1,2 @@
1
+ -- The second addition by name under 0005, a duplicate.
2
+ CREATE TABLE users (id INTEGER PRIMARY KEY);
@@ -1 +1 @@
1
- MIGRATION-GUARD: clean (3 migration(s), 1 added, against base)
1
+ MIGRATION-GUARD: clean (4 migration(s), 2 added, against base; clash check off: no base ref under --base-dir)
@@ -0,0 +1,2 @@
1
+ -- A second addition, numbered above the first.
2
+ CREATE INDEX accounts_name ON accounts (name);
@@ -24,6 +24,12 @@ expect() { # expect <label> <want-rc> <substring> <got-rc> <output>
24
24
  fi
25
25
  }
26
26
 
27
+ refute() { # refute <label> <substring> <output>
28
+ if grep -qF -- "$2" <<<"$3"; then
29
+ echo " FAIL [$1]: output holds '$2': $3"; fails=$((fails + 1))
30
+ fi
31
+ }
32
+
27
33
  LIST="$SANDBOX/destructive.list"
28
34
  printf '# the template floor\nDROP (TABLE|INDEX|VIEW|TRIGGER)\nALTER TABLE .* DROP\nALTER TABLE .* RENAME\n' > "$LIST"
29
35
 
@@ -71,6 +77,42 @@ git -C "$r" -c user.name=t -c user.email=t@e.invalid commit -qam edit
71
77
  out="$(guard "$r")"; rc=$?
72
78
  expect edit-committed 1 'db/migrations/0001_a.sql: [MIGRATION-EDITED]' "$rc" "$out"
73
79
 
80
+ # --- the checkout form: a clean filter hiding an edit from git diff reds, an untouched file in an
81
+ # autocrlf or an LF clone is clean, and an edit in the autocrlf clone reds.
82
+ r="$(fresh filtered)"
83
+ git -C "$r" config filter.strip.clean "tr -d '#'"
84
+ git -C "$r" config filter.strip.smudge cat
85
+ printf '*.sql filter=strip\n' > "$r/.git/info/attributes"
86
+ printf 'CREATE TABLE a (id INTEGER);#\n' > "$r/db/migrations/0001_a.sql"
87
+ out="$(guard "$r")"; rc=$?
88
+ expect filter-hidden-edit 1 'db/migrations/0001_a.sql: [MIGRATION-EDITED]' "$rc" "$out"
89
+ refute filter-untouched 'db/migrations/0002_b.sql: [MIGRATION-EDITED]' "$out"
90
+ o="$(fresh clone-src)"
91
+ git -C "$o" checkout -q main
92
+ r="$SANDBOX/crlf"
93
+ git clone -q -c core.autocrlf=true "$o" "$r" && git -C "$r" checkout -qb topic
94
+ out="$(guard "$r")"; rc=$?
95
+ expect autocrlf-untouched 0 'clean (2 migration(s), 0 added, against merge base' "$rc" "$out"
96
+ printf 'CREATE TABLE b (id INTEGER, y TEXT);\r\n' > "$r/db/migrations/0002_b.sql"
97
+ out="$(guard "$r")"; rc=$?
98
+ expect autocrlf-edit 1 'db/migrations/0002_b.sql: [MIGRATION-EDITED]' "$rc" "$out"
99
+ r="$SANDBOX/lf"
100
+ git clone -q "$o" "$r" && git -C "$r" checkout -qb topic
101
+ out="$(guard "$r")"; rc=$?
102
+ expect lf-untouched 0 'clean (2 migration(s), 0 added, against merge base' "$rc" "$out"
103
+
104
+ # --- a conversion attribute changed since the merge base reds; a filter naming no configured
105
+ # driver cannot be read in its checkout form, which is 3, never a pass.
106
+ r="$(fresh attr-drift)"
107
+ printf 'db/migrations/*.sql eol=lf\n' > "$r/.gitattributes"
108
+ out="$(guard "$r")"; rc=$?
109
+ expect attr-drift 1 'db/migrations/0001_a.sql: [MIGRATION-ATTR] eol unspecified -> lf' "$rc" "$out"
110
+ refute attr-drift-edit 'MIGRATION-EDITED' "$out"
111
+ r="$(fresh no-driver)"
112
+ printf '*.sql filter=nodriver\n' > "$r/.git/info/attributes"
113
+ out="$(guard "$r")"; rc=$?
114
+ expect no-driver 3 "its filter attribute names driver 'nodriver'" "$rc" "$out"
115
+
74
116
  # --- a delete and a rename.
75
117
  r="$(fresh delete)"
76
118
  git -C "$r" rm -q db/migrations/0002_b.sql
@@ -103,6 +145,105 @@ out="$( cd "$r" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations GATE_SDK_MIGRAT
103
145
  && gate_run check-migration-guard "$CHECKS" 2>&1 )"; rc=$?
104
146
  expect list-absent 0 'destructive check off: no list at absent.list' "$rc" "$out"
105
147
 
148
+ # --- the width is the directory's own: a five-digit history takes a five-digit addition, and a
149
+ # four-digit history refuses a five-digit one at 3, naming it.
150
+ r="$SANDBOX/wide"
151
+ mkdir -p "$r/db/migrations"
152
+ git -C "$r" init -q -b main
153
+ printf 'CREATE TABLE a (id INTEGER);\n' > "$r/db/migrations/00001_a.sql"
154
+ git -C "$r" add db
155
+ git -C "$r" -c user.name=t -c user.email=t@e.invalid commit -qm base
156
+ git -C "$r" checkout -qb topic
157
+ printf 'CREATE TABLE b (id INTEGER);\n' > "$r/db/migrations/00002_b.sql"
158
+ out="$(guard "$r")"; rc=$?
159
+ expect five-digit-history 0 'clean (2 migration(s), 1 added, against merge base' "$rc" "$out"
160
+ r="$(fresh widened)"
161
+ printf 'CREATE TABLE c (id INTEGER);\n' > "$r/db/migrations/10003_c.sql"
162
+ out="$(guard "$r")"; rc=$?
163
+ expect width-mixed 3 'db/migrations/10003_c.sql: its number is 5 digit(s) wide' "$rc" "$out"
164
+
165
+ # A commit on <branch> adding one migration, the topic branch checked out again after it.
166
+ on() { # on <repo> <branch> <file> <content> — branch made from main when absent
167
+ local r="$1"
168
+ git -C "$r" checkout -q "$2" 2>/dev/null || git -C "$r" checkout -qb "$2" main
169
+ printf '%s\n' "$4" > "$r/db/migrations/$3"
170
+ git -C "$r" add db
171
+ git -C "$r" -c user.name=t -c user.email=t@e.invalid commit -qm "$3"
172
+ git -C "$r" checkout -q topic
173
+ }
174
+
175
+ # --- a clash with an unmerged sibling, and none for one adding the same name with other content.
176
+ r="$(fresh clash)"
177
+ on "$r" sib 0003_theirs.sql 'CREATE TABLE t (id INTEGER);'
178
+ printf 'CREATE TABLE m (id INTEGER);\n' > "$r/db/migrations/0003_mine.sql"
179
+ out="$(guard "$r")"; rc=$?
180
+ expect clash 1 'db/migrations/0003_mine.sql: [MIGRATION-CLASH] 0003 refs/heads/sib 0003_theirs.sql' "$rc" "$out"
181
+ r="$(fresh same-name)"
182
+ on "$r" sib 0003_c.sql 'CREATE TABLE theirs (id INTEGER);'
183
+ printf 'CREATE TABLE mine (id INTEGER);\n' > "$r/db/migrations/0003_c.sql"
184
+ out="$(guard "$r")"; rc=$?
185
+ expect same-name 0 'clean (3 migration(s), 1 added, against merge base' "$rc" "$out"
186
+ expect same-name-read 0 ', 1 other ref(s) read' "$rc" "$out"
187
+
188
+ # --- a sibling merged into the base after the branch forked reads as ORDER, never CLASH; a file
189
+ # the base took by cherry-pick under its name is the base's, and the branch passes clean.
190
+ r="$(fresh merged)"
191
+ on "$r" sib 0003_theirs.sql 'CREATE TABLE t (id INTEGER);'
192
+ git -C "$r" checkout -q main && git -C "$r" merge -q --ff-only sib && git -C "$r" checkout -q topic
193
+ printf 'CREATE TABLE m (id INTEGER);\n' > "$r/db/migrations/0003_mine.sql"
194
+ out="$(guard "$r")"; rc=$?
195
+ expect merged-after-fork 1 'db/migrations/0003_mine.sql: [MIGRATION-ORDER] 0003 <= 0003' "$rc" "$out"
196
+ refute merged-after-fork 'MIGRATION-CLASH' "$out"
197
+ r="$(fresh picked)"
198
+ on "$r" topic 0003_c.sql 'DROP TABLE a;'
199
+ git -C "$r" checkout -q main && git -C "$r" -c user.name=t -c user.email=t@e.invalid cherry-pick topic >/dev/null \
200
+ && git -C "$r" checkout -q topic
201
+ out="$(guard "$r")"; rc=$?
202
+ expect cherry-picked 0 'clean (3 migration(s), 0 added, against merge base' "$rc" "$out"
203
+
204
+ # --- the precedence: an addition both a duplicate and a clash prints DUP alone.
205
+ r="$(fresh precedence)"
206
+ on "$r" sib 0003_q.sql 'CREATE TABLE q (id INTEGER);'
207
+ printf 'CREATE TABLE a2 (id INTEGER);\n' > "$r/db/migrations/0003_a.sql"
208
+ printf 'CREATE TABLE b2 (id INTEGER);\n' > "$r/db/migrations/0003_b.sql"
209
+ out="$(guard "$r")"; rc=$?
210
+ expect precedence-dup 1 'db/migrations/0003_b.sql: [MIGRATION-DUP] 0003 also 0003_a.sql' "$rc" "$out"
211
+ expect precedence-clash 1 'db/migrations/0003_a.sql: [MIGRATION-CLASH] 0003 refs/heads/sib 0003_q.sql' "$rc" "$out"
212
+ refute precedence-one 'db/migrations/0003_b.sql: [MIGRATION-CLASH]' "$out"
213
+
214
+ # --- the ref set: a detached HEAD excludes no ref, an orphan is skipped, `none` turns the check
215
+ # off, a glob narrows it, and a glob opening with '-' is refused at 2.
216
+ r="$(fresh detached)"
217
+ on "$r" topic 0003_c.sql 'CREATE TABLE c (id INTEGER);'
218
+ out="$(guard "$r")"; rc=$?
219
+ expect own-ref 0 ', 0 other ref(s) read' "$rc" "$out"
220
+ git -C "$r" checkout -q --detach topic
221
+ out="$(guard "$r")"; rc=$?
222
+ expect detached 0 ', 1 other ref(s) read' "$rc" "$out"
223
+ o="$SANDBOX/orphan-src"
224
+ mkdir -p "$o/db/migrations"
225
+ git -C "$o" init -q -b main
226
+ printf 'CREATE TABLE x (id INTEGER);\n' > "$o/db/migrations/0003_x.sql"
227
+ git -C "$o" add db
228
+ git -C "$o" -c user.name=t -c user.email=t@e.invalid commit -qm lone
229
+ r="$(fresh orphan)"
230
+ git -C "$r" fetch -q "$o" main:refs/heads/lone
231
+ printf 'CREATE TABLE m (id INTEGER);\n' > "$r/db/migrations/0003_mine.sql"
232
+ out="$(guard "$r")"; rc=$?
233
+ expect orphan 0 'clean (3 migration(s), 1 added, against merge base' "$rc" "$out"
234
+ expect orphan-unread 0 ', 0 other ref(s) read' "$rc" "$out"
235
+ r="$SANDBOX/clash"
236
+ refs() { # refs <value> — the gate in the clash repository under GATE_SDK_MIGRATION_REFS=<value>
237
+ ( cd "$r" && gate_env GATE_SDK_MIGRATION_DIR=db/migrations GATE_SDK_MIGRATION_DESTRUCTIVE="$LIST" \
238
+ GATE_SDK_MIGRATION_REFS="$1" && gate_run check-migration-guard "$CHECKS" 2>&1 )
239
+ }
240
+ out="$(refs none)"; rc=$?
241
+ expect refs-none 0 '; clash check off: GATE_SDK_MIGRATION_REFS is none' "$rc" "$out"
242
+ out="$(refs 'refs/heads/feat/**')"; rc=$?
243
+ expect refs-narrowed 0 ', 0 other ref(s) read' "$rc" "$out"
244
+ out="$(refs -x)"; rc=$?
245
+ expect refs-option 2 "'-x' opens with '-'" "$rc" "$out"
246
+
106
247
  # --- a stray file is 3; an unresolved base, a malformed list and a bad argument are 2.
107
248
  r="$(fresh refusals)"
108
249
  printf 'notes\n' > "$r/db/migrations/README.md"
@@ -132,5 +273,5 @@ if [[ "$fails" -gt 0 ]]; then
132
273
  echo "check-migration-guard.test.sh: $fails case(s) failed"
133
274
  exit 1
134
275
  fi
135
- echo "check-migration-guard.test.sh: clean (the git arm's edit, delete, rename, order and destructive cases, and its exit classes — $cases cases)"
276
+ echo "check-migration-guard.test.sh: clean (the git arm's edit, checkout-form, attribute-drift, missing-driver, delete, rename, order, width, duplicate, clash, ref-set and destructive cases, and its exit classes — $cases cases)"
136
277
  exit 0
@@ -57,6 +57,19 @@ out="$( cd "$SANDBOX/empty" && gate_env GATE_SDK_PIPEFAIL_ALL=yes \
57
57
  && gate_run check-pipefail-readers "$CHECKS" 2>&1 )"; rc=$?
58
58
  expect all-value 2 'GATE_SDK_PIPEFAIL_ALL must be 0|1' "$rc" "$out"
59
59
 
60
+ # --- the waiver floor is the consumer's: a five-character reason the default passes reds under
61
+ # a floor of 10, and a value that is no positive integer is refused at 2.
62
+ mkdir -p "$SANDBOX/floor"
63
+ printf '#!/usr/bin/env bash\nset -o pipefail\nls | head -1 # pipefail-ok: short\n' > "$SANDBOX/floor/waived.sh"
64
+ out="$( cd "$SANDBOX/floor" && gate_run check-pipefail-readers "$CHECKS" waived.sh 2>&1 )"; rc=$?
65
+ expect floor-default 0 'clean (1 shell file(s) read' "$rc" "$out"
66
+ out="$( cd "$SANDBOX/floor" && gate_env GATE_SDK_PIPEFAIL_WAIVER_MIN=10 \
67
+ && gate_run check-pipefail-readers "$CHECKS" waived.sh 2>&1 )"; rc=$?
68
+ expect floor-raised 1 'waived.sh:3: [PIPEFAIL-EARLY-EXIT] waiver reason under 10 characters' "$rc" "$out"
69
+ out="$( cd "$SANDBOX/floor" && gate_env GATE_SDK_PIPEFAIL_WAIVER_MIN=0 \
70
+ && gate_run check-pipefail-readers "$CHECKS" waived.sh 2>&1 )"; rc=$?
71
+ expect floor-value 2 'GATE_SDK_PIPEFAIL_WAIVER_MIN must be a positive integer' "$rc" "$out"
72
+
60
73
  # --- a span the reader cannot read is LINT-PARSE at 3, and the fix arm writes nothing to it.
61
74
  mkdir -p "$SANDBOX/parse"
62
75
  printf '#!/usr/bin/env bash\nset -o pipefail\necho "open\nls | head -1\n' > "$SANDBOX/parse/broken.sh"
@@ -110,5 +123,5 @@ if [[ "$fails" -gt 0 ]]; then
110
123
  echo "check-pipefail-readers.test.sh: $fails case(s) failed"
111
124
  exit 1
112
125
  fi
113
- echo "check-pipefail-readers.test.sh: clean (configuration, operands, exit classes, the whole-file knob, pruning and the fix arm — $cases cases)"
126
+ echo "check-pipefail-readers.test.sh: clean (configuration, operands, exit classes, the whole-file knob, the waiver floor, pruning and the fix arm — $cases cases)"
114
127
  exit 0
@@ -39,4 +39,38 @@ leaked="$(env -u GIT_CONFIG_NOSYSTEM "$system=$hostile/system.config" GIT_CONFIG
39
39
  printf 'FAIL: a sourcing suite read host git config: %s\n' "$leaked"
40
40
  exit 1
41
41
  }
42
- echo 'LIB-TEST-HERMETIC: clean (inherited kit variables cleared, binary kept, library and later pins applied, host git config unread)'
42
+
43
+ # A name under the temp dir that is not private to this user is refused at 3 and never written:
44
+ # a link to another directory, and off native Windows a directory open to others.
45
+ mkdir -p "$hostile/tmp-link" "$hostile/target" "$hostile/tmp-open/gate-sdk-hermetic.$(id -u)"
46
+ ln -s "$hostile/target" "$hostile/tmp-link/gate-sdk-hermetic.$(id -u)"
47
+ TMPDIR="$hostile/tmp-link" bash -c 'source "$1"' bash "$GATE_SDK_TEST_LIB_DIR/test-hermetic.sh" 2>/dev/null
48
+ rc=$?
49
+ [[ "$rc" == 3 && -z "$(ls -A "$hostile/target")" ]] || {
50
+ printf 'FAIL: a linked private-dir name was used (exit %s): %s\n' "$rc" "$(ls -A "$hostile/target")"
51
+ exit 1
52
+ }
53
+ case "${OSTYPE:-}" in
54
+ msys* | cygwin* | win32*) ;;
55
+ *)
56
+ open="$hostile/tmp-open/gate-sdk-hermetic.$(id -u)"
57
+ chmod 755 "$open"
58
+ TMPDIR="$hostile/tmp-open" bash -c 'source "$1"' bash "$GATE_SDK_TEST_LIB_DIR/test-hermetic.sh" 2>/dev/null
59
+ rc=$?
60
+ [[ "$rc" == 3 && -z "$(ls -A "$open")" ]] || {
61
+ printf 'FAIL: an open private-dir name was used (exit %s)\n' "$rc"
62
+ exit 1
63
+ }
64
+ ;;
65
+ esac
66
+ fresh="$hostile/tmp-fresh"
67
+ mkdir -p "$fresh"
68
+ TMPDIR="$fresh" bash -c 'source "$1"' bash "$GATE_SDK_TEST_LIB_DIR/test-hermetic.sh" || {
69
+ echo 'FAIL: a fresh temp dir refused the private dir'
70
+ exit 1
71
+ }
72
+ [[ -f "$fresh/gate-sdk-hermetic.$(id -u)/empty.knobs" ]] || {
73
+ echo 'FAIL: the empty files are not under the private dir'
74
+ exit 1
75
+ }
76
+ echo 'LIB-TEST-HERMETIC: clean (inherited kit variables cleared, binary kept, library and later pins applied, host git config unread, a non-private temp name refused)'
@@ -5,9 +5,28 @@
5
5
  # shellcheck disable=SC2164 # the anchor is the contract's bare builtin, which check-path-dialect clears only as the whole line; a failed chdir leaves the cwd where it was
6
6
  cd "$(pwd -P)"
7
7
  _th_root="$(cd "${BASH_SOURCE[0]%/*}/../.." && pwd)"
8
- _th_empty="${TMPDIR:-/tmp}/gate-sdk-hermetic-empty.sh"
8
+ _th_sep=:
9
+ case "${OSTYPE:-}" in msys* | cygwin* | win32*) _th_sep=';' ;; esac
10
+ # spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — the empty files live in a directory private to this
11
+ # user, made mode 700 and owner-checked before use; a name that is not private is refused, never used
12
+ _th_dir="${TMPDIR:-/tmp}/gate-sdk-hermetic.$(id -u)"
13
+ mkdir -m 700 "$_th_dir" 2>/dev/null
14
+ _th_why=
15
+ if [[ -L "$_th_dir" || ! -d "$_th_dir" ]]; then
16
+ _th_why='is not a directory'
17
+ elif [[ ! -O "$_th_dir" ]]; then
18
+ _th_why='is owned by another user'
19
+ elif [[ "$_th_sep" == : ]]; then
20
+ case "$(ls -ld "$_th_dir")" in d???------*) ;; *) _th_why='is open to group or other' ;; esac
21
+ fi
22
+ if [[ -n "$_th_why" ]]; then
23
+ printf 'test-hermetic.sh: %s %s, so nothing is written there; remove it, or point TMPDIR at a directory of your own\n' \
24
+ "$_th_dir" "$_th_why" >&2
25
+ exit 3
26
+ fi
27
+ _th_empty="$_th_dir/empty.sh"
9
28
  : >"$_th_empty"
10
- _th_empty_knobs="${TMPDIR:-/tmp}/gate-sdk-hermetic-empty.knobs"
29
+ _th_empty_knobs="$_th_dir/empty.knobs"
11
30
  : >"$_th_empty_knobs"
12
31
  for _th_kit in "$_th_root"/gate-sdk "$_th_root"/*-kit; do
13
32
  [[ -d "$_th_kit" ]] || continue
@@ -20,12 +39,10 @@ for _th_kit in "$_th_root"/gate-sdk "$_th_root"/*-kit; do
20
39
  [[ "$_th_var" == GATE_SDK ]] || export "${_th_var}_LOCAL_KNOB_FILE=${_th_empty_knobs}"
21
40
  done
22
41
  # spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — the temp dir the suite is handed heads the git ceiling list
23
- _th_sep=:
24
- case "${OSTYPE:-}" in msys* | cygwin* | win32*) _th_sep=';' ;; esac
25
42
  _th_tmp="$(cd -P "${TMPDIR:-/tmp}" && pwd -P)"
26
43
  export GIT_CEILING_DIRECTORIES="${_th_tmp}${GIT_CEILING_DIRECTORIES:+${_th_sep}${GIT_CEILING_DIRECTORIES}}"
27
44
  # spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — git reads no host global config, and no system config off native Windows
28
- _th_git_global="${TMPDIR:-/tmp}/gate-sdk-hermetic-empty.gitconfig"
45
+ _th_git_global="$_th_dir/empty.gitconfig"
29
46
  : >"$_th_git_global"
30
47
  export GIT_CONFIG_GLOBAL="$_th_git_global"
31
48
  [[ "$_th_sep" == ';' ]] || export GIT_CONFIG_NOSYSTEM=1
@@ -44,7 +61,7 @@ if [[ -z "${GATE_SDK_NATIVE_BIN:-}" ]]; then
44
61
  fi
45
62
  # spec: gate-sdk/SPEC.md §lib/test-hermetic.sh — gate-sdk's overlay is pinned after the binary read above, outside its already-set guard
46
63
  export GATE_SDK_LOCAL_KNOB_FILE="$_th_empty_knobs"
47
- unset _th_name _th_root _th_empty _th_empty_knobs _th_kit _th_var _th_bin _th_sep _th_tmp _th_git_global
64
+ unset _th_name _th_root _th_empty _th_empty_knobs _th_kit _th_var _th_bin _th_sep _th_tmp _th_git_global _th_dir _th_why
48
65
 
49
66
  # spec: gate-sdk/SPEC.md §run-gate-tests — invoke a gate through its declared dispatch rather
50
67
  # than by script path, so a bespoke test names a gate and never a substrate: gate_command