Skip to content

[BCF-3491] Add option to ignore pre-release version#21017

Merged
cedric-cordenier merged 2 commits intodevelopfrom
BCF-3491-ignore-pre-release-version
Feb 6, 2026
Merged

[BCF-3491] Add option to ignore pre-release version#21017
cedric-cordenier merged 2 commits intodevelopfrom
BCF-3491-ignore-pre-release-version

Conversation

@cedric-cordenier
Copy link
Contributor

@cedric-cordenier cedric-cordenier commented Feb 3, 2026

Address the PMAI to ignore the pre-release version

@cedric-cordenier cedric-cordenier requested a review from a team as a code owner February 3, 2026 21:08
Copilot AI review requested due to automatic review settings February 3, 2026 21:08
@cedric-cordenier cedric-cordenier requested a review from a team as a code owner February 3, 2026 21:08
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

👋 cedric-cordenier, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds functionality to optionally ignore pre-release versions when comparing application and database versions. The change allows version checking to strip pre-release identifiers (e.g., "-cre" in "9.9.8-cre") when the CL_APP_VERSION_CHECK_IGNORE_PRE environment variable is set to "true".

Changes:

  • Modified CheckVersion function to accept an ignorePrerelease boolean parameter
  • Added logic to strip pre-release identifiers from both app and database versions when enabled
  • Updated all test cases to pass the new ignorePrerelease parameter

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
core/services/versioning/orm.go Added ignorePrerelease parameter to CheckVersion function and implemented pre-release stripping logic; reads CL_APP_VERSION_CHECK_IGNORE_PRE environment variable
core/services/versioning/orm_test.go Updated all CheckVersion test calls to include the new ignorePrerelease parameter; added test case for pre-release ignoring behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 101 to 108
newDbv, err := dbv.SetPrerelease("")
if err != nil {
return nil, nil, fmt.Errorf("could not generate db version without pre-release: %w", err)
}
dbv = &newDbv
newAppv, err := appv.SetPrerelease("")
if err != nil {
return nil, nil, fmt.Errorf("could not generate app version without pre-release: %w", err)
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable shadowing: the error variable 'err' is reused within the if block, which shadows the named return value 'err'. This could lead to confusion and potential bugs if the function's control flow changes. Consider using different variable names (e.g., 'dbErr' and 'appErr') for these intermediate error values.

Suggested change
newDbv, err := dbv.SetPrerelease("")
if err != nil {
return nil, nil, fmt.Errorf("could not generate db version without pre-release: %w", err)
}
dbv = &newDbv
newAppv, err := appv.SetPrerelease("")
if err != nil {
return nil, nil, fmt.Errorf("could not generate app version without pre-release: %w", err)
newDbv, dbPrereleaseErr := dbv.SetPrerelease("")
if dbPrereleaseErr != nil {
return nil, nil, fmt.Errorf("could not generate db version without pre-release: %w", dbPrereleaseErr)
}
dbv = &newDbv
newAppv, appPrereleaseErr := appv.SetPrerelease("")
if appPrereleaseErr != nil {
return nil, nil, fmt.Errorf("could not generate app version without pre-release: %w", appPrereleaseErr)

Copilot uses AI. Check for mistakes.
assert.Equal(t, "9.9.8", dbv.String())

// ignores pre-release if specified
appv, dbv, err = CheckVersion(ctx, db, lggr, "9.9.8-cre", true)
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test only validates the happy path for pre-release ignoring. Consider adding test cases for error scenarios, such as when SetPrerelease fails or when comparing versions with different pre-release identifiers to ensure the feature works correctly in edge cases.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

trunk-io[bot]

This comment was marked as outdated.

trunk-io[bot]

This comment was marked as outdated.

@trunk-io
Copy link

trunk-io bot commented Feb 3, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@cedric-cordenier cedric-cordenier force-pushed the BCF-3491-ignore-pre-release-version branch from 9d6a353 to 61ec875 Compare February 4, 2026 12:00
mateusz-sekara
mateusz-sekara previously approved these changes Feb 4, 2026
Copy link
Contributor

@jmank88 jmank88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How important is this in practice? Because it will inevitably cause problems too.

@cedric-cordenier
Copy link
Contributor Author

@jmank88 I think this is valuable -- we've been bitten multiple times by images that have inconsistently applied prerelease info in the semver tag. This is because in practice we use the prerelease tag to indicate the flavour of image, not that it's a pre-release.

@jmank88
Copy link
Contributor

jmank88 commented Feb 4, 2026

@jmank88 I think this is valuable -- we've been bitten multiple times by images that have inconsistently applied prerelease info in the semver tag. This is because in practice we use the prerelease tag to indicate the flavour of image, not that it's a pre-release.

Semver has a spot for metadata, a suffix following a +. If we used that, would this problem go away?

Regardless, should this be optional instead of affecting everyone? e.g. if it were opt-in via env var, we could set it in the released images that we build.

@cedric-cordenier
Copy link
Contributor Author

@jmank88 It wouldn't because the problem is that we're sometimes setting it by accident.

I can make it optional if you prefer, but fwiw I checked with @mateusz-sekara from CCIP and he said this wouldn't affect them negatively if we applied it across the board.

@jmank88
Copy link
Contributor

jmank88 commented Feb 4, 2026

@jmank88 It wouldn't because the problem is that we're sometimes setting it by accident.

I can make it optional if you prefer, but fwiw I checked with @mateusz-sekara from CCIP and he said this wouldn't affect them negatively if we applied it across the board.

The risk being introduced is to the normal usage though. This check is meaningful when semver is used normally

}

if dbvWithoutPre.GreaterThan(&appvWithoutPre) {
return nil, nil, errors.Errorf("Application version (%s) is lower than database version (%s). Only Chainlink %s or higher can be run on this database", appv, dbv, dbv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the params to the error should be appvWithoutPre, dbvWithoutPre, dbvWithoutPre

@cedric-cordenier cedric-cordenier force-pushed the BCF-3491-ignore-pre-release-version branch from 07958f4 to 37f935f Compare February 5, 2026 11:19
jmank88
jmank88 previously approved these changes Feb 5, 2026
@cl-sonarqube-production
Copy link

@cedric-cordenier cedric-cordenier added this pull request to the merge queue Feb 6, 2026
Merged via the queue into develop with commit e023531 Feb 6, 2026
221 of 222 checks passed
@cedric-cordenier cedric-cordenier deleted the BCF-3491-ignore-pre-release-version branch February 6, 2026 14:25
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.

5 participants