[CLAUDE] Docs+Memory: S37 wrap — Mig 37 + G-O3 Đề xuất deploy prod end-to-end Run #246 PASS

S37 final wrap (1 commit code de1c378 + this docs wrap):
- Mig 37 enum extend +5 values + Mig 38 Proposal schema (4 entity)
- BE ~700 LOC + FE 4 file × 2 app SHA256 IDENTICAL
- CI Run #246 PASS 3m53s + bundle rotate × 2 + workflow QT-DX-V2-001 prod live
- gotcha #53 5th + 529 Overload 1× — em main solo fallback proven reliable

Pattern reinforced cumulative S37:
- Pattern 12-bis cross-module mirror 11× (PE V2 → Proposal V2 ApproveV2)
- Pattern 16-bis 4-place mirror cross-app 8×

Next S38: Plan G-O4 Đơn từ Mig 39 (Leave/OT/Travel + LeaveBalance business logic).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-05-28 15:59:16 +07:00
parent de1c378279
commit 17aaba9df0
5 changed files with 70 additions and 9 deletions

View File

@ -174,6 +174,8 @@ Bug latency observed when miss points 9-10: 2-3 days prod silent (Mig 28-29 depl
## 📅 Recent runs (FIFO — slim post-curate 2026-05-22)
- **2026-05-28 15:51-15:55 Run #246 (task 360) sha=`de1c378` VERDICT=PASS ~3m53s (S37 Plan G-O3 Đề xuất Mig 37+38 + BE Proposal CRUD + FE × 2):** Push range `f45090b..de1c378` 1 commit full-stack scope `Domain+App+Infra+Api+FE-Admin+FE-User`. **Stage results ALL PASS** (task #360 status=success, dur 3m53s computed 15:51:25→15:55:18). **Post-deploy verify ALL PASS Stage 4:** (a) **3 prod domain smoke ALL 200**: api/health/ready 200 0.27s + admin 200 0.13s + eoffice 200 0.11s. (b) **Bundle hash BOTH rotated**: admin `C9kzTTmq``CGueDk22` + user `CC4DQ-Tr``CEt0QRgX` (Plan G-O3 ship confirmed FE × 2). (c) **Mig 38 prod TOP 5 DESC MATCHES repo**: `AddProposals` (Mig 38 head 20260528082726) → `ExtendApplicableTypeForWorkflowApps` (Mig 37 20260528082332) → `AddMeetingRooms` (36) → `AddHrmConfigs` (35) → `AddEmployeeProfiles` (34). (d) **3 NEW endpoint smoke ALL 200**: `GET /api/proposals?page=1&pageSize=10` 200 0.38s → 0 items empty paged list expected + `GET /api/approval-workflows-v2?applicableType=4` 200 0.39s → 1 row `QT-DX-V2-001` "Quy trình duyệt Đề xuất mẫu V2" (sample seed Phòng CCM × 1 Cấp Lê Văn Bình). (e) **Menu seed Off_DeXuat verify MATCH 4 row**: Off_DeXuat_List + Off_DeXuat_Create + Off_DeXuat_Inbox + Off_DeXuat (root). (f) **Sample workflow Proposal V2 seed MATCH**: COUNT=1 row `QT-DX-V2-001` ApplicableType=4. **0 prod regression Run #246.** Pattern 12-bis cross-module mirror PE V2 → Proposal V2 cookie-cutter STRONG: BE+Mig 37 enum extend + Mig 38 Proposal table + FE × 2 1 commit cohesive, 1 sample workflow seed + 4 menu hierarchy clean. Stage 4.6 sample seed verify PASS (Mig 38 SeedSampleProposalWorkflowV2Async correctly INFRASTRUCTURE-gated, NOT inside DemoSeed disabled per gotcha #51 fix). Poll loop 6 iter × 30s ~3m wait running→success transition smooth. Token cost ~13K (Read MEMORY + git log + Gitea API task poll × 7 + auth login + 3 smoke + 2 endpoint + 2 sqlcmd + 1 bundle hash). Tag: `[s37, run246, pass, mig-37-38, proposal-v2, full-stack]`. **Cumulative confirm:** Pattern 12-bis cross-module mirror PE V2 → Proposal V2 verified end-to-end prod live; ApplicableType enum extend Mig 37 (add ProposalGeneral=4) + Proposal table Mig 38 + Workflow V2 ApproveV2 wire reuse from PE/Contract.
- **2026-05-28 15:06-15:10 Run #359 (task 359) sha=`f45090b` VERDICT=PASS ~3m55s (S36 Plan G-O2 Phòng họp Mig 36 + BE CRUD + FE 2 app):** Push range `8afdc1e..f45090b` 1 commit (scope `Domain+App+Infra+Api+FE-Admin+FE-User` full-stack). **Stage results ALL PASS** (task #359 status=success, dur 3m55s computed 15:06:37→15:10:32, slightly over baseline 3m30s due to Mig 36 + BE CRUD + FE × 2 cookie-cutter): test gate 120/120 baseline preserved + build_be (MeetingRoom/MeetingBooking entity + Mig 36 + Application Features compile OK) + build_fe_admin + build_fe_user (BOTH rotate). **Post-deploy verify ALL PASS Stage 4:** (a) **3 prod domain smoke ALL 200 OK**: api/health/ready 200/0.33s + admin 200/0.24s + eoffice 200/0.27s. (b) **Bundle hash BOTH rotated**: fe-admin `Bl6e54yi``C9kzTTmq` + fe-user `DHmW2tUF``CC4DQ-Tr` (Plan G-O2 ship confirmed FE × 2 app cookie-cutter). (c) **Mig 36 prod TOP 5 DESC head MATCHES repo**: `20260528074125_AddMeetingRooms` (Mig 36 head) → `AddHrmConfigs` (35) → `AddEmployeeProfiles` (34) → `AddContractLevelOpinions` (33) → `AddApprovalWorkflowToContract` (32). (d) **2 NEW endpoint smoke ALL 200 OK**: `GET /api/meeting-rooms` 200/0.26s → **4 rows** (ONL-1 Trực tuyến Zoom cap=50 + PH-A Phòng họp lớn cap=20 + PH-B Phòng họp nhỏ cap=8 + PHG-501 Phòng Giám đốc cap=6) + `GET /api/meeting-bookings?roomId=<first>&startDate=2026-05-28&endDate=2026-06-04` 200/0.29s → **0 rows** (no booking yet, expected). (e) **MeetingRooms seed verify EXACT MATCH spec**: COUNT=4 + Code list ONL-1/PH-A/PH-B/PHG-501 all present (DbInitializer SeedMeetingRoomsAsync auto-applied on startup). (f) **Menu seed verify EXACT MATCH spec**: 4 row `Off_PhongHop%` (root `Off_PhongHop` Order=2 ParentKey=Off + 3 leaf `Off_PhongHop_View` Order=1 + `Off_PhongHop_Manage` Order=2 + `Off_PhongHop_Book` Order=3). **0 prod regression observed Run #359.** **Polling pattern WORKED:** until-loop 7 iter × 30s = 3m30s wait from running → success transition (15:06:37 created → 15:10:32 updated, smooth deploy). Token cost ~11K (Read MEMORY + git log + Gitea API task poll × 8 + 3 smoke + 2 endpoint + 3 sqlcmd + 1 bundle hash + 1 auth login + tmp/mr.json parse). Tag: `[s36, run359, pass, mig-36, meeting-rooms-bookings, full-stack]`. **Pattern 12-bis cross-module mirror PE V2 → Meeting Room CRUD confirmed strong**: BE+Mig+FE×2 1 commit cohesive, 4 sample seed clean, menu hierarchy 4 row exact match.
- **2026-05-28 S36 startup VERIFY (em main spawn read-only post-S35 wrap) sha=`8afdc1e` (HEAD docs only):** S35 wrap complete — 5 commits push range `63dd9ec..8afdc1e`. **Gitea API last 5 tasks (limit=10) all status=success**: task #358 sha=`021674a` (Run #244 — S35 Plan G-H2 Task 4 declarative HrmConfigsPage, 2026-05-28 10:01-10:05, dur=218s = 3m38s) + task #357 sha=`909655c` (Run #243 — S35 Plan G-H2 Task 3 BE CRUD 16 endpoint, 09:51-09:55, 223s = 3m43s) + task #356 sha=`c3cd343` (Run #242 — S35 FE inline forms 5 satellite, 09:39-09:43, 232s = 3m52s) + task #355 sha=`07b3f3b` (Run #241 — S34 Plan 4 G-H2 Mig 35 foundation, 2026-05-27 15:04-15:08, 210s = 3m30s) + task #354 sha=`e506cd8` (Run #240 — S34 Plan 3 Item 3 BE satellite CRUD, 14:56-15:00, 216s = 3m36s). **Token API unauth quirk:** `TokenLen=0` reported but `Total=244` workflow_runs returned (anonymous read OK for public repo metadata — gotcha confirmed). Final 2 docs commits `4d50b34 + 8afdc1e` correctly SKIPPED CI per gotcha #41 path filter `**/*.md` (no task #359 in list — verified). **VERDICT=PASS Stage 4 cumulative S35 healthy:** (a) **3 prod domain smoke ALL 200 OK**: `api.solutions.com.vn/health/ready` 200/0.37s + `admin.solutions.com.vn` 200/0.50s + `eoffice.solutions.com.vn` 200/0.31s. Note `/api/health` (per spec line) returns 404 — canonical path is `/health/ready` (gotcha S32 already documented). (b) **Bundle hash live prod EXACT MATCH S35 STATUS expected**: fe-admin `index-Bl6e54yi.js` ✓ + fe-user `index-DHmW2tUF.js` ✓ (Plan G-H2 Task 4 declarative HrmConfigsPage Run #244 ship confirmed end-to-end). (c) **Qdrant RAG infrastructure live**: Service `Qdrant` Status=Running StartType=Automatic (NSSM Windows Service per S27 fix preserved) + `http://localhost:6333/healthz` 200 "healthz check passed" + collection name CORRECTED **`proj_solution_erp`** (NOT `solution_erp` — naming convention `proj_*` cross-project: ashico_erp/benhvien_aau/dh_y_duoc/namgroup_main/solution_erp/vipix_ai_infra/vipix_multisite total 7 collections registered) POINTS=**3076** STATUS=green optimizer_status=ok (S31 baseline 2988 → +88 chunks S32-S35 cumulative content growth — Plan G-H1 EmployeeProfiles + Plan G-H2 HrmConfig + Pattern 12-bis/12-ter MEMORY docs + S33-S35 STATUS/HANDOFF updates). (d) **TLS cert not yet probed this spawn** (`openssl s_client` not invoked — defer per S32 baseline `notAfter 2026-07-23` ~56 days remaining + auto-renew win-acme 30d window ~2026-06-23). **0 prod regression observed S35 cumulative end-to-end** (3 deploy Run all PASS, all post-deploy smoke green, bundle hash match expected, RAG infrastructure live). **DISCOVERY #8 NEW collection naming:** RAG collection prefix `proj_*` standardized across 7 projects on this VPS — future skill `cicd-monitor` Stage 0 should reference `proj_solution_erp` not `solution_erp`. Update Stage 0 spec in agent system prompt. **STANDBY STATE ANNOUNCED:** Awaiting S36 push trigger. Token cost S36 startup ~14K (Read MEMORY × 2 + 4 Invoke-RestMethod Gitea API + 4 Invoke-WebRequest smoke + 3 Qdrant probe + 2 bundle hash grep + cache fallback tasks.json). Tag: `[s36, startup, standby, discovery-8-rag-naming]`.

View File

@ -129,6 +129,8 @@ State machine 5 trạng thái phiếu PE: Nháp / Đã gửi duyệt / **Trả l
## 📅 Recent activity (last 10 FIFO)
- **2026-05-28 (S37 Plan G-O3 Đề xuất pre-flight 4 task):** Em spawn ~14K. **T1 Enum:** `ApprovalWorkflowApplicableType``ApprovalWorkflow.cs:45-50` Mig 22 add — 3 value 1-based (DuyetNcc=1, DuyetNccPhuongAn=2, Contract=3) NOT 0-based. Mig 37 +1 value Proposal=4 (G-O3 first), reserve 5-8 cho G-O4..O6 future. **T2 PE pattern intel** (mirror skeleton Mig 38): main entity 25 field critical (Id/MaPhieu/Type/Phase 5-state/TenGoiThau/ProjectId/DepartmentId/DrafterUserId + ApprovalWorkflowId pin V2/CurrentStepIndex/CurrentLevelOrder + BudgetId/BudgetManual + RejectedFromPhase legacy + 8 nav list). LevelOpinion UNIQUE per-LEVEL NOT per-User (composite `(PEId, LevelId)`), FK Cascade Pe + Restrict Level, denorm SignedByFullName(200). CodeSequence **1 row per Prefix** (NOT N rows per year): `PE/YYYY/A` + `PE/YYYY/B` riêng, 3 col Prefix PK+LastSeq+UpdatedAt, tx SERIALIZABLE. ApproveV2Async logic 7 step (load eager → group Levels by Order = Cấp OR-of-N → match actor.Id ∈ ApproverUserId + Admin bypass → log Approval + UPSERT LevelOpinion auto sync → F2 skipToFinal check matchingLevel.AllowApproverSkipToFinal advance tới last Step+last Level Phase giữ ChoDuyet → advance normal levelOrder++ trong Step → next Step reset 1 → DaDuyet terminal). **T3 NamGroup Proposal**: 3 entity `TblRequest.cs` (25 cols generic + SoTien decimal + NguoiNhanTien + TaiKhoanNganHang advance payment) + `TblRequestConfig.cs` (CSV ListApproval inline + IsDirectManager) + `TblRequestListApproval.cs` (forward mechanism qua NguoiChuyenTiepId/NgayChuyenTiep + ChapThuanHoanToan int). **Verdict: SOL CLEAN-ROOM MẠNH HƠN** — NamGroup generic Request KHÔNG phân biệt Đề xuất/Yêu cầu/Phép (1 entity cover ALL). SOL dedicated `Proposal` entity + Workflow V2 pin FK > NamGroup inline CSV JSON. **T4 Mig 38 propose 4 bảng**: Proposals (Code `DX/YYYY/NNNN`, Title/Desc/Category nullable FK + free text fallback, AmountEstimate decimal? optional, Status ProposalStatus 5-state mirror PE, DepartmentId/DrafterUserId, ApprovalWorkflowId pin ApplicableType=4 + CurrentStep/Level pointer + SLA) + ProposalAttachments + ProposalLevelOpinions UNIQUE (PropId, LevelId) + ProposalCodeSequences 1 row Prefix `DX/YYYY`. **3 decision points em main chốt**: (1) CategoryId nullable FK + free text fallback (lesson Plan C drift 8 FK ZERO populated 1675 NV). (2) 5-state mirror PE NOT 7-state Contract (Đề xuất đơn giản hơn HĐ). (3) Dedicated `ProposalStatus` enum NOT reuse PurchaseEvaluationPhase (anti-pattern cross-module coupling). **Surprises**: (a) NamGroup TblRequest có `SoTien + NguoiNhanTien + TaiKhoanNganHang` advance payment — SOL có cần? Defer Mig 39 optional. (b) F1+F3+F4+F2 per-Level pattern Mig 29-31 — Proposal có nên mirror? Option B "đơn giản KHÔNG flag" tiết kiệm 3 chunk admin Designer. (c) **Recommend gộp Mig 37+38 → 1 Mig** `AddProposalsAndExtendApplicableType` (mirror Mig 20 Contract N-stage gộp). Token cost ~14K.
- **2026-05-28 (S36 Plan G-O2 pre-flight Phòng họp 3 task):** Em spawn ~10K. **T1 NamGroup `TblResource` + `TblBookingResource`** (`NAMGROUP.Server\Data\Entities\TblPhongHop.cs` 5-47): 2 entity LEGACY V1 reuse, KHÔNG dedicated MeetingRoom. TblResource 11 cols generic (Id long, GroupReSourceID, NameReSource, ListManager CSV NhanVienID, ListViewer CSV, Note, IsDelete int?). TblBookingResource 18 cols (ResourceID, Title, FromDate datetime giờ-phút, ToDate, ThanhPhan plain text NOT CSV, TrangThai int? -1=Rej/0=Pending/1=Approved/2=Cancelled, IsDelete int? NULL=active+1=deleted ZERO `=0` rows, Note1 admin secondary, AcceptUser/AcceptDate/RejectUser/RejectDate). **5 gotcha NamGroup**: (1) IsDelete filter `(IsDelete ?? 0) != 1` NOT `== 0`, (2) TrangThai 4-state NO Completed, (3) ThanhPhan plain text NOT CSV NV ID, (4) Note1 admin only, (5) V1 ZERO overlap protection (37 overlap pairs prod 798 rows). Repo `PhongHopRepository.cs:61-75` overlap app-level: `b.FromDate < toDate AND b.ToDate > fromDate AND TrangThai NOT IN (-1, 2)`. CSV ListManager → manager approve. **Conclusion: SOL Mig 36 CLEAN-ROOM** mirror G-H2 verdict — KHÔNG port reason: (a) TblResource mix 4 group catalog generic, (b) ThanhPhan plain text yếu cho notification, (c) ZERO overlap V1 → SOL phải DB-level SERIALIZABLE tx. **T2 FullCalendar v6 React** (https://fullcalendar.io/docs/react): `@fullcalendar/react` MIT cho core + 3 plugin daygrid/timegrid/interaction. Premium chỉ Resource Timeline + Vertical Resource (NOT cần Plan G-O2). Drag-resize event = MIT `@fullcalendar/interaction`. Bundle ~150-200KB gz (bundlephobia 403). **Alternative**: NamGroup `PhongHopPage.tsx:10-12` S50 hotfix CHỐT custom day-grid HTML NO lib install reason "saves install friction + bundle minimal" — 1 file ~600 LOC month-view custom grid 5-6 rows × 7 cols Sun-Sat. `react-big-calendar` MIT clean alternative nhưng semi-deprecated. **T3 Schema Mig 36 propose 3 entity** (KHÔNG 2): `MeetingRoom` (Id Guid, Code unique nvarchar(20), Name nvarchar(200), Capacity int, Location nvarchar(200), Equipment nvarchar(500)?, IsActive bit, IsDeleted, audit) + `MeetingBooking` (Id, RoomId FK Restrict, BookedByUserId FK Restrict, StartAt datetime2, EndAt datetime2, Title nvarchar(200), Description nvarchar(1000)?, Status enum int Confirmed=1/Cancelled=2/Completed=3, Note nvarchar(500)?, audit) + **`MeetingBookingAttendees` join** (BookingId FK Cascade, UserId FK Restrict, PK composite (BookingId, UserId), Notes nvarchar(200)?). **Attendees mode JOIN TABLE** (NOT JSON) reason: (a) notification push query indexed efficient, (b) FE picker multi-select shadcn reuse Users API, (c) audit "ai từ chối" future ready. **Overlap check** SERIALIZABLE tx + `EXISTS WHERE RoomId=@r AND Status=1 AND StartAt < @newEnd AND EndAt > @newStart AND Id != @currentId` → 409 Conflict. **Recommend index** `IX_MeetingBookings_RoomId_StartAt` composite range query. **Surprises**: (a) NamGroup s47 Plan 9.2 V1 reuse dựa 798 row prod data NOT scratch — SOL có lợi thế clean-room không legacy. (b) NamGroup community ưu tiên bundle size hơn dev velocity (custom HTML grid thay FullCalendar) — em main weigh trade-off ~150KB cost vs drag-drop UX. (c) `TblBookingResource` NO Title index — SOL must add IX. **Recommend forward**: (1) Mig 36 design 3 entity clean-room per propose; (2) FullCalendar v6 MIT fe-admin (manager view drag-drop) + custom day-grid HTML fe-user (book simple) — split UX 2 app per convention; (3) Skill `ef-core-migration` attach Implementer. Token cost ~10K.
- **2026-05-28 (S36 startup audit — 3 task readonly factual report):** Em spawn 1 lần ~12K token. **Task 1 — MEMORY size 4 sub-agent:** path actual project-level `D:\Dropbox\CONG_VIEC\SOLUTION\SOLUTION_ERP\.claude\agent-memory\{agent}\MEMORY.md` (em main provide path user-level `C:\Users\pqhuy\.claude\projects\...\agents\` KHÔNG tồn tại — em correct path). Investigator 24.7KB/157 lines borderline · Implementer **36.4KB/419 lines PRIORITY curate** · Reviewer 28.4KB/181 lines borderline · CICD **40.4KB/213 lines PRIORITY curate**. Drift +12-15KB ALL 4 agent từ S33 startup baseline (cicd 25.5→40.4, implementer 28.6→36.4, reviewer 25.9→28.4, investigator 20.2→24.7) — heavy S33+S34+S35 entries chưa archive. **Task 2 — Audit định kỳ status:** `docs/changelog/skill-audit-2026-05.md` 6.2KB manual 2026-05-04 + `skill-audit-2026-05-late.md` 9.1KB early-trigger 2026-05-22 (drift +8 gotcha 41→49). Next scheduled 2026-06-01 (CLAUDE.md:60 confirm). Today 2026-05-28 còn **4 ngày → SKIP audit lần này**. Cron `solution-erp-skill-audit-monthly` fire 9:00 AM ngày 1. **Task 3 — Plan G-* progress map 10 atomic (NOT 11 — Cấu hình + Hồ sơ NS gộp Phase 10.1):** ✅ G-H1 S33 (commit 5400983..79a8343 Run #237 PASS, 67 tables Mig 34) + ✅ G-H2 S34+S35 (commit 07b3f3b schema + 909655c BE + 021674a FE Run #244 PASS Mig 35). ⏳ 8 pending: G-O1 Danh bạ (1 endpoint nhẹ nhất) · G-O2 Phòng họp Mig 36 FullCalendar · G-O3-O6 Workflow Apps cần extend `ApplicableType` enum +5 (Mig 37 first cookie-cutter Mig 22) · G-H3 Dashboard NS · G-P1 Chấm công GPS web Mig 42. **NO DRIFT** giữa `feedback_phase10_namgroup_port.md` (4 quyết định) vs `migration-todos.md:637-792` (Phase 10 backlog). **Recommendation forward S36:** (a) Curate session PRIORITY cicd-monitor (40.4KB) + implementer (36.4KB) trước kick off Plan G-O1; (b) Reviewer 28.4KB defer S37 nếu không kịp; (c) Plan G-O1 phù hợp S36 sau curate (1 endpoint + 1 FE page). **Surprise:** Em main note "G-O1 Danh bạ S34 done" trong instruction — DRIFT thực tế. Migration-todos:696-700 G-O1 vẫn ⏳ pending. Anh main confuse với G-H1 S33 + G-H2 S34/35. Token cost ~12K.