Skip to content

Conversation

@Quentin-David-24
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/add-minor-payments-version

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My IDE was not happy with the state of the go mod, it would update automatically this file

Comment on lines -44 to -49
res := semver.Compare(version, "v3.0.0-rc.1")
switch res {
case 0, 1:
controller.SetVersion(V3)
controller.SetVersion(*paymentVersion)
return nil
}

func computePaymentVersion(rawVersion string) (*Version, error) {
semverVersion := semver.MajorMinor(rawVersion)
if semverVersion == "" {
// we assume the version is a commit id
// thus corresponds to the latest possible version
return &Version{Major: V3, Minor: math.MaxInt, Raw: rawVersion}, nil
}

parts := strings.Split(semver.Canonical(semverVersion), ".")
if len(parts) < 2 {
return nil, fmt.Errorf("expected both major and minor for version string: %s", rawVersion)
}

var major PaymentMajorVersion
minor, _ := strconv.Atoi(parts[1])

switch parts[0] {
case "v0", "v1", "v2":
major = V1
case "v3":
major = V3
default:
controller.SetVersion(V1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Following that existing piece of code, V0 and V2 does not exist.

There is a lot of places in the codebase where we check for V0. Maybe we should remove those?

if semverVersion == "" {
// we assume the version is a commit id
// thus corresponds to the latest possible version
return &Version{Major: V3, Minor: math.MaxInt, Raw: rawVersion}, nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I added MaxInt minor to be sure to capture everything, a bit hacky

}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might be unreachable now since you cannot get a versions.V0 from version controller

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.

2 participants