Clean up imports, remove section banners, and fix seed endpoint with autoscan disabled

Move inline/lazy imports to top-level now that blake3 is a main dependency and
circular-import concerns are resolved. Remove decorative section-header comments
in asset_reference queries. Allow the seed API endpoint to temporarily re-enable
the seeder when --disable-assets-autoscan is active so manual triggers still work.
Add retry-on-409 logic in test helpers and remove try/finally around prompt
execution in favour of sequential pause/resume.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Luke Mino-Altherr
2026-02-23 15:58:00 -08:00
parent cdc6c1c143
commit 196959472a
10 changed files with 44 additions and 90 deletions

View File

@@ -2,23 +2,10 @@ import asyncio
import os
from typing import IO
from blake3 import blake3
DEFAULT_CHUNK = 8 * 1024 * 1024
_blake3 = None
def _get_blake3():
global _blake3
if _blake3 is None:
try:
from blake3 import blake3 as _b3
_blake3 = _b3
except ImportError:
raise ImportError(
"blake3 is required for asset hashing. Install with: pip install blake3"
)
return _blake3
def compute_blake3_hash(
fp: str | IO[bytes],
@@ -55,7 +42,7 @@ def _hash_file_obj(file_obj: IO, chunk_size: int = DEFAULT_CHUNK) -> str:
if orig_pos != 0:
file_obj.seek(0)
h = _get_blake3()()
h = blake3()
while True:
chunk = file_obj.read(chunk_size)
if not chunk: