From 9491967adb1596c0b796fade825e0b64e42c2bf3 Mon Sep 17 00:00:00 2001 From: John Mario Montoya Zapata Date: Thu, 13 Aug 2026 09:52:09 -0500 Subject: [PATCH 1/2] fix(ingestion): create PAPERS_DIR parent before writing, isolate test from disk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _download_pdf assumed data/papers/ already existed, which is only true if ensure_dirs() ran first. It never does in a clean clone, so extract_text_pdf raised FileNotFoundError. mkdir(parents=True, exist_ok=True) before the write makes the service robust regardless of call order. test_extract_text_pdf still wrote through to the real data/papers/ even after the previous fix (only the PDF bytes were mocked, not the write target). Patches PAPERS_DIR to tmp_path so the test never touches the repo. Verified in a genuinely fresh clone this time, not just the working copy — T14 was marked done on 12/08 without that check and this exact bug slipped through. --- src/researchos/application/services/ingestion_service.py | 1 + tests/unit/application/test_ingestion_service.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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", From 8d3b604626b3a08b779f04d54c8b5e026a94c311 Mon Sep 17 00:00:00 2001 From: John Mario Montoya Zapata Date: Thu, 13 Aug 2026 09:53:44 -0500 Subject: [PATCH 2/2] docs(roadmap): correct T14 completion date, mark T17 merge done MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit T14 was checked off on 12/08 without verifying in a clean clone — it still failed. Corrected the note to record what actually happened and the real completion date. T17 (merge to main) happened today via PR#4. --- ROADMAP.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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