ComfyUI/app/assets/database/queries
Matt Miller dc6190e8ba
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Build package / Build Test (3.10) (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.14) (push) Has been cancelled
fix(assets): seed added_at past max(existing) to survive Windows clock collisions
The per-tag microsecond stagger preserves intra-batch order, but two
back-to-back write batches on the same reference (e.g.
set_reference_tags for path tags, then add_tags_to_reference for user
tags) call get_utc_now() independently. On Windows the system clock can
return the same datetime for both calls if no OS tick elapsed between
the commits — both batches end up sharing microseconds and
ORDER BY added_at, tag_name falls back to the alphabetic tiebreaker,
sorting user tags ahead of path tags they were meant to follow.

Add _next_added_at_base(reference_id) that reads max(existing added_at)
and returns max(existing + 1us, get_utc_now()), guaranteeing the new
batch sorts strictly after anything previously written for that
reference. Used by set_reference_tags and add_tags_to_reference;
batch_insert_seed_assets stays on raw get_utc_now() since seed inserts
are always the first writes for a new reference.

The accompanying regression test pins get_utc_now() to a frozen value
so the previously-Windows-only race becomes a platform-independent
failure mode under test.
2026-05-20 20:33:39 -07:00
..
__init__.py feat(assets): register output files as assets after prompt execution (#12812) 2026-03-24 20:48:55 -07:00
asset_reference.py feat(assets): preserve insertion order on tag retrieval 2026-05-19 20:14:01 -07:00
asset.py feat(assets): register output files as assets after prompt execution (#12812) 2026-03-24 20:48:55 -07:00
common.py feat(assets): align local API with cloud spec (#12863) 2026-03-16 12:34:04 -07:00
tags.py fix(assets): seed added_at past max(existing) to survive Windows clock collisions 2026-05-20 20:33:39 -07:00