Unreachable block detection for filesystem page templates.
contracts.rules_unreachable_blocks
| 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
Map each block/region name to its nearest enclosing block/region name.
Fragment block names are collected infragment_namesso the caller can
skip them — …
True if block_name is a composition root or nested under one.
Detect blocks in page templates thatrender_with_blockscannot reach.
When Chirp composes filesystem pages into layouts, only thecontentslot (fed from the rendered…
_walk_block_parents
function
def _walk_block_parents(nodes: Sequence[Node], enclosing: str | None, parent_map: dict[str, str | None], fragment_names: set[str]) -> None
Map each block/region name to its nearest enclosing block/region name.
Fragment block names are collected infragment_namesso the caller can
skip them —{% fragment %}blocks are swap-only and never participate
in full-page composition, so they are reachable by definition via
render_block / render_fragment.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
nodes
|
Sequence[Node]
|
— | |
enclosing
|
str | None
|
— | |
parent_map
|
dict[str, str | None]
|
— | |
fragment_names
|
set[str]
|
— |
_block_is_reachable
function
def _block_is_reachable(block_name: str, roots: set[str], parent_map: dict[str, str | None]) -> bool
True if block_name is a composition root or nested under one.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
block_name
|
str
|
— | |
roots
|
set[str]
|
— | |
parent_map
|
dict[str, str | None]
|
— |
check_unreachable_blocks
function
def check_unreachable_blocks(page_leaf_templates: set[str], kida_env: Environment | None, *, extras: dict[str, Any] | None = None) -> list[ContractIssue]
Detect blocks in page templates thatrender_with_blockscannot reach.
When Chirp composes filesystem pages into layouts, only thecontent
slot (fed from the rendered page block subtree) participates. Blocks that
are siblings of the composition roots — for examplepage_scriptsnext
topage_root— are never rendered and are silently dropped.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
page_leaf_templates
|
set[str]
|
— | |
kida_env
|
Environment | None
|
— | |
extras
|
dict[str, Any] | None
|
None
|