# Bug O FIXED — Docx 重 import diff stepper 4 key 擴展 + TabView refactor

| 項目 | 內容 |
|---|---|
| 收尾日期 | 2026-05-25 |
| Branch | `feature/ssp-oscal-alignment` |
| Spec | `docs/features/FR-028-2605-ssp-oscal-alignment/design.md §11.34` |
| Plan | `docs/features/FR-028-2605-ssp-oscal-alignment/implementation-plan-bug-o.md` |
| Handoff (本期接手) | `docs/features/FR-028-2605-ssp-oscal-alignment/handoff/2026-05-25-bug-o-diff-stepper-expansion-handoff.md` |
| Changelog | `docs/changelog/2026-05-25-feat-bug-o-diff-stepper-4key-tabview.md` |
| Handoff (下期 3 個新 bug) | `docs/features/FR-028-2605-ssp-oscal-alignment/handoff/2026-05-25-bug-p-q-r-parties-form-handoff.md` |

---

## 1. Commits 清單（含 H-6 follow-up + Bug O 全部）

### BE (5 個 commits)

| Hash | Type | 內容 |
|---|---|---|
| `d6e135ec` | fix | H-6 follow-up — 3 v3 write strategy 漏改造成 cleanup 後 `org_unit_id` 殘留 |
| `cc7f3c58` | docs | H-6 follow-up changelog + issue 回填 commit hash |
| `a0408de2` | feat | Bug O Phase A — BE diff service 4 key annotation + summary |
| `bedbb91c` | feat | Bug O Phase B — BE confirm 接 4 個 v3 decisions filter（overwrite caveat）|
| `b0032e46` | fix | Bug O regression — 4 v3 list annotated 用獨立 `_diff` key + GET 路徑漏 wire |

### FE (4 個 commits)

| Hash | Type | 內容 |
|---|---|---|
| `4c5ff7d` | feat | Bug O Phase C — FE store 擴展 4 key decisions schema |
| `7e34aeb` | feat | Bug O Phase D — FE 4 新 DiffSection + 3 DiffCard 元件 |
| `061a742` | feat | Bug O Phase E — DiffResolutionStep TabView refactor (126→268 行，6-tab) |
| `5f6458b` | fix | Bug O regression + UI 微調 — store 對齊 `_diff` key / banner i18n / Step 3 確認按鈕綠色 / tab name 對齊 template-edit |

### Phase O-F 收尾（本檔同 commit）

- BE: design.md §11.34 closed + 補 5 教訓 + 補 commit clause + index 拿掉 ⏸ DEFERRED
- BE: changelog `2026-05-25-feat-bug-o-diff-stepper-4key-tabview.md`
- BE: implementation-plan-bug-o.md（plan 本身）
- BE: 本檔 SUMMARY
- BE: 下期 handoff `2026-05-25-bug-p-q-r-parties-form-handoff.md`

---

## 2. 跨 repo 範圍

| Repo | Local commits ahead | 套件版號 |
|---|---|---|
| compliance-manager-be | 8（含 Phase O-F docs commit）| 不 bump（純 feature commit）|
| compliance-manager-fe | 4 | 不 bump |
| jedi-oscal | 無 | 不 bump（本期沒動套件）|
| jedi-common | 無 | 不 bump |

**push 規模**：8 BE + 4 FE = 12 commits。**等 user 拍板 push**。

---

## 3. 行為差異一句話

對既有 mf 重 import docx 時，FE diff stepper 從 2-section（controls + parties）擴展到 6-tab TabView（含 4 個新 v3 key），每 row per-decision；BE confirm 對 overwrite-semantic 寫入 path 正確 inject current row 防 delete。Step 3 預覽 tab name 對齊 template-edit 命名，「確認匯入」按鈕綠色。

---

## 4. 規範文件齊全度

- [x] design.md §11.34 closed + 補 5 教訓 + 補 commit clause
- [x] implementation-plan-bug-o.md（plan 本身留 archive）
- [x] changelog（type=feat，涵蓋 BE + FE + Bug O regression fix + UI 微調）
- [x] handoff（本期接手 + 本期收尾 SUMMARY + 下期 3 bug handoff）
- [x] H-6 follow-up issue 已 resolved + changelog
- [ ] 對話歷史歸檔 → `docs/conversation-history/2026-05-25/bug-o-diff-stepper/` (跑 extract script)
- [x] design.md §11 index 拿掉 ⏸ DEFERRED 標註

---

## 5. 已知 follow-up

### 5.1 本 session 收尾時 user 發現的 3 個新 bug（已寫 handoff 給下個 session）

詳見 `docs/features/FR-028-2605-ssp-oscal-alignment/handoff/2026-05-25-bug-p-q-r-parties-form-handoff.md`：

1. **Bug P (推測命名)**：負責單位預覽畫面點「連結帳號」跳 Error，且應該連到「組織單位」而非「帳號」（FE PartiesSection / PartyLinkDialog 問題）
2. **Bug Q**：參與人員少了「角色」下拉選單（H-N 期可能 regression）
3. **Bug R**：點選匯入後，負責單位 / 參與人員沒更新成新的資料（可能 confirm 後 FE template-edit cache 沒 invalidate，或 BE parties write path 漏；需 trace）

### 5.2 其它 follow-up（非本期 scope）

- jedi-* 套件無異動（Bug O 純主專案 BE + FE）
- BE / FE 版號對齊：本期不 bump，user 拍板 push 後決定要不要進版

---

## 6. 部署 handover

1. **重啟 BE**：必做 — `_apply_v3_decisions` / `_load_current_v3_lists` / annotated `_diff` key 都 in-memory 邏輯，需要 process 重啟
2. **重 build FE**：4 新 vue 元件 + store 改動需 vite build
3. **無 DB migration**：純 JSONB 內 in-memory annotation，既有 `oscal.ssp_docx_parse_jobs.parsed_result` 直接接 4 個新 key

---

## 7. E2E 驗證紀錄（本 session 由 Claude 跑 playwright MCP）

- ✓ Login → /module-frame/<mf>/template-edit → 批次維護 → 從文件匯入 → upload docx → Step 2 看到 6 tab + badge
- ✓ 修補 2 個 regression（annotated 覆寫 raw / FE store init 讀錯 key）
- ⚠️ Step 2 →  Step 3 → confirm 走完整流程未 E2E 完成（user 收尾時切手測），但 plan 已 cover decision filter 邏輯 + pytest 214 passed verify
- ⚠️ 3 個新 bug 由 user 手測發現（已寫 handoff，下期處理）

---

## 8. 跟 H-N arc 的關聯

Bug O 是 H-N 整段 arc 的**第 10 個 follow-up**，補完 update mode 的 diff stepper（H-N 已打通 create mode 的 chain）。完成後 docx import 整段 user-facing chain（create + update mode）就 complete v1 階段，可開始考慮 Phase 5 OSCAL Export deferred plan — 但需先解 5.1 的 3 個新 bug 才算 user-facing complete。
