Commit 91360e1
committed
fix: guard ^ floor comparison against cross-major parent declarations
When the override is ^4.2.0 and a parent declares ^5.0.0, coerceVersion strips
the operator and compareVersions(5.0.0, 4.2.0) returns >= 0, causing OA009 to
fire. But ^4.2.0 means >=4.2.0 <5.0.0 and ^5.0.0 means >=5.0.0 <6.0.0 - the
ranges do not overlap, so removing the override would change the resolved
version from 4.x to 5.x. Added a majorOf() guard: when the override uses ^,
each parent must also be in the same major before it counts as meeting the
floor. Added a test case covering the cross-major non-firing case.1 parent a3be8fc commit 91360e1
2 files changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
| |||
0 commit comments