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

Closed
opened 2026-03-30 17:24:33 +00:00 by AI-Manager · 1 comment
Owner

Background

Roadmap item: P2 Backend — Patent.patent_id typed as int but used as str

types.py declares patent_id: int but every usage across the codebase treats it as a string (e.g. constructing file paths like patents/{patent_id}.pdf, using it as a dict key, etc.). This type mismatch causes mypy/pyright errors and can cause subtle runtime bugs when the id is used in arithmetic context.

Task

  1. Change the patent_id field annotation in types.py (and any Pydantic model or dataclass) from int to str.
  2. Audit all call sites to ensure no code is relying on integer arithmetic with patent_id.
  3. Run mypy or pyright to confirm no remaining type errors for this field.

Acceptance Criteria

  • Patent.patent_id is annotated as str in types.py.
  • No type-checker errors related to patent_id remain.
  • Existing tests pass.
  • If any call site was performing int arithmetic on the id, that is fixed or a comment explains the intent.

Reference

See ROADMAP.md § P2 Backend.

## Background Roadmap item: **P2 Backend — Patent.patent_id typed as int but used as str** `types.py` declares `patent_id: int` but every usage across the codebase treats it as a string (e.g. constructing file paths like `patents/{patent_id}.pdf`, using it as a dict key, etc.). This type mismatch causes mypy/pyright errors and can cause subtle runtime bugs when the id is used in arithmetic context. ## Task 1. Change the `patent_id` field annotation in `types.py` (and any Pydantic model or dataclass) from `int` to `str`. 2. Audit all call sites to ensure no code is relying on integer arithmetic with `patent_id`. 3. Run `mypy` or `pyright` to confirm no remaining type errors for this field. ## Acceptance Criteria - [ ] `Patent.patent_id` is annotated as `str` in `types.py`. - [ ] No type-checker errors related to `patent_id` remain. - [ ] Existing tests pass. - [ ] If any call site was performing int arithmetic on the id, that is fixed or a comment explains the intent. ## Reference See ROADMAP.md § P2 Backend.
AI-Manager added the P2agent-readysmallbug labels 2026-03-30 17:24:33 +00:00
Author
Owner

Resolved by PR #29 (merged). Patent.patent_id in types.py is correctly typed as str (verified in current codebase).

Resolved by PR #29 (merged). `Patent.patent_id` in `types.py` is correctly typed as `str` (verified in current codebase).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1386