oliver-zehentleitner / maity

hub: mail budget kinds from one table, counters() in one GROUP BY; settings overview defaults read from config

Sign in to report

tsk-0tm1b0kcc112 Open

Audit round 3 (tsk-hgnbapyw7hnh), read at 588f911b. Kind: duplication. Near tsk-k019dz7e9pzj (mail settings validated twice), a different defect.

What is wrong

  • Mail budget kinds are listed in seven places: hub/src/maity_hub/mail/outbox.py:35-44 (BUDGETS); hub/src/maity_hub/mail/settings.py VALUE_FIELDS (44-55), DEFAULTS (62-80), store.register (~369-390); hub/src/maity_hub/mail/environment.py:50-57 and parse (~148-160); hub/src/maity_hub/settings_overview.py:161-191. Adding verification, invitation and second_factor in this range touched each.
  • mail/settings.py:202-253 counters() copy-pastes the same count(*) … status in (waiting, sending) query (212-219, 220-227, 228-235) and hand-writes every *_sent_last_hour/*_dropped_last_hour key.
  • The settings overview's defaults are literals copied from config: e.g. settings_overview.py:111 Entry("MAITY_DB_POOL_SIZE", "database", "16") vs hub/src/maity_hub/config.py:260 parse_number(env, "MAITY_DB_POOL_SIZE", 16, …); likewise max overflow, pool recycle, statement timeout, HSTS max age, second-factor wrong per day, workers/replicas (config.py:258-331). hub/tests/test_settings_overview.py checks only a handful, so a config change silently makes §16.14 wrong.

Proposal: one kind table (kind -> field, env name, default, dropped?) the others derive from; counters() as one GROUP BY kind; module-level default constants in config.py used by the overview, or a test that Settings.from_env({}) yields every overview default.

Effort / risk: M. Low risk.