# Session 33 — Plan B G-H1 + Plan C B-Wrap deploy prod end-to-end **Date:** 2026-05-26 (16:00 → 20:45 ICT, ~5h cumulative) **Trigger:** Anh main chốt "Plan cha B và Plan cha C" sau S33 startup audit + drift patch. ## Outcomes - **34 mig** (+1 Mig 34 `AddEmployeeProfiles`) - **67 tables** (+7: EmployeeProfile + 5 satellite + EmployeeCodeSequence) - **~153 endpoints** (+5 employees REST: GET list, GET detail, POST, PUT, DELETE) - **40 FE pages** (+2 EmployeesListPage + EmployeeCreatePage × 2 app SHA256 IDENTICAL) - **62 menu keys** (+2 Hrm + HrmHoSo) - **120 test PASS** (+9 BW1-BW7 Contract V2 test bundle, was 111 baseline) - **52 gotcha** unchanged (no new gotcha discovered S33, 2 existing lesson applied) - **33 EmployeeProfile** seeded prod (1 admin + 30 demo + 2 catalog.manager) - **7 commit pushed** remote `5400983..79a8343` (full range cumulative S33) - **2 CI Run PASS:** #350 Phase 1 (3m38s) + #237 Phase 2 (3m50s) ## Plan execution ### Plan cha A (S32 done — Phase 9 stabilize 4 task) Status carry-over — no S33 work needed. ### Plan cha B — Phase 10.1 G-H1 Hồ sơ Nhân sự (S33 NEW — 7 task end-to-end) **Trigger:** HANDOFF S32 kick off priority + anh main S33 authorize. | Task | Owner | Result | |---|---|---| | 1. NamGroup pre-flight audit | 🟦 Investigator a103d20 | 10 bảng `TblNhanVien*` (NOT 8 anh estimate) + field map 70 cols + 5 satellite proposal | | 2. Mig 34 schema design | 👤 Em main solo | 4 decision: 5 satellite / Skill polymorphic / DiaChi FK+freetext dual-write / `NV/{YYYY}/{Seq:D4}` atomic | | 3. BE entity + EF Config + Mig 34 | 🟨 Implementer a8f4567 | 17 file mới + 4 modified + Mig 34 3-file rule (em main verified via build + ef database update) | | 3b. DbInitializer seed 30 demo | 👤 Em main solo | SeedDemoEmployeeProfilesAsync ~90 LOC NOT gated DemoSeed flag per gotcha #51 + EmployeeCodeSequence row | | 4. BE CQRS + Controller | 🟨 Implementer a9bb9f3 | 3 file: EmployeeFeatures (5 pair) + Dtos (5 satellite) + EmployeesController (5 REST endpoint class-level [Authorize]) | | 5. FE 2 app pages | 🟨 Implementer afdc812 | 6 mới × 2 app SHA256 IDENTICAL + 6 modified (App.tsx + Layout.tsx + menuKeys.ts × 2 app) | | 6. Permission menu seed | 👤 Em main solo | MenuKeys +Hrm+HrmHoSo + SeedMenuTreeAsync +2 entry order=28 (Admin auto-grant via SeedAdminPermissionsAsync iterate All[]) | | 7. Pre-commit + post-deploy verify | 🟥 Reviewer ae752c0 + 🟩 CICD ae2a01f | Smart Friend 6× clean (0 critical, 0 major, 3 minor defer Phase 1.5) + Run #237 PASS 3m50s (6/6 endpoint 200 + bundle rotate × 2 + menu seeded + 33 row preserved) | ### Plan cha C — B-Wrap Contract V2 test bundle BW1-BW7 (S33 NEW — 4 step end-to-end) **Trigger:** Anh main S32 chốt defer dedicated session ~2h. S33 kick off cùng Plan B. | Step | Owner | Result | |---|---|---| | 1. Test infra helpers | 👤 Em main solo | TestCurrentUser.cs stub ICurrentUser (31 LOC) — KHÔNG mock ChangelogService (use REAL impl với stub) | | 2. Scaffold BW1-BW7 | 🟨 Implementer aaaf0511 | 3 file: ContractWorkflowServiceApproveV2Tests (BW1-4+7) + CreateContractCommandApplicableTypeTests (BW5) + ContractV2SchemaPersistenceTests (BW6 split 3 [Fact]) = 9 [Fact] total | | 3. Reviewer pre-commit | 🟥 Reviewer aaa1df3 | Smart Friend 5× clean — 9/9 PASS independent verify in 4.7s, spec strings exact match service source, 0 critical/major, 3 minor cosmetic | | 4. CICD post-deploy verify | 🟩 CICD a67df4e | Run #350 PASS 3m38s — test_infra 62/62 (53+9 BW), Mig 34 prod applied, 33 EmployeeProfiles seeded prod, gotcha #51 verified | ### Plan cha D — Drift patch S33 startup ad-hoc (em main solo) **Trigger:** S33 startup Reviewer SEVERE catch — CLAUDE.md baseline header drift cumulative S19→S32 misleading future spawn context. | Action | File | Result | |---|---|---| | Patch drift | CLAUDE.md root + docs/CLAUDE.md + .claude/agents/implementer.md | 10 line edit: 26→33 mig + 81→111 test + 26→52 gotcha + audit next 2026-06-01 + Contract V2 wire status + table 52→60 | ## Multi-agent ROI cumulative S33 | Agent | Spawn count | Token est | Verdict | |---|---:|---:|---| | 🟦 Investigator | 2 | ~20K | Solid pre-flight audit + cross-agent learning synthesis | | 🟨 Implementer | 4 | ~110K | Pattern 12-bis + 16-bis 4× cumulative reinforced. 2/4 truncated mid-MEMORY update (Task 3+4 heavy ~50+ tool uses) — functional work complete despite | | 🟥 Reviewer | 3 | ~60K | Smart Friend 6× clean cumulative — drift severity catch + 2 pre-commit pre-push gates | | 🟩 CICD | 3 | ~60K | Run #350 + #237 verify PASS + gotcha #51 INFRASTRUCTURE seed pattern reaffirmed prod | | 👤 Em main solo | — | ~150K | Task 2 schema + Task 3b seed + Task 6 menu + 7 commit batch + push + STATUS/HANDOFF update | | **Total S33** | **12 spawn** | **~400K** | **0 critical issue end-to-end, 0 prod regression** | ## Patterns reinforced cumulative S33 1. **Pattern 12-bis cross-module entity cookie-cutter mirror PE → Hrm** — 4× cumulative (S29 Plan B Contract Mig 33 + S33 Task 3+4+5) 2. **Pattern 16-bis 4-place mirror cross-app fe-admin+fe-user IDENTICAL** — 4× cumulative (S29 Plan CA HF1 + Plan B Chunk D + S33 Task 5) 3. **Smart Friend independence 6× cumulative clean** (S22 #44 + S25 #48 + S29 Plan CA password + S29 Plan B ApplicableType + S33 Plan C BW + S33 Plan B Phase 2) 4. **gotcha #51 INFRASTRUCTURE vs DEMO seed gate lesson applied 2×** S33 (EmployeeProfile seed line 94 + Hrm menu seed line 1480, both OUT of `if (!demoSeedDisabled)` block) 5. **gotcha #50 Layout staticMap mirror cross-app** applied 1× S33 (`Hrm_HoSo: '/employees'` cả fe-admin + fe-user Layout.tsx) 6. **gotcha #41 path filter Discovery #3** reaffirmed (commit `79a8343` MEMORY-only rides push range trigger when ≥1 commit code) 7. **Implementer truncation pattern observation 2/3** NEW S33 — heavy scaffold ~50+ tool uses runs out token budget on final MEMORY update phase. Functional work complete via Edit/Write tool, MEMORY append cutoff mid-sentence. Mitigation: split heavy task → 2 phase budget reserve OR em main proxy MEMORY append next session 8. **RAG ROI evaluation framework reinforced** — RAG hit 2/3 PASS S33 startup verify (Plan G NamGroup 0.848 + gotcha #52 0.910 + per-NV 10-surface 0.684 boundary). Solo project marginal saving 5-10%, cross-project transform pending 6 project bootstrap. ## Defer Phase 1.5 backlog 1. Per-action policy `Hrm_HoSo_View/Create/Edit/Delete` (gotcha #44 mitigation) 2. Convert 3 bool field UpdateCommand → `bool?` safe partial update 3. Satellite CRUD endpoint (WorkHistory/Education/FamilyRelation/Skill/Document) + FE edit form 4. Test bundle Plan B Phase 2 (Create UNIQUE conflict + List filter + codeGen race) 5. UAT smoke non-admin role verify silent 403 catch 6. fe-admin menuKeys.ts add Bg_*/Catalog* sync với fe-user (drift not blocking) ## Defer S34+ backlog priority 1. **Curate 4 MEMORY sub-agent** (~30 phút) — all 4 over 25KB threshold post-S33 heavy spawn (CICD 32.9 + Imp 30.5 + Rev 28.5 + Inv 26) 2. **G-O1 Danh bạ nội bộ** (~2-3h) easiest standalone, no workflow — reuse Users + EmployeeProfile + Departments 3. **G-H2 Cấu hình HRM** (~3-4h) prerequisite cho G-O3-O6 workflow apps (Mig 35 LeaveTypes + Holidays + ShiftPatterns + OtPolicy) ## Commits range S33 ``` 79a8343 [CLAUDE] Memory: S33 Plan B Phase 2 + Reviewer activity 3 sub-agent append 9616ae2 [CLAUDE] FE-Admin+FE-User: Plan B G-H1 Task 5 — EmployeesPage 2-panel + EmployeeCreatePage cookie-cutter mirror 0e191de [CLAUDE] Domain+App+Api+Infra: Plan B G-H1 Task 4+6 — Hrm CQRS 5 endpoint + Permission menu 48a99e1 [CLAUDE] Domain+App+Infra: Plan B G-H1 Mig 34 EmployeeProfile + seed 30 demo 0605f19 [CLAUDE] Tests: Plan C B-Wrap BW1-BW7 Contract V2 test bundle +9 tests (111→120) b3444a3 [CLAUDE] Memory: S33 startup + Plan B+C activity 3 sub-agent append 1bc6b70 [CLAUDE] Docs: patch CLAUDE.md+docs/CLAUDE.md+implementer.md drift S19→S32 ``` CI Runs: #350 Phase 1 (3m38s) + #237 Phase 2 (3m50s) cả 2 PASS. Cumulative deploy time ~7m28s within baseline 3-4 min/Run. ## New capability prod end-to-end UAT-ready Anh main login `admin@solutions.com.vn / Admin@123456` → sidebar "Nhân sự" > "Hồ sơ Nhân sự" → `/employees`: - List 33 row sample: `NV/2026/0007 BOD 1 - Director, Ban Giám đốc, Active, hireDate=2021-08-01` - Click row → 6 section collapsible: Cơ bản (Header) + Công tác (WorkHistory empty Phase 1) + Đào tạo + Thân nhân + Kỹ năng + Hồ sơ (Documents empty Phase 1) - "Tạo mới" button → `/employees/new` form Header minimal (UserId picker + status + birthday + gender + phone + hire date + nationality) - POST creates new profile with auto `NV/2026/0034+` code sequence Phase 1.5 sẽ add inline edit + satellite CRUD form.