Commit 79e8f4b
fix: address review — empty-string timing fields, IPv6 comment, suspicious-batch logs
5 items + 2 coverage gaps from the latest cr round.
### Concerns
1. **Empty-string handling on timing fields.** `update({ extend_by: "" })`
and `mintLink({ expires_in: "" })` previously round-tripped to the API
as `{"extend_by": ""}`, hitting either the mutual-exclusion check
(because `"" !== undefined`) or the server's duration parser. Both
write surfaces now reject empty-string timing fields with a structured
`ValidationError` — `description: ""` keeps its documented
clear-the-field semantic. Three new tests: rejection on each surface
plus a positive test locking in `description: ""` round-trips.
2. **Conflicting IPv6 hostname comment.** Tightened the outer comment
that said `URL.hostname` strips IPv6 brackets — the inner comment
correctly notes Node returns hosts WITH brackets, and the code
handles both forms. Outer comment now points at the inner block
instead of contradicting it.
4. **`request_id` shadowing debug log.** Added a both-fields-present
debug log in `batchCreate` mirroring `mapQurlsField`'s pattern.
If the server ever puts `request_id` on both `data` and `meta`,
operators see the divergence rather than learning about it via
support-ticket archaeology.
5. **Empty BatchCreateOutput debug log.** Added a debug log in
`validateBatchCreateResponse` for the `succeeded: 0, failed: 0,
results: []` case — shape-valid but suspicious (the SDK definitely
sent items). Keeps the response valid; surfaces the anomaly.
### Coverage
- **list-side `mapQurlsField` mapping.** Test asserts list items
containing wire-format `qurls` map to `access_tokens` consistently.
Locks in the defensive `data.map(mapQurlsField)` in `list()`.
### No action
- **#3 RFC 3339 client-side parse for `expires_at`.** Reviewer marked
optional ("if you ever want a tiny sanity check"). Keeping the
duration-parser stance: server is authoritative.
- **#6 `requireValidTags` empty-array semantics.** Reviewer noted as
intentional and well-supported by existing test.
- **#7 `Number.isFinite` for `maxRetries` null-coverage.** Reviewer
confirmed the `?? DEFAULT_MAX_RETRIES` chain already handles null.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 3cb5a30 commit 79e8f4b
2 files changed
Lines changed: 155 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
442 | 485 | | |
443 | 486 | | |
444 | 487 | | |
| |||
1168 | 1211 | | |
1169 | 1212 | | |
1170 | 1213 | | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
1171 | 1277 | | |
1172 | 1278 | | |
1173 | 1279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
451 | | - | |
452 | | - | |
453 | | - | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
638 | 650 | | |
639 | 651 | | |
640 | 652 | | |
| |||
769 | 781 | | |
770 | 782 | | |
771 | 783 | | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
772 | 796 | | |
773 | 797 | | |
774 | 798 | | |
| |||
969 | 993 | | |
970 | 994 | | |
971 | 995 | | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
972 | 1008 | | |
973 | 1009 | | |
974 | 1010 | | |
| |||
1017 | 1053 | | |
1018 | 1054 | | |
1019 | 1055 | | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1020 | 1066 | | |
1021 | 1067 | | |
1022 | 1068 | | |
| |||
0 commit comments