GTR001 — Canonical 4-space indentation (fmt)

Contract: behaviour-preserving.

Claim

Rewriting whitespace-only .text/.tail to canonical indentation never changes runtime or rendered behaviour.

Proof

  • <tool> and other element-only content models (XSD): XML 1.0 declares inter-element whitespace non-significant in element content — rewriting it is invisible to any conformant consumer.

  • The rule skips the whole subtree of (a) any element holding mixed content (a ws-only tail there is a rendered word separator — the XML 1.0 clause covers element content only) and (b) any text-bearing element with children per the schema-derived payload guard (payload.py over tier-1 schema_content.text_bearing_tags()): even an all-whitespace text/tail between <expand> children is spliced into script/template/RST, where a space→newline rewrite changes meaning (in shell, a newline separates commands).

  • safe_set_text/safe_set_tail write only when the existing value is None/whitespace.

Scope boundary

Whitespace inside text-bearing subtrees is never touched (fmt §D19/§D20). The guard set is derived from all 28 vendored XSDs, with two proof-carried exceptions documented in GTR004.

History

Refuted (mixed-content drift) → guarded, PR #158; payload-guard derivation fmt §D20. Audit trail: ../behavior_preservation.md.