oliver-zehentleitner / maity

hub: one RequestFacts builder for the middleware precheck and deps.facts_of

Sign in to report

tsk-epffstkdjc91 Open

Audit round 3 (tsk-hgnbapyw7hnh), read at 588f911b. Kind: duplication.

What is wrong: RequestFacts is built in hub/src/maity_hub/deps.py:50-64 (facts_of) and in hub/src/maity_hub/middleware.py:345-356 (_precheck). They take raw_query from different places (scope["state"]["raw_query"] vs scope["query_string"]), their raw_path fallbacks differ, and only deps sets max_reads_env and route. Harmless today (the precheck counts no reads); the next field added to one will be missing from the other.

Proposal: one RequestFacts.from_scope(scope, settings, body=…) used by both.

Effort / risk: S. Low risk.