Fix renderer typing, preserve message text, and harden crypto key han… #5

Merged
anorak999 merged 2 commits from fix/new-change into main 2025-11-07 08:45:09 -05:00
anorak999 commented 2025-11-05 09:05:43 -05:00 (Migrated from github.com)

…dling

Fix abstract renderer signatures and add small stubs so type checkers can see expected attributes (e.g. username, _decrypt). This removes several mypy false-positives that were caused by mixin/ABC mismatches. Preserve message text containing ':' by using split(':', 1) in both DefaultClientRenderer and RichClientRenderer.
Normalize renderer APIs: print_chat(...) now takes the response mapping and returns None (matches runtime behavior).
Make RSA symmetric-key request more robust: read r.content instead of a fixed-size r.raw.read(999), avoiding truncated key material. Improve _connect_ws exception handling in client to ensure a valid Exception is re-raised if connection attempts fail. Correct server/service typing: memory_msgs is now typed as list[Message] and we null-check incoming payload text before creating a new Message.
Replace manual package list in setup.py with setuptools.find_packages() so packaging uses valid Python package names.
Installed types-requests in the project venv so mypy no longer flags the requests import.
Verification: ran python -m compileall and mypy cmd_chat — no issues remain.
Notes:

Wire format still uses Python literal evaluation in some places (existing behavior); switching to JSON for client/server payloads is recommended as a follow-up for robustness and security.

…dling Fix abstract renderer signatures and add small stubs so type checkers can see expected attributes (e.g. username, _decrypt). This removes several mypy false-positives that were caused by mixin/ABC mismatches. Preserve message text containing ':' by using split(':', 1) in both DefaultClientRenderer and RichClientRenderer. Normalize renderer APIs: print_chat(...) now takes the response mapping and returns None (matches runtime behavior). Make RSA symmetric-key request more robust: read r.content instead of a fixed-size r.raw.read(999), avoiding truncated key material. Improve _connect_ws exception handling in client to ensure a valid Exception is re-raised if connection attempts fail. Correct server/service typing: memory_msgs is now typed as list[Message] and we null-check incoming payload text before creating a new Message. Replace manual package list in setup.py with setuptools.find_packages() so packaging uses valid Python package names. Installed types-requests in the project venv so mypy no longer flags the requests import. Verification: ran python -m compileall and mypy cmd_chat — no issues remain. Notes: Wire format still uses Python literal evaluation in some places (existing behavior); switching to JSON for client/server payloads is recommended as a follow-up for robustness and security.
emilycodestar (Migrated from github.com) requested changes 2025-11-07 05:38:39 -05:00
emilycodestar (Migrated from github.com) left a comment

Please remove the .history folder; everything else is fine. After removal, I will accept this merge request. Thank you!

Please remove the .history folder; everything else is fine. After removal, I will accept this merge request. Thank you!
anorak999 commented 2025-11-07 06:05:00 -05:00 (Migrated from github.com)

Removed .history folder.

Removed .history folder.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
emilycodestar/cmd-chat!5
No description provided.