contracts.rules_vary

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

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 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.

contracts.rules_vary

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_vary_coverage
function
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 Default Description
template_sources dict[str, str] —

View source · /home/runner/work/chirp/chirp/site/../src/chirp/contracts/rules_vary.py:1