Problem
From verification of PsychQuant/che-word-mcp#104 (verify report: comment-4346442620):
「Multiple SEQ fields in same paragraph ([..., begin1, instrText1, sep1, cached1, end1, begin2, ...]) untested. State machine appears to reset correctly on second begin, but no explicit verification. Same for mixed-identifier within paragraph.」
— Source: team:logic
parseFiveRunSpan (Sources/OOXMLSwift/Parsing/FieldParser.swift:181-246) is a state machine that resets on each fldCharType="begin". Per code review the reset path is correct, but no test exercises:
-
Two consecutive SEQ Figure fields in same paragraph — [caption, begin1, instrText("SEQ Figure"), separate1, cached1, end1, " ", begin2, instrText("SEQ Figure"), separate2, cached2, end2]. Should return 2 ParsedFields.
-
Mixed-identifier SEQ in same paragraph — [..., begin1, instrText("SEQ Figure"), ..., end1, begin2, instrText("SEQ Table"), ..., end2]. Should return 2 ParsedFields with different identifiers; updateAllFields should increment both counters.
-
Truncated paragraph (begin without end) — [begin, instrText] with no separate / end. State machine should leave current non-nil at loop exit and silently emit nothing. Currently doc-comment doesn't pin this invariant.
Type
test gap (P3)
Acceptance criteria
Why low priority
State machine logic appears correct on inspection. Real-world OOXML producers rarely emit multiple SEQ in same paragraph (typical pattern is one caption per paragraph). But pathological documents or future producers might, and the assumption is unverified.
Related: PsychQuant/che-word-mcp#104
Current Status
Phase: implemented
Last updated: 2026-05-02 by idd-implement
Key Decisions
Scope Changes
Blocking
- Awaiting IDD verify / PR review.
Commits
11860b5 test: cover canonical sequence field edge cases
Problem
parseFiveRunSpan(Sources/OOXMLSwift/Parsing/FieldParser.swift:181-246) is a state machine that resets on eachfldCharType="begin". Per code review the reset path is correct, but no test exercises:Two consecutive SEQ Figure fields in same paragraph —
[caption, begin1, instrText("SEQ Figure"), separate1, cached1, end1, " ", begin2, instrText("SEQ Figure"), separate2, cached2, end2]. Should return 2 ParsedFields.Mixed-identifier SEQ in same paragraph —
[..., begin1, instrText("SEQ Figure"), ..., end1, begin2, instrText("SEQ Table"), ..., end2]. Should return 2 ParsedFields with different identifiers;updateAllFieldsshould increment both counters.Truncated paragraph (begin without end) —
[begin, instrText]with no separate / end. State machine should leavecurrentnon-nil at loop exit and silently emit nothing. Currently doc-comment doesn't pin this invariant.Type
test gap (P3)
Acceptance criteria
Issue104FieldParserCanonicalFormTests(or a newFieldParserStateMachineEdgeCasesTestsfile) covering the three scenarios above.parseFiveRunSpandoc-comment.Why low priority
State machine logic appears correct on inspection. Real-world OOXML producers rarely emit multiple SEQ in same paragraph (typical pattern is one caption per paragraph). But pathological documents or future producers might, and the assumption is unverified.
Related: PsychQuant/che-word-mcp#104
Current Status
Phase: implemented
Last updated: 2026-05-02 by idd-implement
Key Decisions
fldCharType="end"appears.Scope Changes
Blocking
Commits
11860b5test: cover canonical sequence field edge cases