Commit Graph
2 Commits
Author SHA1 Message Date
Ewald a363a77a6b feat(db): Phase C tag normalization — v18/v19 migrations, normalized FTS, readers v2, stop-write, drop legacy columns
- m018_fts_from_normalized_tags: replace FTS triggers to read from asset_tags+tags
  instead of the legacy JSON asset_metadata.tags column
- m019_drop_legacy_tag_columns: remove asset_metadata.tags and tags_text via
  create-copy-swap; includes invariant check (aborts if legacy tags not backfilled)
- registry.py: MIGRATIONS = [M017, M018, M019]
- schema_fts.py / schema_sql.py: FTS helpers and baseline triggers rewritten to
  source from normalized tables with asset_tags guard
- TagsRepository: normalized read path (get_tags_for_asset, list_assets_with_tag,
  search_assets_by_tags) + sync_from_legacy_row repair helper
- Readers v2: searcher, result_hydrator, metadata_helpers, updater, rating_tags_service,
  rename_service, stacks/service, duplicates/service migrated to asset_tags/tags JOIN
- Stop-Write: writes no longer update asset_metadata.tags / tags_text
- sqlite_facade: ahas_table helper; sqlite_recovery updated
- deps.py: TagsRepository wired into service container
- scripts/tag_drift_doctor.py: detects assets with legacy tags not backfilled
- ADR 0009, ARCHITECTURE_MAP, RATINGS_TAGS_COLLECTIONS, adr/README updated
- Tests: test_drop_legacy_tag_columns (2), test_fts_from_normalized (6),
  test_tags_dual_write, test_tags_normalized_readers + regression fixes across
  test_rating_tags_import, test_index_metadata_helpers, test_index_searcher,
  test_asset_updater, test_deps, test_schema_heal
- Full suite: 1687 passed, 2 skipped, 2 pre-existing failures (test_health_routes)
2026-05-22 15:00:27 +02:00
Ewald 912ebb975d feat(api): add /api/v2/assets/* OpenAPI compat layer (Phase 3.1)
Read-only surface mirroring ComfyUI core OpenAPI assets spec under a /api/v2/ prefix to avoid collision with the existing /api/assets/* endpoints served by core.

Endpoints:

- GET  /api/v2/assets (list with name_contains, include/exclude_tags, sort, limit/offset)

- GET  /api/v2/assets/{id} (numeric ID, blake3:hex hash, or filename fallback)

- GET  /api/v2/assets/{id}/content (FileResponse, path-allowlist enforced)

- GET  /api/v2/assets/{id}/tags

- HEAD /api/v2/assets/hash/{hash} (existence check)

11 unit tests in tests/features/test_api_v2_assets.py covering payload shape, pagination, hash check (match/miss/malformed), 404 paths, and disallowed content paths.
2026-05-21 22:24:46 +02:00