From 08cf4d4911fcd26dc4e567d356ab0d561343256e Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Fri, 26 Dec 2025 17:29:16 -0800 Subject: [PATCH] feat: add --run-chaos-tests flag to release script (bd-kx1j) Adds chaos and E2E test running to the release process: - New --run-chaos-tests flag runs chaos/corruption recovery tests - Runs both chaos and e2e tagged tests before commit/tag - Updated quick start to recommend chaos tests for releases - Tests use 10m timeout for thorough coverage Part of PR #752 integration. --- scripts/bump-version.sh | 50 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 3bda2392..a77f4930 100755 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -12,10 +12,13 @@ set -e # QUICK START (for typical release): # # # 1. Update CHANGELOG.md and cmd/bd/info.go with release notes (manual) -# # 2. Run version bump with all local installations: -# ./scripts/bump-version.sh X.Y.Z --commit --all -# # 3. Test locally, then push: -# git push origin main && git push origin vX.Y.Z +# # 2. Run version bump with chaos tests and all local installations: +# ./scripts/bump-version.sh X.Y.Z --run-chaos-tests --commit --tag --push --all +# +# Or step by step: +# ./scripts/bump-version.sh X.Y.Z --run-chaos-tests # Run chaos tests first +# ./scripts/bump-version.sh X.Y.Z --commit --all # Commit and install +# git push origin main && git push origin vX.Y.Z # Push # # WHAT --all DOES: # --install - Build bd and install to ~/go/bin AND ~/.local/bin @@ -47,7 +50,7 @@ NC='\033[0m' # No Color # Usage message usage() { - echo "Usage: $0 [--commit] [--tag] [--push] [--install] [--upgrade-mcp] [--mcp-local] [--restart-daemons] [--publish-npm] [--publish-pypi] [--publish-all] [--all]" + echo "Usage: $0 [--commit] [--tag] [--push] [--install] [--upgrade-mcp] [--mcp-local] [--restart-daemons] [--run-chaos-tests] [--publish-npm] [--publish-pypi] [--publish-all] [--all]" echo "" echo "Bump version across all beads components." echo "" @@ -60,6 +63,7 @@ usage() { echo " --upgrade-mcp Upgrade local beads-mcp installation via pip after version bump" echo " --mcp-local Install beads-mcp from local source (for pre-PyPI testing)" echo " --restart-daemons Restart all bd daemons to pick up new version" + echo " --run-chaos-tests Run chaos/corruption recovery tests before tagging" echo " --publish-npm Publish npm package to registry (requires npm login)" echo " --publish-pypi Publish beads-mcp to PyPI (requires TWINE credentials)" echo " --publish-all Shorthand for --publish-npm --publish-pypi" @@ -75,7 +79,11 @@ usage() { echo " $0 0.9.3 --commit --tag --push # Full release preparation" echo " $0 0.9.3 --all # Install bd, local MCP, and restart daemons" echo " $0 0.9.3 --commit --all # Commit and install everything locally" + echo " $0 0.9.3 --run-chaos-tests # Run chaos tests before proceeding" echo " $0 0.9.3 --publish-all # Publish to npm and PyPI" + echo "" + echo "Recommended release command (includes chaos testing):" + echo " $0 X.Y.Z --run-chaos-tests --commit --tag --push --all" exit 1 } @@ -153,6 +161,7 @@ main() { AUTO_RESTART_DAEMONS=false AUTO_PUBLISH_NPM=false AUTO_PUBLISH_PYPI=false + AUTO_RUN_CHAOS_TESTS=false # Parse flags shift # Remove version argument @@ -189,6 +198,9 @@ main() { AUTO_PUBLISH_NPM=true AUTO_PUBLISH_PYPI=true ;; + --run-chaos-tests) + AUTO_RUN_CHAOS_TESTS=true + ;; --all) AUTO_INSTALL=true AUTO_MCP_LOCAL=true @@ -602,6 +614,34 @@ main() { echo "" fi + # Run chaos tests if requested (before commit/tag to catch issues early) + if [ "$AUTO_RUN_CHAOS_TESTS" = true ]; then + echo "Running chaos/corruption recovery tests..." + echo " (This tests database corruption recovery, may take a few minutes)" + echo "" + + # Run chaos tests with the chaos build tag + if go test -tags=chaos -timeout=10m ./cmd/bd/...; then + echo -e "${GREEN}✓ Chaos tests passed${NC}" + echo "" + else + echo -e "${RED}✗ Chaos tests failed${NC}" + echo -e "${YELLOW} Fix the failures before releasing.${NC}" + exit 1 + fi + + # Also run E2E tests if available + echo "Running E2E tests..." + if go test -tags=e2e -timeout=10m ./cmd/bd/...; then + echo -e "${GREEN}✓ E2E tests passed${NC}" + echo "" + else + echo -e "${RED}✗ E2E tests failed${NC}" + echo -e "${YELLOW} Fix the failures before releasing.${NC}" + exit 1 + fi + fi + # Check if cmd/bd/info.go has been updated with the new version if ! grep -q "\"$NEW_VERSION\"" cmd/bd/info.go; then echo -e "${YELLOW}Warning: cmd/bd/info.go does not contain an entry for $NEW_VERSION${NC}"