Skip to content

feat: XML lowering for ByValue conditions — version-gated rules (p5-s1 follow-up) - #79

Merged
JArmandoAnaya merged 3 commits into
mainfrom
feat/p5-s1-byvalue-xml-lowering
Aug 1, 2026
Merged

JArmandoAnaya merged 3 commits into
mainfrom
feat/p5-s1-byvalue-xml-lowering

Conversation

@JArmandoAnaya

Copy link
Copy Markdown
Contributor

Closes the p5-s1 deferral. The six ByValueCondition members, the
dateTime → ir::DateTime parse and the rule literal mapping landed with
p4-s2's storyboard lowering (#25); this PR delivers the remaining scope item
— per-version Rule-literal gating — plus the suite that proves the
family member by member.

What

  • ReadContext carries the document revision. set_version /
    version_at_least, filled once FileHeader is read. p4-s5's per-version
    acceptance rules build on the same hook.
  • One read_rule for every value-comparing condition, with the
    availability table: equalTo/greaterThan/lessThan from 1.0, the
    non-strict and negated operators later.
  • The gate warns, it does not reject. The 1.4.0 reference text records
    no per-literal introduction version — confirming one needs the per-version
    XSDs of ASAM's gated bundle (roadmap OQ-4) — so a 1.0 document using
    greaterOrEqual loads with the operator's documented meaning and is told.
    Rejecting a possibly valid file over an unverified introduction version is
    the more damaging of the two errors; the table and the docs both say so.

How tested

frontends/xml/tests/xml_byvalue_test.cpp — 15 cases:

  • each member carries its payload into the IR (simulation time, parameter,
    variable, user-defined value, storyboard element state, both
    traffic-signal conditions);
  • the full rule literal matrix, an unknown literal rejected as a
    ValidationError, and the version gate in both directions (newer
    literal in a 1.0 document warns and still loads; the 1.0 literals never
    warn);
  • the dateTime matrix: basic notation, fractional seconds scaled to
    milliseconds and truncated past three digits, Z / ±hh:mm / ±hhmm
    zones, a leap day accepted, and eight malformed or impossible values
    rejected citing asam.net:xosc:1.0.0:data_type.time_format;
  • a lowered ParameterCondition firing its event through the engine.

Local: 802 gtest (787 → 802) + 158 pytest green; clang-format, detmath guard
and the coverage-matrix checker green.

Docs

  • docs/user-guide/conditions.md — the "lowering lands separately" note is
    gone (it landed), and the Rule section states the older-document behavior.
  • Coverage matrix: the eight by-value rows name xml_byvalue_test.cpp and
    carry the unverified-introduction-version caveat.

Closes #57

The reader context now carries the revision the FileHeader declared, so an
element reader can ask whether a construct is available in this document's
version — the thing p4-s5's per-version acceptance rules will be built on.

Its first user is the `rule` attribute, which every value-comparing
condition now reads through one function: same literal set, same
diagnostics, same gate. `equalTo`, `greaterThan` and `lessThan` are the 1.0
operators; the non-strict and negated ones arrived later, and the 1.4.0
reference text records no per-literal introduction version — confirming one
needs the per-version XSDs of ASAM's gated bundle (OQ-4). The check
therefore *warns* and loads the condition with its documented meaning:
rejecting a possibly valid file over an unverified introduction version is
the more damaging of the two errors, and the table says so where it lives.
xml_byvalue_test proves each member of the family carries its payload into
the IR — simulation time, parameter, variable, user-defined value,
storyboard element state and the two traffic-signal conditions — plus the
full rule literal matrix, an unknown literal rejected, the version gate in
both directions, and a lowered ParameterCondition actually firing its event
in the engine.

The dateTime attribute gets the matrix it deserves: the basic notation,
fractional seconds scaled to milliseconds (and truncated past three
digits), the Z / ±hh:mm / ±hhmm zone designators, a leap day accepted, and
eight malformed or impossible values rejected citing
asam.net:xosc:1.0.0:data_type.time_format.
The conditions chapter drops the "lowering lands separately" note — it has
landed — and states what happens when an older document uses a newer
operator. The eight by-value coverage rows name the suite that proves their
lowering and carry the unverified-introduction-version caveat.
@JArmandoAnaya
JArmandoAnaya merged commit 076ede2 into main Aug 1, 2026
9 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the feat/p5-s1-byvalue-xml-lowering branch August 1, 2026 11:37
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.

[p5-s1] XML lowering for ByValue conditions

1 participant