Modal focus/keyboard polish, Camie-in-autocomplete, re-extract self-resume #82

Merged
bvandeusen merged 4 commits from dev into main 2026-06-07 12:17:43 -04:00
Showing only changes of commit 394c7dcd67 - Show all commits
+16 -4
View File
@@ -6,7 +6,7 @@ import io
import zipfile
import pytest
from PIL import Image
from PIL import Image, ImageDraw
from sqlalchemy import select
from backend.app.models import (
@@ -28,6 +28,18 @@ def _jpeg(color, size=256):
return buf.getvalue()
def _patterned_jpeg(idx, size=256):
"""Structurally distinct per idx so the members don't phash-collapse — solid
colors collide to distance 0 and the second would dedupe away (the two-axis
dedup gotcha). A rectangle at an idx-derived position keeps phashes apart."""
img = Image.new("RGB", (size, size), "white")
x = 20 + idx * 60
ImageDraw.Draw(img).rectangle([x, x, x + 70, x + 70], fill="black")
buf = io.BytesIO()
img.save(buf, "JPEG")
return buf.getvalue()
def test_reextract_links_archive_members_to_post(db_sync, tmp_path, monkeypatch):
from backend.app.tasks import ml as ml_mod
from backend.app.tasks import thumbnail as thumb_mod
@@ -122,10 +134,10 @@ def test_reextract_timebox_resumes_from_cursor(db_sync, tmp_path, monkeypatch):
store_dir = images_root / "attachments" / "two"
store_dir.mkdir(parents=True)
att_ids = []
for n, color in enumerate(("red", "blue")):
arc = store_dir / f"{n}_archive_{color}"
for n in range(2):
arc = store_dir / f"{n}_archive"
with zipfile.ZipFile(arc, "w") as zf:
zf.writestr(f"{color}.jpg", _jpeg(color))
zf.writestr(f"member{n}.jpg", _patterned_jpeg(n))
sha = hashlib.sha256(arc.read_bytes()).hexdigest()
att = PostAttachment(
post_id=post.id, artist_id=artist.id, sha256=sha, path=str(arc),