oliver-zehentleitner / maity
clean-up: chats and inbox: dead owner_changed, small leftovers, private names across modules
tsk-sjq1h8tf6nmy Open
From the clean-up audit tsk-hgnbapyw7hnh, Area 6 (Chats and inbox), read at 80647565. Line numbers are at that SHA; check them against current main first. Paths are under hub/src/maity_hub/. Finding numbers are the audit's. All items are S and low risk.
Order:
- A6-9 has a twin in Area 5:
restricted.owner_changed(tsk-hzqerzwemvhz item 8). Decide both together (open question below). - A6-14's
_owner_onlyhas a twin in Area 5:_addressee_onlyin foreign_agent.py, cross_owner.py and bridges.py (tsk-hzqerzwemvhz item 4). Do both in one PR.
A6-9. Debt + docs drift: cross_chats.owner_changed has no caller
- cross_chats.py:1189-1193. Its only caller is hub/tests/test_cross_chats.py:448. Its docstring says "No route changes an owner yet", and nothing in hub/src writes a new
agent_profile.owner_id. restricted.owner_changed (restricted.py:317) is in the same state; only its tests call it (test_restricted_set.py:331, 348). - Even so, context/chat.md:621-623 and docs/api.md:14184-14188 describe leaving with
reason: owner_changedas current behaviour. - Proposal: the alpha has no legacy users, so delete
owner_changedand its test, and add it back together with the owner-change feature. Or keep it, but mark both doc passages as "when an owner change exists". Either way, code and docs should agree. - Effort: S. Risk: low.
A6-14. Debt: small leftovers
- group_chats.py:572:
if not conversation.hub_thread and len(...) >= MAX_PARTICIPANTS. Thehub_threadtest is dead, because 567-568 already raisedround_thread()for a hub thread. - chat_request.py:599-600, 608:
_owner_onlyalways returns None and is passed as thepredicate.Answerer.predicatealready defaults to None (proposals.py:82), and the name suggests a check that does not exist. Drop it. - inbox.py:95 (
originally_addressed) and :211 (answered_in_own_right) takeconnand never use it. :216 (consent_target_ok) never usesproject_id.addressed_to(82) takesconnonly to pass it on. - cross_chats.py:740-741:
message_viewonly forwards to_message. Make_messagethe public one. - hub/tests/test_chat_meat_proxy.py:207-218: the test is named
..._and_the_deletion_takes_thembut checks only the export. :210 importsaccount_deletionunused (noqa: F401) with a comment that points to a deletion test "below" that is not in the file. The deletion is tested in test_account_deletion.py:895-898. Rename the test and drop the import. - Effort: S. Risk: low.
A6-21. Debt: private names used across modules, and __all__ out of date
- conversation_list.py:599-607
__all__leaves outagent_cursorandSHORT, although routes/conversations.py:352 and :303 use them. - routes/attachments.py:32 imports the private
_reader(andOutsider) from routes/conversations.py, so it reaches into another route module's private helper. - Proposal: complete
__all__, or drop it. Makereaderpublic, or moveOutsider/outsider/_readerinto access.py, wheremembershipalready lives. - Effort: S. Risk: low.
Open question
- A6-9 (with its Area 5 twin
restricted.owner_changed): delete both and their tests until an owner-change route exists, or keep them and mark the docs (context/chat.md:621-623, docs/api.md:14184-14188) as future behaviour? Lead's call.
Left out (hub-wide patterns, to shared cards)
- A6-2: "the project's newest event seq" copies (chat_gate._highest_seq, group_chats._highest_seq, handover.newest_seq, isolation._head beside events.newest_seq).
- A6-3, and the owner-lookup part of A6-18: agent-to-owner lookup copies (group_chats._owner_of, the inline batch query in group_chats.observers and conversation_list.py:375-385, beside chat_gate.owners_of).
- A6-4: handle lookups (chat_access._handles, chat_request._handles, jourfixe/rounds._handles beside views.owner_handles).
- The rest of A6-18 (agent ids owned by the observer, written twice) is on the Area 6 conversation-list card (A6-16).
Covered elsewhere
- A6-15 (chat_request.py:319 imports
routes.requests.close_request): tsk-dwrtrhdgzezs, which lists this import.
Effort sum: S+S+S = 3 points.