# Run: Supplier import v2 — INVEST (fable-clone ensemble)

- **run-id (folder):** 2026-07-12-S113-supplier-import-v2-invest
- **workflow:** `wf_e7896ca6-901` (Workflow tool — 5 investigator-codebase lane parallel, RETURN-only schema)
- **session:** S113 · **date:** 2026-07-12 · **owner:** anh Kiệt · **lead:** Opus 4.8 (1M) Max
- **engine:** `fable-clone-ensemble` (H21 LỆNH-B per-invocation — anh gõ `/fable-clone investigator-codebase`)
- **stage:** invest → (next) synthesize spec 3-mục → anh decisions → HMW Opus implement

## Feature + requirements (R1-R7)
Supplier import v2 (NCC Excel):
- **R1** Import đọc ĐÚNG cấu trúc file thật (header ROW 4, 30 cột, Sheet1).
- **R2** Nút "Tải file mẫu" (download template Excel trống đúng layout).
- **R3** Bước MỚI sau upload: user TỰ NHẬP "Mã NCC" (KHÔNG auto-gen; file KHÔNG có cột này).
- **R4** Thiếu Mã NCC → DRAFT/ẩn, không public (nháp trước khi public).
- **R5** Dedup theo MST (Mã số thuế = cột 12).
- **R6** Không MST VÀ không Mã NCC → không được public.
- **R7** List NCC hiện trạng thái Public / đang-ẩn(draft).

## Excel thật (input) — `Data base - 1_7_2027.xlsx`
Sheet1 · 31 col · **header ROW 4** · 4 data row (R5-R8 = 4 NCC đã seed prod). MST=c12 · TÊN VIẾT TẮT(→Code S112)=c4 · header có `\n` trong ô · R2 c22-c31=#REF! · KHÔNG có cột "Mã NCC".

## taskList snapshot (5 lane — CÙNG vai `investigator-codebase`, đa lăng-kính)
1. `invest:schema-data-model` — Supplier entity, Code vs Mã-NCC semantics, SupplierStatus enum, draft/public field, migration
2. `invest:import-service-backend` — SupplierExcelImportService, dedup→MST, bước nhập Mã-NCC, LayoutValid verify tokens
3. `invest:fe-import-dialog-ux` — SupplierImportDialog + SuppliersPage, nút file-mẫu, grid nhập Mã-NCC, badge trạng thái, mirror 2-app
4. `invest:public-visibility-consumers` — grep mọi consumer Supplier, draft-không-public filter, R6 guard
5. `invest:dedup-validation-rules` — dedup-by-MST edge (null/dup), R6 publish-guard, reconcile 22 NCC prod, test cases

## Status
- [x] invest ensemble **DONE** (`wf_e7896ca6-901`) — 4/5 lane structured (schema · import-service · fe-ux · dedup-validation) + 1 lane `public-visibility-consumers` **#53-garble** → em-main-solo recover (grep BE 16 + FE 11 consumer).
- [x] spec-file **WRITTEN** → `spec-supplier-import-v2-12-07-2026.md`
- [!] **CHỜ anh Kiệt chốt** D1 (Mã NCC identity) · D2 (publish gate R4 vs R6) · D3 (authz) → rồi HMW Opus implement.

## Synthesis (em-main refute + P3/P4)
**Hội tụ 4 lane (auto-decide):** IsPublic bool (KHÔNG đụng SupplierStatus) · dedup MST-primary+Code-backstop (chống 500) · backfill 22 prod→public · PublishSupplierCommand riêng (né #73) · template BE-gen ClosedXML · LayoutValid re-bake 30-token-thật (đã extract byte-exact).
**Chẻ đôi (→ anh chốt):** D1 Mã-NCC = Code[schema-lens] vs field-mới[import-lens]. D2 R4-strict vs R6-literal (mâu thuẫn thật). D3 authz FE⧣BE mismatch.
**Recover visibility:** consumers = PE picker (PeWorkspaceCreateView/PeDetailTabs) · ContractCreatePage · CreateContractFromEvaluationFeatures · dashboard — đều qua ListSuppliersQuery → filter `Published`. HMW grep-all trước implement.
→ Chi tiết đầy đủ ở `spec-supplier-import-v2-12-07-2026.md`.

## OUTCOME — SHIPPED PROD (Run #497 PASS 5m14s, commit `5fa11b5`)
Spec → HMW-Opus implement (BE⟂FE parallel) → test-specialist +19 (477 PASS) → reviewer GO-WITH-ADJ (2 must-fix applied) → deploy verified. **4 bug caught+fixed pre-prod:** #53-visibility-lane-recover · null-Code NRE #80 (test-specialist) · authz-403 Import-nút (em verify-chéo) · draft-leak-picker + CreateSupplier-IsPublic (reviewer). Mig 64 prod 37/37-backfill · bundle admin `acprMqfB`/user `Ck3BTDdA` · byte-verify feature PRESENT. ⚠️ #53-garble ×2 (invest-visibility-lane + impl-be-first-return → SendMessage-resume 1/3 finish sạch). Harvest: em-main stamp invest-ensemble `[engine: fable-clone-ensemble · Opus-S113]` + product-agents self-updated diary S113.
