Skip to content

fix(body_patch): replace text in a table's holder and its cells in one edit - #509

Merged
airmang merged 1 commit into
mainfrom
fix/body-replace-text-nested-paragraphs
Oct 18, 2026
Merged

airmang merged 1 commit into
mainfrom
fix/body-replace-text-nested-paragraphs

Conversation

@airmang

@airmang airmang commented Oct 17, 2026

Copy link
Copy Markdown
Owner

무엇

apply_body_ops의 replace_text는 찾은 글이 든 문단마다 편집 하나를 만들었다. 표를 담은 문단의 글과 그 표 칸 안 문단의
글이 함께 맞으면 두 편집 구간이 겹쳐, 바깥 문단 편집이 어긋난 위치에 붙고 저장 검사가 ValueError: malformed XML로
멈췄다(파일은 쓰지 않음).

이제 편집된 문단 안에 또 편집된 문단이 있으면 바깥 문단 하나로 묶어, 그 안의 치환과 칸의 lineWrap SQUEEZE→BREAK
편집을 한 번에 적용하고 전처럼 줄 배치 정보를 지운다. 겹치지 않는 경우의 결과는 전과 같다.

시험

  • tests/test_body_patch.py::test_replace_text_in_a_table_holder_and_its_own_cell_at_once: 표를 담은 문단과 그 칸에서 같은
    글을 바꾸면 두 곳 모두 바뀌고, SQUEEZE 칸은 BREAK가 되고, 문서가 다시 열린다(고치기 전에는 malformed XML로 실패).

🤖 Generated with Claude Code

@airmang airmang left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact head: 91cf300.

Reviewed paragraph/sublist span discovery, outermost edited paragraph grouping, reverse-ordered text/wrap splices, escaping, count refusal and layout-cache removal. Nested holder/cell edits are coalesced while disjoint edits retain their previous behavior. No unresolved code finding. All four local body-patch tests passed, including the new nested holder/cell save/reopen regression and untouched-cell SQUEEZE preservation.

All 13 current CI checks pass; verified successful workflow head SHA and read its test/lint/type/hygiene log (6,929 passed, 18 skipped, 1 xfailed; coverage 90.04%).

Merge held: after #505 merged, git merge-tree against current main 366e25d reproduces a content conflict in CHANGELOG.md. Preserve both entries when resolving against latest main, then revalidate the changed head and integration. No conflicted integration-test pass is claimed. COMMENT because this authenticated account owns the PR.

@airmang
airmang force-pushed the fix/body-replace-text-nested-paragraphs branch from 91cf300 to d4264b1 Compare October 17, 2026 17:53

@airmang airmang left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head d4264b1.

Range-diff confirms rebase/CHANGELOG placement only since the prior review. Rechecked outer edited paragraph coalescing, reverse text/wrap edits, escaping/count refusal and untouched-cell preservation. All four local body-patch tests pass, including the holder/cell round trip. No unresolved code finding. All 13 current CI checks pass; verified workflow head SHA and read its test/lint/type/hygiene log (6,930 passed, 18 skipped, 1 xfailed; coverage 90.04%).

Merge held: after #506 and #512 merged, git merge-tree against current main 73d68a7 reproduces content conflicts in CHANGELOG.md. Resolve preserving both PRs' changes and fixture coverage, then revalidate the updated head and combined tree. No conflicted integration-test pass is claimed. COMMENT because this account owns the PR.

@airmang
airmang force-pushed the fix/body-replace-text-nested-paragraphs branch from d4264b1 to e807a43 Compare October 18, 2026 00:07

@airmang airmang left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head e807a43. Range-diff confirms only rebase/CHANGELOG placement changed since the prior implementation review. Rechecked nested holder/cell span coalescing, reverse replacements, SQUEEZE-to-BREAK edits, escaping/count refusal and cache removal. No unresolved code finding. All four local body-patch tests pass, including round trip and untouched-cell preservation. All 13 exact-head checks pass; workflow SHA verified and logs inspected (6,933 passed, 18 skipped, 1 xfailed plus lint/types/hygiene).

Merge held: current main 45b9541 after #508/#513 conflicts in CHANGELOG.md. Preserve both entries on resolution and revalidate the updated head and integration. No conflicted integration-test pass is claimed. COMMENT because this account owns the PR.

…e edit

replace_text built one edit per paragraph that held a match. A match in
the paragraph holding a table and another in a cell of that table gave
two nested edits; applying both spliced the outer one at stale offsets
and the save check stopped on malformed XML. The matches and the cell
wrap fixes inside an edited paragraph are now applied to that outermost
paragraph in one edit, then its layout caches are dropped as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@airmang
airmang force-pushed the fix/body-replace-text-nested-paragraphs branch from e807a43 to 622e256 Compare October 18, 2026 06:02

@airmang airmang left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 622e256. Range-diff confirms only rebase/CHANGELOG placement changed from the previous review. Rechecked outermost edited paragraph grouping, nested holder/cell text and wrap splices, escaping/count refusal and selective SQUEEZE/cache handling. No unresolved finding; previous conflict is resolved.

All four local body-patch tests pass. All 13 current CI checks pass; verified workflow head SHA and read test/lint/type/hygiene logs (6,938 passed, 18 skipped, 1 xfailed; coverage 90.05%). Integrated latest main 6539e9e, including the independently merged #507, without conflicts; all 69 body-patch/HWP-open tests pass on tree 2f2761933366c367736b0824bebf538d82ec85c6. This validates the PR integration and does not claim resolution of #507's separate previously reported finding. Ready for expected-head-SHA squash merge. COMMENT because this account owns the PR.

@airmang
airmang merged commit 469aa3c into main Oct 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant