feat: exclude @vaadin packages from the minimum frontend package age - #25620
feat: exclude @vaadin packages from the minimum frontend package age#25620totally-not-ai[bot] wants to merge 8 commits into
Conversation
The packages Vaadin publishes are pinned to the version of the platform in use, so the minimum frontend package age blocks an installation that runs during the first day after a Vaadin release: there is no older version to fall back to and the build fails. Specifies with tests how each package manager should be told to exempt those packages, and that the build is warned when the package manager cannot do it. The resolution itself is left unimplemented until the approach is agreed on; the version checks that tell which package managers support excluding are already in place.
Passes --min-release-age-exclude=@vaadin/* to npm 11.17 and newer, and --config.minimum-release-age-exclude=@vaadin/* to pnpm 10.17 and newer, so that a project can be built with a Vaadin version that was released a moment ago. The argument is also passed when the age itself comes from the package manager configuration. bun accepts exclusions only as exact package names in a bunfig.toml, and older npm and pnpm versions do not know the setting at all. Those builds are warned that an installation started during the first day after a Vaadin release may fail, and how to turn the age check off.
A command line value replaces the exclusions the package manager resolves from its own configuration instead of adding to them, so a project that excludes its own scope silently lost that exclusion. The configured patterns are now passed along with '@vaadin/*'. The pnpm argument is also passed twice when there is a single pattern: pnpm reads the setting as a list only when the argument occurs more than once, and pnpm 11 excludes every package when the value is a plain string, which turned the age check off altogether. Nothing is excluded and nothing is warned about when no age applies, which now includes the package manager itself being configured with an age of 0.
Artur-
left a comment
There was a problem hiding this comment.
We might want to mention the node version that ships with a new enough npm also
| } | ||
| if (options.isEnableBun()) { | ||
| warnAboutPackagesThatCannotBeExcluded(logger, | ||
| "bun accepts exclusions only as exact package names in the 'minimumReleaseAgeExcludes' setting of a bunfig.toml"); |
There was a problem hiding this comment.
Should this tell what you should add to match the npm/pnpm behavior?
There was a problem hiding this comment.
Yes — the warning now ends with the remedy for the package manager in use. For bun it says to list the @vaadin packages the project depends on one by one in the minimumReleaseAgeExcludes setting of a bunfig.toml, since bun matches exact names only (@vaadin/* does not match) and has no command line equivalent. pnpm and npm get their own line: upgrade to 10.17.0 and 11.17.0 respectively.
| + "minimum frontend package age, as {}. Installing a " | ||
| + "Vaadin version during the first day after its " | ||
| + "release may therefore fail. Upgrade the package " | ||
| + "manager, or set the '{}' parameter to 0 to turn " |
There was a problem hiding this comment.
We should not suggest turning off the age check
There was a problem hiding this comment.
Removed — the warning no longer mentions the age parameter at all. Instead of suggesting to turn the check off, it now names the upgrade that makes the exclusion work: npm 11.17.0 (first shipped with Node.js 24.19.0), pnpm 10.17.0, or the exact @vaadin package names in a bunfig.toml for bun.
The warning no longer suggests turning the age check off. It now ends with the remedy for the package manager in use: upgrading npm to 11.17.0, which Node.js 24.19.0 is the first release to ship, upgrading pnpm to 10.17.0, or, for bun, listing the '@vaadin' packages one by one in the 'minimumReleaseAgeExcludes' setting of a bunfig.toml, as bun matches exact names only. The parameter documentation names the Node.js version as well.
Only the npm remedy was asserted, so swapping the other two messages would have gone unnoticed.
|
|
| * date npm falls back to is not a number and always blocks something. | ||
| */ | ||
| private static boolean blocksNothing(String packageManagerValue) { | ||
| try { |
There was a problem hiding this comment.
Is this a method for comparing a string with "0" that is always used in an inverted manner !blocksNothing?
There was a problem hiding this comment.
It compared the age that npm or pnpm resolves for itself against zero, which is the one value that blocks nothing (before is a date, so it always blocks something). Turned around into blocksSomeVersion, so the call site reads without a negation.
| } | ||
| if (options.isEnableBun()) { | ||
| warnAboutPackagesThatCannotBeExcluded(logger, | ||
| "bun accepts exclusions only as exact package names in the 'minimumReleaseAgeExcludes' setting of a bunfig.toml", |
There was a problem hiding this comment.
If this is done by the user, will the warning still be printed?
There was a problem hiding this comment.
It was, on every build, with nothing the project could do about it. The bunfig.toml next to the package.json is now read, and the warning is skipped when it lists Vaadin packages in minimumReleaseAgeExcludes. The file is read as it is, since bun has no command for printing its resolved configuration, so a bunfig.toml outside the project (the one in the home directory) is still not seen.
| } | ||
|
|
||
| @Test | ||
| void minimumFrontendPackageAgeExclude_pnpmTooOld_warnsInsteadOfExcluding() { |
There was a problem hiding this comment.
Shouldn't pnpm tests be in the pnpm test class?
There was a problem hiding this comment.
These are unit tests of the argument resolution with a mocked FrontendTools, not tests of a pnpm install, and the class already holds the pnpm and bun variants of the neighbouring age tests (minimumFrontendPackageAge_pnpm_usesMinimumReleaseAgeInMinutes, resolveMinimumFrontendPackageAge_pnpmConfiguredValue_doesNotOverrideIt), so the whole npm/pnpm/bun matrix stays in one place. The test that runs a real pnpm install and checks the argument reaches the command is in TaskRunPnpmInstallTest. Happy to move the pnpm ones over if you prefer them separated.
A bun build could do nothing to stop the warning, as the exclusion it asks for cannot be seen from the command line. The bunfig.toml of the project is now read, and the warning is skipped when it lists Vaadin packages in 'minimumReleaseAgeExcludes'. Also states the check of the age a package manager resolved for itself the way it is used, instead of negating it at the call site.
Both strings were looked for anywhere in the bunfig.toml, so a commented out setting or an unrelated mention of a Vaadin package was enough to lose the warning. The package now has to be a value of the setting.
Test Results 1 440 files ±0 1 524 suites ±0 1h 41m 29s ⏱️ + 7m 17s For more details on these errors, see this check. Results for commit efc02ca. ± Comparison against base commit 8365470. ♻️ This comment has been updated with latest results. |
|
|
The failing |



Summary
The minimum frontend package age blocks packages that were published less than a day ago, so a build could fail right after a Vaadin release. Flow now tells npm and pnpm to skip that age check for the
@vaadin/*packages, and warns you with a concrete fix when the package manager cannot do it.What changed
Behavior change (all users of the minimum frontend package age): the install command now gets extra arguments, and the warning text changed.
--min-release-age-exclude=@vaadin/*; pnpm 10.17.0 or newer gets--config.minimum-release-age-exclude=@vaadin/*. This also happens when the age comes from the package manager's own configuration (.npmrc,pnpm-workspace.yaml) and Flow passes no age argument at all.@vaadin/*. Before, a command line value replaced them, so a project that excluded its own scope silently lost that exclusion.@vaadinpackages one by one inminimumReleaseAgeExcludesinbunfig.toml, because bun matches exact names only. The warning no longer suggests turning the age check off.bunfig.tomland stays quiet when that setting really lists a Vaadin package. A commented-out line or a mention elsewhere in the file is not enough.0.resolveMinimumFrontendPackageAgeArgumentis nowresolveMinimumFrontendPackageAgeand returns whether an age applies together with the argument.Use case
A team builds with bun and hits a failed frontend install on the morning after a Vaadin release. The build log now names the fix instead of telling them to disable the age check, so they add the Vaadin packages their app depends on to
bunfig.toml:The next build installs the fresh Vaadin version, the warning goes away, and every other package is still held back for a day.
Test summary
--min-release-age-exclude=@vaadin/*--config.minimum-release-age-exclude=@vaadin/*twice, also in a realpnpm installcommand@vaadin/*is appendedminimumReleaseAgeExcludesand@vaadin/*bunfig.tomlthat lists a@vaadinpackage as a value of the setting → no warningbunfig.tomlthat only mentions@vaadinin a comment and excludes other packages → still warnsmin-release-age=0in the configuration, orapplies == false) → no argument and no warning.npmrcstill produces the exclusion argument although no age argument is passedgetConfiguredSettingValuesreads a JSON array and a comma separated string, and returns empty for a null or empty keynpmSupportsMinReleaseAgeExclude/pnpmSupportsMinimumReleaseAgeExcludeversion boundaries (11.16 vs 11.17, 10.16 vs 10.17, unknown version →false)TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_npm_excludesVaadinPackages→ 1TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_pnpm_excludesVaadinPackagesAsAList→ 2TaskRunPnpmInstallTest.runPnpmInstall_excludesVaadinPackagesFromTheMinimumAge→ 2TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_configuredPatterns_areKept→ 3TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_npmTooOld_warnsInsteadOfExcluding→ 4TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_pnpmTooOld_warnsInsteadOfExcluding→ 5TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_bun_warnsInsteadOfExcluding→ 6TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_bunfigListsThePackages_noWarning→ 7TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_bunfigListsOtherPackages_warns→ 8TaskRunNpmInstallTest.resolveMinimumFrontendPackageAge_npmrcValueOfZero_noAgeApplies→ 9TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_noAgeApplies_noArgumentOrWarning→ 9TaskRunNpmInstallTest.minimumFrontendPackageAgeExclude_npmrcValue_isStillExcludedFrom→ 10FrontendToolsTest.getConfiguredSettingValues_listAndCommaSeparatedValue_areRead→ 11FrontendToolsTest.getConfiguredSettingValues_keyWithoutValue_isEmpty→ 11Left untested on purpose: the added Javadoc in
Options,InitParameters,BuildFrontendMojoandBuildDevBundleMojo, and the unchanged behaviour ofnpmSupportsMinReleaseAge, which only moved into a shared helper. The version checks in row 12 run a real--versioncommand, so they are exercised only indirectly by the mocked tests above.