feat(attachments): scan enumerates all; import_file maps 'attached' + member ML

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 11:14:49 -04:00
parent f97551e2f6
commit 89103c4570
4 changed files with 75 additions and 16 deletions
+24
View File
@@ -0,0 +1,24 @@
"""FC-2d-iii: import_file maps 'attached' + enqueues ML for members."""
import pytest
from backend.app.services.importer import ImportResult
from backend.app.tasks.import_file import _map_result_to_status
pytestmark = pytest.mark.integration # imports the celery app graph
def test_attached_maps_to_complete_no_requeue():
status, requeue = _map_result_to_status(
ImportResult(status="attached")
)
assert status == "complete"
assert requeue is False
def test_imported_still_requeues():
status, requeue = _map_result_to_status(
ImportResult(status="imported", image_id=5)
)
assert status == "complete"
assert requeue is True
+20
View File
@@ -0,0 +1,20 @@
"""FC-2d-iii: scan no longer filters to media-only."""
import pytest
pytestmark = pytest.mark.integration
def test_scan_includes_non_media(tmp_path):
from backend.app.tasks import scan as scan_mod
root = tmp_path / "imp"
(root / "Alice").mkdir(parents=True)
(root / "Alice" / "pic.jpg").write_bytes(b"x")
(root / "Alice" / "pack.zip").write_bytes(b"x")
(root / "Alice" / "doc.pdf").write_bytes(b"x")
(root / "Alice" / "meta.json").write_text("{}")
(root / "Alice" / ".hidden").write_text("x")
seen = sorted(p.name for p in scan_mod._iter_import_files(root))
assert seen == ["doc.pdf", "pack.zip", "pic.jpg"] # no json/dotfile