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

Sign in to report

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.view and from maity_hub.setup_cards). views.py:304 reads project.setup directly. 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_write checks the route's endpoint, and idempotency.LOADERS["member_team"] exists only for idempotency keys a member PATCH stored before it answered member_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 parametrizes stored over member and member_team for it.
  • Proposal: once that day has passed, delete the member_team loader, the endpoint branch in load_member_write (it becomes load_member) and the test's member_team case.
  • 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_instance false, no replaces) whose agent became a member through another join before this exchange. Its body is the same as the elif row.new_instance branch 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_transfer and one key (to or by), lock the project and close it. _summary and _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 path own_settings.not_listening.minutes is 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 own and the rule into a domain module (for example next to not_listening), as own_minutes(own_settings) and thresholds(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_join and runner._join_fields: tsk-hz5nkwyn9sj9 item 9.
  • The project_names imports of routes.requests: tsk-dwrtrhdgzezs.
  • open_transfers filtering proposal.kind in Python: tsk-bvw5mk2dbwkp item 4 (proposals.kind_of).
  • Searched: setup_cards.view, member_team, withdraw_into, own_settings.

Effort sum: 5S, 5 points.