# rules_route_contract URL: /api/contracts/rules_route_contract/ Section: contracts -------------------------------------------------------------------------------- rules_route_contract - Chirp window.BENGAL_THEME_DEFAULTS = { appearance: 'light', palette: 'charcoal-bengal' }; window.Bengal = window.Bengal || {}; window.Bengal.enhanceBaseUrl = '/chirp/assets/js/enhancements'; window.Bengal.watchDom = true; window.Bengal.debug = false; window.Bengal.enhanceUrls = { 'toc': '/chirp/assets/js/enhancements/toc.736b857e.js', 'docs-nav': '/chirp/assets/js/enhancements/docs-nav.57e4b129.js', 'tabs': '/chirp/assets/js/enhancements/tabs.aac9e817.js', 'lightbox': '/chirp/assets/js/enhancements/lightbox.1ca22aa1.js', 'interactive': '/chirp/assets/js/enhancements/interactive.96c8880c.js', 'mobile-nav': '/chirp/assets/js/enhancements/mobile-nav.d991657f.js', 'action-bar': '/chirp/assets/js/enhancements/action-bar.d62417f4.js', 'copy-link': '/chirp/assets/js/enhancements/copy-link.7d9a5c29.js', 'data-table': '/chirp/assets/js/enhancements/data-table.1f5bc1eb.js', 'lazy-loaders': '/chirp/assets/js/enhancements/lazy-loaders.a5c38245.js', 'holo': '/chirp/assets/js/enhancements/holo.ee13c841.js', 'link-previews': '/chirp/assets/js/enhancements/link-previews.96620bcf.js' }; (function () { try { var defaults = window.BENGAL_THEME_DEFAULTS || { appearance: 'system', palette: '' }; var defaultAppearance = defaults.appearance; if (defaultAppearance === 'system') { defaultAppearance = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light'; } var storedTheme = localStorage.getItem('bengal-theme'); var storedPalette = localStorage.getItem('bengal-palette'); var theme = storedTheme ? (storedTheme === 'system' ? defaultAppearance : storedTheme) : defaultAppearance; var palette = storedPalette ?? defaults.palette; document.documentElement.setAttribute('data-theme', theme); if (palette) { document.documentElement.setAttribute('data-palette', palette); } } catch (e) { document.documentElement.setAttribute('data-theme', 'light'); } })(); { "prerender": [ { "where": { "and": [ { "href_matches": "/docs/*" }, { "not": { "selector_matches": "[data-external], [target=_blank], .external" } } ] }, "eagerness": "conservative" } ], "prefetch": [ { "where": { "and": [ { "href_matches": "/*" }, { "not": { "selector_matches": "[data-external], [target=_blank], .external" } } ] }, "eagerness": "conservative" } ] } Skip to main content Magnifying Glass ESC Recent Clear Magnifying Glass No results for "" Start typing to search... ↑↓ Navigate ↵ Open ESC Close Powered by Lunr ⌁⌁ DocumentationGet StartedCore ConceptsTemplatesGit BranchRoutingMiddlewareStreamingDatabaseDataTestingFile TextReferenceServerDeploymentInfoAboutExamplesGuidesTutorialsReleasesDevGitHubChirp API ReferenceForum Magnifying Glass Search ⌘K Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal List ⌁⌁ Magnifying Glass Search X Close Documentation Caret Down Get Started Core Concepts Templates Git Branch Routing Middleware Streaming Database Data Testing File Text Reference Server Deployment Info About Examples Guides Tutorials Releases Dev Caret Down GitHub Chirp API Reference Forum Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal Chirp API Reference Caret Right Internal asgi invoke invoke_plan kwargs_resolve multimap types Caret Right Ai _providers _structured errors llm streaming Caret Right App compiler diagnostics lifecycle registry runtime server state Caret Right Cache Caret Right Backends memory null redis key middleware protocol Caret Right Cli Caret Right Templates full minimal scaffold shell sse v2 _check _makemigrations _new _resolve _routes _run _security_check _templates Caret Right Contracts checker declarations routes rules_accessibility rules_commands rules_forms rules_htmx rules_inline rules_islands rules_layout rules_page_shell rules_route_contract rules_sse rules_swap rules_vary template_scan types utils Caret Right Data Caret Right Drivers postgres sqlite Caret Right Schema diff generate introspect operations parse types _mapping _sqlite database errors migrate query types Caret Right Ext chirp_ui Caret Right Http cookies forms headers query request response sync_request Caret Right I18N catalog detection formatting middleware Caret Right Markdown errors filters renderer Caret Right Middleware _redis_rate_limit allowed_hosts auth auth_rate_limit builtin csp_nonce csrf inject layout_debug protocol security_headers sessions static Caret Right Pages actions context debug discovery Caret Right index bus events stream renderer resolve sections shell_actions shell_context types Caret Right Realtime events sse Caret Right Routing params route router Caret Right Security audit decorators lockout passwords urls Caret Right Server Caret Right Debug editor frames render_plan_snapshot renderers request_context styles template_context alpine debug_page delegation dev dev_browser_reload devtools errors handler handler_kwargs htmx_debug htmx_safe_target islands negotiation negotiation_oob production route_explorer sender speculation_rules sse_lifecycle sync_handler terminal_checks terminal_errors view_transitions Caret Right Templating adapter composition filters fragment_target_registry integration kida_adapter macros oob_registry render_plan returns streaming suspense Caret Right Testing assertions client sse Caret Right Tools events handler registry schema Caret Right Validation result rules chirp config context domains errors extraction health logging plugin resilience shell_actions shell_regions sources Chirp API ReferenceContracts ᗢ Caret Down Link Copy URL External Open LLM text Copy Copy LLM text Share with AI Ask Claude Ask ChatGPT Ask Gemini Ask Copilot Module contracts.rules_route_contract Route directory contract validation. 6Functions Functions 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 static meta 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. def check_section_tab_hrefs(sections: dict[str, Section], page_route_paths: set[str]) -> list[ContractIssue] Parameters Name Type Description sections dict[str, Section] page_route_paths set[str] 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] ← Previous rules_page_shell Next → rules_sse List © 2026 Chirp built in ᓚᘏᗢ { "linkPreviews": { "enabled": true, "hoverDelay": 200, "hideDelay": 150, "showSection": true, "showReadingTime": true, "showWordCount": true, "showDate": true, "showTags": true, "maxTags": 3, "includeSelectors": [".prose"], "excludeSelectors": ["nav", ".toc", ".breadcrumb", ".pagination", ".card", "[class*='-card']", ".tab-nav", "[class*='-widget']", ".child-items", ".content-tiles"], "allowedHosts": [], "allowedSchemes": ["https"], "hostFailureThreshold": 3, "showDeadLinks": true } } window.BENGAL_LAZY_ASSETS = { tabulator: '/chirp/assets/js/tabulator.min.js', dataTable: '/chirp/assets/js/data-table.js', mermaidToolbar: '/chirp/assets/js/mermaid-toolbar.9de5abba.js', mermaidTheme: '/chirp/assets/js/mermaid-theme.344822c5.js', graphMinimap: '/chirp/assets/js/graph-minimap.ff04e939.js', graphContextual: '/chirp/assets/js/graph-contextual.355458ba.js' }; window.BENGAL_ICONS = { close: '/chirp/assets/icons/close.911d4fe1.svg', enlarge: '/chirp/assets/icons/enlarge.652035e5.svg', copy: '/chirp/assets/icons/copy.3d56e945.svg', 'download-svg': '/chirp/assets/icons/download.04f07e1b.svg', 'download-png': '/chirp/assets/icons/image.c34dfd40.svg', 'zoom-in': '/chirp/assets/icons/zoom-in.237b4a83.svg', 'zoom-out': '/chirp/assets/icons/zoom-out.38857c77.svg', reset: '/chirp/assets/icons/reset.d26dba29.svg' }; Arrow Up -------------------------------------------------------------------------------- Metadata: - Word Count: 1021 - Reading Time: 5 minutes