fix(lib): retry the staging install without --prefer-offline outside CI - #407
Open
jsteinich wants to merge 1 commit into
Open
fix(lib): retry the staging install without --prefer-offline outside CI#407jsteinich wants to merge 1 commit into
jsteinich wants to merge 1 commit into
Conversation
`scripts/pack.mjs` installs staging deps with --prefer-offline. When the local npm cache holds a packument older than a dependency bump, npm never refreshes it and reports ETARGET -- "No matching version found" -- for a version that does exist. The message blames the version, so the usual reaction is to distrust the pin rather than the cache. Outside CI we now retry once with --prefer-online. In CI the failure is rethrown untouched, so a stale cache can never quietly change what gets packaged; a release build that cannot resolve a pinned version should fail rather than silently reach for a different resolution. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
No issue — follow-up from #395, where this cost real time during the upgrade.
Description
packages/cdktn/scripts/pack.mjsinstalls the staging dependencies with--prefer-offline. When the local npm cache holds a packument older than a dependency bump, npm never refreshes it and reports:The version does exist — the cached index just predates it. The message blames the pin, so the natural reaction is to distrust the version rather than the cache. This happened repeatedly while upgrading jsii, on a long-lived container with a warm cache.
Outside CI the install is retried once with
--prefer-online, which refreshes the metadata and succeeds.In CI the error is rethrown untouched. A release build that cannot resolve a pinned version should fail rather than quietly reach for a different resolution — the fallback exists to unstick local development, not to paper over a non-reproducible build.
process.env.CIis set by GitHub Actions.Verification
The happy path is unchanged (warm cache, single install, no retry).
The gate was exercised by pinning a dependency to a version that does not exist, which produces the real ETARGET:
Checklist
🤖 Generated with Claude Code