-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
pythonPull requests that update python codePull requests that update python coderefactorCode refactoring and cleanupCode refactoring and cleanup
Milestone
Description
Summary
Add static type checking enforcement to the Python codebase using Pyright in strict mode, with CI integration to prevent regressions.
Motivation
Type safety is a security measure. Unchecked types allow None to flow into sensitive functions (SSH command construction, os.path.join, shlex.quote), unvalidated external data to propagate through the system, and subtle bugs to hide at module boundaries.
RapidCopy enforces Mypy strict with 0 errors. We should match or exceed this with Pyright.
Current State
- Angular: Already strong —
strict: truein tsconfig, strict templates, only ~12anyusages at JSON parsing boundaries - Python: Type hints exist on many functions but no static checker is configured or enforced. Pyright already flags real issues:
Optionalvalues passed toos.path.join(),str | Nonetoshlex.quote(), etc.
Implementation
Python (primary scope)
- Add
pyrightconfig.jsonwith strict mode - Fix all violations — focus on security-critical paths first:
- SSH command construction (
remote_scanner.py,sshcp.py) - Path handling (
os.path.join, file operations) - Config deserialization boundaries
- Shell command building (
lftp.py)
- SSH command construction (
- Add Pyright check to CI as a required step
- Target: 0 errors enforced
Angular (secondary scope)
- Replace ~12
anyusages with typed interfaces for JSON parsing (e.g.,RawModelFileinterface for SSE event data) - Lower priority since strict mode is already enforced and blast radius of frontend type errors is smaller
Acceptance Criteria
-
pyrightconfig.jsonadded with strict mode - 0 Pyright errors in Python codebase
- CI step enforces Pyright (fails on any error)
- Security-critical code paths fully typed (SSH, paths, shell commands, config)
- Angular
anyusages replaced with typed interfaces
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
pythonPull requests that update python codePull requests that update python coderefactorCode refactoring and cleanupCode refactoring and cleanup