contracts.rules_static_dom

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

Static DOM integrity checks — duplicate ids and dead OOB fragment producers.

Complements browser smoke (#234) with cheaper startup signals for two silent UI bug classes: invalid duplicate element ids in a…

Static DOM integrity checks — duplicate ids and dead OOB fragment producers.

Complements browser smoke (#234) with cheaper startup signals for two silent UI bug classes: invalid duplicate element ids in a template and OOB fragment blocks that nothing ever renders (#238).

contracts.rules_static_dom

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

_string_arg
function
def _string_arg(node: ast.Call, index: int) -> tuple[bool, str | None]

Return(confident, value)for a positional string argument.

Parameters

Name Type Default Description
node ast.Call
index int
_collect_fragment_calls
function
def _collect_fragment_calls(node: ast.AST, out: set[tuple[str, str]], blocks: set[str]) -> None

Walk an AST subtree collecting literal Fragment(template, block) pairs.

Parameters

Name Type Default Description
node ast.AST
out set[tuple[str, str]]
blocks set[str]
infer_fragment_producers
function
def infer_fragment_producers(handler: Any) -> tuple[set[tuple[str, str]], set[str]]

Infer literalFragment(template, block)pairs and block names from handler.

Parameters

Name Type Default Description
handler Any
infer_handler_fragment_blocks
function
def infer_handler_fragment_blocks(handler: Any) -> set[str]

Infer fragment block names from a handler and its same-module callees.

Parameters

Name Type Default Description
handler Any
infer_fragment_block_names
function
def infer_fragment_block_names(handler: Any) -> set[str]

Infer literal fragment block names produced by a handler.

Parameters

Name Type Default Description
handler Any
collect_fragment_block_producers
function
def collect_fragment_block_producers(router: Router, signal_registry: Any | None = None) -> set[str]

Collect fragment block names produced by routes and signal render callbacks.

Parameters

Name Type Default Description
router Router
signal_registry Any | None None
_extract_oob_fragment_blocks
function
def _extract_oob_fragment_blocks(source: str) -> list[str]

Return fragment block names whose body carrieshx-swap-oob.

Parameters

Name Type Default Description
source str
_duplicate_ids_in_source
function
def _duplicate_ids_in_source(source: str) -> list[tuple[str, int]]

Return static ids repeated in non-fragment markup or within one fragment.

Parameters

Name Type Default Description
source str
check_duplicate_static_ids
function
def check_duplicate_static_ids(template_sources: dict[str, str]) -> list[ContractIssue]

Warn when a template repeats the same staticid="..."value.

Parameters

Name Type Default Description
template_sources dict[str, str]
check_oob_fragment_producers
function
def check_oob_fragment_producers(template_sources: dict[str, str], router: Router, signal_registry: Any | None = None) -> list[ContractIssue]

Warn when an OOB fragment block has no route/signal handler that renders it.

Parameters

Name Type Default Description
template_sources dict[str, str]
router Router
signal_registry Any | None None

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