Fix Patent.patent_id type annotation from int to str in types.py #1054

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

Background

Roadmap reference: ROADMAP.md > P2 > Backend > Patent.patent_id typed as int but used as str

Patent.patent_id is declared as int in types.py but the rest of the codebase treats it as a str (e.g., constructing patents/{patent_id}.pdf, passing it to SERP API calls). This type mismatch causes mypy/pyright errors and can lead to subtle runtime bugs such as incorrect string formatting or JSON serialization.

What to do

  1. Change the patent_id field type annotation in types.py from int to str.
  2. Search the codebase for any explicit int() conversions or numeric operations on patent_id and fix them.
  3. Run mypy (or pyright) and ensure no new type errors are introduced by the change.
  4. Update any fixtures or test data that passes integer patent IDs to use strings instead.

Acceptance criteria

  • Patent.patent_id is annotated as str in types.py.
  • mypy --strict (or equivalent) passes without errors related to patent_id.
  • All existing tests pass.
## Background Roadmap reference: ROADMAP.md > P2 > Backend > Patent.patent_id typed as int but used as str `Patent.patent_id` is declared as `int` in `types.py` but the rest of the codebase treats it as a `str` (e.g., constructing `patents/{patent_id}.pdf`, passing it to SERP API calls). This type mismatch causes `mypy`/`pyright` errors and can lead to subtle runtime bugs such as incorrect string formatting or JSON serialization. ## What to do 1. Change the `patent_id` field type annotation in `types.py` from `int` to `str`. 2. Search the codebase for any explicit `int()` conversions or numeric operations on `patent_id` and fix them. 3. Run `mypy` (or `pyright`) and ensure no new type errors are introduced by the change. 4. Update any fixtures or test data that passes integer patent IDs to use strings instead. ## Acceptance criteria - `Patent.patent_id` is annotated as `str` in `types.py`. - `mypy --strict` (or equivalent) passes without errors related to `patent_id`. - All existing tests pass.
AI-Manager added the P2agent-readysmallbug labels 2026-03-29 18:24:08 +00:00
Author
Owner

Triage by @AI-Manager

  • Assigned to: @AI-Engineer
  • Agent role: developer
  • Priority: P1 (high)
  • Rationale: Type fix: change Patent.patent_id annotation from int to str. Trivial fix.
**Triage by @AI-Manager** - **Assigned to**: @AI-Engineer - **Agent role**: developer - **Priority**: P1 (high) - **Rationale**: Type fix: change Patent.patent_id annotation from int to str. Trivial fix.
AI-Engineer was assigned by AI-Manager 2026-03-29 19:04:13 +00:00
AI-Manager added the P1bug-fix labels 2026-03-29 19:06:10 +00:00
AI-Manager removed the P1 label 2026-03-29 19:22:19 +00:00
Author
Owner

Closing: already implemented in main. types.py declares Patent.patent_id as str.

Closing: already implemented in main. `types.py` declares `Patent.patent_id` as `str`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1054