ComfyUI/tests-unit/assets_test
Luke Mino-Altherr 6b48144751 refactor(assets): merge AssetInfo and AssetCacheState into AssetReference
This change solves the basename collision bug by using UNIQUE(file_path) on the
unified asset_references table. Key changes:

Database:
- Migration 0005 merges asset_cache_states and asset_infos into asset_references
- AssetReference now contains: cache state fields (file_path, mtime_ns, needs_verify,
  is_missing, enrichment_level) plus info fields (name, owner_id, preview_id, etc.)
- AssetReferenceMeta replaces AssetInfoMeta
- AssetReferenceTag replaces AssetInfoTag
- UNIQUE constraint on file_path prevents duplicate entries for same file

Code:
- New unified query module: asset_reference.py (replaces asset_info.py, cache_state.py)
- Updated scanner, seeder, and services to use AssetReference
- Updated API routes to use reference_id instead of asset_info_id

Tests:
- All 175 unit tests updated and passing
- Integration tests require server environment (not run here)

Amp-Thread-ID: https://ampcode.com/threads/T-019c4fe8-9dcb-75ce-bea8-ea786343a581
Co-authored-by: Amp <amp@ampcode.com>
2026-02-24 11:34:44 -08:00
..
queries refactor(assets): merge AssetInfo and AssetCacheState into AssetReference 2026-02-24 11:34:44 -08:00
services refactor(assets): merge AssetInfo and AssetCacheState into AssetReference 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(assets): merge AssetInfo and AssetCacheState into AssetReference 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_file_utils.py Skip hidden files and directories in asset scanner 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 refactor(assets): merge AssetInfo and AssetCacheState into AssetReference 2026-02-24 11:34:44 -08:00