# numPr Section Continuity Check (2026-07-12 盈浦健康科普案)

## Problem Pattern

Contracts where **every section's body paragraphs use auto-numbering (numPr)** — each chapter heading (一、二、三…) is followed by body paragraphs that all carry a shared `numId`, rendering as "1." "2." "3." etc.

When workflow inserts new paragraphs via `add_clause`:
1. **Missing numPr**: New paragraph gets no numPr → breaks numbering sequence (siblings show "1." "2." "3." but new paragraph has no number)
2. **Wrong numId**: New paragraph inherits numPr from wrong section (e.g., clones neighbor paragraph's numId=11 which belongs to "七、不可抗力", making the new "转包" content render as "3." in the wrong sequence)

## Diagnosis Steps

1. Run `numbering-diagnose.py` on both original and modified files
2. For each WB INS paragraph, check:
   - Does it have numPr? Should it?
   - If yes, does its numId match the **section it belongs to** (not an adjacent section)?
3. Map numId → section by looking at which chapter heading precedes the numId's first occurrence

## Real Example (盈浦健康科普 2026-07-12)

Original structure:
- 五、保密条款: P59-P61 all numId=9 → renders "1." "2." "3."
- 六、违约责任: P64-P68 all numId=10 → renders "1." "2." "3." "4." "5."
- 七、不可抗力: P71-P72 numId=11 → renders "1." "2."
- 八、争议解决: P75-P78 numId=12 → renders "1." "2." "3." "4."

Workflow output problems:
- **P62 (new data breach clause under 五、保密)**: No numPr at all. Should be numId=9 to continue as "4."
- **P75 (转包 body text under new 八、转包)**: Got numId=11 (不可抗力's sequence!) → renders as "3." continuing 不可抗力's list. Should either have no numPr (single-paragraph section doesn't need numbering) or a fresh numId with start=1.

## Reviewer Checklist Item

When reviewing workflow output for contracts with section-level auto-numbering:
- [ ] Each new INS paragraph: does it need numPr? (Yes if sibling paragraphs in same section have numPr)
- [ ] If it has numPr: does numId match the correct section?
- [ ] If it lacks numPr: do sibling paragraphs in the same section have numPr? (If yes → missing, severity: critical)
- [ ] New standalone sections (like 转包): body paragraph should NOT inherit previous section's numId

## Root Cause

`add_clause` in ContractEditor clones the **adjacent paragraph's pPr**. When inserting after the last paragraph of section N (which has numId for section N), the new paragraph for section N+1 inherits section N's numId. The library's A-type strip logic removes numPr for "standalone clauses" but doesn't always fire correctly when the clone source has numPr.
