diff --git a/ROADMAP.md b/ROADMAP.md index 8217bbc..8dc247f 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -27,10 +27,15 @@ - [x] T11: Bot de Telegram como adapter (`infrastructure/bot/telegram_bot.py`, `AnswerFn` inyectado, completado 10 ago) - [x] T12: Composition root `scripts/run_telegram_bot.py` con wiring hybrid+rerank (completado 11 ago) - [x] T13: `answer_query` inyecta `retrieve: RetrieveFn` en vez de `store: VectorStore` (completado 11 ago) -- [x] T14: Fix — `test_extract_text_pdf` sin depender de un PDF no versionado (completado 12 ago) +- [x] T14: Fix — `test_extract_text_pdf` sin depender de un PDF no versionado + (marcado completado 12 ago, pero **no lo estaba**: seguía fallando en + clon limpio porque `_download_pdf` escribía a `data/papers/` sin crear + el directorio, y el test escribía sobre el `data/papers/` real del + repo. Corregido de verdad y verificado en un clon limpio real — + completado 13 ago) - [x] T15: Fix — límite de 4096 caracteres por mensaje de Telegram (completado 12 ago) - [x] T16: `scripts/ingest_documents.py` implementado — CLI delgado sobre `ingest_papers` (completado 12 ago) -- [ ] T17: Merge de la rama de V1 real a `main` +- [x] T17: Merge de la rama de V1 real a `main` (completado 13 ago, PR#4) ## Deuda técnica conocida - [ ] `ingestion_service.py` (`application/`) importa `httpx`, `fitz` y diff --git a/src/researchos/application/services/ingestion_service.py b/src/researchos/application/services/ingestion_service.py index f589cbc..23ad485 100644 --- a/src/researchos/application/services/ingestion_service.py +++ b/src/researchos/application/services/ingestion_service.py @@ -74,6 +74,7 @@ async def _download_pdf(paper: Paper) -> Path: response = await client.get(url) response.raise_for_status() # save pdf in local system + local_pdf_path.parent.mkdir(parents=True, exist_ok=True) with open(local_pdf_path, "wb") as f: f.write(response.content) diff --git a/tests/unit/application/test_ingestion_service.py b/tests/unit/application/test_ingestion_service.py index d85dc7e..9a42896 100644 --- a/tests/unit/application/test_ingestion_service.py +++ b/tests/unit/application/test_ingestion_service.py @@ -18,7 +18,9 @@ def _fake_pdf_bytes() -> bytes: @pytest.mark.unit @pytest.mark.asyncio -async def test_extract_text_pdf(): +async def test_extract_text_pdf(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): + monkeypatch.setattr("researchos.application.services.ingestion_service.PAPERS_DIR", tmp_path) + paper = Paper( source_id="1", source="arxiv",