ComfyUI/tests-unit/assets_test
Luke Mino-Altherr a51bbd0b25 feat: non-destructive asset pruning with is_missing flag
- Add is_missing column to AssetCacheState for soft-delete
- Replace hard-delete pruning with mark_cache_states_missing_outside_prefixes
- Auto-restore missing cache states when files are re-scanned
- Filter out missing cache states from queries by default
- Rename functions for clarity:
  - mark_cache_states_missing_outside_prefixes (was delete_cache_states_outside_prefixes)
  - get_unreferenced_unhashed_asset_ids (was get_orphaned_seed_asset_ids)
  - mark_assets_missing_outside_prefixes (was prune_orphaned_assets)
  - mark_missing_outside_prefixes_safely (was prune_orphans_safely)
- Add restore_cache_states_by_paths for explicit restoration
- Add cleanup_unreferenced_assets for explicit hard-delete when needed
- Update API endpoint /api/assets/prune to use new soft-delete behavior

This preserves user metadata (tags, etc.) when base directories change,
allowing assets to be restored when the original paths become available again.

Amp-Thread-ID: https://ampcode.com/threads/T-019c3114-bf28-73a9-a4d2-85b208fd5462
Co-authored-by: Amp <amp@ampcode.com>
2026-02-24 11:34:44 -08:00
..
queries feat: non-destructive asset pruning with is_missing flag 2026-02-24 11:34:44 -08:00
services Make ingest_file_from_path and register_existing_asset private 2026-02-24 11:34:44 -08:00
conftest.py chore: remove unused re-exports from conftest.py 2026-02-24 11:34:44 -08:00
helpers.py feat(assets): add background asset seeder for non-blocking startup 2026-02-24 11:34:44 -08:00
test_assets_missing_sync.py fix: resolve test import errors and module collision in assets_test 2026-02-24 11:34:44 -08:00
test_crud.py refactor: convert asset tests to table-driven parametrized tests 2026-02-24 11:34:44 -08:00
test_downloads.py fix: resolve test import errors and module collision in assets_test 2026-02-24 11:34:44 -08:00
test_list_filter.py refactor: convert asset tests to table-driven parametrized tests 2026-02-24 11:34:44 -08:00
test_metadata_filters.py Assets Part 2 - add more endpoints (#12125) 2026-01-31 02:22:05 -05:00
test_prune_orphaned_assets.py fix: resolve test import errors and module collision in assets_test 2026-02-24 11:34:44 -08:00
test_tags_api.py fix: resolve test import errors and module collision in assets_test 2026-02-24 11:34:44 -08:00
test_uploads.py Assets Part 2 - add more endpoints (#12125) 2026-01-31 02:22:05 -05:00