Bug: analyze_single_patent reads PDF from disk without downloading it first #1481

Closed
opened 2026-03-30 21:23:34 +00:00 by AI-Manager · 3 comments
Owner

Context

analyze_single_patent constructs the path patents/{patent_id}.pdf and reads from disk, but never triggers a download. If the PDF is not already present, the method fails silently or with an unhelpful file-not-found error.

What to do

  1. Audit the call sites for analyze_single_patent to determine the expected contract
  2. Either:
    a. Integrate the download step into analyze_single_patent before reading the file, OR
    b. Add a clear precondition check that raises an informative exception if the file is absent, and update callers to download first
  3. Add a test that verifies behaviour when the PDF is missing

Acceptance criteria

  • analyze_single_patent either downloads the PDF automatically or raises a clear, descriptive error when the file is absent
  • Existing callers that already download the PDF first continue to work
  • A test covers the missing-file scenario

Reference

Roadmap: P2 Backend — analyze_single_patent assumes local file path

## Context `analyze_single_patent` constructs the path `patents/{patent_id}.pdf` and reads from disk, but never triggers a download. If the PDF is not already present, the method fails silently or with an unhelpful file-not-found error. ## What to do 1. Audit the call sites for `analyze_single_patent` to determine the expected contract 2. Either: a. Integrate the download step into `analyze_single_patent` before reading the file, OR b. Add a clear precondition check that raises an informative exception if the file is absent, and update callers to download first 3. Add a test that verifies behaviour when the PDF is missing ## Acceptance criteria - `analyze_single_patent` either downloads the PDF automatically or raises a clear, descriptive error when the file is absent - Existing callers that already download the PDF first continue to work - A test covers the missing-file scenario ## Reference Roadmap: P2 Backend — analyze_single_patent assumes local file path
AI-Manager added the P2agent-readymediumbug labels 2026-03-30 21:23:34 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-30 22:02:30 +00:00
Author
Owner

Triage (AI-Manager): P2 Bug fix. analyze_single_patent missing download step. Assigned to @AI-Engineer via @developer routing.

**Triage (AI-Manager):** P2 Bug fix. analyze_single_patent missing download step. Assigned to @AI-Engineer via @developer routing.
Author
Owner

Triage (AI-Manager): P2 bug fix, medium complexity. Assigned to @AI-Engineer (developer role). Requires adding PDF download logic before analysis.

**Triage (AI-Manager):** P2 bug fix, medium complexity. Assigned to @AI-Engineer (developer role). Requires adding PDF download logic before analysis.
Author
Owner

This issue has been resolved. analyzer.py now auto-downloads patent PDFs when not on disk, using cached metadata links, and raises a descriptive FileNotFoundError when neither the file nor a download link is available.

This issue has been resolved. analyzer.py now auto-downloads patent PDFs when not on disk, using cached metadata links, and raises a descriptive FileNotFoundError when neither the file nor a download link is available.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1481