oliver-zehentleitner / maity

clean-up: G5 ticker and swarm: two https checks, the member list read again, and the swarm's day window twice

Sign in to report

tsk-jvnq39rab67x Done Maity KTW Integrator

From the clean-up audit tsk-hgnbapyw7hnh (uncovered files, G5 Jour fixe, ticker, swarm, Keep the Why and memory), read at 9dfd4b65. Line numbers are at that SHA. Paths are under hub/src/maity_hub/.

1. Two rules for one https URL (rule written twice)

  • Files: ticker._https_or_none (ticker.py:965-970, a forge deployment's log_url: https://\S+, case-sensitive) and routes/ticker._https (routes/ticker.py:40-45, a manual post's url and deploy.log_url: https://[^\s]+, re.IGNORECASE).
  • What is wrong: §17.1's "one absolute https URL of at most 2048 characters" accepts HTTPS://… in a manual post and drops it from the forge.
  • Proposal: one ticker.https_url(value) -> bool, used by both.
  • Effort: S. Risk: none.

2. The member list is read again (slow path, small)

  • Files: ticker.write (ticker.py:293) calls members(conn, project_id) only to know who is human, although every caller has just built people (on_request_answered, on_release_done, write_merge, and the route at routes/ticker.py:173). routes/ticker._check (:144-147) calls ticker.members once per member: token, up to 20, and the route reads it once more after.
  • Proposal: write takes people (or the set of human principals); _check reads the members once and hands them on.
  • Effort: S. Risk: none.

3. The swarm's day window is written twice (duplication)

  • Files: swarm.fold (swarm.py:339-347, per-day count at :381-385) and swarm.whole (:400-406, per_day at :408-413) each build shown, cut and inside and a per-day counter.
  • What is wrong: 663703cf (#1225) had to change the cut in both places for one fix.
  • Proposal: one _window_days(found, days) -> (shown, inside) and one _per_day(shown, inside, days).
  • Effort: S. Risk: none.

Covered elsewhere

  • The listing's own cursor codec (routes/ticker.py:242-256): tsk-k25qqhygend8 item 3.
  • ticker.linked_cards loading every card: tsk-92tjmmcfvwm4 / tsk-es10trywfqs7 (A7-8).
  • .replace("Z", "+00:00") at ticker.py:689 and routes/ticker.py:237: tsk-kfpz2m8we8f1.
  • The swarm's handovers and the ticker's type lists: the two G5 bug cards filed with this one.
  • Searched: ticker cursor, _https, swarm fold.

Effort sum: 3S, about 3 points.