Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

chore(release): assert the target set in verify-release.sh, never discover it

xerj-orgdbfcabaf7c14
diff --git a/AGENTS.md b/AGENTS.md
index ca43132cb..6c9d948b9 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -61,7 +61,7 @@ cannot push at all: [.github/AI_CONTRIBUTIONS.md](./.github/AI_CONTRIBUTIONS.md)
| Architecture map | [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) |
| Pre-submission and review protocol | [docs/CONTRIBUTION_REVIEW.md](./docs/CONTRIBUTION_REVIEW.md) |
| How to send a bug or a fix back upstream (written for agents) | [.github/AI_CONTRIBUTIONS.md](./.github/AI_CONTRIBUTIONS.md) |
-| Checking a published release is actually good | `scripts/verify-release.sh [tag]` — downloads every asset, verifies checksums, asserts each binary reports its tag's version, boots the host-native one and runs a search |
+| Checking a published release is actually good | `scripts/verify-release.sh [tag]` — downloads every asset, asserts every target we ship is present, verifies checksums, asserts each binary reports its tag's version, boots the host-native one and runs a search |
## How to evaluate this project fairly
diff --git a/scripts/verify-release.sh b/scripts/verify-release.sh
index 96b7b4452..cc7f3288a 100755
--- a/scripts/verify-release.sh
+++ b/scripts/verify-release.sh
@@ -17,21 +17,28 @@
# scripts/verify-release.sh v1.0.0-rc.13 -> PASS
#
# Checks, in order:
-# 1. every archive has a .sha256 companion, and matches it
-# 2. every archive contains the binary + LICENSE + README
-# 3. every binary — including the ones this host cannot execute — carries the
+# 1. every target we ship is present — the set is DECLARED below, not read off
+# the release page, so a release that lost a matrix leg fails instead of
+# quietly verifying the targets that did make it
+# 2. every archive has a .sha256 companion, and matches it
+# 3. every archive contains the binary + LICENSE + README
+# 4. every binary — including the ones this host cannot execute — carries the
# tag's version in its startup banner, and carries no other version
-# 4. the host-native binary: --version, boot on a clean data dir, health
+# 5. the host-native binary: --version, boot on a clean data dir, health
# green, index a doc, search it back, run a terms aggregation
#
+# A target this host cannot unpack (no unzip for the Windows .zip) is counted
+# and reported, never silently dropped: the run then exits non-zero, because a
+# partially-checked release is not a verified release.
+#
# Usage:
# scripts/verify-release.sh # latest release
# scripts/verify-release.sh v1.0.0-rc.13 # a specific tag
# scripts/verify-release.sh --keep # keep the download dir
# scripts/verify-release.sh --no-smoke # checksums + versions only
#
-# Requires: gh (authenticated), curl, tar, sha256sum|shasum. unzip for the
-# Windows archives (skipped with a warning if absent).
+# Requires: gh (authenticated), curl, tar, sha256sum|shasum, and unzip for the
+# Windows archives.
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail
@@ -46,7 +53,7 @@ while [ $# -gt 0 ]; do
--keep) KEEP=1 ;;
--no-smoke) DO_SMOKE=0 ;;
--repo) REPO="$2"; shift ;;
- -h|--help) sed -n '2,36p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
+ -h|--help) awk 'NR>1 && /^#/ {sub(/^# ?/, ""); print; next} NR>1 {exit}' "$0"; exit 0 ;;
-*) echo "unknown flag: $1" >&2; exit 2 ;;
*) TAG="$1" ;;
esac
@@ -59,7 +66,27 @@ if [ -t 1 ]; then
GRN=$(printf '\033[32m'); YEL=$(printf '\033[33m'); RST=$(printf '\033[0m')
fi
+# Every target .github/workflows/release.yml publishes (its `matrix.include`).
+# Declared, not discovered. A gate that verifies whatever the release page
+# happens to hold reports a clean PASS for a release that is missing platforms:
+# delete the two windows-msvc archives from a release and the rest of this
+# script goes 6-for-6 green. Keep this list in step with release.yml — if the
+# matrix gains or loses a target, this is the other half of that change.
+EXPECTED_TARGETS="aarch64-apple-darwin
+aarch64-pc-windows-msvc
+aarch64-unknown-linux-gnu
+aarch64-unknown-linux-musl
+x86_64-apple-darwin
+x86_64-pc-windows-msvc
+x86_64-unknown-linux-gnu
+x86_64-unknown-linux-musl"
+TOTAL_TARGETS=$(printf '%s\n' "$EXPECTED_TARGETS" | wc -l | tr -d ' ')
+
FAILURES=0
+# Targets that were present but could not be checked (archive not unpackable on
+# this host). Counted separately from failures: not a defect in the release, but
+# not a verification either, and the verdict must never round it up to PASS.
+SKIPPED_TARGETS=0
pass() { printf ' %sPASS%s %s\n' "$GRN" "$RST" "$1"; }
fail() { printf ' %sFAIL%s %s\n' "$RED" "$RST" "$1"; FAILURES=$((FAILURES + 1)); }
warn() { printf ' %sSKIP%s %s\n' "$YEL" "$RST" "$1"; }
@@ -120,7 +147,18 @@ ARCHIVES=$(find . -maxdepth 1 -type f \( -name '*.tar.gz' -o -name '*.zip' \) |
[ -n "$ARCHIVES" ] || { fail "no .tar.gz or .zip assets on $TAG"; exit 1; }
printf ' %s%s archives%s\n' "$DIM" "$(printf '%s\n' "$ARCHIVES" | wc -l | tr -d ' ')" "$RST"
-step "2. checksums"
+step "2. every target we ship is present"
+# Asserted against EXPECTED_TARGETS, never inferred from what was downloaded:
+# one failed leg of the release matrix must fail this gate, not shrink it.
+for t in $EXPECTED_TARGETS; do
+ if printf '%s\n' "$ARCHIVES" | grep -qE -- "-${t}\.(tar\.gz|zip)\$"; then
+ pass "$t"
+ else
+ fail "$t — NO archive published for this target"
+ fi
+done
+
+step "3. checksums"
for a in $ARCHIVES; do
if [ ! -f "$a.sha256" ]; then
fail "$a — no .sha256 companion published"
@@ -135,7 +173,7 @@ for a in $ARCHIVES; do
fi
done
-step "3. archive contents"
+step "4. archive contents"
for a in $ARCHIVES; do
d="unpack/${a%.tar.gz}"; d="${d%.zip}"
mkdir -p "$d"
@@ -143,7 +181,7 @@ for a in $ARCHIVES; do
*.tar.gz) tar -xzf "$a" -C "$d" ;;
*.zip)
if command -v unzip >/dev/null 2>&1; then unzip -q -o "$a" -d "$d"
- else warn "$a — unzip not on PATH"; continue; fi ;;
+ else warn "$a — unzip not on PATH, contents NOT checked"; continue; fi ;;
esac
bin=$(find "$d" -type f \( -name xerj -o -name xerj.exe \) | head -1)
missing=""
@@ -153,14 +191,21 @@ for a in $ARCHIVES; do
if [ -n "$missing" ]; then fail "$a — missing:$missing"; else pass "$a binary + LICENSE + README"; fi
done
-step "4. version string matches the tag, on every target"
+step "5. version string matches the tag, on every target"
# The rc.10 check. A binary whose banner disagrees with its own filename is the
# defect; a binary carrying two different versions is a stale-artifact defect.
for a in $ARCHIVES; do
d="unpack/${a%.tar.gz}"; d="${d%.zip}"
- bin=$(find "$d" -type f \( -name xerj -o -name xerj.exe \) 2>/dev/null | head -1)
- [ -n "$bin" ] || continue
target=$(printf '%s' "$a" | sed "s/^xerj-$EXPECTED-//; s/\.tar\.gz$//; s/\.zip$//")
+ bin=$(find "$d" -type f \( -name xerj -o -name xerj.exe \) 2>/dev/null | head -1)
+ if [ -z "$bin" ]; then
+ # Step 4 could not unpack this archive (typically: no unzip for a Windows
+ # .zip). Dropping it here would leave this section headed "on every target"
+ # quietly checking fewer targets than it names.
+ warn "$target — no binary unpacked, version NOT checked"
+ SKIPPED_TARGETS=$((SKIPPED_TARGETS + 1))
+ continue
+ fi
found=$(banner_versions "$bin" | tr '\n' ' ' | sed 's/ $//')
if [ -z "$found" ]; then
fail "$target — no version banner found in the binary"
@@ -171,7 +216,7 @@ for a in $ARCHIVES; do
fi
done
-# ── 5. run the one we can actually run ───────────────────────────────────────
+# ── 6. run the one we can actually run ───────────────────────────────────────
HOST_OS=$(uname -s); HOST_ARCH=$(uname -m)
case "$HOST_OS" in
Linux) host_glob="*${HOST_ARCH}-unknown-linux-*" ;;
@@ -189,7 +234,7 @@ fi
# it when it did not happen — a cross-arch runner or --no-smoke leaves this 0.
SMOKED=0
-step "5. run the host-native artifact"
+step "6. run the host-native artifact"
if [ -z "$HOST_BIN" ]; then
warn "no artifact for $HOST_OS/$HOST_ARCH — nothing to execute here"
elif [ "$DO_SMOKE" = 0 ]; then
@@ -264,14 +309,25 @@ EOF
fi
step "verdict"
-if [ "$FAILURES" -eq 0 ]; then
+# PASS is only ever printed for a release where every declared target was
+# actually checked. --no-smoke narrows the verdict text because the operator
+# asked for it; a skipped target is not something anyone asked for, so it fails
+# closed rather than being rounded up into a PASS this run did not earn.
+if [ "$FAILURES" -eq 0 ] && [ "$SKIPPED_TARGETS" -eq 0 ]; then
if [ "$SMOKED" = 1 ]; then
- scope="checksums, versions and a live search all verified"
+ scope="checksums and versions verified on $TOTAL_TARGETS/$TOTAL_TARGETS targets, plus a live search"
else
- scope="checksums and versions verified — NO binary was executed, so nothing here says it runs"
+ scope="checksums and versions verified on $TOTAL_TARGETS/$TOTAL_TARGETS targets — NO binary was executed, so nothing here says it runs"
fi
printf ' %sPASS%s %s: %s\n' "$GRN" "$RST" "$TAG" "$scope"
exit 0
fi
-printf ' %sFAIL%s %s: %s check(s) failed — do not announce this release\n' "$RED" "$RST" "$TAG" "$FAILURES"
+
+if [ "$SKIPPED_TARGETS" -gt 0 ]; then
+ printf ' %sFAIL%s %s: %s of %s target(s) NOT verified (see SKIP above) — install the missing tool (unzip, for the Windows .zip archives) and re-run; do not announce a partially checked release\n' \
+ "$RED" "$RST" "$TAG" "$SKIPPED_TARGETS" "$TOTAL_TARGETS"
+fi
+if [ "$FAILURES" -gt 0 ]; then
+ printf ' %sFAIL%s %s: %s check(s) failed — do not announce this release\n' "$RED" "$RST" "$TAG" "$FAILURES"
+fi
exit 1