Middleware chain report — a diagnostic of the resolved request pipeline.
App.add_middleware(mw, priority=...)resolves the user middleware to a
deterministic order at freeze (stable sort by(priority, registration); see
chirp.middleware.ordering). This check emits a single INFO line naming the
resolved user middleware order (outermost → innermost) so app authors can
confirm the pipeline they registered is the pipeline that runs — especially once
explicitpriority=values reorder it away from registration order.
It is a diagnostic only: it never reports the ordering-invariant ERROR.
CSRFMiddleware placed outside SessionMiddlewareis still caught by the
existingcsrf_session ERROR (rules_safety.check_csrf_session_order) and
by the hardConfigurationError floor in compiler._validate_middleware_ordering.
Keeping this category INFO avoids double-reporting that violation under a new
severity.
contracts.rules_middleware_chain
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
check_middleware_chain
function
def check_middleware_chain(middleware_list: list[Any], priorities: list[int] | None) -> list[ContractIssue]
Report the resolved user-middleware order as a single INFO diagnostic.
Mirrors the freeze-time sort so the reported order matches the runtime chain. Emits nothing when no user middleware is registered (an app with only builtin middleware has no user pipeline to report).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
middleware_list
|
list[Any]
|
— | |
priorities
|
list[int] | None
|
— |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/contracts/rules_middleware_chain.py:1