ComfyUI/app/assets/services
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
..
__init__.py feat: non-destructive asset pruning with is_missing flag 2026-02-24 11:34:44 -08:00
asset_management.py refactor(assets): consolidate duplicated query utilities and remove unused code 2026-02-24 11:34:44 -08:00
bulk_ingest.py feat: non-destructive asset pruning with is_missing flag 2026-02-24 11:34:44 -08:00
file_utils.py refactor(assets): extract scanner logic into service modules 2026-02-24 11:34:44 -08:00
hashing.py refactor: require blake3 package directly in hashing module 2026-02-24 11:34:44 -08:00
ingest.py Make ingest_file_from_path and register_existing_asset private 2026-02-24 11:34:44 -08:00
metadata_extract.py Make ingest_file_from_path and register_existing_asset private 2026-02-24 11:34:44 -08:00
path_utils.py refactor(assets): consolidate duplicated query utilities and remove unused code 2026-02-24 11:34:44 -08:00
schemas.py refactor: eliminate manager layer, routes call services directly 2026-02-24 11:34:44 -08:00
tagging.py refactor: add explicit types to asset service functions 2026-02-24 11:34:44 -08:00