Commit 2a98da9
fix(extensions): address reviewer feedback on update/rollback logic
- Hook rollback: handle empty backup_hooks by checking `is not None`
instead of truthiness (falsy empty dict would skip hook cleanup)
- extension_info: use resolved_installed_id for catalog lookup when
extension was found by display name (prevents wrong catalog match)
- Rollback: always remove extension dir first, then restore if backup
exists (handles case when no original dir existed before update)
- Validate extension ID from ZIP before installing, not after
(avoids side effects of installing wrong extension before rollback)
- Preserve enabled state during updates: re-apply disabled state and
hook enabled flags after successful update
- Optimize _resolve_catalog_extension: pass query to catalog.search()
instead of fetching all extensions
- update() now merges metadata with existing entry instead of replacing
(preserves fields like registered_commands when only updating enabled)
- Add tests for ExtensionRegistry.update() and restore() methods:
- test_update_preserves_installed_at
- test_update_merges_with_existing
- test_update_raises_for_missing_extension
- test_restore_overwrites_completely
- test_restore_can_recreate_removed_entry
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 7bd6fd9 commit 2a98da9
File tree
3 files changed
+166
-36
lines changed- src/specify_cli
- tests
3 files changed
+166
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1881 | 1881 | | |
1882 | 1882 | | |
1883 | 1883 | | |
1884 | | - | |
1885 | | - | |
1886 | | - | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
1887 | 1887 | | |
1888 | 1888 | | |
1889 | 1889 | | |
| |||
2468 | 2468 | | |
2469 | 2469 | | |
2470 | 2470 | | |
2471 | | - | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
2472 | 2475 | | |
2473 | 2476 | | |
2474 | 2477 | | |
| |||
2729 | 2732 | | |
2730 | 2733 | | |
2731 | 2734 | | |
2732 | | - | |
| 2735 | + | |
2733 | 2736 | | |
2734 | 2737 | | |
2735 | 2738 | | |
| |||
2778 | 2781 | | |
2779 | 2782 | | |
2780 | 2783 | | |
2781 | | - | |
2782 | | - | |
2783 | | - | |
2784 | | - | |
| 2784 | + | |
2785 | 2785 | | |
2786 | 2786 | | |
2787 | | - | |
2788 | | - | |
2789 | | - | |
2790 | | - | |
2791 | | - | |
| 2787 | + | |
| 2788 | + | |
2792 | 2789 | | |
2793 | | - | |
2794 | | - | |
2795 | | - | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
2796 | 2798 | | |
2797 | | - | |
| 2799 | + | |
2798 | 2800 | | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
2799 | 2823 | | |
2800 | 2824 | | |
2801 | 2825 | | |
2802 | 2826 | | |
2803 | 2827 | | |
2804 | | - | |
| 2828 | + | |
2805 | 2829 | | |
2806 | 2830 | | |
2807 | 2831 | | |
| |||
2819 | 2843 | | |
2820 | 2844 | | |
2821 | 2845 | | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
2822 | 2852 | | |
2823 | | - | |
2824 | | - | |
2825 | | - | |
2826 | 2853 | | |
2827 | 2854 | | |
2828 | 2855 | | |
| |||
2834 | 2861 | | |
2835 | 2862 | | |
2836 | 2863 | | |
2837 | | - | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
2838 | 2867 | | |
2839 | 2868 | | |
2840 | 2869 | | |
2841 | | - | |
2842 | | - | |
2843 | | - | |
2844 | | - | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
2845 | 2873 | | |
2846 | | - | |
| 2874 | + | |
2847 | 2875 | | |
2848 | 2876 | | |
2849 | | - | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
2850 | 2882 | | |
2851 | 2883 | | |
2852 | 2884 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
236 | | - | |
| 240 | + | |
237 | 241 | | |
238 | 242 | | |
239 | 243 | | |
240 | | - | |
| 244 | + | |
241 | 245 | | |
242 | 246 | | |
243 | 247 | | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
247 | | - | |
| 251 | + | |
248 | 252 | | |
249 | 253 | | |
250 | | - | |
251 | | - | |
252 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
253 | 260 | | |
254 | 261 | | |
255 | 262 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
280 | 371 | | |
281 | 372 | | |
282 | 373 | | |
| |||
0 commit comments