# Payload envelope codec ## Observed codec pipeline For the studied configuration payloads: ```text SQL BinaryData → raw-deflate (or detected alternative envelope) → UTF-8 text, sometimes BOM → brace-based 1C serialized value tree / container text ``` The decoder must retain envelope type, original encoding, BOM, line endings, and all unmodified text. An encoder is valid only if an unchanged decode→encode cycle returns byte-identical payload bytes. ## Lossless transform discipline 1. Decode source bytes. 2. Identify the exact BSL or value-tree slice with a proven extractor. 3. Replace only that slice. 4. Encode with the original codec metadata. 5. Calculate SHA-1 from the final raw stored bytes, never from decoded text. Do not canonicalize braces, whitespace, strings, BOM, compression level, or base64 blocks without an independently proven canonical writer.