Files
sow-tools/scripts/crucible-smoke.sh
T
archvillainette 9357b30994
test / test (push) Successful in 1m31s
build-binaries / build-binaries (push) Successful in 2m27s
build-image / publish (push) Successful in 42s
crucible depot: Increment 1 core (status/push/verify/get/pull + local/cdn/bunny backends) (#30)
Implements Increment 1 of `docs/superpowers/specs/2026-07-04-crucible-depot-core-design.md`: a new stdlib-only `internal/depot` package wired into the dispatcher.

- `crucible depot status|push|verify|get|pull` with backends `local`/`cdn`/`bunny`; exit contract `0` clean / `1` drift / `2` unconfirmed-only / `64` usage / `70` internal.
- Presence is always probed against the real target (IPv4 1-byte range GET; HEAD is banned with a regression-tripwire test). `unconfirmed` is a distinct state, never collapsed into `missing`.
- No prompting anywhere: missing `BUNNY_STORAGE_*` env fails closed (read path included), enforced by a no-stdin test.
- Uploads: probe-then-PUT with `Checksum: <UPPER-sha>`; read/write key split (`BUNNY_STORAGE_READ_PASSWORD` falls back to `BUNNY_STORAGE_PASSWORD`).
- Field-driven fix included: per-probe transient retry (curl `--retry 2` equivalent) — without it a real 1490-blob CDN sweep reported 1222 false-unconfirmed; with it, 1490/1490 present in 74s, exit 0.
- Registry: depot `Wired: true`, joins the interactive menu; stale "(SeaweedFS)" wording removed.

Tests: unit + httptest fake-Bunny (probe sequence, Checksum header, key split, 428 throttling → exit 2) + local→bunny integration (drift → push → clean → idempotent no-second-PUT; incremental pull). `make check` green.

**Merge ordering:** this merges FIRST; the companion `sow-assets-manifest#crucible-depot-cutover` PR needs its flake input bumped to include this.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #30
Reviewed-by: xtul <mpiasecki720@protonmail.com>
Co-authored-by: vickydotbat <vickydotbat@tutamail.com>
Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
2026-07-04 23:30:54 +00:00

66 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Smoke test the built Crucible binaries:
# - the dispatcher reports version + lists builders
# - an unwired builder (no migrated logic yet) fails closed with exit 70
# - a wired builder rejects a missing subcommand with a usage error (exit 64,
# NOT 70) and exits cleanly under --help — proof it delegates to the migrated
# nwn-tool surface rather than faking an artifact
# - each standalone shim agrees with the dispatcher
set -euo pipefail
cd "$(dirname "$0")/.."
bin=bin
[[ -x "${bin}/crucible" ]] || { echo "no ${bin}/crucible — run scripts/build-binaries.sh first" >&2; exit 1; }
"${bin}/crucible" version >/dev/null
"${bin}/crucible" list >/dev/null
# Keep in sync with internal/dispatch.Registry (Wired flag).
unwired=()
wired=(depot hak module topdata wiki)
exit_of() { set +e; "$@" >/dev/null 2>&1; local c=$?; set -e; echo "${c}"; }
for b in "${unwired[@]}"; do
[[ -x "${bin}/crucible-${b}" ]] || { echo "missing ${bin}/crucible-${b}" >&2; exit 1; }
via_dispatch="$(exit_of "${bin}/crucible" "${b}")"
via_shim="$(exit_of "${bin}/crucible-${b}")"
if [[ "${via_dispatch}" -ne 70 ]]; then
echo "FAIL: crucible ${b} exit=${via_dispatch}, want 70 (unwired must fail closed)" >&2
exit 1
fi
if [[ "${via_shim}" -ne 70 ]]; then
echo "FAIL: crucible-${b} exit=${via_shim}, want 70 (must match dispatcher)" >&2
exit 1
fi
done
for b in "${wired[@]}"; do
[[ -x "${bin}/crucible-${b}" ]] || { echo "missing ${bin}/crucible-${b}" >&2; exit 1; }
# --help is a clean exit for a wired builder.
help_code="$(exit_of "${bin}/crucible" "${b}" --help)"
if [[ "${help_code}" -ne 0 ]]; then
echo "FAIL: crucible ${b} --help exit=${help_code}, want 0 (wired builder)" >&2
exit 1
fi
# No subcommand is a usage error, and crucially NOT the unwired 70.
via_dispatch="$(exit_of "${bin}/crucible" "${b}")"
via_shim="$(exit_of "${bin}/crucible-${b}")"
for pair in "dispatch:${via_dispatch}" "shim:${via_shim}"; do
code="${pair#*:}"
if [[ "${code}" -eq 70 ]]; then
echo "FAIL: ${pair%%:*} crucible ${b} still fails closed (70) but is wired" >&2
exit 1
fi
if [[ "${code}" -ne 64 ]]; then
echo "FAIL: ${pair%%:*} crucible ${b} exit=${code}, want 64 (missing subcommand)" >&2
exit 1
fi
done
done
echo "smoke ok: ${#unwired[@]} unwired fail closed (70), ${#wired[@]} wired delegate to nwn-tool logic"