umath 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@
11
11
  "lib/plurimath/math/symbols/paren.rb": "sha256:316dc4d8b5accb78ac8ca9ff5035a3eb42365492abb666c4589b12b0e677c837"
12
12
  }
13
13
  },
14
- "source": "Plurimath::Utility.all_symbols_classes(:umath); value is the class's to_umath, kind is paren for Math::Symbols::Paren classes",
14
+ "source": "Plurimath::Utility.all_symbols_classes(:unicodemath); value is the class's to_unicodemath, kind is paren for Math::Symbols::Paren classes",
15
15
  "symbols": {
16
16
  "\"P{!=}\"": {
17
17
  "value": "≠",
@@ -167,14 +167,7 @@ parentheses, 100 nested fractions) was built and serialized without error.
167
167
  `scripts/replay_corpus.rb --inventory ... --rows ...`, which checks raw
168
168
  parity again and that the model holds the bound tree. A row the legacy
169
169
  grammar refused must raise `ParseError`, and a row without a formula
170
- must give an empty document.
171
- On the native engine, the rows in
172
- `spec/parser/fixtures/oracle/native-divergences.yml` give another tree
173
- than legacy, because Parsanol's native engine takes another alternative
174
- of the same grammar. The grammar before the shape normalization gives the
175
- same native trees, so the normalization does not cause them. Both checks
176
- require those rows to still differ, so a fixed engine shows up as a
177
- failure that asks to shorten the list.
170
+ must give an empty document. Both checks hold on the native engine too.
178
171
  * `scripts/verify_lml.rb` exports every model class with
179
172
  `Lutaml::Model::Lml.export`, requires the committed
180
173
  `model/umath.lml.json` and `model/umath.lml.checksums.txt` to
@@ -102,7 +102,7 @@ in the encoded text.
102
102
 
103
103
  The grammar is not self-contained: `ConstantsRules` builds alternations from
104
104
  `Constants` when the grammar loads, and `Constants.wrapper_symbols` reads
105
- Plurimath's symbol catalog (`Utility.symbols_hash(:umath)`). The
105
+ Plurimath's symbol catalog (`Utility.symbols_hash(:unicodemath)`). The
106
106
  decimal-marker rule reads `Plurimath.configuration`. A gem grammar must take
107
107
  these inputs from committed data, not from a live Plurimath.
108
108
 
@@ -112,7 +112,7 @@ these inputs from committed data, not from a live Plurimath.
112
112
  `Plurimath::Math::Formula`. Grammar refusals and transform failures both
113
113
  surface as `Plurimath::Math::ParseError`. The capture records the formula
114
114
  object graph and the exact output of the `to_asciimath`, `to_latex`,
115
- `to_mathml`, `to_umath`, `to_omml` and `to_html` writers.
115
+ `to_mathml`, `to_unicodemath`, `to_omml` and `to_html` writers.
116
116
 
117
117
  == What the gem must keep (syntax)
118
118
 
@@ -204,7 +204,7 @@ another artifact.
204
204
 
205
205
  `data/umath-symbols.json` is the symbol catalog the legacy transform
206
206
  uses: every UnicodeMath spelling of Plurimath's `Math::Symbols::Symbol` and
207
- `Math::Symbols::Paren` classes, as `Plurimath::Utility.all_symbols_classes(:umath)`
207
+ `Math::Symbols::Paren` classes, as `Plurimath::Utility.all_symbols_classes(:unicodemath)`
208
208
  returns them at the pinned commit. For each spelling it records the Unicode
209
209
  text the class writes as UnicodeMath (`value`) and whether the class is a
210
210
  symbol or a paren (`kind`). It has 3282 spellings, 64 of them parens.
@@ -11,10 +11,10 @@ generations, named in `spec/fixtures/testsuite-pin.yml`:
11
11
  ----
12
12
  schema: plurimath-stage/pin/1
13
13
  repository: https://github.com/plurimath/plurimath-testsuite
14
- commit: 2a18ff43a26716a60c1c4330d5107c26dc73963c
14
+ commit: 6138a102589093cdb3587334ff312ece5f17e428
15
15
  language: unicode
16
- generation: 2
17
- snapshot_digest: sha256:0a6f19b9a7836e71544d1a027e3f3ea2397dc5e9a1aba8b7834079b1dc91593d
16
+ generation: 5
17
+ snapshot_digest: sha256:282fb3eead874618dda3229320a3a5d061434ea3766c8c95c641e07d49444b10
18
18
  ----
19
19
 
20
20
  Generation 2 keeps every case of generation 1 (the legacy corpus, produced by
@@ -22,6 +22,30 @@ Plurimath 0.11.12) byte for byte and adds a raw-tree row for each of its 72
22
22
  cases, rejections included, written by `scripts/stage_cases.rb` at umath
23
23
  1929f69.
24
24
 
25
+ Generation 3 keeps every payload of generation 2 byte for byte and adds
26
+ typed-model rows beside the raw-tree rows.
27
+
28
+ Generation 4 keeps every payload of generation 3 byte for byte except the
29
+ five raw-tree payloads, which `scripts/stage_cases.rb` rewrote after the gem
30
+ was renamed to umath: their header comment and description name umath and
31
+ `Umath::RawParser`. No row changed.
32
+
33
+ Generation 5 keeps every payload of generation 4 byte for byte and adds a
34
+ raw-tree row (`unicode-external-NNN.raw`) and a typed-model row
35
+ (`unicode-external-NNN.model`) for each of the 675 external UnicodeMath
36
+ inputs of the testsuite's `fixtures/unicode-expectations.yaml`, in the
37
+ `raw-external-*` and `model-external-*` payloads: 33 payloads and 1566 rows
38
+ in all. The inputs are the fixture's, without the leading `0` or `1` that
39
+ marks inline or display math; three inputs occur twice in the fixture and
40
+ keep both of their ids. The expected values were computed by
41
+ `scripts/stage_cases.rb` at umath c7587f0 (the 0.2.0 version bump), with
42
+ the Ruby and the native engine agreeing on every row; 7 inputs of each
43
+ boundary are refusals, the fixture's parse-error cases. The upstream MathML
44
+ of these inputs stays in the fixture as reference and is not compared here.
45
+ The fixture's inputs come from the MIT-licensed UnicodeMathML test data
46
+ (copyright 2019 Noah Doersing); the testsuite records the source and the
47
+ licence in its provenance and in `LICENSES/UnicodeMathML-MIT.txt`.
48
+
25
49
  == What CI checks
26
50
 
27
51
  The `corpus` workflow checks out the testsuite at the pinned commit and then:
@@ -37,34 +61,42 @@ The `corpus` workflow checks out the testsuite at the pinned commit and then:
37
61
  `scripts/replay_corpus.rb` fail on a small generated testsuite;
38
62
  . runs `scripts/replay_corpus.rb --testsuite`, which repeats the pin checks
39
63
  and then parses every row of every raw-tree payload of the generation with
40
- `Umath::RawParser.parse` on the Ruby and the native engine. Each
64
+ `Umath::RawParser.parse` and every row of every typed-model payload with
65
+ `Umath.parse`, on the Ruby and the native engine. For a raw-tree row each
41
66
  engine's result, the preprocessed text and the tree in the legacy grammar's
42
67
  shape or the refusal and its byte offset, must equal the row's expected
43
68
  value in the canonical form of the testsuite's
44
- `docs/tree-parity-contract.adoc`.
45
-
46
- The rows whose source id is listed in
47
- `spec/parser/fixtures/oracle/native-divergences.yml` are the exception on the
48
- native engine: Parsanol's native engine takes another alternative of the same
49
- grammar for those inputs, so their native result must still differ from the
50
- expected value, and the replay fails once one of them matches, so the list
51
- can be shortened. None of the listed inputs is in generation 2, whose rows
52
- were written only where both engines agreed.
69
+ `docs/tree-parity-contract.adoc`; for a typed-model row the built
70
+ `Umath::Model::Document` in tagged form, or the refusal, must. The
71
+ typed-model rows of generation 3 were written before the gem was renamed
72
+ and tag their nodes `Unicodemath::Model::...`; the replay reads that
73
+ prefix as `Umath::Model::` and changes nothing else (20 rows of generation
74
+ 5, counted in the report). It writes
75
+ the ids of the rows it ran to a file (1494 for generation 5: 747 raw-tree
76
+ and 747 typed-model);
77
+ . runs the testsuite's `scripts/validate-unicode-external.rb` on that file,
78
+ which fails unless every external row of the generation (675 `.raw` and
79
+ 675 `.model`) is listed exactly once, and checks that the same file with
80
+ one id removed fails it.
53
81
 
54
82
  To run the replay locally:
55
83
 
56
84
  [source,sh]
57
85
  ----
58
86
  git clone https://github.com/plurimath/plurimath-testsuite tmp/testsuite
59
- git -C tmp/testsuite checkout 2a18ff43a26716a60c1c4330d5107c26dc73963c
60
- bundle exec ruby scripts/replay_corpus.rb --testsuite tmp/testsuite --report tmp/replay.json
87
+ git -C tmp/testsuite checkout 6138a102589093cdb3587334ff312ece5f17e428
88
+ bundle exec ruby scripts/replay_corpus.rb --testsuite tmp/testsuite \
89
+ --report tmp/replay.json --executed-ids tmp/executed-ids.txt
90
+ ruby tmp/testsuite/scripts/validate-unicode-external.rb tmp/testsuite \
91
+ --generation 5 --executed tmp/executed-ids.txt
61
92
  ----
62
93
 
63
94
  The `replay` workflow checks out the testsuite at the same commit and fails if
64
95
  its commit and the pin's differ. The `stage-cases` workflow writes the
65
96
  generation after the latest one of its source commit, so it still reads
66
97
  generation 1 at b4520d8; it also checks out the pinned commit and requires the
67
- raw-tree payloads it writes to equal the pinned generation's byte for byte.
98
+ payloads it writes to equal generation 4's at the pinned commit byte for
99
+ byte (generation 5 keeps them unchanged).
68
100
  The same workflow also writes a typed-model generation (`scripts/stage_cases.rb
69
101
  --boundary typed-model`) from the latest generation at 5e32851: every payload
70
102
  copied byte for byte plus a `model-<group>.yaml` payload of typed models from
@@ -84,6 +116,24 @@ repository, and requires the raw tree and the typed model built by
84
116
  divergences. The legacy corpus itself is not changed by this gem: generation 1
85
117
  stays as it was imported.
86
118
 
119
+ == Coverage of UTN 28
120
+
121
+ `scripts/utn28_coverage.rb` reads the typed-model rows of the pinned
122
+ generation. The 675 external rows are declared in `docs/utn28-coverage.yml`
123
+ under `unmapped_payloads`: they are replayed, but which UTN 28 constructs each
124
+ one exercises is not recorded, so they change no construct's status.
125
+
126
+ == The release and the pin
127
+
128
+ The pin states what this repository's code reproduces, not what a released
129
+ gem does. The `lib/` files of umath 0.2.0 on RubyGems are those of c7587f0,
130
+ the commit at which `scripts/stage_cases.rb` produced the expected values of
131
+ the 675 external rows, so the 0.2.0 parser is the one generation 5 was
132
+ written from. A commit after 0.2.0
133
+ is checked against the pin by CI, but it reaches gem users only in a later
134
+ release; until then a fix that exists only in Git is not in the published
135
+ gem. umath 0.1.0 predates generation 5 and is not tested against it.
136
+
87
137
  == Moving the pin
88
138
 
89
139
  Commit, generation and digest change together, in one change, and only to a