Module

contracts.rules_route_contract

Route directory contract validation.

Functions

_tab_href_matches_page_routes 3 bool
True if *tab_path* is exact or, for prefix tabs, covered by a registered route.
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 Description
tab_path str
match_mode str
page_route_paths set[str]
Returns
bool
check_section_bindings 2 list[ContractIssue]
Warn if RouteMeta.section references unknown section.
def check_section_bindings(route_metas: dict[str, RouteMeta | None], sections: dict[str, Section]) -> list[ContractIssue]
Parameters
Name Type Description
route_metas dict[str, RouteMeta | None]
sections dict[str, Section]
Returns
list[ContractIssue]
check_shell_mode_blocks 4 list[ContractIssue]
Error if shell_mode='tabbed' but template lacks required blocks.
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]
Parameters
Name Type Description
route_metas dict[str, RouteMeta | None]
route_templates dict[str, str]
fragment_target_registry FragmentTargetRegistry
kida_env Environment | None
Returns
list[ContractIssue]
check_route_file_consistency 4 list[ContractIssue]
Info-level for page routes without _meta.py. Action routes (no sibling templat…
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 Description
route_metas dict[str, RouteMeta | None]
page_route_paths set[str]
action_route_paths set[str] | None Default:None
meta_provider_paths set[str] | None Default:None
Returns
list[ContractIssue]
check_duplicate_routes 1 list[ContractIssue]
Warn if two routes resolve to the same (url_path, method) pair.
def check_duplicate_routes(discovered_routes: list[Any]) -> list[ContractIssue]
Parameters
Name Type Description
discovered_routes list[Any]
Returns
list[ContractIssue]
check_section_tab_hrefs 2 list[ContractIssue]
Warn if a TabItem.href does not match any registered route path. For prefix-ma…
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 Description
sections dict[str, Section]
page_route_paths set[str]
Returns
list[ContractIssue]
check_section_coverage 4 list[ContractIssue]
Info when routes sit under a section prefix but lack ``meta.section``. Routes …
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 Description
route_metas dict[str, RouteMeta | None]
sections dict[str, Section]
page_route_paths set[str]
meta_provider_paths set[str] | None Default:None
Returns
list[ContractIssue]
check_context_provider_signatures 2 list[ContractIssue]
Warn if _context.py param matches neither path param nor provider type.
def check_context_provider_signatures(discovered_routes: list[Any], providers: dict[type, Any] | None) -> list[ContractIssue]
Parameters
Name Type Description
discovered_routes list[Any]
providers dict[type, Any] | None
Returns
list[ContractIssue]