Repository navigation
Encode trailing space as _x20_ in XML ids to keep round trip - #3225
Open
Silvertree2010 wants to merge 1 commit into
Open
Silvertree2010 wants to merge 1 commit into
Silvertree2010 wants to merge 1 commit into
Conversation
Found while testing crates/doc/src/xml_id.rs:80 (strip_unique), triggered by from_object_name at :32 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
FredApps
approved these changes
Oct 20, 2026
FredApps
left a comment
Contributor
There was a problem hiding this comment.
Read the full diff at 8197a7e. A trailing space in an object name is now written as x20 instead of a bare _, so a name ending in digits can no longer read back as a uniqueness suffix; the round trip is tested with the 20-digit name. FreeBSD build + test green at this head.
Messhias
approved these changes
Oct 20, 2026
Messhias
left a comment
Contributor
There was a problem hiding this comment.
Encode trailing space as x20 in XML ids to keep round trip. Checklist cargo xtask ci is ticked.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Found while testing
crates/doc/src/xml_id.rs:80 (strip_unique), triggered by from_object_name at :32(no existing issue): XML-ID object-name round trip drops text when a name ends with a space after 20+ digits.Cause:
from_object_nameturned a trailing space into a bare_. For a name like "Scan 12345678901234567890 " the id ended in_<20+ digits>_, whichstrip_uniquetreats as a uniqueness suffix and removes.to_object_namethen returned "Scan".Fix:
from_object_namenow writes a trailing space as_x20_, so the id never ends in a bare_<digits>_.to_object_namealready decodes_xHH_escapes, so it needs no change.How it was tested
xml_id::tests. They check that the id ends in_x20_and that the name round-trips. Without the fix the first assertion fails.xml_id::tests::round_trip_names_that_cannot_start_an_xml_name: fails onmainwithout the fix and passes with it (cargo test -p vectorcraft-doc --lib xml_id).cargo xtask cipasses.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.Not changed
strip_uniqueandto_object_nameare unchanged, so ids likeS_0000…_still decode to "S". Interior spaces still encode as_.🤖 Generated with AI by ApolloOffice, see the Co-Authored-By trailers for the models
Summary by CodeRabbit