contracts.rules_fragment_targets

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

Fragment target registry orphan check.

Fails loud at startup when the fragment target registry contains entries whosefragment_blockis not defined by any page leaf template. Such registrations are inert: boosted requests…

Fragment target registry orphan check.

Fails loud at startup when the fragment target registry contains entries whosefragment_blockis not defined by any page leaf template. Such registrations are inert: boosted requests hitting that HX-Target resolve to a block that does not exist, producing a runtimeBlockNotFoundError (for required targets) or silently falling back to full-page composition (for optional targets).

Relation to sibling checks:

  • check_page_shell_contractsiterates each page template and reports missing required blocks per-template. High per-page fidelity but noisy when a registration is simply dead.
  • This check iterates each registration and reports orphans once per target — a single high-signal issue per registry typo. It is also the only check coveringrequired=Falsetargets.

Severity tiering:

  • required=True(contract-required or ad-hoc required): ERROR. Render-time would raiseBlockNotFoundErroron any boosted request matching the target id.
  • required=False: WARNING. Silent render fallback keeps requests working, but the registration is almost certainly a typo or stale.

Apps can demote globally via app.override_contract_severity("fragment_target_orphan", Severity.WARNING).

contracts.rules_fragment_targets

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

check_fragment_target_orphans
function
def check_fragment_target_orphans(program: HypermediaProgram | None) -> list[ContractIssue]

Emit ERROR/WARNING issues for targets whose block no template defines.

Parameters

Name Type Default Description
program HypermediaProgram | None

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