cac:LegalMonetaryTotal[BR-CO-13]-Invoice total amount without VAT (BT-109) = Σ Invoice line net amount (BT-131) - Sum of allowances on document level (BT-107) + Sum of charges on document level (BT-108).
Hitting this rule in production? Paste the invoice into the validator or wire the API into CI so it never ships broken again.