-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-589] [Bug] dbt deps
does not precisely match the regex for SemVer
#5201
Comments
dbt deps
does not precisely match the regex for SemVer
@dbeatty10 Thanks for opening! You're right, that I'd be very supportive of taking two steps here:
Going to mark this a |
Right on! We've got a bunch already over in |
Hey @jtcohen6 and @dbeatty10 I see this is marked as a I have been wanting to pick up a good first issue and was wondering if you would be open if I attempt a PR for this issue? To confirm my understanding of what is ultimately desired here:
packages:
- package: fivetran/fivetran_log
version: 0.5.0.b1
Therefore to address this, we want to apply to following adjustments:
Let me know if you would mind if I tried to tackle this. Full disclosure, I would definitely need require support with the unit testing, but happy to give it a go! 😄 |
Yep, you pretty much nailed it, @fivetran-joemarkiewicz . Would definitely welcome a PR for this issue, and I'd be happy to provide assistance for the unit testing and anything else. Here's my recommended order:
I'll try to write up an example of editing the RegEx unit tests and re-running just the one you want (rather than the entire suite). |
Hey @dbeatty10 thanks so much for the recommended order! 🙌 This was so helpful in figuring out what exactly needed to be updated for this issue to be addressed. I actually ended up having time this afternoon to dig into this and I think I got the issue addressed in the above linked PR! I did go a bit rogue and created a new function to leverage in the unit test. I have a feeling this was not needed and I was missing something right in front of me. So please let me know regarding that haha. Finally, I noticed the RegEx rules didn't change too much once I broke them out like you suggested, but did see the difference between the current and this patch unit tests. Let me know if I missed something. We can probably move any convo for this to the PR. Thank you so much though for being so helpful with guiding me to opening the PR! 🕺 |
Is there an existing issue for this?
TL;DR
There's probably not a very impactful issue here -- opening up this issue at risk of being very nit picky.
Current Behavior
This regular expression is used within
dbt deps
to determine valid installable versions. It might also be utilized duringdbt --version
to determine if the installed adapters are up-to-date with the latest versions available.If I did the string substitution correctly, it produces these results for a range of input strings:
https://regex101.com/r/YyaxyD/1
Expected Behavior
There is a suggested regular expression (RegEx) to check a SemVer string.
It produces these results:
https://regex101.com/r/Ly7O1x/3/
Steps To Reproduce
^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
Relevant log output
Additional Context
Summary
Why it's not that impactful
There's two cases of errors (false negatives and false positives). The former is more impactful to users; there are very few known theoretical cases (and zero known actual cases in the wild).
False negative - a valid semantic version doesn't match the regex
This is the case that would impact users the most.
There are only a couple of these, and it's easy to change to one that is recognized:
False positive - an invalid semantic version does matches the regex
There are quite a few examples of these, but maybe many/most wouldn't be seen in the wild. If so, maybe "no harm, no foul?"
See "Current Behavior" section for examples of invalid semantic versions.
Disclosure: I regularly flip-flop my false negatives with my false positives 😅 So sorry if I got it backwards.
What is impactful though...
An example error message is:
One user got this message and didn't know what action they should take. The error message should be more clear about what the user should do to fix the problem.
The text was updated successfully, but these errors were encountered: