oliver-zehentleitner / maity
hub: read_limits uses the shared window estimate, errors.rate_limited and limits.resolve
tsk-a62a06pakm2m Open
Audit round 3 (tsk-hgnbapyw7hnh), read at 588f911b. Kind: design / duplication. Neighbour of tsk-5sfts81hr516 (one counter and breaker layer); merge there if it fits.
What is wrong
hub/src/maity_hub/read_limits.py:86inlines the two-window estimate (current + previous*(1-elapsed)) ofshared_counts.Window.estimate(shared_counts.py:52); only the copy has a+1e-9tolerance, so the rule is written two ways.read_limits.refusal(:189-195) builds its own 429 becauseerrors.rate_limited(errors.py:124-130) takes no message.instance_value(:128-145) resolvesmax_reads_per_minuteitself besidelimits.of(limits.py:82-85).
Proposal: one estimate function; a message argument on errors.rate_limited; instance_value calls limits.resolve behind its cache.
Effort / risk: S. Low risk.