Skip to content

Commit 49b01d3

Browse files
committed
fix: CI tests and photo pipeline improvements
- Fix test expecting version 4.2.3, now correctly expects 5.0.0 - Add missing os import to photo_processor.py - Update photo pipeline to process ALL zip files (removed filter) - Add fallback paths for finding takeout archives - Add validation to skip tiny/corrupted image files - Update Docker mount for Google Drive Takeout folder CI tests now passing: 33 passed, 2 skipped
1 parent af8a22c commit 49b01d3

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

.claude/settings.local.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@
123123
"Bash(wsl:*)",
124124
"Bash(.venv/Scripts/python.exe -m uvicorn:*)",
125125
"Bash(.venv\\Scripts\\python.exe -m uvicorn:*)",
126-
"Bash(docker inspect:*)"
126+
"Bash(docker inspect:*)",
127+
"Bash(docker cp \"$file\" secondbrain-app:/takeout_local/)",
128+
"Bash(do docker cp \"$file\" secondbrain-app:/takeout_local/)",
129+
"Bash(docker cp:*)"
127130
],
128131
"deny": [],
129132
"additionalDirectories": []

app/routes/photo_pipeline.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ async def _run_processing(self) -> None:
160160
try:
161161
# Get all zip files to process
162162
# Check if running in Docker or locally
163-
if os.path.exists("/takeout"):
163+
if os.path.exists("/takeout_local") and list(Path("/takeout_local").glob("*.zip")):
164+
takeout_path = Path("/takeout_local") # Docker local copy
165+
print(f"📁 Using Docker local copy: {takeout_path}")
166+
elif os.path.exists("/takeout") and list(Path("/takeout").glob("*.zip")):
164167
takeout_path = Path("/takeout") # Docker mount
165168
print(f"📁 Using Docker mount: {takeout_path}")
166169
elif os.path.exists("G:/My Drive/Takeout"):
@@ -180,9 +183,8 @@ async def _run_processing(self) -> None:
180183
print(f"📊 Total files in directory: {len(all_files)}")
181184
zip_files = sorted(takeout_path.glob("*.zip"))
182185
print(f"📦 Total zip files found: {len(zip_files)}")
183-
# Filter for the ones we want
184-
zip_files = sorted([f for f in zip_files
185-
if "-1-" in f.name or f.name.endswith("-032.zip")])
186+
# Process ALL zip files
187+
zip_files = sorted(zip_files)
186188
print(f"✅ Filtered zip files to process: {len(zip_files)}")
187189
else:
188190
print(f"❌ Path does not exist: {takeout_path}")

app/services/photo_processor.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import asyncio
77
import io
8+
import os
89
import sys
910

1011
# Force UTF-8 encoding for Windows console
@@ -38,7 +39,11 @@
3839
from app.core.service_config import config
3940

4041
# Get all configuration from central source
41-
TAKEOUT_PATH = config.TAKEOUT_PATH
42+
# Use Windows path if available, otherwise Docker mount
43+
if os.path.exists("G:/My Drive/Takeout"):
44+
TAKEOUT_PATH = "G:/My Drive/Takeout"
45+
else:
46+
TAKEOUT_PATH = config.TAKEOUT_PATH
4247
CLIP_SERVICE_URL = config.get_clip_url()
4348
LLAVA_SERVICE_URL = config.get_llava_url()
4449
DATABASE_URL = config.get_database_url()
@@ -208,6 +213,11 @@ async def process_image(
208213
"""Process a single image: generate embedding and store in database"""
209214

210215
try:
216+
# Skip tiny files (likely corrupted)
217+
if len(image_data) < 100:
218+
print(f" ⏭️ Skipping {file_name} (too small, likely corrupted)")
219+
return False
220+
211221
# Check if already processed
212222
async with self.pool.acquire() as conn:
213223
exists = await conn.fetchval(

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
volumes:
1919
- .:/app:rw
2020
- /app/.venv # Exclude .venv from mount
21-
- "./takeout:/takeout:ro" # Mount local takeout folder
21+
- "G:\\My Drive\\Takeout:/takeout:ro" # Mount Google Drive Takeout folder (Windows format)
2222
depends_on:
2323
postgres:
2424
condition: service_healthy

tests/unit/test_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_root_endpoint(self):
5151

5252
data = response.json()
5353
assert data["environment"] == "testing"
54-
assert data["version"] == "4.2.3"
54+
assert data["version"] == "5.0.0"
5555
assert "ready" in data
5656

5757
def test_health_endpoint(self):

0 commit comments

Comments
 (0)