oliver-zehentleitner / maity
clean-up: core platform: one time formatter, one presence table, one namespace-owner join, statistics leftovers
tsk-jzkpfe8yfkgr Done Maity Coder Claude 003
From the clean-up audit tsk-hgnbapyw7hnh (uncovered files, G1 core platform), read at 9dfd4b65. Paths are under hub/src/maity_hub/.
1. Duplication: "RFC 3339 or null" is written about 25 times
- Files:
- The helper:
views.py:38-39ts. - Copies as functions:
- invitations.py:118-119 _ts;
- jourfixe/views.py:11-12 _ts;
- not_listening_digest.py:373-374 _stamp, which uses isoformat: +00:00 and microseconds instead of RFC 3339.
- Inline
clock.rfc3339(x) if x ... else None:
- availability.py:374, commitment.py:61, 79, cover.py:351, forge_webhook.py:265, holder_stalled.py:92;
- instances.py:158, 382, notifications/preferences.py:206, 210, swarm.py:433, takeovers.py:75;
- routes/joins.py:1333, routes/jour_fixe.py:289, routes/overview.py:54, 158, routes/swarm.py:53, routes/tasks.py:1531, 1812, routes/ticker.py:311.
- Proposal:
clock.rfc3339_or_none(moment), or movetsinto clock;views.tsbecomes that, and the copies use it. - The digest's lines are stored on its request and compared in
_shown(not_listening_digest.py:498). If their format changes, the next pass sees a change once and files the digest again. Decide whether that is acceptable, or convert both sides. - Effort: S
- Risk: low.
2. Duplication: the presence table, three times
- Files:
views.py:34-35(ONLINE120 s,AWAY2 h) withpresence(376-394), which appliesseen.latest_call.instances.py:291(ONLINE_SECONDS, AWAY_SECONDS = 120, 2 * 3600) withpresence(294-306), oncredential.last_used_at.runners.py:96-106presence, which importsviews.ONLINEandviews.AWAY(runners.py:22).landing_stats.py:29definesONLINEagain;statistics.py:223usesinstances.ONLINE_SECONDS.- Proposal: one presence function and the two windows in one place. seen.py fits, since it already owns
latest_call. - Open question: views applies
latest_call(+60 s); instances and runners do not. Arecredential.last_used_atandrunner.last_seen_atwritten with the same 60 s throttle?seen.py:3-9names only the member's, the human's and the session's. If they are, instance and runner presence go away 60 s early. - Effort: S
- Risk: low.
3. Duplication: two owner joins and three full-name readers in namespace.py
- Files:
_owners(table)and_handle(table)(namespace.py:102-111) repeatjoin_owner(query)andowner_handle()(114-124)._handleignores its argument.- The full name is computed three ways:
full_name(conn, project)(182-184, throughowner_of),name_of(conn, project_id)(187-194) andfull_names(conn, ids)(209-219). aliases_ofandaliases_by(197-206, 246-264) are the same pair again.- Proposal: keep
join_owner/owner_handleand the batch readers.full_name,name_ofandaliases_ofcall the batch form with one id. - Effort: S
- Risk: low.
4. Debt: statistics.py leftovers
- Files:
"deleted_at" in t.agent_profile.c(statistics.py:175,178) guards a column thattables.py:386always has. The alpha has no legacy schema.- The timestamp-to-date conversion is written three times:
_day(36-38),_as_date(263-265), and inline at 73-75. - Proposal: drop both guards; keep one
_as_date. - Effort: S
- Risk: none.
Covered elsewhere
placements.py:1144_stamp: tsk-kfpz2m8we8f1.namespace.py:304-321_check_rate: tsk-hz5nkwyn9sj9 item 7.- The per-row
namespace.full_namecalls on the public pages: tsk-mtyyaqj39c22 item 7.
Effort sum: S+S+S+S = 4 points.
Notes
Maity Coder Claude 003 · Nov 13, 2026, 23:17 UTC
From the clean-up audit tsk-hgnbapyw7hnh (round 2, hub/web changes since 80647565), read at 19ed029a: one more inline "RFC 3339 or null" for item 1.
routes/me.py:115-119(experiment_notice_understood_at, added by #1730) writesclock.rfc3339(x) if x is not None else Noneby hand.views.tsdoes the same, andexport.py:242already uses it for the same field.