R8.2: Word EQ fields open as formulas; inline objects follow their run

Gitea #9. Patch 0049 moves inline pictures and OLE objects with
their run's w:position. Patches 0050 and 0051 turn EQ fields into
Math objects; unreadable fields show their code. Round 3 findings
(lowercase \s\do tail, split subscripts, \ai/\di, italics through
OMML) fixed and covered by word.rs; no fourth review.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude committed 2026-10-18 21:39:17 -04:00
1 parent 6f1eebb4b5
commit 2ca53ef585
11 files changed
+975 -1

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
FAIL
- patches/libreoffice/0050-writer-eq-fields-as-formulas.patch:92 — [P1] Trimming the command without trimming its character-format vector shifts every formatting index. Reproduced against the rebuilt Windows worker by prepending one space to the EQ instruction in `word.docx`: the expected italic `a₁₀/a₃` becomes `a1₀/a3`, with the wrong characters italicized and the denominator's subscript lost. The parser already skips leading spaces; pass the original command, or adjust both inputs identically, and add this regression. Evidence: `.work/r82-r1/probe.log` and `regression.log`.
- patches/libreoffice/0050-writer-eq-fields-as-formulas.patch:395 — [P1] Secondary switch names remain case-sensitive, although Word field switches are case-insensitive ([field syntax §2.16.1](https://www.durusau.net/publications/Muscular-WordProcessingML.pdf)). Reproduced: `EQ \I\SU(1,5,x)` imports as an integral, whereas `EQ \i\su(1,5,x)` imports as a sum; `\A\CO2(a,b,c,d)` becomes a four-row column instead of a two-by-two array. This silently changes mathematical meaning. Normalize secondary switch names before interpreting them and test uppercase and mixed-case spellings. Evidence: `.work/r82-r1/probe.log`.
- patches/libreoffice/0050-writer-eq-fields-as-formulas.patch:266 — [P2] Parse failures disappear without the promised diagnostic in the shipped kernel. `fail()` only uses `SAL_WARN`, which this Windows release build compiles out (`ENABLE_SAL_LOG` is empty); the empty result is then discarded at lines 93–94. Reproduced with `EQ \f(a)`: loading and saving both succeed, the field disappears, and worker stderr contains no EQ diagnostic even with `SAL_LOG=+INFO.writerfilter.dmapper`. This violates the error-exposure rule and the R8.2 documentation's logging claim. Propagate failure through an import warning/error observable in release builds and add a failure-path test. Evidence: `.work/r82-r1/regression.log`, `worker.log`, and `review.log`.
- patches/libreoffice/0050-writer-eq-fields-as-formulas.patch:95 — [P2] The new `SAL_INFO` statement logs the complete formula, including document text. With a logging-enabled kernel and `SAL_LOG=+INFO.writerfilter.dmapper` or a corresponding `SAL_LOG_FILE`, opening a field such as `EQ \f(PrivateAmount,PrivateDivisor)` writes both operands into the native diagnostic log. This violates rule 4's prohibition on logging document contents. Remove the formula payload from the diagnostic.
- patches/libreoffice/0050-writer-eq-fields-as-formulas.patch:517 — [P3] This newly added file has 517 lines, exceeding the explicit 500-line file limit. Split the diff into smaller ordered patches while preserving all changes and their application order.
+9
View File
@@ -0,0 +1,9 @@
FAIL
- patches/libreoffice/0050-writer-eq-field-parser.patch:327 — [P1] An incomplete final array row silently loses operands. Reproduced with `EQ \a\co2(a,b,c)`: the generated StarMath has unequal row lengths, the actual MathML contains only `a` and `b`, and saving DOCX writes only those two operands into OMML. The annotation still contains `c`, so checking annotation text alone misses the loss. Pad the final row or reject the conversion visibly; test actual rendered/exported formula content. Evidence: `.work/r82-r2/edge-probe.log`, `array_three`.
- patches/libreoffice/0050-writer-eq-field-parser.patch:340 — [P1] The parser consumes custom operator switches but silently substitutes an integral. Reproduced with `EQ \i\fc\∑(1,5,x)`: the resulting formula is `int from{"1"} to{"5"} {"x"}`, and its MathML operator is `∫`. The specified summation operator has changed mathematical meaning. Honor the supplied symbol or fail parsing so the original field code remains visible; cover both `\fc` and `\vc`. These switches specify the operator character in [ECMA-376 Part 4 §14.10.4.6](https://ecma-international.org/wp-content/uploads/ECMA-376-4_5th_edition_december_2016.zip). Evidence: `.work/r82-r2/edge-probe.log`, `operator_sigma`.
- patches/libreoffice/0050-writer-eq-field-parser.patch:141 — [P1] Unrecognized bracket characters silently become invisible delimiters. Reproduced with `EQ \b\lc\⌊\rc\⌋(x)`: import succeeds as `left none {"x"} right none`; the actual MathML contains only `x`, losing the floor operation. The character options are defined by [ECMA-376 Part 4 §14.10.4.6](https://ecma-international.org/wp-content/uploads/ECMA-376-4_5th_edition_december_2016.zip). Preserve the delimiters or report the command unreadable instead of replacing them with `none`, and add a regression. Evidence: `.work/r82-r2/edge-probe.log`, `floor`.
- patches/libreoffice/0050-writer-eq-field-parser.patch:194 — [P2] General field switches are imported as visible equation text. Reproduced with `EQ \f(a,b) \* MERGEFORMAT`: the fraction acquires the literal suffix ` * MERGEFORMAT` in both StarMath and MathML; `\* CHARFORMAT` behaves likewise. [Microsoft documents these as formatting switches](https://support.microsoft.com/en-au/word/format-field-results), with MERGEFORMAT added by default by the field dialog. Parse general switches separately from equation content and add regressions asserting they do not appear in the formula result. Evidence: `.work/r82-r2/probe.log`, `mergeformat` and `charformat`.
+9
View File
@@ -0,0 +1,9 @@
FAIL
- patches/libreoffice/0051-writer-eq-fields-as-formulas.patch:149 — [P1] Fields beginning with lowercase `\s\do` still bypass the new parser and silently truncate the expression. `EQ \s\do2(x)+y` imports and saves as just `x`, losing `+y`; `EQ \s\do2(\f(a,b))` becomes the literal incomplete text `\f(a,b`. Uppercase equivalents retain the complete expressions. Route complete EQ expressions through the parser instead of this partial legacy reader, and cover both cases through DOCX save/reopen. Evidence: `.work/r82-r3/probe.log`, `lower_script_tail` and `lower_script_nested`.
- patches/libreoffice/0050-writer-eq-field-parser.patch:191 — [P1] Changing italics within one subscript flushes and attaches another subscript to the already subscripted base. Reproduced with `EQ \f(a10,b)`, where both digits have `w:vertAlign="subscript"`, but only `1` is italic: import creates `(a₁)₀/b` with two nested MathML `msub` elements, and saved DOCX contains nested `m:sSub` objects. Both digits should remain in one subscript. Accumulate a contiguous script across font-style changes before attaching it, preserving the styles inside that script; add a rendered/exported structure regression. Evidence: `.work/r82-r3/probe.log`, `split_script` versus `merged_script`.
- patches/libreoffice/0050-writer-eq-field-parser.patch:312 — [P1] `\ai` and `\di` are treated as aliases for raising and lowering an argument. These are paragraph spacing options in [Microsoft's EQ reference](https://support.microsoft.com/en-us/word/field-codes-eq-equation-field). `EQ x\s\ai4(y)` becomes `x` raised to `y`, while `EQ x\s\di4(y)` becomes `x` subscript `y`; the incorrect mathematical structures persist in DOCX. Handle spacing separately from script positioning, or preserve the field code visibly when unsupported, and test the actual MathML/OMML structure. Evidence: `.work/r82-r3/probe.log`, `script_ai` and `script_di`; `.work/r82-r3/spec.log`, page 194.
- patches/libreoffice/0050-writer-eq-field-parser.patch:183 — [P2] The generated `ital "text"` representation loses italics when saved as DOCX. Reproduced using the unchanged `tests/fixtures/office/word.docx`: its fraction initially has two italic `a` characters, but exported OMML marks both as `m:nor` without italic formatting, and reopening shows both upright. The new tests only assert formula styling before DOCX saving. Preserve italic formatting through OMML serialization and assert the fixture's formula styles after save/reopen. Evidence: `.work/r82-r3/fixture-roundtrip.log` and `.work/r82-r3/regressions.log`.