Skip to content

fix(builder): Fall back to NpmSpec for node engine version ranges (backport #582) - #583

Merged
balamurali27 merged 1 commit into
masterfrom
mergify/bp/master/pr-582
Aug 18, 2026
Merged

fix(builder): Fall back to NpmSpec for node engine version ranges (backport #582)#583
balamurali27 merged 1 commit into
masterfrom
mergify/bp/master/pr-582

Conversation

@mergify

@mergify mergify Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Problem

ValidationManager.check_version parses every version constraint with semantic_version.SimpleSpec. That works for pyproject.toml's requires-python, but package.json's engines.node uses npm range syntax that SimpleSpec rejects outright:

spec SimpleSpec
>=18 <21 ValueError
18.x ValueError
20 || 22 ValueError

The ValueError escapes _validate_node_version, so the deploy fails with an unhandled exception instead of either passing validation or raising ContextValidationError.

Fix

Try SimpleSpec first (so requires-python's comma syntax keeps working), fall back to NpmSpec.

Testing

New agent/tests/test_builder.py covers both syntaxes, positive and negative, for each range form. Verified no spec that parses under both parsers gets a different verdict from them, so the fallback does not change behaviour for anything that already worked.

Known gap

Specs that NpmSpec also rejects still raise out of check_version>= 18 (space after the operator) and >=v18 (v-prefix) are both legal npm but fail here. Not a regression, they failed before this change too. Happy to fold a normalization step in if you'd rather close that off in the same PR.

🤖 Generated with Claude Code


This is an automatic backport of pull request #582 done by Mergify.

package.json engines.node uses npm range syntax that SimpleSpec cannot
parse: space-separated ranges (">=18 <21"), x-ranges ("18.x") and
alternations ("20 || 22") all raise ValueError, failing the deploy
instead of validating the version.

Try SimpleSpec first so requires-python keeps its comma syntax, then
fall back to NpmSpec.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit e0e3d3e)
@balamurali27
balamurali27 merged commit 963dd02 into master Aug 18, 2026
3 of 5 checks passed
@balamurali27
balamurali27 deleted the mergify/bp/master/pr-582 branch August 18, 2026 10:07
@mergify

mergify Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant