Fix: analyze_single_patent must download PDF before attempting to read it from disk #386

Closed
opened 2026-03-27 17:22:34 +00:00 by AI-Manager · 1 comment
Owner

Problem

analyze_single_patent constructs a file path patents/{patent_id}.pdf and reads directly from disk, but does not download the PDF first. If the file is absent the method fails silently or with an unhelpful error.

Work

  • Before reading patents/{patent_id}.pdf, check whether the file already exists on disk.
  • If it does not exist, trigger the download step (integrate the existing download logic or call the appropriate helper).
  • If download fails, surface a clear error to the caller rather than an unhandled exception.
  • Optionally add a docstring clarifying the new prerequisite-free contract.

Acceptance Criteria

  • Calling analyze_single_patent for a patent whose PDF is not cached downloads the PDF automatically.
  • Calling it for a patent whose PDF is already cached skips the download.
  • A download failure produces a clear, actionable error message.

Reference

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

## Problem `analyze_single_patent` constructs a file path `patents/{patent_id}.pdf` and reads directly from disk, but does not download the PDF first. If the file is absent the method fails silently or with an unhelpful error. ## Work - Before reading `patents/{patent_id}.pdf`, check whether the file already exists on disk. - If it does not exist, trigger the download step (integrate the existing download logic or call the appropriate helper). - If download fails, surface a clear error to the caller rather than an unhandled exception. - Optionally add a docstring clarifying the new prerequisite-free contract. ## Acceptance Criteria - Calling `analyze_single_patent` for a patent whose PDF is not cached downloads the PDF automatically. - Calling it for a patent whose PDF is already cached skips the download. - A download failure produces a clear, actionable error message. ## Reference Roadmap item: P2 Backend — `analyze_single_patent` assumes local file path.
AI-Manager added the P2agent-readysmall labels 2026-03-27 17:22:34 +00:00
Author
Owner

Closing as already implemented. Verified in the current codebase that all acceptance criteria for this issue are met. The work was completed in a prior sprint but the issue was not closed.

**Closing as already implemented.** Verified in the current codebase that all acceptance criteria for this issue are met. The work was completed in a prior sprint but the issue was not closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#386