diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index e121d96b..6a42e11d 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -270,6 +270,9 @@ jobs:
- name: Identify-changes tests
run: ./scripts/quality-gate/fixtures-identify-changes/run.sh
+ - name: Unexpected-exit tests
+ run: ./scripts/quality-gate/fixtures-unexpected-exit/run.sh
+
- name: Mark-API-shipped tests
run: ./scripts/quality-gate/fixtures-mark-api/run.sh
diff --git a/scripts/quality-gate/README.md b/scripts/quality-gate/README.md
index 07e471e5..7add9bf1 100644
--- a/scripts/quality-gate/README.md
+++ b/scripts/quality-gate/README.md
@@ -47,7 +47,7 @@ Unit tests are the `Unit` and `Contract` categories. Packing also validates each
| `--bypass-format` | stage 1b without failing |
| `--overwrite-baseline` | also saves lower warning counts to the baseline |
-Exit codes: 0 pass, 1 fail, 2 incomplete, 3 usage or environment error. The report is `
/.gate/report.json`, with logs in `/.gate/logs/`. A failed build lists its errors; in CI, a failed gate job keeps `.gate/` as an artifact.
+Exit codes: 0 pass, 1 fail, 2 incomplete, 3 usage or environment error. Any other stop is a bug in the gate: it prints the command that failed and writes no report. The report is `/.gate/report.json`, with logs in `/.gate/logs/`. A failed build lists its errors; in CI, a failed gate job keeps `.gate/` as an artifact.
## Configuration
@@ -65,7 +65,7 @@ An intended API break is accepted with the `CompatibilitySuppressions.xml` from
| `build-and-test.yml` | Gate (unit) | `--unit`; on a PR, compares coverage with master's; on master, saves coverage and the packages to release |
| `build-and-test.yml` | Gate (E2E) | starts a local Supabase while building, then `--e2e` |
| `build-and-test.yml` | Waiting for the test suite to finish | passes when both parts pass; the check to require |
-| `build-and-test.yml` | Quality gate tests | the five test suites below, when `scripts/quality-gate/` changes |
+| `build-and-test.yml` | Quality gate tests | the six test suites below, when `scripts/quality-gate/` changes |
| `mutation.yml` | Mutation testing | Stryker on changed files, then `--mutation` |
| `release.yml` | Publish tested packages | pushes the packages the gate built for the released commit |
@@ -79,6 +79,7 @@ An intended API break is accepted with the `CompatibilitySuppressions.xml` from
./scripts/quality-gate/fixtures-compare-baselines/run.sh
./scripts/quality-gate/fixtures-compare-coverage/run.sh
./scripts/quality-gate/fixtures-identify-changes/run.sh
+./scripts/quality-gate/fixtures-unexpected-exit/run.sh
./scripts/quality-gate/fixtures-mark-api/run.sh
```
diff --git a/scripts/quality-gate/fixtures-unexpected-exit/run.sh b/scripts/quality-gate/fixtures-unexpected-exit/run.sh
new file mode 100755
index 00000000..92dcfb70
--- /dev/null
+++ b/scripts/quality-gate/fixtures-unexpected-exit/run.sh
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+set -uo pipefail
+
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+LIB="$HERE/../lib"
+GATE="$HERE/../gate.sh"
+RUNROOT="${FIXTURE_RUNROOT:-${TMPDIR:-/tmp}/unexpected-exit-tests.$$}"
+
+if [[ -t 1 && -z "${NO_COLOR:-}" ]]; then
+ RED=$'\033[31m'; GRN=$'\033[32m'; DIM=$'\033[2m'; BLD=$'\033[1m'; OFF=$'\033[0m'
+else RED=""; GRN=""; DIM=""; BLD=""; OFF=""; fi
+
+mkdir -p "$RUNROOT"
+trap '[[ -n "${FIXTURE_KEEP:-}" ]] || rm -rf "$RUNROOT"' EXIT
+
+PASS=0; FAIL=0
+
+script() {
+ cat <