From 616a6b0871441a594cb34d7dc23bffecf5bd3b16 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 17:24:24 +0000 Subject: [PATCH 1/4] Run a byte slice of any head on Linux runners through the Sweep workflow A lane's hand-back slices one mode and the other waited for one machine's batch, for hours. The three scripts under .github/scripts/slice-sweep build the head's tool, 2.4.5's and the readers once, run the byte branch's gate over the seeds on up to 40 runners, and print the slice's verdict in the claim block's layout. Sweep now also passes its arguments to the prepare and summary scripts, which is how they learn the head and the mode. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01HLuVQLHq43QvdYBYGWTdSo --- .github/scripts/slice-sweep/prepare.sh | 55 ++++++++++++++++++++++ .github/scripts/slice-sweep/shard.sh | 33 ++++++++++++++ .github/scripts/slice-sweep/summary.py | 63 ++++++++++++++++++++++++++ .github/workflows/sweep.yml | 12 +++-- 4 files changed, 158 insertions(+), 5 deletions(-) create mode 100644 .github/scripts/slice-sweep/prepare.sh create mode 100644 .github/scripts/slice-sweep/shard.sh create mode 100644 .github/scripts/slice-sweep/summary.py diff --git a/.github/scripts/slice-sweep/prepare.sh b/.github/scripts/slice-sweep/prepare.sh new file mode 100644 index 0000000000..dd4b83c771 --- /dev/null +++ b/.github/scripts/slice-sweep/prepare.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# prepare.sh PREPARED HEAD MODE [FIRST LAST] +# For sweep.yml: builds once what every shard of a byte slice needs, as productivity's full-slice batch does on a +# Mac, so that a head's second slice mode is read on Linux runners in minutes instead of waiting for that machine. +# HEAD is the full commit under test, MODE is production or mocks. +# on/SafeDITool HEAD's release tool; in mocks mode with lay-out-mocks.sh's edits (the four switches) +# off/SafeDITool 2.4.5's (SLICE_OFF_COMMIT), built from source by this compiler +# scripts/ the byte branch's gate scripts (claude/targeted-byte-runs, SLICE_SCRIPTS_REF) +# readers/ the reader of approved production differences, built from the registry of the reader line +# (the mocks-on branch while it exists, else main; SLICE_READER_REF), and that line's reader of +# approved mock differences +# header.txt what the claim names: head, the tools' build records, base, switches, readers +# Each tool carries the build record claim-block.py writes, so a shard's block names the commit and the switch edits. +set -euo pipefail +prepared=$1; head=${2:?the full commit under test}; mode=${3:?production or mocks} +case $mode in production | mocks) ;; *) echo "MODE is production or mocks" >&2; exit 2 ;; esac +[[ $head =~ ^[0-9a-f]{40}$ ]] || { echo "HEAD must be a full 40-character commit" >&2; exit 2; } +off_commit=${SLICE_OFF_COMMIT:-ae642c3f5d49c86b32afde775f72ebe0d3a9100a} +scripts_ref=${SLICE_SCRIPTS_REF:-claude/targeted-byte-runs} +work=${RUNNER_TEMP:-$HOME/.cache/SafeDITests}/slice-sweep; mkdir -p "$work" "$prepared/on" "$prepared/off" "$prepared/readers" +export TMPDIR=$work/tmp; mkdir -p "$TMPDIR" +git fetch -q --depth 1 origin "$scripts_ref" +scripts_commit=$(git rev-parse FETCH_HEAD) +git worktree add -q --detach "$work/scripts" FETCH_HEAD +cp -R "$work/scripts/.github/scripts/switch-attack" "$prepared/scripts" +reader_ref=${SLICE_READER_REF:-} +if [[ -z $reader_ref ]]; then + if git fetch -q --depth 1 origin claude/project-thread-dab9up-mocks-on-146 2>/dev/null; then reader_ref=claude/project-thread-dab9up-mocks-on-146; else reader_ref=main; git fetch -q --depth 1 origin main; fi +else git fetch -q --depth 1 origin "$reader_ref"; fi +reader_commit=$(git rev-parse FETCH_HEAD) +git worktree add -q --detach "$work/reader" FETCH_HEAD +bash "$prepared/scripts/build-approved-production-differences.sh" "$work/reader" "$prepared/readers/approved-production-differences" +cp "$work/reader/Scripts/node-records-mock-approved-differences.py" "$prepared/readers/" +build() { # build NAME COMMIT: a release tool with its record + git fetch -q --depth 1 origin "$2" + git worktree add -q --detach "$work/$1" FETCH_HEAD + if [[ $1 == on && $mode == mocks ]]; then bash "$prepared/scripts/lay-out-mocks.sh" "$work/$1" > "$work/lay-out.log" 2>&1 || { cat "$work/lay-out.log" >&2; exit 2; }; fi + ( cd "$work/$1" && swift build -c release --product SafeDITool > "$work/$1-build.log" 2>&1 ) || { tail -n 30 "$work/$1-build.log" >&2; echo "prepare.sh: the $1 tool ($2) did not build" >&2; exit 1; } + cp "$work/$1/.build/release/SafeDITool" "$prepared/$1/SafeDITool" + python3 -I "$prepared/scripts/claim-block.py" record "$prepared/$1/SafeDITool" "$work/$1" +} +build on "$head" & +on_build=$! +build off "$off_commit" & +off_build=$! +wait $on_build; wait $off_build +switches=none; [[ $mode == production ]] || switches="laysOutMockRoots recordsFilledCalls sharesMockWorldsInProduction writesHomes" +{ + echo "head=$head"; echo "mode=$mode"; echo "base=2.4.5 built from source ($off_commit)"; echo "switches=$switches" + echo "build=$(python3 -I "$prepared/scripts/claim-block.py" build "$prepared/on/SafeDITool")" + echo "on_uncommitted=$(sed -n 's/^uncommitted //p' "$prepared/on/SafeDITool.build-record")" + echo "scripts=$scripts_ref $scripts_commit"; echo "reader_line=$reader_ref $reader_commit" + echo "reader=production $(git hash-object --no-filters "$prepared/readers/approved-production-differences" | cut -c1-12), mocks blob $(git hash-object --no-filters "$prepared/readers/node-records-mock-approved-differences.py")" + echo "swift=$(swift --version 2>&1 | head -n 1)" +} | tee "$prepared/header.txt" diff --git a/.github/scripts/slice-sweep/shard.sh b/.github/scripts/slice-sweep/shard.sh new file mode 100644 index 0000000000..0770dce9e0 --- /dev/null +++ b/.github/scripts/slice-sweep/shard.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# shard.sh SHARD SHARDS PREPARED RESULTS HEAD MODE [FIRST LAST] +# For sweep.yml: runs the byte gate (gate.sh of the byte branch, as prepare.sh packed it) over this shard's share of +# seeds FIRST...LAST (default 0...4999, both declaration orders: the full slice's 10,000 graphs), a contiguous run +# of them. Writes the gate's line for each graph, one `header` line a shard, and, for each differing graph, the first +# lines of the diff of its two outputs, to RESULTS. Exits 0 whatever the graphs read: summary.py gives the verdict. +set -uo pipefail +shard=$1; shards=$2; prepared=$3; results=$4; mode=${6:?HEAD MODE}; first=${7:-0}; last=${8:-4999} +count=$(( last - first + 1 )) +from=$(( first + shard * count / shards )); to=$(( first + (shard + 1) * count / shards - 1 )) +mkdir -p "$results" +printf 'header %s\n' "$(tr '\n' '\t' < "$prepared/header.txt")" > "$results/0-header.txt" +if (( to < from )); then exit 0; fi +chmod +x "$prepared/on/SafeDITool" "$prepared/off/SafeDITool" "$prepared/readers/approved-production-differences" +out=${RUNNER_TEMP:-$HOME/.cache/SafeDITests}/slice-sweep-out; export TMPDIR=$out-tmp; mkdir -p "$TMPDIR" +status=0 +GATE_MODE=$mode GATE_DRAWS=${GATE_DRAWS-v} GATE_APPROVED_READER=$prepared/readers/approved-production-differences \ + GATE_TESTED_MOCK_READER=$prepared/readers/node-records-mock-approved-differences.py \ + GATE_SWITCHES="$(sed -n 's/^switches=//p' "$prepared/header.txt")" \ + bash "$prepared/scripts/gate.sh" "$prepared/on/SafeDITool" "$prepared/off/SafeDITool" "$from" "$to" "$(nproc)" "$out" > "$out.txt" 2>&1 || status=$? +tail -n 40 "$out.txt" +if [[ ! -f $out/all.log ]]; then + printf 'shard-failed %s seeds %s...%s gate.sh exited %s: %s\n' "$shard" "$from" "$to" "$status" "$(grep -m 2 -E 'ERROR|No graph' "$out.txt" | tr '\n' ' ')" > "$results/1-graphs.txt" + exit 1 +fi +sed 's/^/graph /' "$out/all.log" > "$results/1-graphs.txt" +printf 'shard %s seeds %s...%s graphs %s gate.sh exit %s\n' "$shard" "$from" "$to" "$(wc -l < "$out/all.log" | tr -d ' ')" "$status" > "$results/2-shard.txt" +# The first lines of each differing graph's diff, so that a difference is read from the run's page. +: > "$results/3-diffs.txt" +for graph in $(grep -E ' (DIFF|EXITDIFF|ERRDIFF) ' "$out/all.log" | cut -d' ' -f1 | head -n 20); do + { diff "$out/keep/$graph/off.swift" "$out/keep/$graph/on.swift" 2>/dev/null; diff "$out/keep/$graph/off.err" "$out/keep/$graph/on.err" 2>/dev/null; } | head -n 12 | sed "s/^/diff $graph /" >> "$results/3-diffs.txt" +done +exit 0 diff --git a/.github/scripts/slice-sweep/summary.py b/.github/scripts/slice-sweep/summary.py new file mode 100644 index 0000000000..230713495f --- /dev/null +++ b/.github/scripts/slice-sweep/summary.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""summary.py RESULTS_FILE [HEAD MODE [FIRST LAST]] +For sweep.yml: reads every shard's lines of a byte slice (shard.sh) and prints the slice's verdict in the layout of +the gate's claim block: head, build, base, switches, seeds, counts, readers. It is not a sealed claim block +(claim-block.py seals one run of gate.sh, and this joins several), so it says so; the counts are the gate's own +verdict for each graph. Exits 1 unless every graph asked for was judged, every shard agrees on the header, and no +graph is DIFF, EXITDIFF or ERRDIFF.""" +import collections +import sys + + +def main(arguments): + first, last = (int(arguments[3]), int(arguments[4])) if len(arguments) >= 5 else (0, 4999) + headers, graphs, failed, diffs = set(), {}, [], collections.defaultdict(list) + with open(arguments[0], errors="replace") as handle: + for line in handle: + kind, _, rest = line.rstrip("\n").partition(" ") + if kind == "header": + headers.add(rest) + elif kind == "graph" and rest: + graphs[rest.split(" ", 1)[0]] = rest + elif kind == "shard-failed": + failed.append(rest) + elif kind == "diff": + name, _, text = rest.partition(" ") + diffs[name].append(text) + expected = (last - first + 1) * 2 + counts = collections.Counter(line.split(" ")[1] for line in graphs.values() if " " in line) + entries = collections.Counter(entry for line in graphs.values() for word in line.split(" ") if word.startswith("entries=") for entry in word[len("entries="):].split(",")) + debug_only = sum(1 for line in graphs.values() if "debug-text-differs" in line) + differing = sorted((name for name, line in graphs.items() if line.split(" ")[1] in ("DIFF", "EXITDIFF", "ERRDIFF")), key=lambda name: (int(name[:-1]), name[-1])) + unexplained = counts["DIFF"] + counts["EXITDIFF"] + counts["ERRDIFF"] + problems = [] + if len(headers) != 1: + problems.append(f"{len(headers)} different headers among the shards") + if failed: + problems.append(f"{len(failed)} shard(s) judged nothing") + if len(graphs) != expected: + problems.append(f"{len(graphs)} graphs judged of {expected}") + if unexplained: + problems.append(f"{unexplained} unexplained") + fields = dict(field.split("=", 1) for field in sorted(headers)[0].split("\t") if "=" in field) if headers else {} + verdict = "CLEAN" if not problems else "NOT CLEAN (" + "; ".join(problems) + ")" + lines = [f"=== SLICE ON LINUX RUNNERS gate.sh {fields.get('mode', '?')} (joined from shards; not a sealed claim block) ===", + f"head: {fields.get('head', '?')}", f"build: {fields.get('build', '?')} (a Linux binary: its hash is not the Mac tool's; the commit and the uncommitted hash are what to compare)", + f"uncommitted: {fields.get('on_uncommitted', '?')}", f"base: {fields.get('base', '?')}", f"switches: {fields.get('switches', '?')}", + f"seeds: {first}...{last}, two orders, draws 'v' unless the run set GATE_DRAWS", f"expected: {expected}", f"judged: {len(graphs)}", + f"same: {counts['SAME']} (of them {debug_only} whose text inside #if DEBUG alone differs, production mode)", + f"approved: {counts['APPROVED']}" + "".join(f" {entry}={count}" for entry, count in entries.most_common()), + f"known: {counts['KNOWN']}", f"diff: {counts['DIFF']}", f"err: EXITDIFF {counts['EXITDIFF']}, ERRDIFF {counts['ERRDIFF']}, ERRSAME {counts['ERRSAME']}", + f"reader: {fields.get('reader', '?')} (line {fields.get('reader_line', '?')})", f"scripts: {fields.get('scripts', '?')}", f"compiler: {fields.get('swift', '?')}", + f"verdict: {verdict}", "=== END ==="] + lines += [f"shard that judged nothing: {line}" for line in failed] + if differing: + lines += ["", f"Differing graphs ({len(differing)}): " + " ".join(differing), ""] + for name in differing[:40]: + lines += [graphs[name]] + [" " + text for text in diffs.get(name, [])[:12]] + print("\n".join(lines)) + return 0 if not problems else 1 + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/.github/workflows/sweep.yml b/.github/workflows/sweep.yml index 86fc470a9d..70c2264591 100644 --- a/.github/workflows/sweep.yml +++ b/.github/workflows/sweep.yml @@ -47,7 +47,7 @@ on: required: true type: string arguments: - description: Words passed to the script after its four arguments. + description: Words passed to the script after its four arguments, and to the prepare and summary scripts after theirs. required: false default: '' type: string @@ -126,12 +126,13 @@ jobs: if: ${{ inputs.prepare != '' }} env: PREPARE: ${{ inputs.prepare }} + ARGUMENTS: ${{ inputs.arguments }} run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" mkdir -p "$RUNNER_TEMP/prepared" case "$PREPARE" in - *.py) python3 -I "$PREPARE" "$RUNNER_TEMP/prepared" ;; - *) bash "$PREPARE" "$RUNNER_TEMP/prepared" ;; + *.py) python3 -I "$PREPARE" "$RUNNER_TEMP/prepared" $ARGUMENTS ;; + *) bash "$PREPARE" "$RUNNER_TEMP/prepared" $ARGUMENTS ;; esac # One archive, so that what the script made executable stays so. - name: Pack What Was Prepared @@ -247,13 +248,14 @@ jobs: if: ${{ inputs.summary != '' }} env: SUMMARY: ${{ inputs.summary }} + ARGUMENTS: ${{ inputs.arguments }} run: | set -o pipefail { echo '```' case "$SUMMARY" in - *.py) python3 -I "$SUMMARY" "$RUNNER_TEMP/sweep-results.txt" ;; - *) bash "$SUMMARY" "$RUNNER_TEMP/sweep-results.txt" ;; + *.py) python3 -I "$SUMMARY" "$RUNNER_TEMP/sweep-results.txt" $ARGUMENTS ;; + *) bash "$SUMMARY" "$RUNNER_TEMP/sweep-results.txt" $ARGUMENTS ;; esac echo '```' } | tee -a "$GITHUB_STEP_SUMMARY" From 2d4e94cd5d1ab40c8193f3eb3070c0b679215822 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 17:30:25 +0000 Subject: [PATCH 2/4] Keep Sweep runs that differ in any input from cancelling one another The concurrency group named the ref, the script and the arguments, so a run that differed only in its prepare script cancelled the run it was the control of. The group now names every input. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01HLuVQLHq43QvdYBYGWTdSo --- .claude/rules/ci.md | 2 +- .github/workflows/sweep.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.claude/rules/ci.md b/.claude/rules/ci.md index d729c3d8ec..d1551801eb 100644 --- a/.claude/rules/ci.md +++ b/.claude/rules/ci.md @@ -19,7 +19,7 @@ paths: - `ci.yml` runs every check on a branch with no pull request: `gh workflow run ci.yml --ref `. A landing stack is checked this way, never through a pull request opened only to carry its CI. The run counts every file as changed, reads no stack position, and compares "Check Generate Time on Linux" and the fuzzer's base comparison with the branch's merge base with main. - `verify.yml` ("Verify on Linux") runs "Build Tests on Linux"'s build for one branch: `gh workflow run verify.yml --ref -f filter=` (empty runs the suite; `-f pins=true` also checks the fuzzer's pins). It restores main's content-stamped build (`.github/scripts/stamp-source-times.sh`) and passed-compile-check caches; keep its container and `RELEASE_SWIFT_TEST_ARGUMENTS` in step with "Build Tests on Linux" and `graph-fuzzer.yml`'s coverage build, which restores its key. `-f mode=fast` needs a filter and builds in debug without coverage, from "Warm the Fast Verify Build Cache"'s cache. `-f mode=function-compile-time` runs only "Check Function Compile Time on Linux"'s build and check ("Verify Function Compile Time on Linux"; keep the two jobs' container, command and check in step) and tests nothing: run it before a pull request that adds or grows a long function under `Sources/SafeDICore` joins a stack, because the limit is about Linux's Swift 6.2 and CI runs on a stack's top only. - **A restored build compiles every test target again when what the tests are compiled against changed.** A restored build did not always compile a test target again when a module it imports changed, and linked tests compiled for an enum of SafeDICore without its new case, which crashed them; such a target can as well pass a test that should fail. `.github/scripts/stamp-source-times.sh` therefore gives a file under `Tests` a time from its content and from `Sources`, the test support target and the manifest together, so a change to any of those compiles every test target again. A job that restores a build of the tests stamps first. To rule a restored build out of one result, label the pull request `clean-build` and re-run (every restore of a SwiftPM or xcodebuild build in `ci.yml` is skipped; the label is read as it is now), or pass `verify.yml` `-f clean=true`. -- `sweep.yml` ("Sweep") runs one script of a branch over many items on up to 40 Linux runners at once, by hand, for a question whose items do not depend on one another (compiling thousands of generated graphs under a compiler setting): `gh workflow run sweep.yml --ref -f script= -f shards=`, with an optional `prepare` script that builds once what every shard needs and a `summary` script that reads every shard's lines. The script chooses the items whose number leaves its shard when divided by the count, and writes one line an item. It gates nothing, and its header holds what each script is given. +- `sweep.yml` ("Sweep") runs one script of a branch over many items on up to 40 Linux runners at once, by hand, for a question whose items do not depend on one another (compiling thousands of generated graphs under a compiler setting): `gh workflow run sweep.yml --ref -f script= -f shards=`, with an optional `prepare` script that builds once what every shard needs and a `summary` script that reads every shard's lines; `-f arguments=` reach all three. Two runs cancel one another only when every input is the same. `.github/scripts/slice-sweep/` is such a set: a byte slice of any commit against 2.4.5, `-f arguments=' production|mocks'`. The script chooses the items whose number leaves its shard when divided by the count, and writes one line an item. It gates nothing, and its header holds what each script is given. - `macos-build-check.yml` builds, by hand, what only a macOS runner builds, with no test run, for a branch that is on no pull request yet: `gh workflow run macos-build-check.yml --ref `. Its steps are copies of ci.yml’s, which `.github/scripts/check-macos-build-check.py` compares in the run; change a copied step in both. It gates nothing: a pull request runs every macOS job of ci.yml. - "Check Line Coverage on Linux" is the coverage gate: `Scripts/unexecuted-lines.py` unions the lcov reports the two test jobs upload, counting lines as Codecov does, and fails on any line under `Sources/` or `Plugins/` that no test executes on Linux or macOS, over the whole tree. Every Swift file there is measured or listed as unmeasured, with its reason, in `Scripts/unmeasured-files.txt`. It fails on missing data (a missing, cut-short or other-commit report, an unlisted file no report records, a listed file a report records) and reads nothing from Codecov or the pull request's base. It has no container, since it only reads reports, as "Check Graph Fuzzer Corpus on Linux" does. When a stack lands, only the check on the landing's final commit counts: an intermediate main commit can fail on lines that tests higher in the stack cover. - A required check that a matrix job reports needs a Linux stand-in that reports the same names when a Markdown-only change skips the job. A skipped job satisfies a required check under its own name, but GitHub evaluates a job's `if:` before expanding its matrix, so a skipped matrix job reports only its unexpanded name. The stand-in takes the job's `name:` and matrix through YAML anchors, runs only when `changes` reports a Markdown-only pull request, and needs no container, since it only reports. diff --git a/.github/workflows/sweep.yml b/.github/workflows/sweep.yml index 70c2264591..41301c8a03 100644 --- a/.github/workflows/sweep.yml +++ b/.github/workflows/sweep.yml @@ -71,7 +71,9 @@ permissions: contents: read concurrency: - group: sweep-${{ github.ref }}-${{ inputs.script }}-${{ inputs.arguments }} + # Every input that makes a run another question is in the group: two runs that differed only in their prepare + # script cancelled one another, and one was the control of the other. + group: sweep-${{ github.ref }}-${{ inputs.script }}-${{ inputs.arguments }}-${{ inputs.prepare }}-${{ inputs.summary }}-${{ inputs.shards }} cancel-in-progress: true jobs: From 775fa75f23d7a979f96385c7bc135aa8bca50220 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 22:27:36 +0000 Subject: [PATCH 3/4] Check out a Sweep's two tools one at a time Two shallow fetches into one clone at once fail on its shallow.lock, so the slice sweep's prepare script fetches and checks out both trees before it builds them side by side. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01HLuVQLHq43QvdYBYGWTdSo --- .github/scripts/slice-sweep/prepare.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/scripts/slice-sweep/prepare.sh b/.github/scripts/slice-sweep/prepare.sh index dd4b83c771..d037ffc79e 100644 --- a/.github/scripts/slice-sweep/prepare.sh +++ b/.github/scripts/slice-sweep/prepare.sh @@ -31,9 +31,13 @@ reader_commit=$(git rev-parse FETCH_HEAD) git worktree add -q --detach "$work/reader" FETCH_HEAD bash "$prepared/scripts/build-approved-production-differences.sh" "$work/reader" "$prepared/readers/approved-production-differences" cp "$work/reader/Scripts/node-records-mock-approved-differences.py" "$prepared/readers/" -build() { # build NAME COMMIT: a release tool with its record +check_out() { # check_out NAME COMMIT. One at a time: two fetches into one shallow clone fail on its shallow.lock. git fetch -q --depth 1 origin "$2" git worktree add -q --detach "$work/$1" FETCH_HEAD +} +check_out on "$head" +check_out off "$off_commit" +build() { # build NAME COMMIT: a release tool with its record, from the tree check_out made if [[ $1 == on && $mode == mocks ]]; then bash "$prepared/scripts/lay-out-mocks.sh" "$work/$1" > "$work/lay-out.log" 2>&1 || { cat "$work/lay-out.log" >&2; exit 2; }; fi ( cd "$work/$1" && swift build -c release --product SafeDITool > "$work/$1-build.log" 2>&1 ) || { tail -n 30 "$work/$1-build.log" >&2; echo "prepare.sh: the $1 tool ($2) did not build" >&2; exit 1; } cp "$work/$1/.build/release/SafeDITool" "$prepared/$1/SafeDITool" From e2c21f564f2f9855ec0ddda9bdae1a13144a5fb0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 3 Dec 2026 00:51:52 +0000 Subject: [PATCH 4/4] Resolve a Sweep's two tools' packages one at a time Two packages resolving at once both download the release's tool bundle into SwiftPM's one cache, and the second fails on a file that already exists, so the slice sweep's prepare script resolves each tree as it checks it out and only then builds the two side by side. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01HLuVQLHq43QvdYBYGWTdSo --- .github/scripts/slice-sweep/prepare.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/scripts/slice-sweep/prepare.sh b/.github/scripts/slice-sweep/prepare.sh index d037ffc79e..5ef5bf5421 100644 --- a/.github/scripts/slice-sweep/prepare.sh +++ b/.github/scripts/slice-sweep/prepare.sh @@ -31,9 +31,12 @@ reader_commit=$(git rev-parse FETCH_HEAD) git worktree add -q --detach "$work/reader" FETCH_HEAD bash "$prepared/scripts/build-approved-production-differences.sh" "$work/reader" "$prepared/readers/approved-production-differences" cp "$work/reader/Scripts/node-records-mock-approved-differences.py" "$prepared/readers/" -check_out() { # check_out NAME COMMIT. One at a time: two fetches into one shallow clone fail on its shallow.lock. +check_out() { # check_out NAME COMMIT. One at a time: two fetches into one shallow clone fail on its shallow.lock, and + # two packages resolving at once both download the release's tool bundle into SwiftPM's one cache, where the second + # fails on "already exists in file system". git fetch -q --depth 1 origin "$2" git worktree add -q --detach "$work/$1" FETCH_HEAD + ( cd "$work/$1" && swift package resolve > "$work/$1-resolve.log" 2>&1 ) || { tail -n 30 "$work/$1-resolve.log" >&2; echo "prepare.sh: the packages of the $1 tool ($2) did not resolve" >&2; exit 1; } } check_out on "$head" check_out off "$off_commit"