From aa2b11d5288c225ff7b5da08036b31c8a5ee48e6 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 9 Mar 2026 09:21:56 -0500 Subject: [PATCH] feat: extend release preflight smoke options --- doc/RELEASING.md | 26 ++++++++ scripts/release-preflight.sh | 124 ++++++++++++++++++++++++++++++++--- 2 files changed, 141 insertions(+), 9 deletions(-) diff --git a/doc/RELEASING.md b/doc/RELEASING.md index e18a3e6e..7b6b69e8 100644 --- a/doc/RELEASING.md +++ b/doc/RELEASING.md @@ -42,6 +42,9 @@ claude -p "Use the release-changelog skill to draft or update releases/v${VERSIO # 4. Smoke test what users will actually install PAPERCLIPAI_VERSION=canary ./scripts/docker-onboard-smoke.sh +# Optional: have preflight run the onboarding smoke immediately afterward +./scripts/release-preflight.sh canary patch --onboard-smoke --onboard-host-port 3232 --onboard-data-dir ./data/release-preflight-canary + # Users install with: npx paperclipai@canary onboard ``` @@ -105,6 +108,21 @@ If `latest` is broken after publish, repoint it to the last known good stable ve This does **not** unpublish anything. It only moves the `latest` dist-tag back to the last good stable release. +### Standalone onboarding smoke + +You already have a script for isolated onboarding verification: + +```bash +HOST_PORT=3232 DATA_DIR=./data/release-smoke-canary PAPERCLIPAI_VERSION=canary ./scripts/docker-onboard-smoke.sh +HOST_PORT=3233 DATA_DIR=./data/release-smoke-stable PAPERCLIPAI_VERSION=latest ./scripts/docker-onboard-smoke.sh +``` + +This is the best existing fit when you want: + +- a standalone Paperclip data dir +- a dedicated host port +- an end-to-end `npx paperclipai ... onboard` check + ### GitHub Actions release There is also a manual workflow at [`.github/workflows/release.yml`](../.github/workflows/release.yml). It is designed for npm trusted publishing via GitHub OIDC instead of long-lived npm tokens. @@ -310,6 +328,14 @@ Run the actual install path in Docker: PAPERCLIPAI_VERSION=canary ./scripts/docker-onboard-smoke.sh ``` +If you want it tied directly to preflight, you can append: + +```bash +./scripts/release-preflight.sh canary --onboard-smoke +./scripts/release-preflight.sh canary --onboard-smoke --onboard-host-port 3232 --onboard-data-dir ./data/release-preflight-canary +./scripts/release-preflight.sh stable --onboard-smoke --onboard-host-port 3233 --onboard-data-dir ./data/release-preflight-stable +``` + Minimum checks: - [ ] `npx paperclipai@canary onboard` installs diff --git a/scripts/release-preflight.sh b/scripts/release-preflight.sh index fdba4ae1..4b68cbb3 100755 --- a/scripts/release-preflight.sh +++ b/scripts/release-preflight.sh @@ -6,15 +6,23 @@ export GIT_PAGER=cat channel="" bump_type="" +run_onboard_smoke=false +onboard_version="" +onboard_host_port="" +onboard_data_dir="" usage() { cat <<'EOF' Usage: - ./scripts/release-preflight.sh + ./scripts/release-preflight.sh [--onboard-smoke] + [--onboard-version ] + [--onboard-host-port ] + [--onboard-data-dir ] Examples: ./scripts/release-preflight.sh canary patch ./scripts/release-preflight.sh stable minor + ./scripts/release-preflight.sh canary minor --onboard-smoke --onboard-version canary --onboard-host-port 3232 What it does: - verifies the git worktree is clean, including untracked files @@ -25,22 +33,62 @@ What it does: pnpm -r typecheck pnpm test:run pnpm build + - optionally runs scripts/docker-onboard-smoke.sh afterward EOF } -if [ $# -eq 1 ] && [[ "$1" =~ ^(-h|--help)$ ]]; then - usage - exit 0 -fi +while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + usage + exit 0 + ;; + --onboard-smoke) + run_onboard_smoke=true + ;; + --onboard-version) + shift + if [ $# -eq 0 ]; then + echo "Error: --onboard-version requires a value." >&2 + exit 1 + fi + onboard_version="$1" + ;; + --onboard-host-port) + shift + if [ $# -eq 0 ]; then + echo "Error: --onboard-host-port requires a value." >&2 + exit 1 + fi + onboard_host_port="$1" + ;; + --onboard-data-dir) + shift + if [ $# -eq 0 ]; then + echo "Error: --onboard-data-dir requires a value." >&2 + exit 1 + fi + onboard_data_dir="$1" + ;; + *) + if [ -z "$channel" ]; then + channel="$1" + elif [ -z "$bump_type" ]; then + bump_type="$1" + else + echo "Error: unexpected argument: $1" >&2 + exit 1 + fi + ;; + esac + shift +done -if [ $# -ne 2 ]; then +if [ -z "$channel" ] || [ -z "$bump_type" ]; then usage exit 1 fi -channel="$1" -bump_type="$2" - if [[ ! "$channel" =~ ^(canary|stable)$ ]]; then usage exit 1 @@ -120,6 +168,14 @@ fi TARGET_STABLE_VERSION="$(compute_bumped_version "$CURRENT_STABLE_VERSION" "$bump_type")" TARGET_CANARY_VERSION="$(next_canary_version "$TARGET_STABLE_VERSION")" +if [ "$run_onboard_smoke" = true ] && [ -z "$onboard_version" ]; then + if [ "$channel" = "canary" ]; then + onboard_version="canary" + else + onboard_version="latest" + fi +fi + if [ -n "$(git -C "$REPO_ROOT" status --porcelain)" ]; then echo "Error: working tree is not clean. Commit, stash, or remove changes before releasing." >&2 exit 1 @@ -146,6 +202,16 @@ if [ "$channel" = "canary" ]; then echo " Next canary version: $TARGET_CANARY_VERSION" echo " Guard: canaries are always derived from the next stable version, never ${CURRENT_STABLE_VERSION}-canary.N" fi +if [ "$run_onboard_smoke" = true ]; then + echo " Post-check: onboarding smoke enabled" + echo " Onboarding smoke version/tag: $onboard_version" + if [ -n "$onboard_host_port" ]; then + echo " Onboarding smoke host port: $onboard_host_port" + fi + if [ -n "$onboard_data_dir" ]; then + echo " Onboarding smoke data dir: $onboard_data_dir" + fi +fi echo "" echo "==> Working tree" @@ -179,5 +245,45 @@ pnpm -r typecheck pnpm test:run pnpm build +echo "" +if [ "$run_onboard_smoke" = true ]; then + echo "==> Optional onboarding smoke" + smoke_cmd=(env "PAPERCLIPAI_VERSION=$onboard_version") + if [ -n "$onboard_host_port" ]; then + smoke_cmd+=("HOST_PORT=$onboard_host_port") + fi + if [ -n "$onboard_data_dir" ]; then + smoke_cmd+=("DATA_DIR=$onboard_data_dir") + fi + smoke_cmd+=("$REPO_ROOT/scripts/docker-onboard-smoke.sh") + printf ' Running:' + for arg in "${smoke_cmd[@]}"; do + printf ' %q' "$arg" + done + printf '\n' + "${smoke_cmd[@]}" + echo "" +fi + +echo "==> Release preflight summary" +echo " Channel: $channel" +echo " Bump: $bump_type" +echo " Last stable tag: ${LAST_STABLE_TAG:-}" +echo " Current stable version: $CURRENT_STABLE_VERSION" +echo " Next stable version: $TARGET_STABLE_VERSION" +if [ "$channel" = "canary" ]; then + echo " Next canary version: $TARGET_CANARY_VERSION" + echo " Guard: canaries are always derived from the next stable version, never ${CURRENT_STABLE_VERSION}-canary.N" +fi +if [ "$run_onboard_smoke" = true ]; then + echo " Onboarding smoke version/tag: $onboard_version" + if [ -n "$onboard_host_port" ]; then + echo " Onboarding smoke host port: $onboard_host_port" + fi + if [ -n "$onboard_data_dir" ]; then + echo " Onboarding smoke data dir: $onboard_data_dir" + fi +fi + echo "" echo "Preflight passed for $channel release."