Skip to content

F12.12 — Django RequestUtils name collision

State Closed
Parent E12
Iteration Release 3
Start Date 2026-10-04
Closed Date 2026-10-04
Predecessors —
Source Owner decision, 2026-10-04

Stories: 1 Closed

Story State Depends on
S12.12.1 — Move debug_request and drop the aliases Closed (2026-10-04) —

rn-forge-django defines two unrelated public classes called RequestUtils. rn_forge.django.utils.RequestUtils has one static method, debug_request(request), which returns a redacted snapshot of a Django HttpRequest. rn_forge.django.drf.RequestUtils (in drf/utils.py) has typed accessors for a DRF Request, used by the view mixins, the exception handler and every auth module. The two share no logic. Code that needs both must alias one of them, and the API reference lists two classes with the same name. This feature removes the Django class and keeps the DRF one. It also removes the DRF module's compatibility aliases, because the same rn-forge-django version is already breaking.

Context

Outcome: the owner carried this break in the same rn-forge-django version as F12.14's, and on 2026-10-04 chose the shape below and approved removing the aliases, because pykit had no live consumers.

Design

Outcome: debug_request is a public function in rn_forge.django.views, so an application can still log a request snapshot; the DRF RequestUtils keeps its name, because renaming it would touch every auth module for no gain; and DRFUtils and the three get_request_* static aliases are gone, while RequestAccessViewMixin's instance methods of the same names stay. The rn-forge-django changelog lists each move, and the URLs and views reference documents debug_request.

S12.12.1 — Move debug_request and drop the aliases

State: Closed (2026-10-04)

Acceptance:

  • rn_forge.django.views defines debug_request(request: HttpRequest) -> dict[str, Any] and lists it in __all__. Its output matches today's RequestUtils.debug_request, including the redaction of HTTP_AUTHORIZATION, HTTP_COOKIE, HTTP_SET_COOKIE, HTTP_X_API_KEY and HTTP_X_AUTH_TOKEN. index_view and debug_request_view call it, and debug_request_view's docstring names the function.
  • rn_forge.django.utils no longer defines RequestUtils. Its __all__ is require_environment and require_settings, and its module docstring no longer mentions request diagnostics.
  • rn_forge.django.drf.utils no longer defines DRFUtils, get_request_param, get_request_data or get_request_value. rn_forge.django.drf no longer re-exports DRFUtils.
  • The debug_request tests move from tests/test_utils.py to tests/test_views.py, which mirrors the module the function now lives in. tests/test_utils.py keeps the startup-guard and ModelUtils tests.
  • The package README describes utils as startup guards only, and views as including debug_request. The API reference shows one RequestUtils.
  • rn-forge-django's CHANGELOG.md has a Removed entry, marked breaking, that lists each row of the table in Design.
  • The acceptance block below passes.
set -euo pipefail
absent() { local rc=0; rg -q --hidden --glob '!.git' "$@" </dev/null || rc=$?; [ "$rc" -eq 1 ]; }

cd packages/rn-forge-django
grep -q '^def debug_request(' src/rn_forge/django/views.py
absent 'class RequestUtils' src/rn_forge/django/utils.py
absent '\bDRFUtils\b' src docs README.md
absent 'def get_request_(param|data|value)' src/rn_forge/django/drf/utils.py
test "$(rg -c 'class RequestUtils' src | wc -l | tr -d ' ')" = 1
grep -q 'debug_request' tests/test_views.py
absent 'debug_request' tests/test_utils.py
grep -qi 'breaking' CHANGELOG.md
uv run pytest -q tests/test_views.py tests/test_utils.py tests/drf tests/auth
(cd ../.. && uv run pyright packages/rn-forge-django && uv run lint-imports)
uv run --group docs mkdocs build --strict -q --site-dir "$(mktemp -d)"

Considered and rejected

  • Renaming the DRF class to DRFUtils so it can hold more helpers. The name would encode the module's grouping, which public class names must not do, and a general Utils class collects unrelated helpers instead of placing each one by what it does. A new helper goes in a module named for its job.
  • Keeping the Django RequestUtils and renaming the DRF one. This touches every auth module, the view mixins and the exception handler. A class with one static method does not need to exist.
  • A private _debug_request in views.py. A redacted request snapshot is useful in an application's own logging, so the function stays public.