refactor(argparse): match negative numbers with one regex #4865
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 191 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
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.315
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4865"
general
weight: 0.35
devin-ai-integration[bot]
Summary
is_negative_numberlets a negative number such as-42be taken as a positional value instead of an unknown short option. It checked-and a first digit with a view pattern, and the rest withall:It is now the pattern it describes:
No
.mbtichange.Testing
moon test -p moonbitlang/core/argparse --target allpasses.- 0 9 a . = space ٣ 😀 +. That's 1,111,111 inputs.Performance
From a temporary benchmark (not committed): 8 typical arguments (
-1,-42,--verbose,-v,file.txt,-123456,--out=x,-) × 100, mean of 3 runs.| target | before | after | change |
|---|---:|---:|---:|
| native | 8.3 µs | 8.6 µs | +4% |
| js | 8.3 µs | 8.4 µs | +1% |
| wasm-gc | 6.5 µs | 6.2 µs | −5% |
It runs once per command-line argument, so this is noise next to everything else parsing does.
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/moonbitlang/core/pull/4865" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->