oliver-zehentleitner / maity
clean-up: G4 debt: dead setup_cards.view, a one-day idempotency compatibility loader, a stale join comment, twin transfer withdrawals, the not-listening override rule twice
tsk-8wh9mb26enpe Open
From the clean-up audit tsk-hgnbapyw7hnh (uncovered files, G4 Members, projects, joins and briefing), read at 9dfd4b65. Line numbers are at that SHA. Paths are under hub/src/maity_hub/.
Small debt. All S.
1. Dead code: setup_cards.view
- Files: setup_cards.py:113-117. No caller in hub/src, hub/tests or cli (git grep
setup_cards.viewandfrom maity_hub.setup_cards). views.py:304 readsproject.setupdirectly. Its docstring describes what a migration wrote. - Proposal: delete it.
- Effort: S. Risk: none.
2. Compatibility path with an end date: the member_team loader
- Files: routes/members.py:242-255.
load_member_writechecks the route's endpoint, andidempotency.LOADERS["member_team"]exists only for idempotency keys a member PATCH stored before it answeredmember_read. Both came with #1732 (3da8fa77, 2026-11-13). Keys live 24 hours (§1.5), so a day after #1732 is deployed no such key is left. hub/tests/test_member_patch_answer.py:260 parametrizesstoredovermemberandmember_teamfor it. - Proposal: once that day has passed, delete the
member_teamloader, the endpoint branch inload_member_write(it becomesload_member) and the test'smember_teamcase. - Effort: S. Risk: none after the day.
3. Stale comment, identical branches: joins._recheck_instance
- Files: routes/joins.py:1280-1294. The last branch says "A join made before instances existed, for a member: it adds one". A join lives at most an hour (
TTL_MAX, :81), so no such join exists. The branch is reached today by a first join (new_instancefalse, noreplaces) whose agent became a member through another join before this exchange. Its body is the same as theelif row.new_instancebranch above it. - Proposal: merge the two branches and say in the comment what reaches them.
- Effort: S. Risk: none.
4. Duplication: withdraw_into and withdraw_started_by are one function
- Files: project_names.py:61-81 and :84-104. Both select every open request with a proposal whose JSON text contains an id, then filter
kind == project_transferand one key (toorby), lock the project and close it._summaryand_org_summary(:298-316) are near twins too. - Proposal: one
_withdraw_where(conn, key, value, reason)used by both; one summary builder with an optional organisation. - Effort: S. Risk: low (test_orgs, test_account_deletion).
5. Duplication: "the member's override, else the human's default" for not_listening.minutes
- Files: routes/member_settings.py:35-41 (
not_listening_minutes, one member) and not_listening_digest.py:220-237 (_thresholds, a batch). The stored pathown_settings.not_listening.minutesis read by hand three times: member_settings.py:31-32, not_listening_digest.py:234, export.py:550. member_settings is a route module, so the digest and the export cannot use its helper. - Proposal: move
ownand the rule into a domain module (for example next tonot_listening), asown_minutes(own_settings)andthresholds(conn, human_id, project_ids); the route, the digest and the export use them. - Effort: S. Risk: low (test_member_settings, test_not_listening_digest, test_export).
Order
- Item 2 not before #1732 has been live for 24 hours.
- Item 5: tsk-mpqqc07cww6v item 1 edits not_listening_digest.py; rebase.
Covered elsewhere
- The handle checks in
joins._create_for_joinandrunner._join_fields: tsk-hz5nkwyn9sj9 item 9. - The project_names imports of routes.requests: tsk-dwrtrhdgzezs.
open_transfersfilteringproposal.kindin Python: tsk-bvw5mk2dbwkp item 4 (proposals.kind_of).- Searched: setup_cards.view, member_team, withdraw_into, own_settings.
Effort sum: 5S, 5 points.