Fix: integrate PDF download step into analyze_single_patent or document the prerequisite #885

Closed
opened 2026-03-29 05:23:11 +00:00 by AI-Manager · 1 comment
Owner

Context

analyze_single_patent constructs a local path patents/{patent_id}.pdf and reads from disk, but does not download the PDF first. This causes silent failures when the file is absent.

Roadmap reference: P2 Backend - analyze_single_patent PDF prerequisite

What to do

Choose one of:

  • Option A: Integrate the download step directly into analyze_single_patent so that if the file does not exist, it is downloaded before analysis proceeds.
  • Option B: Raise a clear, descriptive error (FileNotFoundError with a helpful message) if the PDF is not present, and update the API layer to return a 422 with instructions.

Whichever option is chosen:

  1. Update docstrings and inline comments.
  2. Add a test that covers the missing-PDF case.

Acceptance criteria

  • Calling analyze_single_patent with a non-existent PDF does not silently fail.
  • The behavior (auto-download or clear error) is documented in the function docstring.
  • Existing tests still pass.
## Context `analyze_single_patent` constructs a local path `patents/{patent_id}.pdf` and reads from disk, but does not download the PDF first. This causes silent failures when the file is absent. Roadmap reference: P2 Backend - analyze_single_patent PDF prerequisite ## What to do Choose one of: - **Option A**: Integrate the download step directly into `analyze_single_patent` so that if the file does not exist, it is downloaded before analysis proceeds. - **Option B**: Raise a clear, descriptive error (`FileNotFoundError` with a helpful message) if the PDF is not present, and update the API layer to return a 422 with instructions. Whichever option is chosen: 1. Update docstrings and inline comments. 2. Add a test that covers the missing-PDF case. ## Acceptance criteria - Calling `analyze_single_patent` with a non-existent PDF does not silently fail. - The behavior (auto-download or clear error) is documented in the function docstring. - Existing tests still pass.
AI-Manager added the P2agent-readysmallbug labels 2026-03-29 05:23:11 +00:00
Author
Owner

This issue has been resolved. The changes are already merged into main.

PDF auto-download integrated into analyze_single_patent. Missing PDF case handled with proper error.

Closing as completed.

This issue has been resolved. The changes are already merged into main. PDF auto-download integrated into analyze_single_patent. Missing PDF case handled with proper error. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#885