Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error on picking latest vault releases #56

Merged
merged 6 commits into from
Jul 22, 2022
Merged

fix error on picking latest vault releases #56

merged 6 commits into from
Jul 22, 2022

Conversation

sinisterstumble
Copy link
Contributor

The version 1.2.6.1+ent is not valid semver in https://releases.hashicorp.com/vault/index.json.

@hashicorp-cla
Copy link

hashicorp-cla commented Jun 18, 2022

CLA assistant check
All committers have signed the CLA.

@dbanck
Copy link
Member

dbanck commented Jul 8, 2022

Hi @markmartirosian! Thanks a lot for catching this bug and raising this PR!

I've created some test cases for getRelease in #58 to catch and prevent bugs like this in the future. Do you mind rebasing the latest changes from main and adding a test case for versions like 1.2.6.1+ent? Something like it('should filter invalid versions', .... I'm happy to assist you with this or add the changes to your branch so that we can get this merged.

@sinisterstumble
Copy link
Contributor Author

@dbanck something like this? (;

Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

Thanks for updating the PR with the changes from main and providing a test case!

Can you explain what your motivation is behind extending your solution? I think the one-line filter was an elegant solution as a bug fix.

Do you mind removing the changes to package-lock.json? Unfortunately, this project still uses an older version of npm, so the lock file is still version 1. I'm planning to update this in a separate PR soon.

src/index.test.ts Outdated Show resolved Hide resolved
@dbanck dbanck added this to the 1.6.1 milestone Jul 13, 2022
@sinisterstumble
Copy link
Contributor Author

@dbanck both codepaths: 1. new Release and 2: matchVersion depend on a versions: Record<string, Release>, this changes ensure that it's the same object in both cases. It's a little defensive, but ultimately reduces complexity and possibility of another bug given that the matchVersion uses semver.maxSatisfying on the versions object.

I've copied package-lock.json from the main branch. It's still showing changes for some reason.

You should have write permissions to the fork repo.

@sinisterstumble sinisterstumble requested a review from dbanck July 18, 2022 10:18
@dbanck
Copy link
Member

dbanck commented Jul 22, 2022

Thanks for the write access! I rebased from main & force pushed to get rid of the changes in package-lock.json.

Unifying the versions for both code paths makes sense! I've added a new type ResponseVersion for the JSON response, because we can't use Release here. And one more test case when passing an invalid version.

Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

Thanks again for reporting and fixing this bug! 👍

@dbanck dbanck merged commit dc5073f into hashicorp:main Jul 22, 2022
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.

3 participants