Skip to content

[BUG] 7.6.0 --> 7.7.0 inc behavior change #763

Closed
@danchurch-alphasights

Description

@danchurch-alphasights

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

We use auto in our CI to manage our versioning.

For canary releases, Auto uses a version format of <version>-canary.<pr#>.<hash>

We started to see our CI randomly failing (based on commit hash or build hash) the last few days with the following error:

Error: Running command 'npx' with args [lerna, publish, prepatch, --dist-tag, canary, --registry, <REDACT>, --yes, --no-git-reset, --no-git-tag-version, --exact, --no-verify-access, --preid, canary.661.2207bf7] failed


Changes:
 - <REDACT>: 0.127.2 => null
 - <REDACT>: 0.35.0 => null

...

lerna ERR! Cannot read properties of null (reading 'trim')
lerna ERR! errno "undefined" is not a valid exit code - exiting with code 1

After digging deep into Lerna / Auto, I found out the root cause was due to a change of the semver package between 7.6.0 and 7.7.0

semver.inc('1.0.0', 'prepatch', 'canary.661.2207bf') semver.valid('1.0.1-canary.661.2207bf.0')
7.6.0 1.0.1-canary.661.2207bf.0 1.0.1-canary.661.2207bf.0
7.7.0 null 1.0.1-canary.661.2207bf.0

Expected Behavior

I would expect semver.inc('1.0.0', 'prepatch', 'canary.661.2207bf') to continue to return a valid value or semver.valid('1.0.1-canary.661.2207bf.0') to return null

Steps To Reproduce

npm i semver@7.6.0 --save-exact

node -e "console.log(require('semver').inc('1.0.0', 'prepatch', 'canary.661.2207bf'));"
1.0.1-canary.661.2207bf.0

npm i semver@7.7.0 --save-exact

node -e "console.log(require('semver').inc('1.0.0', 'prepatch', 'canary.661.2207bf'));"
null

npm i semver@7.7.0 --save-exact

node -e "console.log(require('semver').valid('1.0.1-canary.661.2207bf.0'));"
1.0.1-canary.661.2207bf.0

Environment

  • npm: 8.3.1
  • Node: v16.14.0
  • OS: Mac Sonoma 14.7.2
  • platform: darwin

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingNeeds Triageneeds an initial review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions