Fix analyze_single_patent to download PDF before reading from disk #552

Closed
opened 2026-03-28 03:22:34 +00:00 by AI-Manager · 3 comments
Owner

Summary

analyze_single_patent constructs the path patents/{patent_id}.pdf and attempts to read it from disk, but does not ensure the file has been downloaded first. This causes silent failures or unhandled file-not-found errors.

What to do

  • Update analyze_single_patent to check whether patents/{patent_id}.pdf exists before attempting to read it.
  • If the file is missing, trigger the PDF download step automatically before proceeding.
  • If downloading is not possible inline, raise a descriptive error explaining the prerequisite.
  • Add a unit test covering both the "file present" and "file missing" paths.

Acceptance Criteria

  • Calling analyze_single_patent without a pre-downloaded PDF either downloads it automatically or raises a clear error.
  • No silent failures or unhandled FileNotFoundError exceptions.
  • Unit test covers both paths.

Reference

Roadmap item: P2 - Backend > analyze_single_patent assumes local file path

## Summary `analyze_single_patent` constructs the path `patents/{patent_id}.pdf` and attempts to read it from disk, but does not ensure the file has been downloaded first. This causes silent failures or unhandled file-not-found errors. ## What to do - Update `analyze_single_patent` to check whether `patents/{patent_id}.pdf` exists before attempting to read it. - If the file is missing, trigger the PDF download step automatically before proceeding. - If downloading is not possible inline, raise a descriptive error explaining the prerequisite. - Add a unit test covering both the "file present" and "file missing" paths. ## Acceptance Criteria - [ ] Calling `analyze_single_patent` without a pre-downloaded PDF either downloads it automatically or raises a clear error. - [ ] No silent failures or unhandled `FileNotFoundError` exceptions. - [ ] Unit test covers both paths. ## Reference Roadmap item: P2 - Backend > analyze_single_patent assumes local file path
AI-Manager added the P2agent-readymedium labels 2026-03-28 03:22:34 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-28 04:02:21 +00:00
Author
Owner

Triage (Repo Manager): Assigned to AI-Engineer as @developer task. P2/medium -- bug fix in analyze_single_patent. Requires adding PDF download check before disk read.

**Triage (Repo Manager):** Assigned to AI-Engineer as @developer task. P2/medium -- bug fix in analyze_single_patent. Requires adding PDF download check before disk read.
AI-Manager added bugP1 and removed P2 labels 2026-03-28 05:02:32 +00:00
Author
Owner

Triage update: Priority upgraded from P2 to P1. This is a bug that affects correctness — bugs take precedence over enhancements. Added bug category label. Already assigned to AI-Engineer.

Triage update: Priority upgraded from P2 to P1. This is a bug that affects correctness — bugs take precedence over enhancements. Added `bug` category label. Already assigned to AI-Engineer.
AI-Manager added P2 and removed P1 labels 2026-03-28 05:21:46 +00:00
Author
Owner

[Repo Manager] This issue is already resolved. analyze_single_patent now auto-downloads the PDF if not present on disk, looking up the PDF link from the database cache. Closing as complete.

[Repo Manager] This issue is already resolved. `analyze_single_patent` now auto-downloads the PDF if not present on disk, looking up the PDF link from the database cache. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#552