Repository navigation
Commit b61050e
committed
fix(presets): report corrupt entries, survive an unreadable registry, correct the footer
Addresses review feedback on #4250, plus two issues found while self-reviewing
the same code.
ExtensionRegistry construction can raise OSError -- _load() recovers from
malformed content but deliberately lets OSError through, and is_corrupt()
re-reads the file. This check runs after the install has already completed and
preset_add handles only preset-domain errors, so an unreadable registry turned
a finished install into a traceback over what is only a warning. An
unreadable registry now yields no results instead.
A corrupted entry was conflated with an absent one. get() returns None for
both, but is_installed() still counts the key, so the suggested
`extension add <id>` is refused as already installed. It is now a distinct
"corrupt" reason remediated with a forced reinstall.
The closing note asserted that dependent features "will do nothing" and that
the preset is "safe to use". Neither holds for a version mismatch: the
extension is installed and enabled, so the preset does invoke it, and the
combination is untested against the declared constraint rather than safe. The
note is now split by consequence.
Found while self-reviewing, in the same two areas this review keeps surfacing:
the id pattern used re.match with an anchored `^...$`, but `$` also matches
before a trailing newline, so "demo-ext\n" validated here while
PresetResolver._is_safe_registry_id (fullmatch) rejects it, and the newline
would have reached a printed command. And declaring one dependency twice
warned twice; exact repeats now collapse, while two entries for one id with
different constraints are still both checked, since both have to hold.
Assisted-by: Claude Code (model: Claude Opus 5, autonomous)1 parent f69a16d commit b61050e
3 files changed
Lines changed: 206 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
594 | | - | |
595 | | - | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
596 | 601 | | |
597 | | - | |
| 602 | + | |
598 | 603 | | |
599 | 604 | | |
600 | 605 | | |
| |||
986 | 991 | | |
987 | 992 | | |
988 | 993 | | |
989 | | - | |
990 | | - | |
991 | | - | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
992 | 1000 | | |
993 | 1001 | | |
994 | 1002 | | |
| |||
1003 | 1011 | | |
1004 | 1012 | | |
1005 | 1013 | | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
1010 | 1027 | | |
1011 | 1028 | | |
1012 | 1029 | | |
1013 | 1030 | | |
1014 | | - | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1015 | 1044 | | |
1016 | 1045 | | |
1017 | 1046 | | |
| |||
1025 | 1054 | | |
1026 | 1055 | | |
1027 | 1056 | | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1032 | 1066 | | |
1033 | | - | |
1034 | | - | |
| 1067 | + | |
1035 | 1068 | | |
1036 | | - | |
| 1069 | + | |
1037 | 1070 | | |
1038 | 1071 | | |
1039 | 1072 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
| |||
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
103 | 125 | | |
104 | 126 | | |
105 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
580 | 586 | | |
581 | 587 | | |
582 | 588 | | |
| |||
1397 | 1403 | | |
1398 | 1404 | | |
1399 | 1405 | | |
1400 | | - | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
1401 | 1409 | | |
1402 | 1410 | | |
1403 | 1411 | | |
| |||
1473 | 1481 | | |
1474 | 1482 | | |
1475 | 1483 | | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
1476 | 1603 | | |
1477 | 1604 | | |
1478 | 1605 | | |
| |||
0 commit comments