Skip to content

fmt-f1: remaining non-preserving parse scopes — header (geoReference), roadMark, laneSection, junction children, unknown attributes #453

Closed

Description

@JArmandoAnaya

Part of the ADR-0008 fmt workstream. Follow-up filed from #326 (fmt-s2), which made foreign/unknown <userData> preservation airtight at road, junction and root scope. The exploration for that sprint enumerated every parse site that meets unmodeled input; these are the scopes that still lose data, deliberately left out of #326 (maintainer decision at planning: one follow-up issue, not scope creep). Line refs are against main e729aed.

Still dropped today

  • <header> children — including <geoReference> (§8.5): parse_header (core/src/xodr/reader.cpp:291) reads only revMajor/revMinor and walks no children; the writer synthesizes a fresh <header> (core/src/xodr/writer.cpp:2448). A georeferenced foreign file loses its projection string silently — the most consequential item here, and a P7 (georeferencing) touchpoint: whoever models <geoReference> should decide whether the interim fix is preservation or modeling.
  • <roadMark> unknown attributes and children (incl. <userData>): the roadMark loop (reader.cpp:618) reads sOffset/type/width/color/material + <type>/<line>; RoadMark (core/include/roadmaker/road/lane.hpp) has no RawXml field. Silent. (Note: fmt-s2: round-trip hardening — foreign userData preservation + rm: registry tests #326's issue text claimed roadMark preserved — it never did; what preserves is ObjectMarking.)
  • <laneSection> unknown children: the side-container walk (reader.cpp:541, :554) visits left/center/right only; anything else (incl. <userData>) is silently skipped.
  • <lanes> children other than laneOffset/laneSection: same shape, silent.
  • <junction> non-userData unknown children: parse_junction (reader.cpp:1715) walks connection/controller/userData (+ the modeled boundary/surface/planView/elevationGrid, which are re-derived); <priority> (§12.9) and any future element are silently lost.
  • Unknown attributes on <lane> and <junction>: both preserve children but have no attribute catch-all (contrast Signal/Object/Bridge, which preserve unknown attributes).
  • <elevationProfile> non-<elevation> children: silently dropped.

Suggested shape

The preserved/RawXml idiom is established (Signal/Object/Controller for attrs+children; Road::object_extras for container children; #326's preserved_user_data for enumerated-code scopes). Each row above is a small, independent change of the same shape; <header> is the one needing a real decision (preserve vs model, and the writer currently synthesizes rather than round-trips).

Acceptance

Activity

  1. added
    pillar:P6
    fmt
    on Jul 27, 2026
  2. JArmandoAnaya commented on Jul 27, 2026

    @JArmandoAnaya
    ContributorAuthor

    2026-07-27 roadmap review — the kernel-vs-spec audit confirmed every scope in this list and found three more in the same class:

    • <laneSection> @singleSide — zero hits anywhere in core/; parse_lanes reads only @s and does no attribute sweep. This issue names laneSection unknown children but not its attributes.
    • <dataQuality> — absent everywhere; at road level it would at least trip the child sweep, at header level it is invisible.
    • junction @type="direct" — parse_virtual_junction tests only == "virtual"; @type is not stored, and the writer emits @type only for virtual, so a direct junction silently degrades to a common one. The unknown-attribute catch-all this issue plans would preserve the string, but the semantic degradation (direct junctions have no connecting roads) deserves a sentence in this issue's acceptance: preserve + warn, since we re-derive geometry the standard says a direct junction doesn't have.

    One scope deliberately not added here: road <type>/<speed> — it is whitelisted at reader.cpp:338-341 (so it never even warns) and is a modeled-element gap, not a preservation gap, now tracked as #454 (model it and write it from the road class). Whichever lands first should remove the silent whitelist.

  3. JArmandoAnaya commented on Jul 28, 2026

    @JArmandoAnaya
    ContributorAuthor

    2026-07-28 roadmap review — additional scopes for this sweep (spec-coverage scan at main cfb0ec9; line refs against that commit). These extend the inventory above; none of them is covered by the existing rows as written.

    1. <header> known attributes, not just children. The existing header row covers <geoReference> and the child walk; the reader also keeps only revMajor/revMinor of the attributes, and the writer synthesizes its own @name/@vendor — so @date, @north/south/east/west, @name, @version, @vendor of a foreign file are regenerated with no diagnostic. Whoever does the header row should round-trip the attributes too (bounding box + provenance).

    2. <roadMark> known attributes. The row says "unknown attributes and children"; note that the known-but-unmodeled @weight, @height, @laneChange (§11.9 Table 48) and <line> @color/@rule are dropped the same way (reader reads only sOffset/type/width/color/material). @laneChange is consumed semantically by simulators, so this is the highest-value part of the roadMark row.

    3. Lane <border> (§11.7.2). Warned (reader.cpp:608-610) and deliberately excluded from the lane preserved tier (reader.cpp:718-721), so a border-defined lane loses its geometry entirely on round-trip — the only warn-drop in the lane scope. Minimum fix: move it into the preserved tier. Border→width conversion is a separate modeling decision, out of this sweep.

    4. Junction @type beyond virtual. parse_virtual_junction returns early unless type=="virtual"; @type is never stored and the writer re-emits only virtual — so <junction type="crossing"> (§12.8, since 1.8.0) round-trips as a common junction with the attribute stripped, silently. (type="direct" is already listed above.) While in the junction row: name <crossPath> explicitly among the unknown children — it is the 1.8+ native pedestrian-crossing carrier, and we author crosswalks as objects instead, so foreign crossPath data is the realistic collision case.

    5. <laneLink> @overlapZone (§12.6.2) — only from/to are read (reader.cpp:1746-1749); silent. And foreign <connection> @ids are renumbered 0..n on write (writer.cpp:1449) with unknown connection attrs/children dropped — an id another tool may reference externally.

    6. Warn-drop → preserve upgrades (all currently warned, so the parser contract holds, but the data is still lost on save): lateralProfile <shape> (§10.5.3) and legacy <crossfall>; road <surface>/OpenCRG (§10.6); root <junctionGroup> (§12.13), <station> (§15.4), <vmsGroup> (the writer's own comment at writer.cpp:2610 cites its Table without handling it); road <railroad> (§15.2–15.3). Preservation makes round-trip lossless without any modeling commitment. Whether rail/CRG ever get modeled is a roadmap non-goal decision, separate from this sweep.

    Related new filing from the same review: #476 — unknown enum spellings (lane type / roadMark type / colour) are actively rewritten (Other → "none"/"solid"/"standard") rather than dropped; kept as its own issue because it corrupts a modeled field rather than losing an unparsed scope.

  4. JArmandoAnaya commented on Jul 28, 2026

    @JArmandoAnaya
    ContributorAuthor

    The <header> row is discharged by #324 (p7-s5), merged as #483 → ad542de

    This issue's first bullet — "<header> children — including <geoReference> (§8.5)" — asked whoever models §8.5 to decide preserve vs model. #324 landed first and built both halves of one dispatch:

    • Modelled: <geoReference> and <offset>, on RoadNetwork::georeference(). A second <geoReference> is refused with asam.net:xodr:1.9.0:header.proj.max_one_proj (first wins); a partial <offset> is reported and dropped, never completed with zeros.
    • Preserved verbatim: every other header child — <license> (§6.4.2), <dataQuality>, <include>, foreign <userData> — and every unknown attribute (date, version, anything foreign), on RoadNetwork::preserved_header() (RawXml), re-emitted after the modelled children per the t_header sequence. Each drop that used to be silent now warns, in the fmt-s2: round-trip hardening — foreign userData preservation + rm: registry tests #326 pattern.

    The one deliberate exception: name/vendor/north/south/east/west are NOT preserved — the writer owns them. The bounding box is derived from the network being written, because a box carried over from the input becomes a lie the moment anything moves.

    Fixture note relevant to the rest of this issue: before #324, not one committed .xodr — sample or fuzz corpus — carried a <geoReference>, so any assertion about it would have passed forever on a build that dropped it. #324 added a georeferenced sample plus three corpus seeds (bad_header_two_georeference, bad_header_offset_partial, header_foreign_children). The remaining rows here have the same exposure — check what the corpus actually contains before trusting a preservation test.

    Still open on this issue: <roadMark> unknown attrs/children, <laneSection> unknown children, <lanes> non-laneOffset/laneSection children, <junction> non-userData unknown children (incl. <priority>), unknown attributes on <lane>/<junction>, and <elevationProfile> non-<elevation> children.

  5. moved this from Todo to In Progress in RoadMaker Roadmapon Aug 1, 2026
  6. moved this from In Progress to Done in RoadMaker Roadmapon Aug 1, 2026
  7. JArmandoAnaya commented on Aug 1, 2026

    @JArmandoAnaya
    ContributorAuthor

    Fixed by #555 (merged as b0e54ac). All six scopes route through one capture_unmodeled() helper that takes the caller's modeled attribute and child names — so a scope is added by naming what it models rather than reimplementing the walk. <geoReference> needed nothing: P7 modeled it in #324, verified against the current reader. @singleSide is preserved rather than typed, since the mesher does not implement single-sided sections. Corpus seed preserved_scopes.xodr added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fmtpillar:P6

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions