From eff814b24578afa7cd67afc4b3178ab3b85d6eb7 Mon Sep 17 00:00:00 2001 From: Julian lechner Date: Fri, 11 Sep 2026 15:43:36 +0200 Subject: [PATCH] test: add build-time validation regression tests (Bash) Bash equivalent of the PowerShell build-validation test, using a tar-based repo copy per case to check the same four rejected-defect scenarios. Co-Authored-By: Claude Sonnet 5 --- scripts/test-build-validation.sh | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 scripts/test-build-validation.sh diff --git a/scripts/test-build-validation.sh b/scripts/test-build-validation.sh new file mode 100644 index 0000000..5ef616f --- /dev/null +++ b/scripts/test-build-validation.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -euo pipefail + +root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) +work=$(mktemp -d) +cleanup() { rm -rf -- "$work"; } +trap cleanup EXIT + +new_repo_copy() { + local copy + copy=$(mktemp -d "$work/case-XXXXXX") + (cd "$root" && tar -cf - --exclude='.git' --exclude='generated' .) | (cd "$copy" && tar -xf -) + printf '%s' "$copy" +} + +test_build_fails() { + local label=$1 mutate_fn=$2 copy + copy=$(new_repo_copy) + "$mutate_fn" "$copy" + if bash "$copy/scripts/build.sh" >/dev/null 2>&1; then + printf 'Expected build to fail for case "%s" but it succeeded.\n' "$label" >&2 + exit 1 + fi + rm -rf -- "$copy" +} + +mutate_invalid_json() { + printf '} this is not json {' >> "$1/adapters/claude/config/settings.json" +} +test_build_fails 'invalid Claude settings.json' mutate_invalid_json + +mutate_duplicate_agent() { + sed -i 's/^name:.*/name: implementer/' "$1/shared/agents/architect/agent.yml" +} +test_build_fails 'duplicate agent name' mutate_duplicate_agent + +mutate_duplicate_plugin() { + local manifest="$1/adapters/plugins.tsv" + sed -n '2p' "$manifest" >> "$manifest" +} +test_build_fails 'duplicate plugin name' mutate_duplicate_plugin + +mutate_leftover_placeholder() { + printf '\n__NOT_A_REAL_PLACEHOLDER__\n' >> "$1/shared/global-instructions.md" +} +test_build_fails 'leftover template placeholder' mutate_leftover_placeholder + +printf 'PASS build validation: invalid JSON, duplicate agent, duplicate plugin, and leftover placeholders are all rejected\n'