Error boundary coverage check for OOB template blocks.
Scans template sources for blocks inside elements withhx-swap-oob
attributes and suggests wrapping them in{% try %}...{% fallback %}
for graceful error handling.
This only catches templates that embedhx-swap-oobin their source.
Templates used withSuspense don't contain hx-swap-oob— the OOB
wrappers are generated at render time by chirp's Suspense pipeline, which
already has its own per-block error handling (seesuspense.py).
Kida 0.4.0 introduced error boundaries —{% try %}blocks that catch
render errors and fall back to safe defaults.
This check emits INFO-level issues (not errors or warnings) since server-side error handling already prevents page-level failures.
Scope limitations — the check uses regex-based HTML parsing, so it:
- Only sees blocks in the literal template source (not inherited/included blocks)
- May miss OOB regions split across template conditionals These are acceptable trade-offs for an INFO-level advisory check.
contracts.rules_boundary
| 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
Extract the inner content of each OOB element by tracking tag nesting.
Limitations (regex-based HTML parsing):
- Cannot see blocks inherited via
{% extends %}…
Suggest error boundaries for blocks inside OOB elements.
Only inspects blocks that are inside elements withhx-swap-oobattributes (explicit OOB swap targets). Blocks outside…
_extract_oob_regions
function
def _extract_oob_regions(source: str) -> list[str]
Extract the inner content of each OOB element by tracking tag nesting.
Limitations (regex-based HTML parsing):
- Cannot see blocks inherited via
{% extends %}or pulled in via{% include %}— only the literal source of each template is scanned. - HTML comments or template conditionals that split tags may confuse the nesting tracker, though this is rare in practice.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
source
|
str
|
— |
check_boundary_coverage
function
def check_boundary_coverage(template_sources: dict[str, str]) -> list[ContractIssue]
Suggest error boundaries for blocks inside OOB elements.
Only inspects blocks that are inside elements withhx-swap-oob
attributes (explicit OOB swap targets). Blocks outside OOB regions in the
same template are not flagged. Does not cover Suspense-rendered OOB
(those wrappers are generated at render time, not in the source).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
template_sources
|
dict[str, str]
|
— |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/contracts/rules_boundary.py:1