Skip to content

fix: true booleans incorrectly rendered as "1" in XML output#1200

Open
gennaroprota wants to merge 1 commit into
cppalliance:developfrom
gennaroprota:fix/true_booleans_incorrectly_rendered_as_1_in_xml_output
Open

fix: true booleans incorrectly rendered as "1" in XML output#1200
gennaroprota wants to merge 1 commit into
cppalliance:developfrom
gennaroprota:fix/true_booleans_incorrectly_rendered_as_1_in_xml_output

Conversation

@gennaroprota
Copy link
Copy Markdown
Collaborator

@gennaroprota gennaroprota commented May 13, 2026

The XML writer emitted true boolean members as <x>1</x> (and omitted the element when false). Reading such output meant knowing that the member was actually a boolean.

The writer now emits the xsd:boolean primary lexical form, <x>true</x>. The omit-when-false convention is preserved, so the golden XMLs change only in the body of already-present boolean elements. The RELAX NG schema is updated accordingly.


Summary

Fixes a long-standing readability quirk in the XML output. The XML writer emitted true boolean members as <x>1</x> (and omitted the element when false). Reading such output meant the consumer had to know in advance that the member was actually a boolean — 1 looks indistinguishable from an integer.

The writer now emits the xsd:boolean primary lexical form: <x>true</x>. The omit-when-false convention is preserved, so the golden XML fixtures change only in the body of already-present boolean elements. The RELAX NG schema is updated to match.

Changes

  • Source: One-line fix in src/lib/Gen/xml/XMLWriter.cpp — the boolean-serialization branch now writes "true" instead of "1".
  • Golden tests: 207 XML fixtures across test-files/golden-tests/ updated to reflect the new <x>true</x> form. Intentional output corrections, not regenerations.
  • Build: mrdocs.rnc updated so the schema accepts the new lexical form on boolean elements.
  • Breaking changes: Downstream tooling that parses mrdocs XML output and matches boolean fields exactly against "1" will need to update to handle "true". The omit-when-false convention is unchanged, so handling for absent elements is unaffected.

Testing

  • The 207 golden XML fixtures are themselves the regression coverage: any future regression that re-emits "1" for booleans (or omits an element when true) fails the golden tests.
  • No CI workflow changes needed — the existing golden-test job runs test-files/golden-tests/ on every build, so the new expectations stay enforced going forward.

Documentation

The schema (mrdocs.rnc) is the canonical reference for the XML output format and is updated. No prose documentation describes the previous "1" encoding, so nothing else needs updating.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

✨ Highlights

  • 🧪 Existing golden tests changed (behavior likely shifted)

🧾 Changes by Scope

Scope Lines Δ% Lines Δ Lines + Lines - Files Δ Files + Files ~ Files ↔ Files -
🥇 Golden Tests 100% 4570 2285 2285 207 - 207 - -
🛠️ Source <1% 2 1 1 1 - 1 - -
🏗️ Build <1% 2 1 1 1 - 1 - -
Total 100% 4574 2287 2287 209 - 209 - -

Legend: Files + (added), Files ~ (modified), Files ↔ (renamed), Files - (removed)

🔝 Top Files

  • test-files/golden-tests/symbols/variable/function-objects.xml (Golden Tests): 370 lines Δ (+185 / -185)
  • test-files/golden-tests/symbols/record/class-template-specializations-1.xml (Golden Tests): 312 lines Δ (+156 / -156)
  • test-files/golden-tests/config/inherit-base-members/copy.xml (Golden Tests): 204 lines Δ (+102 / -102)

Generated by 🚫 dangerJS against 55bca26

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.12%. Comparing base (1fc06a0) to head (55bca26).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1200   +/-   ##
========================================
  Coverage    82.12%   82.12%           
========================================
  Files           33       33           
  Lines         3149     3149           
  Branches       734      734           
========================================
  Hits          2586     2586           
  Misses         387      387           
  Partials       176      176           
Flag Coverage Δ
bootstrap 82.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cppalliance-bot
Copy link
Copy Markdown

cppalliance-bot commented May 13, 2026

An automated preview of the documentation is available at https://1200.mrdocs.prtest2.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-05-13 14:29:06 UTC

The XML writer emitted true boolean members as `<x>1</x>` (and omitted
the element when false). Reading such output meant knowing that the
member was actually a boolean.

The writer now emits the xsd:boolean primary lexical form,
`<x>true</x>`. The omit-when-false convention is preserved, so the
golden XMLs change only in the body of already-present boolean elements.
The RELAX NG schema is updated accordingly.
@gennaroprota gennaroprota force-pushed the fix/true_booleans_incorrectly_rendered_as_1_in_xml_output branch from b2c63a4 to 55bca26 Compare May 13, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants