contracts.rules_route_contract

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

Route directory contract validation.

Route directory contract validation.

contracts.rules_route_contract

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

_tab_href_matches_page_routes
function
def _tab_href_matches_page_routes(tab_path: str, match_mode: str, page_route_paths: set[str]) -> bool

True if tab_path is exact or, for prefix tabs, covered by a registered route.

Parameters

Name Type Default Description
tab_path str
match_mode str
page_route_paths set[str]
check_section_bindings
function
def check_section_bindings(route_metas: dict[str, RouteMeta | None], sections: dict[str, Section]) -> list[ContractIssue]

Warn if RouteMeta.section references unknown section.

Parameters

Name Type Default Description
route_metas dict[str, RouteMeta | None]
sections dict[str, Section]
check_shell_mode_blocks
function
def check_shell_mode_blocks(route_metas: dict[str, RouteMeta | None], route_templates: dict[str, str], fragment_target_registry: FragmentTargetRegistry, kida_env: Environment | None) -> list[ContractIssue]

Error if shell_mode='tabbed' but template lacks required blocks.

Parameters

Name Type Default Description
route_metas dict[str, RouteMeta | None]
route_templates dict[str, str]
fragment_target_registry FragmentTargetRegistry
kida_env Environment | None
check_route_file_consistency
function
def check_route_file_consistency(route_metas: dict[str, RouteMeta | None], page_route_paths: set[str], action_route_paths: set[str] | None = None, meta_provider_paths: set[str] | None = None) -> list[ContractIssue]

Info-level for page routes without _meta.py.

Action routes (no sibling template, pure mutation handlers) are skipped because they render fragments rather than standalone pages and don't benefit from title/breadcrumb metadata.

Routes whose_meta.py defines meta()(dynamic metadata) register a meta provider at discovery time with staticmeta left None; those paths are listed in meta_provider_paths and are treated as having metadata.

Parameters

Name Type Default Description
route_metas dict[str, RouteMeta | None]
page_route_paths set[str]
action_route_paths set[str] | None None
meta_provider_paths set[str] | None None
check_duplicate_routes
function
def check_duplicate_routes(discovered_routes: list[Any]) -> list[ContractIssue]

Warn if two routes resolve to the same (url_path, method) pair.

Parameters

Name Type Default Description
discovered_routes list[Any]
check_section_tab_hrefs
function
def check_section_tab_hrefs(sections: dict[str, Section], page_route_paths: set[str]) -> list[ContractIssue]

Warn if a TabItem.href does not match any registered route path.

For prefix-match tabs, the href may be a parent path; at least one registered route must equal it or lie under it (including/seg/\{param}).

Emits a warning when two tabs in the same section normalize to the same href.

Parameters

Name Type Default Description
sections dict[str, Section]
page_route_paths set[str]
check_section_coverage
function
def check_section_coverage(route_metas: dict[str, RouteMeta | None], sections: dict[str, Section], page_route_paths: set[str], meta_provider_paths: set[str] | None = None) -> list[ContractIssue]

Info when routes sit under a section prefix but lackmeta.section.

Routes whose_meta.py defines meta()(dynamic metadata) register a meta provider at discovery time with staticmeta left None; those paths are listed in meta_provider_paths and are excluded from the "no meta.section" INFO to avoid false positives.

Warn whenmeta.sectionis set but the route path is not covered by that section'sactive_prefixes(when prefixes are defined).

Parameters

Name Type Default Description
route_metas dict[str, RouteMeta | None]
sections dict[str, Section]
page_route_paths set[str]
meta_provider_paths set[str] | None None
check_context_provider_signatures
function
def check_context_provider_signatures(discovered_routes: list[Any], providers: dict[type, Any] | None) -> list[ContractIssue]

Warn if _context.py param matches neither path param nor provider type.

Parameters

Name Type Default Description
discovered_routes list[Any]
providers dict[type, Any] | None

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