Commit 6e60f09
authored
Fixes comma support in the lockfile (#279)
The lockfile format doesn't currently escape commas in ranges, which
leads to lockfile corruption when they contain some (since we already
split on commas entries with multiple descriptors).
This diff addresses that by making sure we escape commas when
serializing multikeys.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes lockfile key serialization/deserialization rules to introduce
escaping for commas/backslashes, which could impact reading/writing
lockfiles across versions if edge cases aren’t handled correctly.
>
> **Overview**
> Prevents lockfile corruption when descriptor strings contain commas
(e.g., comma-separated PyPI ranges) by **escaping `,` and `\\`** when
serializing `MultiKey` values and updating deserialization to correctly
unescape them while preserving unknown escapes for backward
compatibility.
>
> Adds an acceptance test that runs `install` twice with a
comma-separated `pypi:` range to ensure lockfile round-trips cleanly.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
33eb8f8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 2281b5c commit 6e60f09
2 files changed
Lines changed: 61 additions & 5 deletions
File tree
- packages/zpm/src
- tests/acceptance-tests/pkg-tests-specs/sources/basic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
209 | 216 | | |
210 | 217 | | |
211 | 218 | | |
| |||
226 | 233 | | |
227 | 234 | | |
228 | 235 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
233 | 267 | | |
234 | 268 | | |
235 | 269 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
89 | 111 | | |
90 | 112 | | |
0 commit comments