[CLAUDE] Docs+Memory: Plan CA wrap — gotcha #50 + Implementer Pattern 16-bis + STATUS
docs/gotchas.md: - Add gotcha #50 "Page move cross-app Layout.tsx resolvePath staticMap missed mirror → silent sidebar drop" - Reference Hotfix 1 commite55d96b+ Implementer Chunk B06a441cmissed point 4 - Add checklist item 25 vào "Checklist debug bug mới" section .claude/agent-memory/implementer/MEMORY.md: - Add Pattern 16-bis "4-place mirror checklist khi cookie-cutter copy page CROSS-APP" - 4 places: page + Routes + menuKeys.ts + Layout.tsx staticMap - Bug latency observed lesson + REFUSE criteria note + Reviewer Cat 1 wire claim verify suggestion docs/STATUS.md: - New Last updated S29 header với Plan CA cumulative summary - 7 commits chain + 2 CI runs PASS + bundle hash rotate + multi-agent ROI breakdown - Stats updated: 50 gotcha (+1), 13 AppRoles (+1 CatalogManager), 34 active users (+catalog.manager), 36 FE pages (+4) Docs-only commit → CI skip per paths-ignore (gotcha #41 + #47 confirmed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -836,6 +836,47 @@ var changelog = await db.PurchaseEvaluationChangelogs
|
||||
- File: `fe-user/src/components/pe/PeDetailTabs.tsx:1995-2070` (ApprovalsTab + decisionBadge + extractNextTargetHint)
|
||||
- Mirror: `fe-admin/src/components/pe/PeDetailTabs.tsx`
|
||||
|
||||
### 50. Page move cross-app — `Layout.tsx` `resolvePath` staticMap missed mirror → silent sidebar drop (Session 29 Plan CA Hotfix 1)
|
||||
|
||||
**Triệu chứng:** Plan CA move 4 master pages từ fe-admin → fe-user (commit `06a441c` Implementer Case 2). BE `/api/menus/me` return tree đầy đủ (Master + 4 children + Catalogs sub-tree 4 children, ALL CanRead=true). Admin login eoffice → sidebar group "DANH MỤC" expand chỉ thấy "Danh mục chi tiết" (Catalogs), **3 leaf Suppliers/Projects/Departments + 4 sub-catalogs biến mất silent**.
|
||||
|
||||
**Root cause:** `fe-user/src/components/Layout.tsx:55-94` `resolvePath(key)` staticMap chỉ có 7 entries cho `Dashboard/Contracts/PE/Budgets/Bg_*`. THIẾU 7 entries cho master/catalog leaf mới move:
|
||||
- `Suppliers`, `Projects`, `Departments`
|
||||
- `CatalogUnits`, `CatalogMaterials`, `CatalogServices`, `CatalogWorkItems`
|
||||
|
||||
Component `MenuLeaf` line 238: `if (!path) return null` → khi `resolvePath` trả null, component returns null → React render nothing → **silent drop khỏi DOM**, không có error toast/console warn.
|
||||
|
||||
**Fix Hotfix 1 (`e55d96b`):** Thêm 7 entries vào fe-user `staticMap` mirror EXACT từ fe-admin `Layout.tsx:33-47`:
|
||||
```typescript
|
||||
const staticMap: Record<string, string> = {
|
||||
Dashboard: '/dashboard',
|
||||
// ... existing 6 entries
|
||||
Suppliers: '/master/suppliers',
|
||||
Projects: '/master/projects',
|
||||
Departments: '/master/departments',
|
||||
CatalogUnits: '/master/catalogs/units',
|
||||
CatalogMaterials: '/master/catalogs/materials',
|
||||
CatalogServices: '/master/catalogs/services',
|
||||
CatalogWorkItems: '/master/catalogs/work-items',
|
||||
}
|
||||
```
|
||||
|
||||
**Pattern reusable — 4-place mirror checklist khi Implementer Case 2 cookie-cutter copy page cross-app:**
|
||||
1. ✅ Page file (`pages/<dir>/*.tsx`) — copy nguyên content
|
||||
2. ✅ `App.tsx` Routes — add `<Route path="..." element={...} />`
|
||||
3. ✅ `lib/menuKeys.ts` constants — mirror BE `MenuKeys.cs`
|
||||
4. ⚠️ **`components/Layout.tsx` `resolvePath` staticMap** — KEY mapping → route path. **DỄ MISS** vì khác file scope với pages directory.
|
||||
|
||||
**Bonus:** fe-admin có `staticMap` đầy đủ từ trước Plan CA → mirror dễ. fe-user trước Plan CA KHÔNG có master keys → Implementer cookie-cutter copy page nhưng quên check staticMap diff.
|
||||
|
||||
**Phòng tránh tương lai:** Implementer Case 2 cross-app page move task prompt MUST list 4 places explicit. Reviewer Cat 1 wire claim verify SHOULD include: "Sidebar menu visible end-to-end test post-build".
|
||||
|
||||
**References:**
|
||||
- Commit Hotfix 1: `e55d96b` (Run #230 PASS, fe-user bundle `DVBLmZlt` → `Dgn1iU9E`)
|
||||
- File: `fe-user/src/components/Layout.tsx:55-94` (resolvePath staticMap + line 238 MenuLeaf null guard)
|
||||
- Original Plan CA Chunk B commit: `06a441c` (Implementer missed point 4)
|
||||
- Mirror: `fe-admin/src/components/Layout.tsx:33-53`
|
||||
|
||||
## Checklist debug bug mới
|
||||
|
||||
1. Build pass không? → fail → check using + package version compat
|
||||
@ -862,4 +903,5 @@ var changelog = await db.PurchaseEvaluationChangelogs
|
||||
22. Nếu button workflow label nói "Trả lại" nhưng phiếu vẫn tiến approve → audit FE `isReject` payload condition vs button `isSendBack` label condition vs dialog `isSendBack` warning condition — phải sync 3 chỗ với CÙNG set target phase. BE thêm guard `(target ∈ terminalSet) ⇔ (decision=Reject)` chặn caller mismatch (#45)
|
||||
23. Nếu Gitea Actions API trả 404 trên `/actions/runs` → đúng path là `/actions/tasks` (Gitea naming khác GitHub). Cache `updated_at` stale ~2 min → cross-check VPS file LastWriteTime cho time-sensitive verify (#46)
|
||||
24. Nếu test `OrderByDescending(CreatedAt).First()` query audit table fail sau add Changelog mới → SQLite frozen-clock tie-break, MUST filter Summary/EntityType discriminator (#48)
|
||||
25. Nếu page move cross-app (Implementer Case 2) nhưng menu leaf KHÔNG hiện sidebar dù BE trả permission OK → check `Layout.tsx` `resolvePath` staticMap miss key mapping → MenuLeaf null guard silent drop (#50). 4-place mirror checklist: page + Routes + menuKeys.ts + Layout.tsx staticMap
|
||||
25. Nếu UI audit list show `Đã gửi duyệt → Đã gửi duyệt` lặp gây nhầm → drop dual-phase badge khi state machine self-loop, thay Decision badge + next-target hint parse từ comment (#49)
|
||||
|
||||
Reference in New Issue
Block a user