oliver-zehentleitner / maity
hub: mail budget kinds from one table, counters() in one GROUP BY; settings overview defaults read from config
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.pyVALUE_FIELDS(44-55),DEFAULTS(62-80),store.register(~369-390);hub/src/maity_hub/mail/environment.py:50-57andparse(~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-253counters()copy-pastes the samecount(*) … status in (waiting, sending)query (212-219, 220-227, 228-235) and hand-writes every*_sent_last_hour/*_dropped_last_hourkey.- The settings overview's defaults are literals copied from config: e.g.
settings_overview.py:111Entry("MAITY_DB_POOL_SIZE", "database", "16")vshub/src/maity_hub/config.py:260parse_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.pychecks 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.