Skip to content

refactor(utils): read the request via accessors #718

Closed

Description

@uniqueg

Part of #634. Blocked by the accessors (child A) and by the decisions below.

Switch the remaining modules to the accessors: utils/urls.py (script_root, endpoint, blueprint), utils/logging.py, utils/pagination.py, api/validation.py, errors/exceptions.py (request.endpoint), and the body-size check in factories/connexion_app.py.

Open design questions

  1. Does the snapshot get query, or do query values come only from injected arguments? Pagination needs the raw query to build links.
  2. Does the snapshot carry the operation_id (for URLs and errors), and how does the base-path lookup work without Flask blueprints?
  3. Does the body-size limit (it rewrites wsgi.input at WSGI level) count as server or middleware code, outside the "no request reads" rule?

Acceptance criteria

  • foca/ reads no request data from flask.request, request_ctx or connexion.request outside the accessor module, apart from what the answers above exempt.

Activity

  1. added this to the v0.22.0 milestone on Nov 5, 2026
  2. added
    priority: high
    status flag: discuss
    status: blocked
    type: maintenance
    workload: hours
    on Nov 5, 2026
  3. uniqueg commented on Nov 6, 2026

    @uniqueg
    MemberAuthor

    Decisions:

    1. The request snapshot includes the raw query string as a read-only query mapping, so pagination can build its links without reading Flask's request.
    2. The snapshot carries the OpenAPI operation_id. The base path is resolved from FOCA's own spec registry, with no dependency on Flask blueprints.
    3. The body-size limit, which rewrites wsgi.input, counts as middleware and is exempt from the "no direct request reads" rule. It is documented as the one place that touches the raw input and will move to ASGI middleware later.
  4. added
    status: in progress
    and removed
    status flag: discuss
    status: blocked
    on Nov 6, 2026
  5. removed
    status: in progress
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: hightype: maintenanceworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions