Tool: zpretty 4.0.2
Environment: Python 3.13, Linux. Reproduced via zpretty -i and zpretty <file> (stdout).
Severity: High - silent data loss. zpretty exits 0 and produces well-formed but truncated output; no warning is printed.
Description
Running zpretty on source/client_info.xml discards the entire <client> root element and all of its children, emitting only the XML declaration and the leading (prolog) comment:
$ zpretty source/client_info.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- This file contains all known information for this client.
All elements are MANDATORY. ...
Example <invoice_rep></invoice_rep> -->
The <client> element (full_name, rates, everything) is gone. With zpretty -i this overwrites the file in place, so the data is lost. xmllint confirms the original is valid, well-formed XML.
The committed file source/client_info.xml reproduces it 100% of the time. Shape of the trigger:
<?xml version="1.0" encoding="UTF-8"?>
<!-- a multi-line comment in the prolog
(before the root element) -->
<client ...>
<full_name>X</full_name>
<!-- inline body comments -->
...
</client>
Observations / partial isolation
- Removing the prolog comment (the comment between
<?xml?> and <client>)
-> output is correct.
- Keeping the prolog comment but removing all body comments
-> output is correct.
- So the trigger is an interaction between a prolog (pre-root) comment and comments inside the body. It did not reduce to a small synthetic snippet (single-/multi-line prolog comments plus a couple of body comments format fine), so it appears sensitive to the specific document content/size. The real ~40-line file is the smallest reliable reproducer we have.
Impact
The CI XML-lint format phase (zpretty --check) cannot pass source/client_info.xml: the only "formatted" output zpretty can produce for it is the truncated one. Accepting it would mean committing data loss.
Workarounds
- Move the descriptive comment from the prolog to inside
<client> - verified to make zpretty preserve the document.
Recommendation
collective/zpretty: a formatter must never silently drop content.
- At minimum it should error out instead of emitting truncated output.
Tool: zpretty 4.0.2
Environment: Python 3.13, Linux. Reproduced via
zpretty -iandzpretty <file>(stdout).Severity: High - silent data loss. zpretty exits 0 and produces well-formed but truncated output; no warning is printed.
Description
Running zpretty on
source/client_info.xmldiscards the entire<client>root element and all of its children, emitting only the XML declaration and the leading (prolog) comment:The
<client>element (full_name,rates, everything) is gone. Withzpretty -ithis overwrites the file in place, so the data is lost.xmllintconfirms the original is valid, well-formed XML.The committed file
source/client_info.xmlreproduces it 100% of the time. Shape of the trigger:Observations / partial isolation
<?xml?>and<client>)-> output is correct.
-> output is correct.
Impact
The CI XML-lint
formatphase (zpretty --check) cannot passsource/client_info.xml: the only "formatted" output zpretty can produce for it is the truncated one. Accepting it would mean committing data loss.Workarounds
<client>- verified to make zpretty preserve the document.Recommendation
collective/zpretty: a formatter must never silently drop content.