Files
PaperClipAI/scripts/confirm-canary-publication.sh
DottaandClaude Opus 5.5 0e8447fe77 fix(release): retry the finalize install while a large tarball lags its npm metadata (#21925)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Since #21917, each canary's npm confirmation, git tag, Docker build
and onboarding smoke run in `canary-finalize.yml`
> - The first canary through it, `2026.1116.0-canary.814700`, passed the
master-position, visibility, provenance (31 of 31) and dist-tag checks
> - It then failed the clean-prefix install: the 524 MB
`@paperclipai/server` tarball returned 404 while npm already listed the
version
> - Without a tag, nightly cannot select that canary, and no Docker
image or smoke runs for it
> - This pull request retries that install for a bounded time
> - The benefit is that a large tarball's normal lag no longer stops a
canary from finishing

## Linked Issues or Issue Description

**What happened?**
Canary finalize run 43927092510 for `2026.1116.0-canary.814700`:
`npm error 404 Not Found - GET
https://registry.npmjs.org/@paperclipai/server/-/server-2026.1116.0-canary.814700.tgz`.
npm's packument records that version at 18:31:41Z. The install ran at
18:32:03Z, and the tarball still returned 404 at 18:34:39 and 18:35:15.
`@paperclipai/shared` and `paperclipai` tarballs at the same version
returned 200.

**Expected behavior**
Finalize waits, within a bound, until the published tarball downloads,
then tags the canary.

Refs #21917

## What Changed

- `scripts/release-lib.sh`: `wait_for_npm_installable` retries
`verify_npm_installable` up to N attempts with a fixed delay.
- `scripts/confirm-canary-publication.sh`: uses it with 40 attempts × 30
s (`NPM_INSTALL_VERIFY_ATTEMPTS`, `NPM_INSTALL_VERIFY_DELAY_SECONDS`).
- `.github/workflows/canary-finalize.yml`: `confirm_canary` timeout 45 →
75 min, to fit the existing 30-minute visibility budget plus the
20-minute install budget.
- Test and `doc/RELEASING.md`.

## Verification

- `node --test scripts/release-lib.test.mjs`: 23 of 23 pass, including a
new test: immediate success, recovery after 3 failures (4 attempts,
warning names attempt 3/5), and failure after the bound (4 of 4
attempts).
- `node --test scripts/__tests__/release-verify-workflow.test.mjs`: 73
of 73 pass.
- After merge: the next canary's finalize run passes the install and
pushes its tag. `canary.814700` itself is recovered by rerunning its
finalize run once its tarball downloads.

## Risks

- Low. A tarball that never appears still fails finalize, after 20
minutes instead of at once.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with
tool use and code execution.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 14:24:40 -06:00

67 lines
3.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# shellcheck source=./release-lib.sh
. "$REPO_ROOT/scripts/release-lib.sh"
usage() {
cat <<'EOF'
Usage:
./scripts/confirm-canary-publication.sh <canary-version> <source-sha>
Confirms a canary that ./scripts/release.sh canary --defer-registry-confirmation
published, then creates and pushes its canary/v<version> tag at <source-sha>.
Run it from a checkout of <source-sha>. It waits for every public package
version to become registry-visible, requires npm provenance from the master
release workflow at <source-sha>, checks dist-tags and internal dependencies
(the canary dist-tag may already name a newer canary), and installs the exact
version into a clean prefix. A tag that already points at <source-sha> is
accepted, so a rerun is safe.
EOF
}
[ $# -eq 2 ] || { usage; exit 1; }
version="$1"
source_sha="$2"
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+-canary\.[0-9]+$ ]] || release_fail "not a canary version: $version"
[[ "$source_sha" =~ ^[0-9a-f]{40}$ ]] || release_fail "not a full commit SHA: $source_sha"
[ "$(git -C "$REPO_ROOT" rev-parse HEAD)" = "$source_sha" ] || release_fail "checkout is not $source_sha"
require_canary_number_from_master_commit "$version" "$source_sha"
tag_name="$(canary_tag_name "$version")"
PUBLISH_REMOTE="$(resolve_release_remote)"
PACKAGE_INFO=""
PACKAGE_NAMES=()
while IFS=$'\t' read -r pkg_dir pkg_name _pkg_version; do
[ -n "$pkg_name" ] || continue
PACKAGE_NAMES+=("$pkg_name")
PACKAGE_INFO+="${pkg_dir}"$'\t'"${pkg_name}"$'\t'"${version}"$'\n'
done < <(list_public_package_info)
[ "${#PACKAGE_NAMES[@]}" -gt 0 ] || release_fail "no public packages were found in the workspace."
release_info "==> Waiting for registry visibility of ${#PACKAGE_NAMES[@]} packages at ${version}..."
wait_for_npm_package_versions "${NPM_PUBLISH_VERIFY_ATTEMPTS:-12}" "${NPM_PUBLISH_VERIFY_DELAY_SECONDS:-5}" "$PACKAGE_INFO" \
|| release_fail "npm did not expose every package at ${version}"
release_info "==> Checking npm provenance..."
node "$REPO_ROOT/scripts/verify-canary-provenance.mjs" "$version" "$source_sha" "${PACKAGE_NAMES[@]}" \
|| release_fail "npm provenance does not tie ${version} to the master release workflow at ${source_sha}"
release_info "==> Checking dist-tags and internal dependencies..."
verify_args=(--channel canary --dist-tag canary --target-version "$version" --allow-newer-canary)
for pkg_name in "${PACKAGE_NAMES[@]}"; do verify_args+=(--package "$pkg_name"); done
if wait_for_release_registry_state "${NPM_REGISTRY_STATE_VERIFY_ATTEMPTS:-12}" "${NPM_REGISTRY_STATE_VERIFY_DELAY_SECONDS:-5}" "${verify_args[@]}"; then
:
else
release_fail "npm dist-tags or registry metadata are wrong or never converged for ${version}"
fi
release_info "==> Installing paperclipai@${version} into a clean prefix..."
wait_for_npm_installable "paperclipai@${version}" "$version" "${NPM_INSTALL_VERIFY_TIMEOUT_SECONDS:-1200}" "${NPM_INSTALL_VERIFY_DELAY_SECONDS:-30}" \
|| release_fail "paperclipai@${version} did not install cleanly"
push_release_tag_at "$PUBLISH_REMOTE" "$tag_name" "$source_sha"