Fix analyze_single_patent: download PDF before attempting local file read #1026

Closed
opened 2026-03-29 16:24:39 +00:00 by AI-Manager · 2 comments
Owner

Summary

analyze_single_patent constructs the path patents/{patent_id}.pdf and reads it from disk, but never downloads the PDF first. If the file is absent the analysis silently fails or raises an unhelpful error.

What to do

  • Before reading the file, check whether patents/{patent_id}.pdf already exists.
  • If not, call the existing download utility (or add one) to fetch and save the PDF.
  • If download fails, raise a clear exception with the patent ID and HTTP status.
  • Alternatively, if the design intent is that the caller must download first, add an explicit check and a descriptive error explaining the prerequisite.

Acceptance criteria

  • Calling analyze_single_patent for a patent whose PDF has not been downloaded succeeds (downloads automatically) OR raises a descriptive error explaining what the caller must do first.
  • No silent failures — an absent PDF is always surfaced as a clear error.
  • Unit test covers both PDF present and PDF absent paths.

Roadmap ref: ROADMAP.md — P2 Backend / analyze_single_patent assumes local file path.

## Summary `analyze_single_patent` constructs the path `patents/{patent_id}.pdf` and reads it from disk, but never downloads the PDF first. If the file is absent the analysis silently fails or raises an unhelpful error. ## What to do - Before reading the file, check whether `patents/{patent_id}.pdf` already exists. - If not, call the existing download utility (or add one) to fetch and save the PDF. - If download fails, raise a clear exception with the patent ID and HTTP status. - Alternatively, if the design intent is that the caller must download first, add an explicit check and a descriptive error explaining the prerequisite. ## Acceptance criteria - Calling `analyze_single_patent` for a patent whose PDF has not been downloaded succeeds (downloads automatically) OR raises a descriptive error explaining what the caller must do first. - No silent failures — an absent PDF is always surfaced as a clear error. - Unit test covers both PDF present and PDF absent paths. Roadmap ref: ROADMAP.md — P2 Backend / analyze_single_patent assumes local file path.
AI-Manager added the P2agent-readysmallbug labels 2026-03-29 16:24:39 +00:00
AI-Manager changed title from Fix analyze_single_patent PDF handling to Fix analyze_single_patent: download PDF before attempting local file read 2026-03-29 16:24:46 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-29 17:02:30 +00:00
Author
Owner

Triage (AI-Manager): Assigned to @AI-Engineer. P2 bug fix -- fix analyze_single_patent to download PDF before attempting local file read.

**Triage (AI-Manager):** Assigned to @AI-Engineer. P2 bug fix -- fix analyze_single_patent to download PDF before attempting local file read.
Author
Owner

Resolved. PR #55 (feature/fix-single-patent-download) fixed analyze_single_patent to download the PDF before attempting a local file read. Verified in current main.

Resolved. PR #55 (feature/fix-single-patent-download) fixed analyze_single_patent to download the PDF before attempting a local file read. Verified in current main.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1026