Add math-script match options to insertion anchors - #115
Conversation
Verify Report — PR #115EngineAgent Team (3 Claude reviewers: requirements / logic / devil's-advocate) + Codex CLI (gpt-5.5 xhigh) AggregatePASS pending cross-repo dep — 1 P1 (cross-repo branch dep), 4 P2 follow-up, ~10 P3 四個獨立 reviewer 都判定 #90 的核心 Path B 設計 FULLY addressed:
但 Codex + DA 共同指出 Unicode 覆蓋缺口(特別是 issue #90 body 明列的 Scope coveragePR refs: #90 #90 — math_script_insensitive Path B (P3 enhancement)Coverage: FULLY addressed for the core H₀/H0 case + 4 insertion tools wiring。但兩個 issue body 明列的 anchor 形態(
Recommended next actions🛑 Required before merge(P1 #1):
Strongly recommended(合併前或 follow-up PR 立即跟進,issue body 自身列出的 case): Open follow-up issues(建議批次開):
每個 reviewer findings 詳檔: Refs #90 |
🛑 Required before mergePer verify triage(https://github.com/PsychQuant/che-word-mcp/pull/115#issuecomment-4364782360): 1. Cross-repo merge gate (P1)
2. X̄ (combining macron) 支援(issue body 明列,本 PR 應補)Issue #90 body 明確列 Fix 方向(lib + che-word-mcp 同步)在 extension String {
fileprivate var stripCombiningMarks: String {
let nfd = self.decomposedStringWithCanonicalMapping
return String(nfd.unicodeScalars.filter { !$0.properties.isDiacritic })
}
}
// In contains() / canonicalize:
let canonical = self.stripCombiningMarks.mapToAscii(...)PR description 寫 "temporarily depends on PsychQuant/ooxml-swift#38 branch",現在這個 fix 同樣可以放在 ooxml-swift#38 PR 內(因為這 PR 還 draft 等 #38),合併時順便。 Testfunc testInsertParagraphAfterText_CombiningMacron_FlagOn() async throws {
// doc 含 "假設 X̄ 為樣本平均"
// insert_paragraph(after_text: "X̄", match_options: {math_script_insensitive: true})
// OR after_text: "X" with flag on
// expect: 兩個方向都 match
}Open follow-ups(已建立,非合併阻擋;剩下的 unicode coverage 可以留 lib audit follow-up,但 X̄ 是 issue body 自身列的 pattern 必須 in-PR fix):
After merge gate (#1) + X̄ fix (#2), this PR can ship. #90 itself can close once #148 (Unicode coverage audit) lands — current PR scope after X̄ fix covers the headline use case. |
ooxml-swift PR #38 merged + v0.22.0 released. Swap the temporary branch dependency back to a tag-pinned semver constraint. Resolves the PR #115 cross-repo merge gate. Refs PsychQuant/ooxml-swift#38, PsychQuant/ooxml-swift v0.22.0
✓ Cross-repo merge gate cleared — PR moves out of draft
What v0.22.0 includes vs the original branch
This means 2 of the 3 required-before-merge items are now done:
Full test status
Open follow-ups (non-blocking)Tracked at issues #148-154 (Unicode coverage audit / negative tests / discoverability / search_text expose / strict mode / perf / test gaps). PR is ready for review. |
…tools Closes #90 — agents can now use Unicode subscript / superscript / combining-mark variants of anchor text and have them match against the OOXML AST's flatten output (and vice-versa). What changed: - AnchorLookupOptions.parseAnchorLookupOptions(args:tool:) helper at top of Server.swift parses the new match_options.math_script_insensitive flag with strict-bool validation (rejects strings, ints, null). - 4 insertion tools wired with the new match_options arg: - insert_paragraph - insert_image_from_path - insert_equation - insert_caption Each schema exposes match_options as optional object; default is .exact (omitted match_options or omitted math_script_insensitive both keep the pre-fix exact-match behavior, no caller break). - Lib delegate: ooxml-swift v0.22.x AnchorLookupOptions handles the actual bidirectional matching (NFD strip + Unicode subscript/superscript map + Greek subscripts U+1D66..U+1D6A + combining marks U+0304 etc). Tests: - Issue90MathScriptMatchOptionsTests with 5 cases: - testInsertParagraphMatchesH0SubscriptInForwardDirection (H₀ → H0) - testInsertCaptionMatchesH0SubscriptInReverseDirection (H0 → H₀) - testOmittedMatchOptionsKeepsExactMatching (default preserved) - testInvalidMatchOptionsTypeIsRejected (string "true" → error) - testMatchOptionsExposedOnFourInsertionTools (schema test) 6-AI verify on this PR: - 5 Claude reviewers (requirements / logic / security / regression / DA) - Codex gpt-5.5 xhigh PASS pending only cross-repo dep, X̄ + ooxml v0.22.0 release. Refs PsychQuant/ooxml-swift#38 PsychQuant/ooxml-swift v0.22.0
e056828 to
e2006b7
Compare
Summary
match_options.math_script_insensitiveon insertion text-anchor toolsAnchorLookupOptionsforafter_text/before_textValidation
swift test --filter Issue90MathScriptMatchOptionsTestsswift test --filter Issue61InsertParagraphAnchorsSmokeTests --filter Issue61InsertEquationAnchorsSmokeTests --filter AnchorDXConsistencyTestsDepends on PsychQuant/ooxml-swift#38.
Refs #90