Add optional blake3 hashing during asset scanning

- Make blake3 import lazy in hashing.py (only imported when needed)
- Add compute_hashes parameter to AssetSeeder.start(), build_asset_specs(), and seed_assets()
- Fix missing tag clearing: include is_missing states in sync when update_missing_tags=True
- Clear is_missing flag on cache states when files are restored with matching mtime/size
- Fix validation error serialization in routes.py (use json.loads(ve.json()))

Amp-Thread-ID: https://ampcode.com/threads/T-019c3614-56d4-74a8-a717-19922d6dbbee
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Luke Mino-Altherr
2026-02-06 19:22:56 -08:00
parent 7a75af59ab
commit a2d26dece5
11 changed files with 119 additions and 52 deletions

View File

@@ -1,3 +1,4 @@
import logging
import os
import uuid
from typing import Callable
@@ -83,7 +84,10 @@ async def parse_multipart_upload(
provided_hash = normalize_and_validate_hash(s)
try:
provided_hash_exists = check_hash_exists(provided_hash)
except Exception:
except Exception as e:
logging.warning(
"check_hash_exists failed for hash=%s: %s", provided_hash, e
)
provided_hash_exists = None # do not fail the whole request here
elif fname == "file":
@@ -162,5 +166,5 @@ def delete_temp_file_if_exists(tmp_path: str | None) -> None:
try:
if os.path.exists(tmp_path):
os.remove(tmp_path)
except Exception:
pass
except OSError as e:
logging.debug("Failed to delete temp file %s: %s", tmp_path, e)