Repository navigation
feat: XML lowering for ByValue conditions — version-gated rules (p5-s1 follow-up) - #79
Merged
Merged
Conversation
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.
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.
Closes the p5-s1 deferral. The six
ByValueConditionmembers, thedateTime→ir::DateTimeparse and theruleliteral mapping landed withp4-s2's storyboard lowering (#25); this PR delivers the remaining scope item
— per-version
Rule-literal gating — plus the suite that proves thefamily member by member.
What
ReadContextcarries the document revision.set_version/version_at_least, filled onceFileHeaderis read. p4-s5's per-versionacceptance rules build on the same hook.
read_rulefor every value-comparing condition, with theavailability table:
equalTo/greaterThan/lessThanfrom 1.0, thenon-strict and negated operators later.
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
greaterOrEqualloads 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:variable, user-defined value, storyboard element state, both
traffic-signal conditions);
ValidationError, and the version gate in both directions (newerliteral in a 1.0 document warns and still loads; the 1.0 literals never
warn);
dateTimematrix: basic notation, fractional seconds scaled tomilliseconds and truncated past three digits,
Z/±hh:mm/±hhmmzones, a leap day accepted, and eight malformed or impossible values
rejected citing
asam.net:xosc:1.0.0:data_type.time_format;ParameterConditionfiring 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 isgone (it landed), and the Rule section states the older-document behavior.
xml_byvalue_test.cppandcarry the unverified-introduction-version caveat.
Closes #57