Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci(order-hunt): keep the matrix shard out of run-e2e.sh's SHARD

garrytanca00ac3c724d
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index ada6692d56..c2580f6bf5 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -743,13 +743,13 @@ jobs:
shell: bash
env:
ORDER_SEED: ${{ inputs.order_seed }}
- SHARD: ${{ matrix.shard }}
+ HUNT_SHARD: ${{ matrix.shard }}
run: |
seed="${ORDER_SEED:-$(( $(date -u +%s) / 86400 ))}"
case "$seed" in ''|*[!0-9]*) echo "::error::order_seed must be digits, got '$seed'"; exit 2 ;; esac
- seed=$(( seed * 4 + SHARD ))
- bun scripts/order-hunt.ts plan --seed "$seed" --shard "$SHARD" --of 4 > "$RUNNER_TEMP/order.txt"
- echo "order hunt: seed $seed, shard $SHARD/4, $(wc -l < "$RUNNER_TEMP/order.txt") files" | tee -a "$GITHUB_STEP_SUMMARY"
+ seed=$(( seed * 4 + HUNT_SHARD ))
+ bun scripts/order-hunt.ts plan --seed "$seed" --shard "$HUNT_SHARD" --of 4 > "$RUNNER_TEMP/order.txt"
+ echo "order hunt: seed $seed, shard $HUNT_SHARD/4, $(wc -l < "$RUNNER_TEMP/order.txt") files" | tee -a "$GITHUB_STEP_SUMMARY"
- name: Run the files in that order on one database
id: run
continue-on-error: true
diff --git a/scripts/order-hunt.ts b/scripts/order-hunt.ts
index ef7404e33e..61347b15e8 100644
--- a/scripts/order-hunt.ts
+++ b/scripts/order-hunt.ts
@@ -79,7 +79,9 @@ function plan(argv: string[]): number {
const of = positiveInt(arg(argv, '--of'), '--of');
const shard = positiveInt(arg(argv, '--shard'), '--shard');
if (of < 1 || shard < 1 || shard > of) throw new Error(`--shard must be 1..${of}`);
- const listed = spawnSync('bash', ['scripts/run-e2e.sh', '--dry-run-list'], { encoding: 'utf8' });
+ // run-e2e.sh reads SHARD (N/M) to pick a weighted slice; the hunt wants the whole corpus.
+ const { SHARD: _shard, ...env } = process.env;
+ const listed = spawnSync('bash', ['scripts/run-e2e.sh', '--dry-run-list'], { encoding: 'utf8', env });
if (listed.status !== 0) throw new Error(`run-e2e.sh --dry-run-list failed: ${listed.stderr.trim()}`);
const files = listed.stdout.split('\n').filter(Boolean);
for (const f of planShard(files, seed, shard, of)) console.log(f);
@@ -93,7 +95,8 @@ function classify(argv: string[]): number {
for (const name of failing) {
const file = order.find(f => f.endsWith(`/${name}`) || f === name);
if (!file) { console.log(`::warning title=order hunt::${name} failed but is not in this shard's order list; read the run-e2e.sh log. Docs: ${DOCS}`); continue; }
- const alone = spawnSync('bash', ['scripts/run-e2e.sh', file], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
+ const { SHARD: _shard, ...env } = process.env;
+ const alone = spawnSync('bash', ['scripts/run-e2e.sh', file], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], env });
if (alone.status === 0) {
orderDependent++;
console.log(`::error file=${file},title=order-dependent test::${file} fails after the files before it in this order but passes alone, so an earlier file leaks state into it. Why: a test that leaves a config row, setting or rows behind breaks the next file on a shared database. Reproduce: ${reproduceCommand(order, file)} (then bisect the files before it). Fix the leaking file's teardown, not this file. Docs: ${DOCS}`);