oliver-zehentleitner / maity

hub: one forge-refusal-for-this-reader helper and one probe_unavailable builder (about twelve inline copies in routes)

Sign in to report

tsk-dkppa5fzgcec Proposed

Audit round 6 (tsk-hgnbapyw7hnh), read at 046a4d3b. Kind: duplication.

What is wrong

  • errors.forge_refusal(reason, admin=mine.may("project:admin"), confirmer=forge_access.is_confirmer(caller, project), ...) is assembled inline at routes/contract_text.py:20-23, routes/keep_the_why.py:111-113, :120-124, :130-132, :266-269, routes/board.py:850-859, routes/probe.py:50-56.
  • ApiError(503, "probe_unavailable", "the forge did not answer", {retry_at}) is built inline at routes/contract_text.py:69 and :107, routes/board.py:863, routes/probe.py:77 and :101, routes/project_images.py:68; routes/keep_the_why.py:39-46 (_spent) is a variant, although errors.py:146 already builds this error.
  • fg.require_covered followed by the NotCoveredError / ForgeUnavailableError mapping is the same in routes/keep_the_why.py:114-128 and routes/probe.py:68-77.

Proposal

  • errors.forge_refusal_for(caller, mine, project, reason, **kw) and errors.probe_unavailable(retry_at, details); optionally one forge_access.require_public_cover(...) for the shared mapping.

Effort / risk: S. Low; the refusal bodies stay the same.