0.65.6 was tagged and never published: the release build failed to compile lucisv-server for Windows. lucisv_core::walk::dir_id is a Copy (dev, ino) pair on unix and an owned PathBuf elsewhere, and 71.1's Workspace::holds_another_spelling_of moved it inside a closure (lucisv_server/src/state/incremental.rs). Compared by reference now. tools/gates.sh gains a `cross` step: cargo check of the three shipped binaries for x86_64-pc-windows-gnu and x86_64-unknown-linux-musl with the rustup toolchain release.sh --cross uses (skipped with a note when it is absent). It fails on the unfixed tree with the release run's own error and passes on this one. tools/RELEASING.md lists it. CHANGELOG.md's 0.65.7 section carries 0.65.6's notes in full under a short account of what happened; the v0.65.6 tag is left where it is. Version bump (Cargo.toml, Cargo.lock, editors/vscode/package.json and both package-lock.json spots). Gates: tools/gates.sh PASS on this tree including cross; a full local tools/release.sh --cross and tools/audit_artifacts.sh dist pass (seven .vsix packages, eighteen binaries). Co-Authored-By: Claude Mythos 5.2 <[email protected]>
258 lines
9.8 KiB
Bash
Executable File
258 lines
9.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Run lucisv's release gates, each as a separate tools/guard.sh step.
|
||
#
|
||
# Steps, in order (names for --only/--skip):
|
||
# fmt cargo fmt --all -- --check
|
||
# clippy cargo clippy --workspace --all-targets -- -D warnings
|
||
# build cargo test --workspace --all-targets --no-run
|
||
# suite:<crate> cargo test -p <crate> --all-targets, one step per crate of
|
||
# the workspace Cargo.toml `members` ("suites" selects all)
|
||
# docs cargo test --workspace --doc
|
||
# corpus cargo build --release -p lucisv, then scripts/corpus_gate.sh
|
||
# over ~/.cache/lucisv-corpus as CI does (skipped, with a
|
||
# note, when that directory is absent; -c overrides it)
|
||
# node node --test editors/vscode/*_test.js
|
||
# cross cargo check of the three shipped binaries for Windows and
|
||
# Linux with the rustup toolchain release.sh --cross uses
|
||
# (skipped, with a note, when that toolchain is absent).
|
||
# Platform-conditional code is compiled nowhere else before
|
||
# the release build: 0.65.6 passed every other gate and then
|
||
# failed to compile for Windows.
|
||
#
|
||
# Each step's output goes to its own log under the log dir (default
|
||
# target/gates/<timestamp>/, -o overrides); the terminal gets one line per
|
||
# step start and end, then a summary table. A step the GUARD killed (exit
|
||
# 137 plus guard.sh's "killing" line in its log) is retried once and shows
|
||
# as "KILLED → retried → pass|fail"; an ordinary failure is not retried.
|
||
# The per-step -t/-m limits are in limits() below, sized from measured runs
|
||
# (docs/features/release-gates/README.md has the numbers).
|
||
#
|
||
# Why separate steps: the combined `cargo test --workspace` hid where a stall
|
||
# was (TODO §65.3); a step per crate shows which binary hung, keeps its log,
|
||
# and a retry costs one crate, not the whole suite.
|
||
#
|
||
# Usage: tools/gates.sh [-o log-dir] [-c corpus-dir] [--only a,b] [--skip a,b]
|
||
# [--list] [--help]
|
||
# tools/gates.sh # everything
|
||
# tools/gates.sh --only suites,docs # the per-crate suites and doc-tests
|
||
# tools/gates.sh --skip corpus # all but the corpus gate
|
||
#
|
||
# Exit status: 0 if every selected step passed (or was skipped for a missing
|
||
# corpus), 1 if any failed or stayed killed, 2 on a usage error.
|
||
# Standard tooling only (bash, awk, date, sed).
|
||
|
||
set -u
|
||
|
||
repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||
cd "$repo_root" || exit 2
|
||
log_dir=
|
||
corpus=$HOME/.cache/lucisv-corpus
|
||
# The toolchain release.sh --cross builds with; the Homebrew rust on PATH has
|
||
# no std for other targets.
|
||
cross_toolchain=$HOME/.rustup/toolchains/stable-aarch64-apple-darwin
|
||
only=
|
||
skip=
|
||
|
||
usage() {
|
||
sed -n '/^# Usage:/,/^# Exit status/p' "$0" | sed '$d; s/^# \{0,1\}//'
|
||
}
|
||
|
||
while [ $# -gt 0 ]; do
|
||
case $1 in
|
||
-o | -c | --only | --skip)
|
||
# A missing or empty value is a usage error, never "no filter".
|
||
if [ $# -lt 2 ] || [ -z "$2" ]; then usage >&2; exit 2; fi
|
||
case $1 in
|
||
-o) log_dir=$2 ;;
|
||
-c) corpus=$2 ;;
|
||
--only) only=$2 ;;
|
||
--skip) skip=$2 ;;
|
||
esac
|
||
shift 2 ;;
|
||
--list) list=1; shift ;;
|
||
-h|--help) usage; exit 0 ;;
|
||
*) usage >&2; exit 2 ;;
|
||
esac
|
||
done
|
||
|
||
# The workspace crates, from the root Cargo.toml `members` list: each
|
||
# member directory's package name. Comments are dropped, a one-line list
|
||
# and a glob member (`crates/*`) work; an empty answer is fatal below.
|
||
crates() {
|
||
local pattern dir
|
||
for pattern in $(awk '/^members *= *\[/ { f = 1 } f { print } f && /\]/ { exit }' Cargo.toml |
|
||
sed 's/#.*//; s/^members *= *//' | tr ',[]' '\n\n\n' | tr -d ' "'); do
|
||
for dir in $pattern; do
|
||
[ -f "$dir/Cargo.toml" ] || continue
|
||
sed -n 's/^name *= *"\(.*\)"/\1/p' "$dir/Cargo.toml" | head -1
|
||
done
|
||
done
|
||
}
|
||
|
||
all_steps() {
|
||
local c
|
||
echo fmt clippy build
|
||
for c in $(crates); do echo "suite:$c"; done
|
||
echo docs corpus node cross
|
||
}
|
||
|
||
# Does step $1 match the comma list $2? "suites" matches every suite:<crate>.
|
||
in_list() {
|
||
local item
|
||
for item in $(echo "$2" | tr ',' ' '); do
|
||
[ "$item" = "$1" ] && return 0
|
||
[ "$item" = suites ] && case $1 in suite:*) return 0 ;; esac
|
||
done
|
||
return 1
|
||
}
|
||
|
||
selected() {
|
||
[ -n "$only" ] && ! in_list "$1" "$only" && return 1
|
||
[ -n "$skip" ] && in_list "$1" "$skip" && return 1
|
||
return 0
|
||
}
|
||
|
||
# Guard limits per step: "<seconds> <GB>". Measured on the release Mac
|
||
# 2026-10-19 from a cold target/ (seconds, peak tree RSS): fmt 3 s; clippy
|
||
# 20 s, 1.6 GB; build 31 s, 2.6 GB; each small suite <= 3 s, <= 0.15 GB;
|
||
# lucisv_server 19 s, 1.1 GB; lucisv_mcp 22 s, 1.4 GB; docs 1 s; corpus
|
||
# (release build + score) 30 s, 1.2 GB; node 1 s. The clocks allow a 12x
|
||
# slowdown (what a busy syspolicyd costs, §65.3) on top, with a floor of
|
||
# two minutes; memory is the peak plus headroom. README has the runs.
|
||
limits() {
|
||
case $1 in
|
||
fmt | node) echo "120 2" ;;
|
||
clippy) echo "900 6" ;;
|
||
build) echo "900 8" ;;
|
||
suite:lucisv_server | suite:lucisv_mcp) echo "600 4" ;;
|
||
suite:*) echo "300 4" ;;
|
||
docs) echo "300 2" ;;
|
||
corpus) echo "900 6" ;;
|
||
cross) echo "900 6" ;;
|
||
esac
|
||
}
|
||
|
||
# The command for step $1, into the array `cmd`.
|
||
set_command() {
|
||
case $1 in
|
||
fmt) cmd=(cargo fmt --all -- --check) ;;
|
||
clippy) cmd=(cargo clippy --workspace --all-targets -- -D warnings) ;;
|
||
build) cmd=(cargo test --workspace --all-targets --no-run) ;;
|
||
suite:*) cmd=(cargo test -p "${1#suite:}" --all-targets) ;;
|
||
docs) cmd=(cargo test --workspace --doc) ;;
|
||
corpus) cmd=(bash -c 'cargo build --release -p lucisv && scripts/corpus_gate.sh "$1"'
|
||
corpus-gate "$corpus") ;;
|
||
node) cmd=(node --test editors/vscode/*_test.js) ;;
|
||
cross) cmd=(env RUSTC="$cross_toolchain/bin/rustc" "$cross_toolchain/bin/cargo" check
|
||
--target x86_64-pc-windows-gnu --target x86_64-unknown-linux-musl
|
||
-p lucisv -p lucisv_server -p lucisv_mcp) ;;
|
||
esac
|
||
}
|
||
|
||
# "passed N failed M" from a step log, where that is cheap to read off:
|
||
# libtest's "test result:" lines, node's "# pass"/"# fail" (TAP; node 22+
|
||
# prints "ℹ pass" instead), the corpus JSON.
|
||
counts() {
|
||
awk '
|
||
/^test result:/ { for (i = 1; i <= NF; i++) { if ($(i+1) ~ /^passed/) p += $i; if ($(i+1) ~ /^failed/) f += $i }; n = 1 }
|
||
($1 == "#" || $1 == "ℹ") && NF == 3 && $2 == "pass" { p += $3; n = 1 }
|
||
($1 == "#" || $1 == "ℹ") && NF == 3 && $2 == "fail" { f += $3; n = 1 }
|
||
/^\{"passing":/ { match($0, /"passing":[0-9]+/); pp = substr($0, RSTART + 10, RLENGTH - 10)
|
||
match($0, /"total":[0-9]+/); t = substr($0, RSTART + 8, RLENGTH - 8)
|
||
p += pp; f += t - pp; n = 1 }
|
||
END { if (n) printf "%d/%d", p, f; else printf "-" }' "$1"
|
||
}
|
||
|
||
# Run step $1 once under the guard into log $2, ending the log with a
|
||
# "gate exit N" line. No gate reads stdin, so it is /dev/null.
|
||
run_once() {
|
||
local step=$1 log=$2 lim secs gb
|
||
lim=$(limits "$step")
|
||
secs=${lim% *} gb=${lim#* }
|
||
set_command "$step"
|
||
{
|
||
echo "\$ tools/guard.sh -t $secs -m $gb -- ${cmd[*]}"
|
||
tools/guard.sh -t "$secs" -m "$gb" -- "${cmd[@]}" </dev/null
|
||
echo "gate exit $?"
|
||
} >"$log" 2>&1
|
||
}
|
||
|
||
status_of() { sed -n 's/^gate exit //p' "$1" | tail -1; }
|
||
was_killed() { [ "$(status_of "$1")" = 137 ] && grep -q '^guard.sh: .*killing' "$1"; }
|
||
|
||
if [ -z "$(crates)" ]; then
|
||
echo "gates.sh: no workspace crates found in Cargo.toml members" >&2
|
||
exit 2
|
||
fi
|
||
[ "${list:-0}" = 1 ] && { all_steps | tr ' ' '\n'; exit 0; }
|
||
|
||
steps=$(all_steps)
|
||
for s in $(echo "$only,$skip" | tr ',' ' '); do
|
||
[ "$s" = suites ] && continue
|
||
echo "$steps" | tr ' ' '\n' | grep -qx -- "$s" - || { echo "gates.sh: unknown step '$s' (see --list)" >&2; exit 2; }
|
||
done
|
||
|
||
picked=0
|
||
for step in $steps; do selected "$step" && picked=$((picked + 1)); done
|
||
if [ "$picked" = 0 ]; then
|
||
echo "gates.sh: the selection runs no step (see --list)" >&2
|
||
exit 2
|
||
fi
|
||
|
||
[ -n "$log_dir" ] || log_dir=target/gates/$(date +%Y%m%d-%H%M%S)
|
||
mkdir -p "$log_dir" || exit 2
|
||
summary=$log_dir/summary.txt
|
||
: >"$log_dir/steps.tsv"
|
||
echo "gates: logs in $log_dir"
|
||
|
||
failed=0
|
||
rows=
|
||
for step in $steps; do
|
||
selected "$step" || continue
|
||
log=$log_dir/$(echo "$step" | tr ':' '-').log
|
||
if [ "$step" = corpus ] && [ ! -d "$corpus" ]; then
|
||
echo "skipped: no corpus at $corpus (tools/corpus_fetch.sh \"$corpus\")" >"$log"
|
||
echo " skip $step (no corpus at $corpus)"
|
||
rows="$rows$step|SKIPPED (no corpus)|0|-|$log
|
||
"
|
||
continue
|
||
fi
|
||
if [ "$step" = cross ] && [ ! -x "$cross_toolchain/bin/cargo" ]; then
|
||
echo "skipped: no rustup toolchain at $cross_toolchain (tools/RELEASING.md)" >"$log"
|
||
echo " skip $step (no rustup toolchain)"
|
||
rows="$rows$step|SKIPPED (no toolchain)|0|-|$log
|
||
"
|
||
continue
|
||
fi
|
||
echo " start $step ($(limits "$step" | sed 's/ / s, /') GB)"
|
||
t0=$(date +%s)
|
||
run_once "$step" "$log"
|
||
result=pass
|
||
[ "$(status_of "$log")" = 0 ] || result=fail
|
||
if was_killed "$log"; then
|
||
mv "$log" "${log%.log}.killed.log"
|
||
run_once "$step" "$log"
|
||
if [ "$(status_of "$log")" = 0 ]; then result="KILLED → retried → pass"
|
||
elif was_killed "$log"; then result="KILLED → retried → KILLED"
|
||
else result="KILLED → retried → fail"; fi
|
||
fi
|
||
t1=$(date +%s)
|
||
case $result in *pass) ;; *) failed=1 ;; esac
|
||
printf '%s\t%s\t%s\t%s\n' "$step" "$t0" "$t1" "$result" >>"$log_dir/steps.tsv"
|
||
echo " end $step: $result ($((t1 - t0)) s)"
|
||
rows="$rows$step|$result|$((t1 - t0))|$(counts "$log")|$log
|
||
"
|
||
done
|
||
|
||
{
|
||
printf '%-22s %-26s %6s %-13s %s\n' step result seconds passed/failed log
|
||
printf '%s' "$rows" | while IFS='|' read -r s r t c l; do
|
||
[ -n "$s" ] || continue
|
||
# printf pads by bytes; widen the column by what the arrows add.
|
||
w=$((26 + $(printf %s "$r" | LC_ALL=C wc -c) - $(printf %s "$r" | LC_ALL=en_US.UTF-8 wc -m)))
|
||
printf "%-22s %-${w}s %6s %-13s %s\n" "$s" "$r" "$t" "$c" "$l"
|
||
done
|
||
[ "$failed" = 0 ] && echo "gates: PASS" || echo "gates: FAIL"
|
||
} | tee "$summary"
|
||
exit "$failed"
|