Repository navigation
fix(release): wait for the new version on npm before syncing the template - #747
MarioCadenas wants to merge 4 commits into
Conversation
…late The template sync ran npm install right after publish, before the registry served the new version, so every attempt failed with ETARGET (npm also reused its stale cached packument between retries). The script now polls `npm view <pkg>@<version> --prefer-online` for each package it pins, with backoff for up to 10 minutes, and fails naming the package and version if it never appears. npm install also runs with --prefer-online. The longer wait widens the window for main to move, so the sync commit is rebased onto the latest branch before tagging, and the commit and tag are pushed in one atomic push (with the tag named explicitly; --follow-tags silently skipped a tag that already existed on the remote). Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: mario.cadenas <mario.cadenas@databricks.com>
npm view already revalidates its cache by default, so the flag is a guard against a config change, not what defeats a stale packument. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: mario.cadenas <mario.cadenas@databricks.com>
|
Review 1 · Fail · 1 major Does the change do what the task asked? No. Gate: major and worse must be fixed. 1 finding (1 important). 1 finding (1 important). The fake registry tests pass, and the script now probes both pinned packages before npm install. The wait still has no effective ten-minute bound when an npm view subprocess is slow or stalled, so the release job can expire without the requested package/version timeout message. The brief's example /xavier-review and /security-review commands were unavailable here. Important (required)
|
npm's own fetch timeout (5 minutes, retried twice) let a single stalled `npm view` outlast the 10-minute wait, so the release job could time out without the package/version message. Each probe now gets at most 60 s, and never more than the time left before the deadline; a probe that is cut off is reported as "npm view did not answer in time". Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: mario.cadenas <mario.cadenas@databricks.com>
🤖 AppKit PR bot🔬 Run evalsStart an eval for this PR from the evals-monitor app: Go to Evals Monitor → 📦 Try this PR's app templateScaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — The template pins |
|
Review 2 · Pass · 1 minor, 1 pre-existing Does the change do what the task asked? Yes. Gate: major and worse must be fixed. 2 findings (1 nit, 1 pre-existing): nothing needs fixing. No findings: nothing needs fixing. The new probe timeout fixes F1: a stalled npm view now ends within the wait and reports the package and version. The prescribed repository check passed, and I found no qualifying finding in this round. Nit (not required, below the gate)
Pre-existing (not required, there before this change)
|
|
Review 3 · Pass · 1 minor Does the change do what the task asked? Yes. Gate: major and worse must be fixed. 1 finding (1 nit): nothing needs fixing. No findings: nothing needs fixing. The prior stalled-probe fault is fixed: each npm view call is bounded by the remaining wait time, and the stalled-registry test passes with the promised package and version error. I found no qualifying fault in this round; the required repository check passed and left the working tree clean. The /xavier-review and /security-review skills named in the brief were unavailable here. Nit (not required, below the gate)
|
|
Review 4 · Fail · 1 major Does the change do what the task asked? Yes. Gate: major and worse must be fixed. 1 finding (1 important). No findings: nothing needs fixing. The change meets the task as far as this review can verify: it waits for both pinned AppKit versions, refreshes npm metadata during install, and preserves the commit and tag in an atomic push. The required repository check passed, and the fake-registry tests exercised delayed availability, timeout reporting, and a stalled registry. I found no qualifying fault. Important (required)
|
Rebasing the sync commit onto the latest branch before tagging let template-v<version> include commits merged after the release was cut, which never went through the release pipeline yet would ship to every app created from that template. The tag now goes on the sync commit on top of the checked-out release; only the branch gets the sync replayed onto newer commits. The git steps move into tools/push-template-tag.ts with a test that recreates the race. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: mario.cadenas <mario.cadenas@databricks.com>
|
Review 5 · Pass Does the change do what the task asked? Yes. Gate: major and worse must be fixed. No findings: nothing needs fixing. No findings: nothing needs fixing. The change meets the task as reviewed in this round. The tag is created on the release checkout before the branch is rebased, and the moved-main test and required repository check pass. No qualifying finding remains. No findings. |
What
Template sync waits until the new release is on npm
Why
: template sync waits until the new release is on npm
Commits on
work/14-template-sync-waits-until-the-(not pushed; the board pushes them):e0c28428: the fix.5d44365f: a comment correction.Why the check failed ("sh: pnpm: not found"): pnpm had never been enabled on this machine. I ran the repo's documented setup step
corepack enable pnpm, which adds apnpmlink to~/.nvm/versions/node/v24.22.1/bin. That directory is on the PATH the check runs with. This changes the machine, not the repo;corepack disable pnpmundoes it.The board runs the check only once per commit. So the second failure message was the cached 10:18 result for
e0c28428. The new commit5d44365fmakes the check run again. It only corrects a comment:npm viewalready revalidates its cache by default, so--prefer-onlinethere is a guard, not the fix.I ran the exact check command the way
finish.shruns it: in my working folder, with this session's PATH and the 900 s timeout. It passed in 43 s.Cause of the release bug:
tools/publish-template-tag.tsrannpm installright after publish. The registry didn't serve the new version yet. The two retries came 2 s and 4 s later, and npm answered them from its local cache (the packument it had just fetched, cacheable for 5 minutes), so all three attempts failed with ETARGET.What changed:
tools/wait-for-npm-version.ts. Before installing, it pollsnpm view <pkg>@<version> version --prefer-onlinefor each package the script pins (@databricks/appkitand@databricks/appkit-ui). Retries start 5 s apart and double up to 30 s. All packages share one 10-minute limit. On timeout the script exits 1 with "<pkg>@<version>is still not on the npm registry after 600s" plus npm's last output.npm installnow runs with--prefer-online. Because of--min-release-age, npm fetches the same full packument for the install asnpm viewdoes, so the probe checks the same document.git pull --rebasebefore tagging.git push --atomic origin HEAD refs/tags/template-v<version>. Before,--follow-tagssilently skipped a tag that already existed on the remote. The branch moved and the script still printed "✓ pushed". Now the commit and the tag land together or not at all.tools/wait-for-npm-version.test.tsuses a fake HTTP registry that serves the version only after N requests. It checks the wait succeeds with exactly N tries per package, and that a timeout names the package and version.Checked:
--atomicleft the branch alone when the tag already existed.Not covered by a test: the git changes (rebase and atomic push) were only checked by hand in the sandbox. The install's
--prefer-onlineis not tested either; the wait test passes with or without it.For the release workflow (private repo), for you to take over:
--lockfile-only) may fetch the abbreviated packument, which the CDN can refresh at a different time than the full onenpm viewchecks. Its existing 2 s / 4 s retries are the only cover.Also noticed:
.gitignore(tmp) andknip.json: knip falsely reportspackages/appkit/bin/appkit.jsand the root devDependenciesesbuildandoraas unused when the checkout's path contains atmpfolder. It passes in the same tree at a normal path.apps/dev-playground/client/package-lock.json:pnpm installat the root once rewrote it (it removed extraneous../../../packages/appkit-uientries). I reverted it; I didn't change it.NPM_CONFIG_REGISTRY, so a pnpm install that has to download goes to the blocked registry.npmjs.org. Installs work here only because the pnpm store already holds every package.How it was verified
pnpm install --frozen-lockfile && pnpm run check && pnpm run knip && pnpm build && pnpm run typecheck && pnpm vitest run --changed "$(git merge-base HEAD origin/main)"passed.Screenshots
None
Notes
None