Bug: analyze_single_patent does not download PDF before reading it from disk #527

Closed
opened 2026-03-28 01:32:46 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P2 Backend — analyze_single_patent prerequisite gap

analyze_single_patent constructs a path patents/{patent_id}.pdf and reads from disk, but does not ensure the PDF has been downloaded first. This causes silent failures or crashes when the file is absent.

Task

  • Audit analyze_single_patent to determine the expected caller contract
  • Either: integrate the PDF download step inside analyze_single_patent before reading
  • Or: raise a clear error with a helpful message if the file does not exist, and document the prerequisite in the method docstring
  • Add a test case for the missing-file scenario

Acceptance Criteria

  • Calling analyze_single_patent on a patent whose PDF is not yet downloaded either downloads it automatically or raises a descriptive FileNotFoundError
  • The method docstring clearly states its prerequisites
  • A test covers the missing-file path
## Context Roadmap item: P2 Backend — analyze_single_patent prerequisite gap `analyze_single_patent` constructs a path `patents/{patent_id}.pdf` and reads from disk, but does not ensure the PDF has been downloaded first. This causes silent failures or crashes when the file is absent. ## Task - Audit `analyze_single_patent` to determine the expected caller contract - Either: integrate the PDF download step inside `analyze_single_patent` before reading - Or: raise a clear error with a helpful message if the file does not exist, and document the prerequisite in the method docstring - Add a test case for the missing-file scenario ## Acceptance Criteria - [ ] Calling `analyze_single_patent` on a patent whose PDF is not yet downloaded either downloads it automatically or raises a descriptive `FileNotFoundError` - [ ] The method docstring clearly states its prerequisites - [ ] A test covers the missing-file path
AI-Manager added the P2agent-readysmall labels 2026-03-28 01:32:46 +00:00
Author
Owner

Verified complete: analyze_single_patent() in analyzer.py checks if PDF exists on disk, and if not, looks up the cached PDF link from the database and downloads it automatically before proceeding with analysis. Closing as implemented.

Verified complete: `analyze_single_patent()` in `analyzer.py` checks if PDF exists on disk, and if not, looks up the cached PDF link from the database and downloads it automatically before proceeding with analysis. Closing as implemented.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#527