Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

Windows Setup E2E runs its long cases on parallel runners (GST-3303) (#4575)

Garry Tan593d7e163441
diff --git a/.github/workflows/windows-setup-e2e.yml b/.github/workflows/windows-setup-e2e.yml
index 3da65103e..b88f6b619 100644
--- a/.github/workflows/windows-setup-e2e.yml
+++ b/.github/workflows/windows-setup-e2e.yml
@@ -51,6 +51,7 @@ on:
- 'scripts/build-cso.sh'
- 'scripts/build-cso-windows.ps1'
- 'scripts/write-version-files.sh'
+ - 'scripts/windows-held-install-fixture.sh'
- 'setup'
- 'setup.ps1'
- 'test/setup-ps1.test.ts'
@@ -120,7 +121,7 @@ jobs:
env:
TRUNK_API_TOKEN: ${{ secrets.TRUNK_API_TOKEN }}
steps:
- - name: Record Trunk's verdicts for windows-setup and held-install-journey (nothing reads them)
+ - name: Record Trunk's verdicts for the Windows setup and held-install jobs (nothing reads them)
if: env.TRUNK_API_TOKEN != ''
timeout-minutes: 3
continue-on-error: true
@@ -129,7 +130,7 @@ jobs:
TRUNK_DISABLE_TELEMETRY: 'true'
with:
token: ${{ env.TRUNK_API_TOKEN }}
- job-keys: windows-setup,held-install-journey
+ job-keys: windows-setup,windows-setup-recovery,windows-setup-cso,held-install-journey,held-install-trial,held-install-later-release
github-token: ''
enable-annotation: 'true'
@@ -171,6 +172,7 @@ jobs:
scripts/build-cso.sh
scripts/build-cso-windows.ps1
scripts/write-version-files.sh
+ scripts/windows-held-install-fixture.sh
setup
setup.ps1
test/setup-ps1.test.ts
@@ -232,9 +234,6 @@ jobs:
with:
bun-version: 1.4.2
- # No bun install cache, as in windows-free-tests.yml: a cold install is
- # faster on windows-latest than restoring the ~450 MB cache entry.
-
- name: Configure git identity
run: |
git config --global user.email "[email protected]"
@@ -427,6 +426,36 @@ jobs:
fi
shell: bash
+ - name: Every setup.ps1 case ran
+ run: |
+ set -euo pipefail
+ cat "$RUNNER_TEMP/setup-cases"
+ test "$(cat "$RUNNER_TEMP/setup-cases")" = "$(printf 'ps51\nsetup-ps1-cases\nsetup-ps1-install')" || (echo "a setup.ps1 case did not run" && exit 1)
+ shell: bash
+
+ windows-setup-recovery:
+ # The false-positive recovery runs on its own runner beside windows-setup
+ # (GST-3303): it clones this checkout and runs ./setup there, so it needs
+ # nothing windows-setup builds.
+ needs: windows-scope
+ if: needs.windows-scope.outputs.install == 'true'
+ runs-on: windows-latest
+ timeout-minutes: 35
+
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
+ with:
+ bun-version: 1.4.2
+
+ - name: Configure git identity
+ run: |
+ git config --global user.email "[email protected]"
+ git config --global user.name "Windows Setup E2E"
+ git config --global init.defaultBranch main
+ shell: bash
+
- name: An install stuck on the false positive recovers with the documented command (#3088, #3100)
# A release whose bin/gstack-hook-check had the Git Bash false positive
# (v1.91.83.0's checker on this tree), then this revision on top. The
@@ -467,6 +496,43 @@ jobs:
test "$(git -C "$INSTALL" rev-parse HEAD)" != "$STUCK" || (echo "the recovery did not move the checkout" && exit 1)
shell: bash
+ windows-setup-cso:
+ # The two forced-CSO-failure cases run on their own runner beside
+ # windows-setup (GST-3303), after the same strict build they followed there.
+ needs: windows-scope
+ if: needs.windows-scope.outputs.install == 'true'
+ runs-on: windows-latest
+ timeout-minutes: 35
+
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
+ with:
+ bun-version: 1.4.2
+
+ - name: Configure git identity
+ run: |
+ git config --global user.email "[email protected]"
+ git config --global user.name "Windows Setup E2E"
+ git config --global init.defaultBranch main
+ shell: bash
+
+ - name: Install dependencies
+ run: bun install --frozen-lockfile
+ shell: bash
+
+ - name: Run bun run build (the previously-broken path)
+ # This is the regression gate. Bun's Windows shell parser rejected
+ # multiple constructs the old inline build chain used; the wave
+ # moved the build to scripts/build.sh. If this step fails on
+ # Windows, the build chain regressed.
+ run: bun run build
+ shell: bash
+ env:
+ GSTACK_SKIP_PLAYWRIGHT: '1'
+ GSTACK_STRICT_BUILD: '1'
+
- name: A forced CSO failure is fatal under GSTACK_STRICT_BUILD=1 (#3071)
run: |
set -uo pipefail
@@ -502,13 +568,6 @@ jobs:
echo "$DOCTOR" | grep -qE '^warn +cso +' || (echo "doctor did not report the CSO failure" && exit 1)
shell: bash
- - name: Every setup.ps1 case ran
- run: |
- set -euo pipefail
- cat "$RUNNER_TEMP/setup-cases"
- test "$(cat "$RUNNER_TEMP/setup-cases")" = "$(printf 'ps51\nsetup-ps1-cases\nsetup-ps1-install')" || (echo "a setup.ps1 case did not run" && exit 1)
- shell: bash
-
held-install-journey:
# #3184: MSYS tar cannot extract a symlink that precedes its target, so
# every v1.91.101.0 install on Windows holds every release. The Git Bash
@@ -544,112 +603,7 @@ jobs:
# release tree (commits built from the two trees, so the shallow
# checkout's history is never needed); fix-branch adds one file for
# the trial form.
- run: |
- set -euo pipefail
- OLD_RELEASE=47d639abffa882b8cbb641d7d1dedf08ecada9ec # v1.91.101.0
- T="$RUNNER_TEMP/held"
- rm -rf "$T" && mkdir -p "$T"
- git cat-file -e "$OLD_RELEASE^{commit}" 2>/dev/null || git fetch -q --no-tags --depth=1 origin "$OLD_RELEASE"
- c() { git commit-tree "$@"; }
- HELD=$(c -m "v1.91.101.0" "$OLD_RELEASE^{tree}")
- MAIN=$(c -p "$HELD" -m "this PR's tree" 'HEAD^{tree}')
- export GIT_INDEX_FILE="$T/fix.index"
- git read-tree "$MAIN"
- git update-index --add --cacheinfo "100644,$(printf 'trial\n' | git hash-object -w --stdin),e2e-trial-marker"
- FIX=$(c -p "$MAIN" -m "a fix branch to try" "$(git write-tree)")
- unset GIT_INDEX_FILE
- test "$(git show "$HELD:VERSION")" = 1.91.101.0 || (echo "the held tree is not v1.91.101.0" && exit 1)
- git ls-tree "$MAIN" connect-chrome | grep -q '^120000 ' || (echo "this PR's tree has no connect-chrome symlink to reproduce the hold" && exit 1)
- git init -q --bare -b main "$T/origin.git"
- git push -q "$T/origin.git" "$MAIN:refs/heads/main" "$FIX:refs/heads/fix-branch"
- printf 'HELD=%s\nMAIN=%s\nFIX=%s\n' "$HELD" "$MAIN" "$FIX" > "$T/vars"
- : > "$T/cases"
- cat > "$T/lib.sh" <<'LIB'
- T="$RUNNER_TEMP/held"
- . "$T/vars"
- INSTALL="$HOME/.claude/skills/gstack"
- STATE="$HOME/.gstack"
- LOG="$STATE/analytics/session-update.log"
- PS="${GSTACK_E2E_POWERSHELL:-powershell.exe}"
- w() { if command -v cygpath >/dev/null 2>&1; then cygpath -w "$1"; else printf '%s\n' "$1"; fi; }
- die() { echo "FAIL: $*" >&2; [ ! -f "$LOG" ] || { echo "--- updater log" && cat "$LOG"; } >&2; exit 1; }
- case_ok() { echo "$1" >> "$T/cases"; echo "CASE OK: $1"; }
- # The command docs/troubleshooting.md publishes under <!-- form:NAME -->.
- form() { awk -v m="<!-- form:$1 -->" '$0 == m { f = 1; next } f && /^```/ { if (o) exit; o = 1; next } f && o { print }' "$GITHUB_WORKSPACE/docs/troubleshooting.md"; }
- # run_ps_form NAME [REPLACEMENT-FOR-.\setup.ps1] [BRANCH]: the form,
- # verbatim, as a script under powershell.exe; prints its output.
- run_ps_form() {
- f=$(form "$1")
- case "$f" in *'{ .\setup.ps1 }') ;; *) die "form $1 is missing or does not end in .\setup.ps1: $f" ;; esac
- [ -z "${2:-}" ] || f="${f%'.\setup.ps1 }'}$2 }"
- [ -z "${3:-}" ] || f=${f//'<branch>'/$3}
- printf '%s\r\nexit $LASTEXITCODE\r\n' "$f" > "$T/form.ps1"
- "$PS" -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$(w "$T/form.ps1")" 2>&1
- }
- # run_updater PATTERN [SECONDS]: one session-start check with the
- # throttle cleared, waiting for its background run to log PATTERN.
- run_updater() {
- rm -f "$STATE/.last-session-update"
- n0=$( { cat "$LOG" 2>/dev/null || true; } | wc -l)
- ( cd "$T" && PATH="${GSTACK_E2E_UPDATER_PATH_PREFIX:+$GSTACK_E2E_UPDATER_PATH_PREFIX:}$PATH" bash "$INSTALL/bin/gstack-session-update" ) || die "the updater exited $?"
- i=0
- until tail -n +"$((n0 + 1))" "$LOG" 2>/dev/null | grep -E "$1" > "$T/updater-line"; do
- i=$((i + 1)); [ "$i" -le "${2:-180}" ] || die "no updater log line matching '$1' within ${2:-180}s"
- sleep 1
- done
- cat "$T/updater-line"
- i=0; while [ -d "$STATE/.setup-lock" ] && [ "$i" -lt 120 ]; do i=$((i + 1)); sleep 1; done
- }
- # install_state clean|dirty|unmerged: a prefix-mode v1.91.101.0
- # install one release behind origin's main.
- install_state() {
- rm -rf "$INSTALL" "$STATE"
- mkdir -p "$(dirname "$INSTALL")"
- git clone -q "$T/origin.git" "$INSTALL"
- git -C "$INSTALL" reset -q --hard "$HELD"
- GSTACK_SETUP_RUNNING=1 bash "$INSTALL/bin/gstack-config" set auto_upgrade true
- GSTACK_SETUP_RUNNING=1 bash "$INSTALL/bin/gstack-config" set skill_prefix true
- bash "$INSTALL/bin/gstack-patch-names" "$INSTALL" true >/dev/null
- ! git -C "$INSTALL" diff --quiet -- SKILL.md '*/SKILL.md' || die "prefix mode left no footprint"
- case "$1" in
- dirty)
- git -C "$INSTALL" diff -U0 "$HELD" "$MAIN" -- docs/troubleshooting.md > "$T/upstream.diff"
- L=$(sed -n 's/^-\([^-]\)/\1/p' "$T/upstream.diff" | sed -n 1p)
- [ -n "$L" ] || die "docs/troubleshooting.md has no upstream change to conflict with"
- L="$L" awk '!d && $0 == ENVIRON["L"] { print $0 " LOCAL-EDIT"; d = 1; next } { print }' "$INSTALL/docs/troubleshooting.md" > "$T/edited"
- cat "$T/edited" > "$INSTALL/docs/troubleshooting.md"
- grep -q 'LOCAL-EDIT' "$INSTALL/docs/troubleshooting.md" || die "the local edit did not apply"
- ;;
- unmerged)
- b=$(printf 'base\n' | git -C "$INSTALL" hash-object -w --stdin)
- o=$(printf 'ours LOCAL-EDIT\n' | git -C "$INSTALL" hash-object -w --stdin)
- t=$(printf 'theirs\n' | git -C "$INSTALL" hash-object -w --stdin)
- git -C "$INSTALL" update-index --force-remove README.md
- printf '100644 %s 1\tREADME.md\n100644 %s 2\tREADME.md\n100644 %s 3\tREADME.md\n' "$b" "$o" "$t" | git -C "$INSTALL" update-index --index-info
- printf '<<<<<<< ours\nours LOCAL-EDIT\n=======\ntheirs\n>>>>>>> theirs\n' > "$INSTALL/README.md"
- [ -n "$(git -C "$INSTALL" ls-files -u)" ] || die "the install has no unmerged files"
- ;;
- esac
- }
- # check_recovered STATE: at origin's main, nothing unmerged, and
- # every local edit (only those) in one rescue ref.
- check_recovered() {
- [ "$(git -C "$INSTALL" rev-parse HEAD)" = "$MAIN" ] || die "$1: the install is at $(git -C "$INSTALL" rev-parse HEAD), not $MAIN"
- [ -z "$(git -C "$INSTALL" ls-files -u)" ] || die "$1: unmerged files remain"
- [ -f "$INSTALL/bin/gstack-ff-update" ] || die "$1: bin/gstack-ff-update is missing"
- refs=$(git -C "$INSTALL" for-each-ref --format='%(refname)' refs/gstack/rescue)
- if [ "$1" = clean ]; then
- [ -z "$refs" ] || die "clean: a rescue ref was made: $refs"
- return 0
- fi
- [ "$(printf '%s\n' "$refs" | grep -c .)" = 1 ] || die "$1: expected one rescue ref, got: $refs"
- file=docs/troubleshooting.md; [ "$1" != unmerged ] || file=README.md
- git -C "$INSTALL" show "$refs:$file" > "$T/rescued"
- grep -q 'LOCAL-EDIT' "$T/rescued" || die "$1: the rescue ref lacks the local edit to $file"
- [ "$(git -C "$INSTALL" diff --name-only "$refs^" "$refs")" = "$file" ] || die "$1: the rescue ref holds more than the user's edit"
- }
- LIB
- bash -n "$T/lib.sh"
+ run: bash scripts/windows-held-install-fixture.sh
shell: bash
- name: 'Held clean and already-unmerged installs: v1.91.101.0 holds, the PowerShell recovery form recovers'
@@ -672,6 +626,50 @@ jobs:
done
shell: bash
+ - name: Every held-install case ran
+ run: |
+ set -euo pipefail
+ cat "$RUNNER_TEMP/held/cases"
+ EXPECTED='clean/v1.91.101.0-held
+ clean/recovered
+ unmerged/v1.91.101.0-held
+ unmerged/recovered'
+ test "$(cat "$RUNNER_TEMP/held/cases")" = "$(printf '%s\n' "$EXPECTED" | sed 's/^ *//')" || (echo "a held-install case did not run" && exit 1)
+ shell: bash
+
+ held-install-trial:
+ # held-install-journey's dirty-conflicting recovery, then the trial and
+ # go-back forms on the install it leaves, on their own runner (GST-3303).
+ needs: windows-scope
+ if: needs.windows-scope.outputs.install == 'true'
+ runs-on: windows-latest
+ timeout-minutes: 50
+ env:
+ GSTACK_SKIP_PLAYWRIGHT: '1'
+ GSTACK_STRICT_BUILD: '0'
+
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
+ with:
+ bun-version: 1.4.2
+
+ - name: Configure git identity
+ run: |
+ git config --global user.email "[email protected]"
+ git config --global user.name "Windows Setup E2E"
+ git config --global init.defaultBranch main
+ shell: bash
+
+ - name: Build the held-install fixture (v1.91.101.0 behind this PR's tree)
+ # origin's main carries this PR's tree on top of the v1.91.101.0
+ # release tree (commits built from the two trees, so the shallow
+ # checkout's history is never needed); fix-branch adds one file for
+ # the trial form.
+ run: bash scripts/windows-held-install-fixture.sh
+ shell: bash
+
- name: 'Held dirty-conflicting install: the PowerShell recovery form, verbatim with .\setup.ps1'
run: |
set -euo pipefail
@@ -713,6 +711,67 @@ jobs:
case_ok goback
shell: bash
+ - name: Every held-install case ran
+ run: |
+ set -euo pipefail
+ cat "$RUNNER_TEMP/held/cases"
+ EXPECTED='dirty/v1.91.101.0-held
+ dirty/recovered-and-set-up
+ trial
+ goback'
+ test "$(cat "$RUNNER_TEMP/held/cases")" = "$(printf '%s\n' "$EXPECTED" | sed 's/^ *//')" || (echo "a held-install case did not run" && exit 1)
+ shell: bash
+
+ held-install-later-release:
+ # held-install-journey's dirty-conflicting recovery, then the later release
+ # the new updater must take, on their own runner (GST-3303).
+ needs: windows-scope
+ if: needs.windows-scope.outputs.install == 'true'
+ runs-on: windows-latest
+ timeout-minutes: 50
+ env:
+ GSTACK_SKIP_PLAYWRIGHT: '1'
+ GSTACK_STRICT_BUILD: '0'
+
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
+ with:
+ bun-version: 1.4.2
+
+ - name: Configure git identity
+ run: |
+ git config --global user.email "[email protected]"
+ git config --global user.name "Windows Setup E2E"
+ git config --global init.defaultBranch main
+ shell: bash
+
+ - name: Build the held-install fixture (v1.91.101.0 behind this PR's tree)
+ # origin's main carries this PR's tree on top of the v1.91.101.0
+ # release tree (commits built from the two trees, so the shallow
+ # checkout's history is never needed); fix-branch adds one file for
+ # the trial form.
+ run: bash scripts/windows-held-install-fixture.sh
+ shell: bash
+
+ - name: 'Held dirty-conflicting install: the PowerShell recovery form, verbatim with .\setup.ps1'
+ run: |
+ set -euo pipefail
+ . "$RUNNER_TEMP/held/lib.sh"
+ install_state dirty
+ run_updater '^[^ ]+ HELD hook-check-unavailable'
+ case_ok dirty/v1.91.101.0-held
+ set +e
+ OUT=$(run_ps_form recovery-powershell)
+ CODE=$?
+ set -e
+ echo "$OUT" | tail -n 60
+ [ "$CODE" -eq 0 ] || die "dirty: the recovery form exited $CODE"
+ check_recovered dirty
+ case_ok dirty/recovered-and-set-up
+ shell: bash
+
- name: The new updater takes a later release whose symlink sorts before its target
# Pushed only now (after recovery), so the hold above is
# connect-chrome's alone. The old updater's archive | tar extraction is
@@ -738,14 +797,8 @@ jobs:
run: |
set -euo pipefail
cat "$RUNNER_TEMP/held/cases"
- EXPECTED='clean/v1.91.101.0-held
- clean/recovered
- unmerged/v1.91.101.0-held
- unmerged/recovered
- dirty/v1.91.101.0-held
+ EXPECTED='dirty/v1.91.101.0-held
dirty/recovered-and-set-up
- trial
- goback
later-release/updated'
test "$(cat "$RUNNER_TEMP/held/cases")" = "$(printf '%s\n' "$EXPECTED" | sed 's/^ *//')" || (echo "a held-install case did not run" && exit 1)
shell: bash
diff --git a/changelog.d/ci-windows-setup-e2e-parallel.md b/changelog.d/ci-windows-setup-e2e-parallel.md
new file mode 100644
index 000000000..796bed519
--- /dev/null
+++ b/changelog.d/ci-windows-setup-e2e-parallel.md
@@ -0,0 +1 @@
+**Windows Setup E2E finishes sooner on install changes.** Its two long jobs ran every case one after another, so a pull request that touched an install file waited about 8 minutes for the slower one. The false-positive recovery and the two forced-CSO-failure cases now run on their own Windows runners beside the setup case, and the held-install journey splits into three jobs (clean and already-unmerged, dirty then trial and go-back, dirty then a later release), each building the same fixture from `scripts/windows-held-install-fixture.sh`. Every case still runs on every in-scope pull request, and each job checks that its own cases ran.
diff --git a/docs/TESTING_INTERNALS.md b/docs/TESTING_INTERNALS.md
index 75a4893d5..f301a748b 100644
--- a/docs/TESTING_INTERNALS.md
+++ b/docs/TESTING_INTERNALS.md
@@ -1726,7 +1726,7 @@ only, <workflow>)":
| `free-tests.yml` | `free-suite`, `macos-named-regressions` |
| `windows-smoke.yml` | `windows-smoke` |
| `windows-scoped-tests.yml` | `windows-scoped-shard` |
-| `windows-setup-e2e.yml` | `windows-setup`, `held-install-journey` |
+| `windows-setup-e2e.yml` | `windows-setup`, `windows-setup-recovery`, `windows-setup-cso`, `held-install-journey`, `held-install-trial`, `held-install-later-release` |
| `quality-gate.yml` | `quality` |
| `evals.yml` | `build-image`, `eval-slices` |
diff --git a/scripts/windows-held-install-fixture.sh b/scripts/windows-held-install-fixture.sh
new file mode 100755
index 000000000..0b695d0f9
--- /dev/null
+++ b/scripts/windows-held-install-fixture.sh
@@ -0,0 +1,112 @@
+#!/usr/bin/env bash
+# Builds the held-install fixture for the held-install jobs in
+# .github/workflows/windows-setup-e2e.yml: a bare origin whose main carries this
+# checkout's tree on top of the v1.91.101.0 release tree, a fix-branch for the
+# trial form, and $RUNNER_TEMP/held/lib.sh, which every held-install step sources.
+# Run from the checkout root on the Windows runner (Git Bash).
+set -euo pipefail
+BASH_COMPAT=50
+OLD_RELEASE=47d639abffa882b8cbb641d7d1dedf08ecada9ec # v1.91.101.0
+T="$RUNNER_TEMP/held"
+rm -rf "$T" && mkdir -p "$T"
+git cat-file -e "$OLD_RELEASE^{commit}" 2>/dev/null || git fetch -q --no-tags --depth=1 origin "$OLD_RELEASE"
+c() { git commit-tree "$@"; }
+HELD=$(c -m "v1.91.101.0" "$OLD_RELEASE^{tree}")
+MAIN=$(c -p "$HELD" -m "this PR's tree" 'HEAD^{tree}')
+export GIT_INDEX_FILE="$T/fix.index"
+git read-tree "$MAIN"
+git update-index --add --cacheinfo "100644,$(printf 'trial\n' | git hash-object -w --stdin),e2e-trial-marker"
+FIX=$(c -p "$MAIN" -m "a fix branch to try" "$(git write-tree)")
+unset GIT_INDEX_FILE
+test "$(git show "$HELD:VERSION")" = 1.91.101.0 || (echo "the held tree is not v1.91.101.0" && exit 1)
+git ls-tree "$MAIN" connect-chrome | grep -q '^120000 ' || (echo "this PR's tree has no connect-chrome symlink to reproduce the hold" && exit 1)
+git init -q --bare -b main "$T/origin.git"
+git push -q "$T/origin.git" "$MAIN:refs/heads/main" "$FIX:refs/heads/fix-branch"
+printf 'HELD=%s\nMAIN=%s\nFIX=%s\n' "$HELD" "$MAIN" "$FIX" > "$T/vars"
+: > "$T/cases"
+cat > "$T/lib.sh" <<'LIB'
+T="$RUNNER_TEMP/held"
+. "$T/vars"
+INSTALL="$HOME/.claude/skills/gstack"
+STATE="$HOME/.gstack"
+LOG="$STATE/analytics/session-update.log"
+PS="${GSTACK_E2E_POWERSHELL:-powershell.exe}"
+w() { if command -v cygpath >/dev/null 2>&1; then cygpath -w "$1"; else printf '%s\n' "$1"; fi; }
+die() { echo "FAIL: $*" >&2; [ ! -f "$LOG" ] || { echo "--- updater log" && cat "$LOG"; } >&2; exit 1; }
+case_ok() { echo "$1" >> "$T/cases"; echo "CASE OK: $1"; }
+# The command docs/troubleshooting.md publishes under <!-- form:NAME -->.
+form() { awk -v m="<!-- form:$1 -->" '$0 == m { f = 1; next } f && /^```/ { if (o) exit; o = 1; next } f && o { print }' "$GITHUB_WORKSPACE/docs/troubleshooting.md"; }
+# run_ps_form NAME [REPLACEMENT-FOR-.\setup.ps1] [BRANCH]: the form,
+# verbatim, as a script under powershell.exe; prints its output.
+run_ps_form() {
+ f=$(form "$1")
+ case "$f" in *'{ .\setup.ps1 }') ;; *) die "form $1 is missing or does not end in .\setup.ps1: $f" ;; esac
+ [ -z "${2:-}" ] || f="${f%'.\setup.ps1 }'}$2 }"
+ [ -z "${3:-}" ] || f=${f//'<branch>'/$3}
+ printf '%s\r\nexit $LASTEXITCODE\r\n' "$f" > "$T/form.ps1"
+ "$PS" -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$(w "$T/form.ps1")" 2>&1
+}
+# run_updater PATTERN [SECONDS]: one session-start check with the
+# throttle cleared, waiting for its background run to log PATTERN.
+run_updater() {
+ rm -f "$STATE/.last-session-update"
+ n0=$( { cat "$LOG" 2>/dev/null || true; } | wc -l)
+ ( cd "$T" && PATH="${GSTACK_E2E_UPDATER_PATH_PREFIX:+$GSTACK_E2E_UPDATER_PATH_PREFIX:}$PATH" bash "$INSTALL/bin/gstack-session-update" ) || die "the updater exited $?"
+ i=0
+ until tail -n +"$((n0 + 1))" "$LOG" 2>/dev/null | grep -E "$1" > "$T/updater-line"; do
+ i=$((i + 1)); [ "$i" -le "${2:-180}" ] || die "no updater log line matching '$1' within ${2:-180}s"
+ sleep 1
+ done
+ cat "$T/updater-line"
+ i=0; while [ -d "$STATE/.setup-lock" ] && [ "$i" -lt 120 ]; do i=$((i + 1)); sleep 1; done
+}
+# install_state clean|dirty|unmerged: a prefix-mode v1.91.101.0
+# install one release behind origin's main.
+install_state() {
+ rm -rf "$INSTALL" "$STATE"
+ mkdir -p "$(dirname "$INSTALL")"
+ git clone -q "$T/origin.git" "$INSTALL"
+ git -C "$INSTALL" reset -q --hard "$HELD"
+ GSTACK_SETUP_RUNNING=1 bash "$INSTALL/bin/gstack-config" set auto_upgrade true
+ GSTACK_SETUP_RUNNING=1 bash "$INSTALL/bin/gstack-config" set skill_prefix true
+ bash "$INSTALL/bin/gstack-patch-names" "$INSTALL" true >/dev/null
+ ! git -C "$INSTALL" diff --quiet -- SKILL.md '*/SKILL.md' || die "prefix mode left no footprint"
+ case "$1" in
+ dirty)
+ git -C "$INSTALL" diff -U0 "$HELD" "$MAIN" -- docs/troubleshooting.md > "$T/upstream.diff"
+ L=$(sed -n 's/^-\([^-]\)/\1/p' "$T/upstream.diff" | sed -n 1p)
+ [ -n "$L" ] || die "docs/troubleshooting.md has no upstream change to conflict with"
+ L="$L" awk '!d && $0 == ENVIRON["L"] { print $0 " LOCAL-EDIT"; d = 1; next } { print }' "$INSTALL/docs/troubleshooting.md" > "$T/edited"
+ cat "$T/edited" > "$INSTALL/docs/troubleshooting.md"
+ grep -q 'LOCAL-EDIT' "$INSTALL/docs/troubleshooting.md" || die "the local edit did not apply"
+ ;;
+ unmerged)
+ b=$(printf 'base\n' | git -C "$INSTALL" hash-object -w --stdin)
+ o=$(printf 'ours LOCAL-EDIT\n' | git -C "$INSTALL" hash-object -w --stdin)
+ t=$(printf 'theirs\n' | git -C "$INSTALL" hash-object -w --stdin)
+ git -C "$INSTALL" update-index --force-remove README.md
+ printf '100644 %s 1\tREADME.md\n100644 %s 2\tREADME.md\n100644 %s 3\tREADME.md\n' "$b" "$o" "$t" | git -C "$INSTALL" update-index --index-info
+ printf '<<<<<<< ours\nours LOCAL-EDIT\n=======\ntheirs\n>>>>>>> theirs\n' > "$INSTALL/README.md"
+ [ -n "$(git -C "$INSTALL" ls-files -u)" ] || die "the install has no unmerged files"
+ ;;
+ esac
+}
+# check_recovered STATE: at origin's main, nothing unmerged, and
+# every local edit (only those) in one rescue ref.
+check_recovered() {
+ [ "$(git -C "$INSTALL" rev-parse HEAD)" = "$MAIN" ] || die "$1: the install is at $(git -C "$INSTALL" rev-parse HEAD), not $MAIN"
+ [ -z "$(git -C "$INSTALL" ls-files -u)" ] || die "$1: unmerged files remain"
+ [ -f "$INSTALL/bin/gstack-ff-update" ] || die "$1: bin/gstack-ff-update is missing"
+ refs=$(git -C "$INSTALL" for-each-ref --format='%(refname)' refs/gstack/rescue)
+ if [ "$1" = clean ]; then
+ [ -z "$refs" ] || die "clean: a rescue ref was made: $refs"
+ return 0
+ fi
+ [ "$(printf '%s\n' "$refs" | grep -c .)" = 1 ] || die "$1: expected one rescue ref, got: $refs"
+ file=docs/troubleshooting.md; [ "$1" != unmerged ] || file=README.md
+ git -C "$INSTALL" show "$refs:$file" > "$T/rescued"
+ grep -q 'LOCAL-EDIT' "$T/rescued" || die "$1: the rescue ref lacks the local edit to $file"
+ [ "$(git -C "$INSTALL" diff --name-only "$refs^" "$refs")" = "$file" ] || die "$1: the rescue ref holds more than the user's edit"
+}
+LIB
+bash -n "$T/lib.sh"
diff --git a/test/egress-receipt-wiring.test.ts b/test/egress-receipt-wiring.test.ts
index 78ab197fd..30ded9710 100644
--- a/test/egress-receipt-wiring.test.ts
+++ b/test/egress-receipt-wiring.test.ts
@@ -179,6 +179,8 @@ const SCANNER_EXEMPT: Record<string, string> = {
'served-page JS talking to its own loopback server (relative ./api fetch)',
'crew/scripts/gate-cost-replay.ts':
'developer-invoked read-only measurement (GSTA-49 T0): git fetch of gstack\'s own origin by SHA (old PR heads and tested merge commits) so past PR gates can be replayed; a download only, no gstack or user state leaves the machine',
+ 'scripts/windows-held-install-fixture.sh':
+ 'CI-only fixture for the Windows Setup E2E held-install jobs: fetches one pinned release commit of gstack\'s own public repo from the workflow checkout\'s origin (a download only) and pushes to a bare repo under $RUNNER_TEMP; never runs on a user machine, and no gstack or user state leaves the runner',
'scripts/ubicloud':
'developer-invoked test infrastructure: Ubicloud API calls (VM create/show/destroy) with the developer\'s own token, the checkout streamed over SSH to that developer\'s own ephemeral VM, and toolchain downloads run on the VM; no installed-gstack user state is sent',
// Skill prose templates: these render agent-executed instructions (the
diff --git a/test/trunk-dynamic-ci-observers.test.ts b/test/trunk-dynamic-ci-observers.test.ts
index 68da3d080..a938f2f83 100644
--- a/test/trunk-dynamic-ci-observers.test.ts
+++ b/test/trunk-dynamic-ci-observers.test.ts
@@ -18,7 +18,7 @@ const OBSERVED: Record<string, string> = {
'free-tests.yml': 'free-suite,macos-named-regressions',
'windows-smoke.yml': 'windows-smoke',
'windows-scoped-tests.yml': 'windows-scoped-shard',
- 'windows-setup-e2e.yml': 'windows-setup,held-install-journey',
+ 'windows-setup-e2e.yml': 'windows-setup,windows-setup-recovery,windows-setup-cso,held-install-journey,held-install-trial,held-install-later-release',
'quality-gate.yml': 'quality',
'evals.yml': 'build-image,eval-slices',
};
diff --git a/test/windows-path-scope-workflow.test.ts b/test/windows-path-scope-workflow.test.ts
index 810accb25..abc1e152c 100644
--- a/test/windows-path-scope-workflow.test.ts
+++ b/test/windows-path-scope-workflow.test.ts
@@ -160,7 +160,7 @@ describe('Windows Setup E2E runs by install path', () => {
expect(scope['runs-on']).toBe('ubuntu-24.04');
expect(scope.steps[0].with).toEqual({ 'fetch-depth': 2, 'persist-credentials': false });
const windowsJobs = Object.keys(setupE2e.jobs).filter(name => name !== 'windows-scope' && name !== 'trunk-dynamic-ci');
- expect(windowsJobs).toEqual(['windows-setup', 'held-install-journey']);
+ expect(windowsJobs).toEqual(['windows-setup', 'windows-setup-recovery', 'windows-setup-cso', 'held-install-journey', 'held-install-trial', 'held-install-later-release']);
for (const name of windowsJobs) {
expect([name, setupE2e.jobs[name]['runs-on'], setupE2e.jobs[name].needs, setupE2e.jobs[name].if])
.toEqual([name, 'windows-latest', 'windows-scope', "needs.windows-scope.outputs.install == 'true'"]);