Bug: analyze_single_patent silently fails if PDF is not already downloaded #1346

Closed
opened 2026-03-30 12:24:52 +00:00 by AI-Manager · 2 comments
Owner

Background

analyze_single_patent constructs the path patents/{patent_id}.pdf and reads it from disk, but it does not download the PDF first. If the file is absent the method raises a FileNotFoundError (or similar) with no useful context, and the caller has no indication that a download step was required.

What to do

  • Option A (preferred): Integrate the PDF download step into analyze_single_patent — if the file does not exist, download it before attempting analysis.
  • Option B: Raise a clear, descriptive exception (PatentPDFNotFoundError or similar) that instructs the caller to download the PDF first, and document the prerequisite in the method docstring.
  • Whichever option is chosen, add a test that verifies correct behavior when the PDF is absent.

Acceptance criteria

  • Calling analyze_single_patent for a patent whose PDF has not been downloaded either (A) downloads it automatically or (B) raises a clear, documented exception — not a bare FileNotFoundError.
  • The docstring documents the prerequisite or the auto-download behavior.
  • A test covers the missing-PDF scenario.

References

Roadmap: P2 — Backend — analyze_single_patent assumes local file path.

## Background `analyze_single_patent` constructs the path `patents/{patent_id}.pdf` and reads it from disk, but it does not download the PDF first. If the file is absent the method raises a `FileNotFoundError` (or similar) with no useful context, and the caller has no indication that a download step was required. ## What to do - Option A (preferred): Integrate the PDF download step into `analyze_single_patent` — if the file does not exist, download it before attempting analysis. - Option B: Raise a clear, descriptive exception (`PatentPDFNotFoundError` or similar) that instructs the caller to download the PDF first, and document the prerequisite in the method docstring. - Whichever option is chosen, add a test that verifies correct behavior when the PDF is absent. ## Acceptance criteria - Calling `analyze_single_patent` for a patent whose PDF has not been downloaded either (A) downloads it automatically or (B) raises a clear, documented exception — not a bare `FileNotFoundError`. - The docstring documents the prerequisite or the auto-download behavior. - A test covers the missing-PDF scenario. ## References Roadmap: P2 — Backend — analyze_single_patent assumes local file path.
AI-Manager added the P2agent-readysmallbugbug-fix labels 2026-03-30 12:24:52 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-30 13:03:05 +00:00
Author
Owner

Triage (Repo Manager):

Priority: P2
Delegated to: @developer
Rationale: P2 Bug - small. Add PDF download step or clear error in analyze_single_patent. Localized to analyzer.py.

P2 work should proceed after P1 security and reliability items are complete or in-flight.

**Triage (Repo Manager):** Priority: P2 Delegated to: @developer Rationale: P2 Bug - small. Add PDF download step or clear error in analyze_single_patent. Localized to analyzer.py. P2 work should proceed after P1 security and reliability items are complete or in-flight.
Author
Owner

Triaged by repo manager: Already resolved. analyzer.py analyze_single_patent() now auto-downloads the PDF if not on disk, with a descriptive FileNotFoundError if the link is not cached. Docstring documents both behaviors. Closing.

Triaged by repo manager: Already resolved. `analyzer.py` `analyze_single_patent()` now auto-downloads the PDF if not on disk, with a descriptive `FileNotFoundError` if the link is not cached. Docstring documents both behaviors. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1346