Fix Firefox regex to handle version without patch segment #530
All Vouch review confidence checks passed
Residual risk 0.02 = Change Risk (0.19) × (1 − Review Confidence (0.91)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.19 · 10 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 2 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.143
Real PR Conversation Timeline
3 items
I am not sure if the \z assertion is supported by every regex-engine. JavaScript seams to not support (or ignore) it. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions
Can you please change that to '(Firefox)/(\d+)\.(\d+)(?:\.(\d+)|)'?
Hey thanks for getting back, you're right. However, the above doesn't seem to work as intended for Ruby. Specifically, the version for Firefox/4.0b9pre will result in 4.0 instead of 4.0b9pre
I've updated to (Firefox)/(\d+)\.(\d+)(?:\.(\d+)|$) instead, $ seems to have the same effect as \z (see ref%20or%20line%20(m%3Dtrue))). It's also a common token used and is supported by Javascript. Let me know if this change sounds good to you too.
commenthol
karissekjw
Update regex to allow patch segment as optional.
Current Issue
When parsing
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0'to https://github.com/ua-parser/uap-ruby,#<MatchData "Firefox/103.0" 1:"Firefox" 2:"104" 3:"0" 4:"">is returned which interpolates toFirefox 104.0.(Notice the additional.here due to the empty string in the patch segment)Solution
With the updated regex, patch segment is optional such that it returns
Firefox 104.0if it's not provided