[CLAUDE] Docs: chèn 12 ảnh khoanh-đỏ vào guide Word Duyệt NCC (em chụp prod) + gotcha #74 + closeout S90

- 12 ảnh prod khoanh-đỏ 1→2→3 vào docs/Huong-dan-Duyet-NCC.docx
  pipeline tự-chế: PowerShell CopyFromScreen + Win32 lọc-process-chrome.exe
  + DOM overlay element-based + python-docx (MCP save_to_disk KHÔNG ra file env này)
- gotcha #74 (chụp-prod-vào-docx) + STATUS/HANDOFF S90 + session log
- 0 production code, 0 prod mutation (xem-only), em-main solo

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-06-25 19:09:28 +07:00
parent 946c5b21ae
commit 6a2435f027
5 changed files with 83 additions and 2 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,65 @@
# S90 (2026-06-25) — Chèn 12 ảnh khoanh-đỏ vào guide Word Duyệt NCC (em tự chụp prod) + chẩn UltraViewer
> **em-main solo · 0 production code · HMW-mode ON.** Browser-driving (Chrome-in-Chrome MCP) + scripting (PowerShell/Python) + docx manipulation. KHÔNG sub-agent, KHÔNG Workflow fan-out (task = vòng-lặp thị-giác tuần-tự, không fan-out được).
## Anh giao
`/session-start` → carry S89 "chèn 12 ảnh guide" → **"mở chrome vào chụp ảnh dán vào luôn đi nhé"**. File `docs/Huong-dan-Duyet-NCC.docx` (tạo S89, 12 ô ảnh trống — mỗi ô = bảng 1×1 có caption mô-tả màn cần chụp + "khoanh đỏ 1→2→3"). Cuối phiên anh hỏi **"sao tao thấy có ultraview bật trên máy tao?"** → `/session-end`.
## Việc làm
### 1. Pipeline chụp-prod-vào-docx tự-chế (gotcha #74 NEW)
**Vấn đề lõi:** `mcp__Claude_in_Chrome__computer{screenshot,save_to_disk}` + `mcp__computer-use__screenshot{save_to_disk}` đều "Successfully captured" + trả ID nhưng **KHÔNG ra file truy-cập được** (search TEMP/LOCALAPPDATA/APPDATA/Downloads/session-dir = rỗng). `gif_creator` cũng vô-dụng (ảnh tĩnh = 0 frame). → PIL/python-docx không có file để chèn.
**Giải (ra PNG thật):**
1. **Chụp** — PowerShell `.NET [System.Drawing.Graphics]::CopyFromScreen` (sau `SetProcessDPIAware`) → PNG full-res 2560×1600. Win32 đưa đúng cửa-sổ Chrome lên trước: `EnumWindows`+`GetWindowThreadProcessId` **lọc process `chrome.exe`** (⚠️ app Claude-Code Electron cùng class `Chrome_WidgetWin_1` + title chứa "Solutions ERP" → lọc-theo-title khớp NHẦM) + `SetForegroundWindow` + ALT-tap unlock-foreground.
2. **Khoanh đỏ** — inject DOM overlay `window.__ccA([{text|q,n,minLeft/maxLeft/minTop/maxTop,exact,up,nth}])` **element-based** (`getBoundingClientRect`, miễn-nhiễm viewport đổi). Toạ-độ-cứng (rect px) VỠ vì Chrome-screenshot render kích-thước thay-đổi (1456↔1494, 812↔822↔833). Match **case-INSENSITIVE** (label CSS `text-transform:uppercase``textContent` mixed-case → exact-uppercase MISS, vd "Dự án" hiển-thị "DỰ ÁN"). Lọc `minLeft>250` để **bỏ sidebar** (text "Dự án" trùng menu/header bảng).
3. **Crop** — bỏ chrome top + taskbar bottom (top=92/bottom=72). ⚠️ Banner CDP **"Claude started debugging this browser"** hiện sau mỗi `navigate` (re-attach), tự ẩn → ảnh ngay-sau-navigate (s08, s12) cần crop top≈146; verify nhanh = **montage dải-trên 90px của cả 12 ảnh** đọc 1 lần (detector heuristic-color all-True nhầm header trắng = không tin được, montage tin được).
4. **Chèn**`python-docx cell...add_picture(width=Inches(6.0))` (A4 content=**6.27"** → 6.3" TRÀN) + caption "Hình N. <desc>" italic gray.
### 2. 12 màn đã chụp+khoanh+chèn (route map prod)
| # | Màn | Nguồn |
|---|---|---|
| 1 | Đăng nhập | `/login` (logged-out, email ví-dụ + ô mật khẩu trống) |
| 2 | Menu Duyệt NCC + nút "+ Thêm mới" | `/purchase-evaluations/workspace` |
| 3 | Form tạo phiếu (Hạng mục/Dự án/Địa điểm) | `/workspace?mode=new` |
| 4 | Thêm NCC + báo giá | phiếu nháp (Vingroup 5tr) |
| 5 | Quy trình duyệt + Ngân sách kỳ này | `?mode=new` |
| 6 | Bảng kiểm + nút "Lưu & Gửi Duyệt" | đáy form |
| 7 | Hộp thư — 9 phiếu chờ duyệt | `/inbox` |
| 8 | Nội dung phiếu + bảng so sánh giá (2 NCC) | phiếu "18 Sub Chống mối" |
| 9 | Khu Quyết định: Duyệt / Trả lại | phiếu chờ admin duyệt |
| 10 | Luồng duyệt + cờ "Duyệt là KẾT THÚC" | `/workflow-matrix` |
| 11 | Nút "+ Tạo HĐ từ phiếu" | phiếu Đã duyệt PE/2026/A/017 |
| 12 | Cây Năm>Dự án>Phiếu + Hộp thư + Tổng quan | `/purchase-evaluations` |
**Verify:** `IMAGE_RELS=13` (1 logo + 12) · mỗi slot 1 ảnh + caption · width 6.0" ≤ A4-content 6.27" · montage 12 dải-trên SẠCH banner. **0 prod mutation** (chỉ xem/scroll/screenshot, KHÔNG bấm Gửi/Duyệt/Trả-lại/Tạo-HĐ; `?mode=new` không tạo draft tới khi sửa field — auto-save on-edit). anh tự login Admin.
### 3. Caveats guide (báo anh — carry)
1. **#9 "Từ chối":** app thực-tế chỉ **Duyệt + Trả lại** (gỡ "Từ chối" từ S60) nhưng **text guide** (Mục 5 Bước 4 + caption Hình 9) còn ghi "Từ chối" → cần sửa text (chờ anh OK).
2. **#10 "Duyệt thay CEO":** workflow đang dùng (QT-DN-V2-001) **chưa bật cờ finalize** → không phiếu nào hiện badge "⚑ Duyệt thay CEO" + CEO mờ trên sơ-đồ → em chụp trang Luồng duyệt khoanh **cờ "Duyệt là KẾT THÚC quy trình (không trình tiếp CEO)"** (nơi bật tính-năng). Muốn ảnh badge thật → bật cờ 1 cấp (Admin) rồi chụp lại.
3. **#11 Tạo HĐ:** khoanh nút "+ Tạo HĐ từ phiếu" nhưng KHÔNG bấm (tránh tạo HĐ thật) → caption "hợp đồng nháp được tạo" chưa có ảnh.
4. **account=admin:** sidebar nhiều menu admin nhân-viên không thấy.
### 4. UltraViewer (anh hỏi "sao bật")
Chẩn (read-only): `UltraViewService` (PID 22368) State=Running **StartMode=Auto** StartName=LocalSystem path `C:\Program Files (x86)\UltraViewer\UltraViewer_Service.exe` · **0 kết-nối Established** (không ai đang điều-khiển) · 0 Run-key (auto qua service). **Em KHÔNG mở nó** — chỉ grant Google Chrome; computer-use screenshot **detect + mask** (ẩn) nó vì không trong allowlist. Hướng-dẫn anh tắt self-serve (`Stop-Service UltraViewService` / `Set-Service -StartupType Manual` / `services.msc`) — **KHÔNG tự đổi** (prohibited-rule "modifying system/security settings" → direct user). Cân-nhắc: nếu IT dùng remote-support thì tắt = mất remote.
## Cách chạy / bài học
- **Browser-driving = solo, KHÔNG fan-out:** task vòng-lặp thị-giác tuần-tự (chụp→kiểm→điều-chỉnh→chụp) — Workflow fan-out không hợp; em-main solo đúng decision-tree (cross-stack tight / interactive).
- **MCP save_to_disk KHÔNG đáng-tin để lấy bytes** (env này) → native PowerShell `CopyFromScreen` là đường chắc-chắn ra file (gotcha #74).
- **Annotation element-based >> rect-cứng** khi viewport không ổn-định; case-insensitive + min/maxLeft chống collision label-trùng/sidebar.
- **Banner CDP inconsistent** → montage-verify thay heuristic-color (color-detect nhầm header trắng).
- An-toàn prod: `?mode=new` không persist tới khi edit; tuyệt-đối không bấm nút mutate.
## §L closeout
§L.a: 0 RCA (0 production code/bug; UltraViewer = direct-user KHÔNG vi-phạm system-setting). §L.b(c): test-specialist L1 34.8KB OVER carry · sleep <7d skip · 0-spawn archive-gate state=start. §L.b(d)(f): 0 sub + 0 `runs/` harvest n-a. §L.b(g): tooling KHÔNG đổi self-check no-spawn-H1. §L.b(h): 4 Active-High không đổi, 0 governance-mới n-a chỉ hiển-thị.
## 📊 Hot-feed %-print cuối phiên (Tầng-1 lead cap 220K)
Ước-lượng: WIP guide-task ~40% · bootstrap-context (STATUS/HANDOFF/README/budget/marks) ~25% · closeout-write ~25% · UltraViewer-diagnostic ~5% · lỗi-lặp/gotcha ~5%. **Headroom: vừa** phiên đốt nhiều tool-result browser (ages out), nội-dung-công-việc nạp đủ, KHÔNG nhồi-rác. *(Ước-lượng-tỉ-lệ; con-số = quyền anh.)*
## State
**GIỮ NGUYÊN: Mig 59 · 88 bảng · 422 test (45D+377I) · gotcha 74 (+#74) · menu 54 · bundle admin `DalcOhvb`/user `CdS4tX_2` · prod 17 user thật.** Chỉ `docs/` đổi (docx + STATUS/HANDOFF/gotchas/log) CI skip.
## NEXT
- **Anh:** review `docs/Huong-dan-Duyet-NCC.docx` trong Word · restart CLI (carry budget v3 + `/user-mark-*` + cadence) · (tùy) bật finalize ảnh #10 badge / bấm tạo thử ảnh #11.
- **Em:** sửa text guide "Từ chối"→"Duyệt/Trả lại" nếu anh OK · curate test-specialist L1 34.8KB OVER (carry S88).
- **monthly 2026-07-01:** tách STATUS/HANDOFF mega-line (≤S87 session logs, GẤP không Read được) · ef-core SKILL Mig59 · 3 vocab-fork alias-map.

View File

@ -1268,6 +1268,22 @@ for h in resp.points: # ← .points không phải iterable trực tiếp
**References:** `src/Backend/SolutionErp.Application/PurchaseEvaluations/PurchaseEvaluationFeatures.cs:~282` (UpdatePeDraftHandler) · `fe-user/src/components/pe/PeHeaderForm.tsx:112` (PUT no-workflow) · bug-class S42 (BudgetPeriodAmount null-safe S61) · `tests/.../PeUpdateDraftWorkflowPreserveTests.cs`.
### 74. MCP `save_to_disk` (Chrome MCP + computer-use) KHÔNG tạo file truy-cập được trong env này → chụp ảnh prod cho docs bằng PowerShell `CopyFromScreen` (Session 90)
**Triệu chứng:** Cần chụp 12 màn prod (eoffice) khoanh-đỏ chèn vào Word guide. `mcp__Claude_in_Chrome__computer {action:screenshot, save_to_disk:true}` + `mcp__computer-use__screenshot {save_to_disk:true}` đều báo "Successfully captured" + ID nhưng **KHÔNG in path + KHÔNG tạo file nào tìm thấy được** (search TEMP/LOCALAPPDATA/APPDATA/Downloads/session-dir = rỗng) PIL/python-docx không file ảnh để chèn. `gif_creator` cũng vô-dụng (ảnh tĩnh = 0 frame).
**Cơ chế:** `save_to_disk` chỉ đính ảnh vào hội-thoại cho user xem, KHÔNG persist ra path lead truy-cập được (harness/env này).
**Fix — pipeline tự-chế (ra PNG thật):**
1. **Chụp:** PowerShell .NET `[System.Drawing.Graphics]::CopyFromScreen` (sau `SetProcessDPIAware`) PNG full-res (2560×1600, DPR=1). Đưa đúng cửa-sổ Chrome lên trước bằng Win32: `EnumWindows`+`GetWindowText`+`GetWindowThreadProcessId` lọc **process `chrome.exe`** + `SetForegroundWindow` + ALT-tap unlock-foreground. Lọc theo title "Solutions ERP" KHÔNG đủ **app Claude Code (Electron) cùng class `Chrome_WidgetWin_1` + title chứa tên project** khớp nhầm; PHẢI lọc process-name = `chrome`.
2. **Khoanh đỏ:** inject DOM overlay `window.__ccA([{text|q, n, minLeft/maxLeft/minTop/maxTop, exact, up, nth}])` **element-based** (bám `getBoundingClientRect`, miễn-nhiễm viewport đổi). Toạ-độ-cứng (rect px) KHÔNG ổn Chrome-screenshot render kích-thước thay-đổi (812833). Match **case-INSENSITIVE** (label CSS `text-transform:uppercase` `textContent` mixed-case exact-uppercase MISS).
3. **Crop:** bỏ chrome trình-duyệt top + taskbar bottom (top=92/bottom=72). Banner CDP **"Claude started debugging this browser"** hiện sau mỗi `navigate` (CDP re-attach), tự ẩn sau vài giây ảnh chụp ngay-sau-navigate cần crop top146; verify nhanh bằng **montage dải-trên 12 ảnh** đọc 1 lần.
4. **Chèn:** `python-docx` `cell...add_picture(width=Inches(6.0))` A4 content = **6.27"** nên 6.3" TRÀN; dùng 6.1".
**An toàn prod:** chỉ XEM/scroll/screenshot KHÔNG bấm nút mutate (Gửi duyệt/Duyệt/Trả lại/Tạo ). Mở `+ Thêm mới` (form `?mode=new`) KHÔNG tạo draft cho tới khi sửa field (auto-save on-edit).
**References:** `$env:TEMP\guideshots\capture.ps1` (session-scratch) · `docs/Huong-dan-Duyet-NCC.docx`. Pattern reusable user-memory `pattern_prod_screenshot_to_docx`.
---
## Checklist debug bug mới