Module

contracts.rules_vary

Contract rules for Vary header correctness.

Warns when templates manually branch onis_htmx / is_narrow_fragment/ HX-Request outside of Chirp's Pagereturn type, which auto-sets Vary: HX-Request. Manual branching without Varycauses HTTP caches to serve the wrong response variant.

Functions

check_vary_coverage 1 list[ContractIssue]
Warn when templates branch on htmx request state. Chirp's ``Page`` return type…
def check_vary_coverage(template_sources: dict[str, str]) -> list[ContractIssue]

Warn when templates branch on htmx request state.

Chirp'sPage return type sets Vary: HX-Requestautomatically. If a template manually checksis_htmx or is_narrow_fragment (via{% if %} blocks), it likely needs the Pagetype or explicitVaryhandling.

Parameters
Name Type Description
template_sources dict[str, str]
Returns
list[ContractIssue]