Files
ComfyUI/tests-unit
Simon Pinfold e6beab52ef fix(assets): recover records when a drive comes back with hashing off (#16646)
* fix(assets): recover records when a drive comes back with hashing off

A scan that runs while a drive is offline marks every row on it missing. With
hashing off (the default), nothing could recover those rows when the drive
returned, so the scan created new records and the user's names, tags, metadata
and job links stayed on the orphaned originals.

- With hashing off, a file that reappears at a path no live row occupies
  recovers the missing row there whose size and mtime match exactly. If several
  match, the newest recovers. Hashing on is unchanged.
- A reference stat that fails with an I/O error other than not-found leaves the
  row live, as the output listing rescan already does.
- seeder.marked_missing is emitted per root when a fast scan marks rows missing,
  and scan_completed carries missing_marked_count and recovered_count.

* fix(assets): read recovery candidates before the write transaction; count recoveries only once committed

* test(assets): a pruned model folder recovers its records when it is registered again

* fix(assets): never recover a missing row whose records were all deleted

* docs(assets): scope the multiple-match rule to hashing on

* docs(assets): only new content splits a same-path edit

* test(assets): scan_completed carries nonzero missing and recovered counts

* perf(assets): let the partial live-path index serve the hashing-off recovery check

Written as IS 0, the check that no live row occupies the path scanned
asset_contents once per recovered file, inside the batch's write transaction.
At 50k rows that stretched each batch's lock window to about 2.5s and made
concurrent output registrations time out.

* ci: run the checks against master

* test(assets): import folder_paths at module level
2026-09-29 20:15:02 -07:00
..
2026-09-28 21:43:07 -04:00

Pytest Unit Tests

Install test dependencies

pip install -r tests-unit/requirements.txt

Run tests

pytest tests-unit/