[CLAUDE] Docs: S42-S43 close-out — Phase 11 P11-A+P11-B session log + HANDOFF tier + gotcha #56
- Session log S42-S43 (P11-A WorkflowApps ApproveV2 + P11-B LeaveBalance, 8 commit chain) - HANDOFF tiering: +S43 +S42, trim S40-S38 → session logs - gotcha #56 CWD-drift stray memory (cd trước spawn → agent ghi nhầm fe-user/.claude, 3× S42-S43) - STATUS gotchas 55→56 - cicd-monitor MEMORY (Run #367 P11-B verdict) User memory: +feedback_high_to_max_multiagent_quality (High lọt 2 bug, Max 0 bug; WIRE FE đọc reference proven + FK-invariant-at-write-doors + Max re-review cross-stack). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -47,10 +47,11 @@ Read-only CI/CD + post-deploy verifier SOLUTION_ERP. Polls Gitea Actions API, ve
|
||||
- **Gitea:** `git.baocaogiaoduc.vn/vietreport-admin/solution-erp` · workflow `.gitea/workflows/deploy.yml` · paths-ignore `['docs/**','**/*.md','.claude/skills/**']`
|
||||
- **Prod:** api/admin/eoffice `.solutions.com.vn` · SSH `ssh vietreport-vps` (Administrator, id_ed25519) · IIS site phys paths (S42 verified): API `C:\inetpub\solution-erp\api` · admin `\fe-admin` · user `\fe-user` (3 sites Started). DB `.\SQLEXPRESS`/`SolutionErp`/`vrapp` SQL-auth. **Conn string key = `ConnectionStrings.Default` (NOT `DefaultConnection`!)** — read pw from prod appsettings.Production.json when `$env:PROD_DB_PASSWORD` empty.
|
||||
- **SSH→PS quoting (S42 lesson):** nested bash→ssh→powershell mangles `$var`/`\"`. Use `iconv UTF-16LE | base64` → `powershell -EncodedCommand $B64`. Single-quote literal paths.
|
||||
- **Tests baseline:** **144 PASS** (58 Domain + 86 Infra) S42 Run #365 (+3 SetWorkflow; was 141). CI gate runs both test projects BEFORE build/deploy (`deploy.yml` L62+L71) → status=success ⟹ test gate passed. Local grep undercounts (Theory/InlineData) — trust CI conclusion. Phase 9 UAT mode skip per chunk OK.
|
||||
- **Mig latest repo:** **Mig 41 `20260530021936_WireWorkflowAppsApprovalV2`** (S42 P11-A). Path `src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/`. Prod check `sqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC TOP 5`.
|
||||
- **Tests baseline:** **154 PASS** (S42 P11-B Run #367 sha 82d7fcf; +11 LeaveBalance +13 P11-A vs prev 130). CI gate runs both test projects BEFORE build/deploy → status=success ⟹ test gate passed (`tasks` endpoint reports terminal as `status:success`, `conclusion` field NOT populated). Local grep undercounts (Theory/InlineData) — trust CI conclusion. Phase 9 UAT mode skip per chunk OK.
|
||||
- **Mig latest repo:** **Mig 42 `20260530034336_AddLeaveBalances`** (S42 P11-B; prod tables 91). Path `src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/`. Prod check `sqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC TOP 5`.
|
||||
- **Bearer:** admin `admin@solutions.com.vn/Admin@123456` (full) · UAT `nv.test@solutions.com.vn/TestUser@123456` (Drafter CCM, gotcha #44 check)
|
||||
- **Bundle hash live S42:** admin `6D4k-aRi` · user `DkME-974` (Run #365 sha 75df04e). Prev admin `BLA09-qv` · user `CXvejOE-` (#250/e7b66cd). Bundle size ~800KB/750KB gz.
|
||||
- **Bundle hash live S42:** admin `Krjvg_3j` · user `6sNStgxa` (Run #367 sha 82d7fcf). Prev admin `BU8FTBRi` · user `tepE4jvR` (#366/ffb2062). Bundle size ~800KB/750KB gz.
|
||||
- **DB pw (S42, when `$PROD_DB_PASSWORD` empty):** `vrapp/buKL3TGBkD0wDDbYVw65QeX9` read from `C:\inetpub\solution-erp\api\appsettings.Production.json`→`ConnectionStrings.Default`. ⚠️ Skill-doc path `C:\inetpub\apps\SolutionErp\Api` is STALE → real path `C:\inetpub\solution-erp\api`. sqlcmd over SSH works direct (no UTF-16 encode needed). ⚠️ sys-catalog string-concat queries hit collation conflict (`Latin1_General_CI_AS_KS_WS` vs `SQL_Latin1_General_CP1_CI_AS`) → add `COLLATE DATABASE_DEFAULT` per concatenated column.
|
||||
|
||||
## 🔑 Critical config (flag commit nếu tái xuất)
|
||||
Node CI `20.x` (`feedback_node_cicd`) · MediatR `12.4.1` (gotcha #1, flag `Version="14`) · Swashbuckle `6.9.0` (gotcha #2) · act_runner manual checkout (#39) · npm cache DISABLED (#40, flag `cache: npm`)
|
||||
@ -67,12 +68,13 @@ BE (test+build) ~90s · FE × 2 ~60s/app · deploy ~30s · **total ~3min code /
|
||||
|
||||
## 📅 Recent runs (FIFO — older → archive/git)
|
||||
|
||||
- **2026-05-30 Run #367 (run_number 253) sha=`82d7fcf` PASS ~4m08s (S42 P11-B LeaveBalance business logic, Mig 42):** Code commit 22 files (4 BE: Domain `LeaveBalance.cs` + App `LeaveBalanceFeatures.cs`/`LeaveOtApprovalFeatures` deduction hook + `LeaveBalancesController` + IApplicationDbContext + DbContext + Config + Mig42 3-file + 2 FE `WorkflowAppDetailPage`×2 +`workflowApps.ts`×2 + 2 tests + 4 agent-memory .md). Started 11:11:40 → success iter4 11:15:48. **Bundle rotate admin `BU8FTBRi→Krjvg_3j` + user `tepE4jvR→6sNStgxa`** (both changed ✓ FE shipped, verified AFTER status=success — pre-deploy snapshot still showed old hash, correct timing). **Mig 42 `20260530034336_AddLeaveBalances` auto-applied prod** (tables 90→**91**, `LeaveBalances` EXISTS). Schema ✓: UserId/LeaveTypeId/Year/EntitledDays/UsedDays/AdjustmentDays decimal + AuditableEntity soft-delete. **UNIQUE `IX_LeaveBalances_UserId_LeaveTypeId_Year`** + **FK→LeaveTypes del=NO_ACTION** (=Restrict) ✓. New endpoint smoke: `GET /api/leave-balances/my` unauth=**401** (route live not 404) + admin auth=**200** lazy-default 5 LeaveTypes (ANNUAL12/COMPASSIONATE3/MATERNITY180/SICK30/UNPAID0, all Used=0, `remainingDays`=entitled ✓ DTO shape has remainingDays/entitledDays) + `?year=2026` admin route 401 unauth + `PUT /adjust`=411 (route reg). health live/ready 200 Healthy. **NO seed gate concern** (plain table, lazy DTO — Stage 4.6 N/A). 0 regression. Note: prev run #366 (ffb2062 docs STATUS update) was a CODE-path push w/ status=success — NOT docs-only-skipped (commit touched only .md but Gitea still ran since prior range?); actually #366 display_title is Docs but ran full → confirms agent-memory .md NOT in paths-ignore (`.claude/skills/**` ignored, `.claude/agent-memory/**` NOT). Tag `[s42, run367, pass, p11b-leavebalance, mig42]`.
|
||||
- **2026-05-30 Run #365 sha=`75df04e` PASS ~4m05s (S42 P11-A fix workflow picker 2-bug + SetWorkflow endpoint, NO migration):** Code commit 11 files (4 BE controllers + 2 App features `LeaveOtApprovalFeatures`/`TravelVehicleApprovalFeatures` +125 lines + 2 FE `WorkflowAppDetailPage` ×2 + 1 test +79 lines). Status=success iter5 (started 10:15:45). **Bundle rotate admin `BLA09-qv→6D4k-aRi` + user `CXvejOE-→DkME-974`** (both changed ✓ FE fix shipped, verified AFTER status=success). +4 endpoint `PUT /api/{leave,ot,travel,vehicle-bookings}/{id}/workflow` (`Set{Module}WorkflowCommand`, route `[HttpPut("{id:guid}/workflow")]` body record `SetWorkflowBody(Guid ApprovalWorkflowId)`). Unauth smoke leave+ot/workflow → **401** (route exists, NOT 404 ✓). health live+ready 200 Healthy. Test gate **144** (CI both proj pre-deploy; grep undercounts InlineData=14 Fact at WorkflowAppApproveV2Tests). **NO migration** → skipped Stage 4.6 seed (verified #250). **NAMING RECONCILE:** Gitea task IDs are real #364 (e7b66cd, mem-labeled "#250") + #365 (this). Going forward use actual Gitea task id. **HEADS-UP em main:** follow-up commit `e47ef1d` (FE-User ProposalCreatePage workflow dropdown shape, latent S37 bug) pushed 10:19:17 DURING poll — NOT yet triggered CI run, will redeploy FE shortly (bundle may re-rotate). Out of scope this verdict. Tag `[s42, run365, pass, p11a-setworkflow]`.
|
||||
- **2026-05-30 Run #364 (mem #250) sha=`e7b66cd` PASS ~4m07s (S42 P11-A wire ApproveV2+LevelOpinions 4 WorkflowApps):** 1 commit BE+FE×2+Mig41+Tests. Status=success iter3. Bundle rotate admin `cWAXid0q→BLA09-qv` + user `CX79e2kZ→CXvejOE-`. **Mig 41 auto-applied prod** (latest=`20260530021936_WireWorkflowAppsApprovalV2`). Tables 84→**90** (+5: Leave/Ot/Travel/VehicleRequest LevelOpinions + WorkflowAppCodeSequences — ALL EXIST). 4 new endpoint smoke 200 auth (leave/ot/travel/vehicle-requests) + unauth 401 (route exists) + POST .../approve=411 (route reg). health live/ready 200. **Stage 4.6 seed gate PASS** (gotcha #51): 4 WF seeded prod despite DemoSeed:Disabled — QT-NP/OT/CT/XE-V2-001 AppType=5/6/7/9, verified call-site L142-145 OUTSIDE `if(!demoSeedDisabled)` gate. Test gate 141 (CI runs both proj pre-deploy). Note: table count 90 vs spec-expected 89 = baseline-count diff, NOT missing table (all 5 present). Stale doc drift deploy.yml comments "54/17 test" (cosmetic, flag em main). Tag `[s42, run250, pass, p11a-approvev2-workflowapps]`.
|
||||
- **2026-05-28 Run #247 sha=`e54a22d` PASS 3m25s (S38 SKELETON 5-plan combo Mig 39+40 dual):** Push 1 commit mega `Domain+App+Infra+Api+FE×2`. ALL PASS. Bundle rotate admin `CGueDk22→cWAXid0q` + user `CEt0QRgX→CX79e2kZ`. Mig 39+40 dual auto-applied startup (90830→90839). 6 endpoint smoke 200 (leave/ot/travel/vehicle/it-tickets/hr-dashboard `totalEmployees=33 male=17 female=16`). 6 new tables + 8 menu seeded. 0 regression. Fastest S38 deploy. Tag `[s38, run247, pass, skeleton-combo]`.
|
||||
- **2026-05-28 Run #246 sha=`de1c378` PASS 3m53s (S37 Proposal Mig 37+38):** Bundle admin `C9kzTTmq→CGueDk22` + user `CC4DQ-Tr→CEt0QRgX`. Mig 38 AddProposals + 37 ExtendApplicableType. `/api/proposals` 200 empty + workflow `QT-DX-V2-001` ApplicableType=4 seed + 4 Off_DeXuat menu. Stage 4.6 sample seed INFRASTRUCTURE-gated correct (gotcha #51). Tag `[s37, run246, pass, proposal-v2]`.
|
||||
- **Archived Run #359/#243/#242/#241/#240 + S35/S36 startup → `archive/2026-05-q4.md` + git d2f52ba (S40 curate):** Run #359 G-O2 Meeting Mig 36 · #243 HrmConfig BE 16 endpoint (BE-only bundle unchanged anti-pattern verify) · #242 FE inline forms 5 satellite · #241 Mig 35 HRM foundation · #240 satellite CRUD. Discovery #7 path-filter eval/** + #8 collection `proj_*`. KEY absorbed in essentials/Stage sections above.
|
||||
- **2026-05-22 Run #232 sha=`38f1c4d` PASS (S29 Plan B CRITICAL gotcha #51 catch):** `SeedSampleContractWorkflowV2` nested in `if(!demoSeedDisabled)` → prod `DemoSeed:Disabled=true` → QT-HD-V2-001 missing → V2 Drafter dropdown EMPTY. Fix hoist out of gate. **Smart Friend ROI 4× cumulative** (S22 #44 + S25 #48 + S29 ApplicableType + S29 DemoSeed). → archive/git for #229-#231.
|
||||
- **Archived Run #232 (S29 gotcha #51 catch — SeedSampleContractWorkflowV2 nested in demoSeedDisabled → empty V2 dropdown, hoist fix) → `archive/2026-05-q4.md` + git. Smart Friend ROI 4× cumulative (S22 #44 + S25 #48 + S29 ApplicableType + S29 DemoSeed).**
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -2,7 +2,38 @@
|
||||
|
||||
> **Tiering rule (S40):** giữ **2-3 session gần nhất**. Cũ hơn → `docs/changelog/sessions/`. Full brief history pre-S40 → `docs/_archive/HANDOFF-preS40-fullhistory.md`.
|
||||
|
||||
**Last updated:** 2026-05-29 (Session 41 — RAG corpus cleanup w/ AI_INFRA: exclude `**/`-fix + re-bootstrap 3080→2406 + 5/5 store_memory preserved)
|
||||
**Last updated:** 2026-05-30 (Session 42-43 — Phase 11 P11-A wire ApproveV2 4 WorkflowApps + P11-B LeaveBalance. Mig 41+42, 154 test, deployed prod #364-367)
|
||||
|
||||
---
|
||||
|
||||
## S43 (2026-05-30) — Phase 11 P11-B: LeaveBalance business logic
|
||||
|
||||
**Commit `82d7fcf` → Gitea #367 PASS, deployed prod.** Agents Max → 0 bug lọt.
|
||||
|
||||
**Done:**
|
||||
- **Mig 42 `AddLeaveBalances`** — `LeaveBalances` (User×LeaveType×Year + Entitled/Used/Adjustment, UNIQUE composite + FK LeaveTypes Restrict). 90→91 tables.
|
||||
- **Trừ phép** hook `ApproveLeaveRequestHandler` terminal DaDuyet — exactly-once (guard chặn re-approve), auto-create từ `DaysPerYear`, `UsedDays+=NumDays`, Year=StartDate.Year. Policy cho phép âm + cảnh báo.
|
||||
- **FK invariant guard** Create+Update validate LeaveTypeId tồn tại → Conflict (đóng cửa tránh 500 kẹt đơn lúc deduction FK insert). grep xác nhận 2 write site duy nhất.
|
||||
- **CQRS** GetMy/GetUser/Adjust (admin `[Authorize(Roles=Admin)]`) + embed balance NGƯỜI TẠO vào leave detail. **FE** block "Số dư phép" + cảnh báo vượt (kind=leave).
|
||||
- **Test** 144→**154** (+11 + repair 2 template terminal FK). Reviewer Max PASS (exactly-once + FK fully closed; 2 minor defer: concurrency no-RowVersion + stale comment).
|
||||
|
||||
**Carry-over (chưa đụng):** `M BROADCAST-OUT...md` + `?? .mcp.json` (từ S40). · RAG S42-S43 chưa index (stopgap store_memory). · cicd flag: skill IIS path stale + agent-memory .md trigger CI.
|
||||
|
||||
**Next S44 (anh pick):** P11-C (Vehicle+Driver Mig 43) / P11-D (ItTicket SLA) / P11-E (AttendanceReport+Excel) / P11-F (MaTicket) · Phase 9 Ops · coord carry-over.
|
||||
|
||||
---
|
||||
|
||||
## S42 (2026-05-30) — Phase 11 P11-A: wire ApproveV2 + LevelOpinions 4 WorkflowApps + Max re-review fix
|
||||
|
||||
**4 commit `e7b66cd`+`75df04e`+`e47ef1d`+docs → #364-366 PASS.** 7-agent.
|
||||
|
||||
**Done:**
|
||||
- **Mig 41 `WireWorkflowAppsApprovalV2`** — 4 `{Module}LevelOpinions` + `WorkflowAppCodeSequences` (atomic MaDonTu) + 4 RejectedFromStatus + enum TravelRequest=9. 84→89 tables. Cookie-cutter mirror Proposal (Mig 38).
|
||||
- **BE** 30 handler + 8 route × 4 module (Leave/OT/Travel/Vehicle) + seed 4 WF. **FE** WorkflowAppDetailPage declarative 4-kind.
|
||||
- **⚠️ Max re-review (agents High) bắt + fix 2 bug FE picker:** (#1) pinWorkflow PUT partial→400 (#2) fetch shape sai (copy nhầm ProposalCreatePage hỏng). Fix: dedicated `PUT /{id}/workflow` + fetch mirror PE/Contract. **Bonus** fix ProposalCreatePage latent S37 bug.
|
||||
- **Test** +14 (ApproveV2 11 + SetWorkflow 3). 130→144.
|
||||
|
||||
**Lesson:** WIRE FE phải đọc reference proven (không đoán); Max re-review cross-stack bắt buộc (→ gotcha #56 CWD-drift + memory `feedback_high_to_max_multiagent_quality`). Detail → `docs/changelog/sessions/2026-05-30-S42-S43-phase11-p11a-p11b.md`.
|
||||
|
||||
---
|
||||
|
||||
@ -26,43 +57,10 @@
|
||||
|
||||
---
|
||||
|
||||
## S40 (2026-05-29) — Init + consolidation + bulletin adoption + RAG recovery
|
||||
## S40-S38 (older) → session logs
|
||||
|
||||
**10 commit `d2f52ba..37536fd`** (all docs/infra → CI skip). KHÔNG product code/schema.
|
||||
- **S40** (2026-05-29) init audit 10-mục + doc consolidation (STATUS/HANDOFF 393KB→9KB zero-loss archive) + AI_INFRA bulletin adopt 4/4 (Tiered Memory v1 + /session-start /session-end slash commands LIVE) + RAG MCP recovery (quit+relaunch FRESH). **Concurrency carry-over** (BROADCAST 2 + `.mcp.json`) bắt nguồn đây — vẫn chưa đụng (xem S43).
|
||||
- **S39** (2026-05-29) infra: Opus 4.8 1M + multi-agent split 4→7 (+investigator/implementer split +test-specialist) + budget +50% + gotcha #54/#55.
|
||||
- **S38** (2026-05-28) 🎊 Phase 10 COMPLETE 11/11 — Mig 39+40 skeleton combo (Đơn từ/Đặt xe/Ticket/Chấm công/Dashboard NS). ApproveV2+LevelOpinions+LeaveBalance DEFER Phase 11 (→ làm xong S42-S43).
|
||||
|
||||
**Done:**
|
||||
- ✅ **Init audit 10-mục** — 7-agent live, RAG re-rank PASS, 130 test confirm, state re-grounded từ code.
|
||||
- ✅ **Doc consolidation** — STATUS 170KB→5.7KB + HANDOFF 224KB→3.4KB (393KB→9KB, full archive `docs/_archive/` zero-loss). Count re-ground: endpoints **211**, FE pages **65** (36+29), menu **~53**, **tables 84 đúng** (DbSet 77 + Identity 7). CLAUDE.md root patch.
|
||||
- ✅ **Curate 4 agent MEMORY** >25KB→<8.4KB (foundation preserved + git verbatim `d2f52ba`).
|
||||
- ✅ **AI_INFRA bulletin 2026-05-29 adopt 4/4:** MỤC1 charter v2 ack · MỤC2 **Tiered Memory Policy v1** (L1 HOT ~30KB / L2 archive / L3 RAG, bỏ hard 25KB) · MỤC3 **/session-start + /session-end slash command LIVE** · MỤC4 RAG v1.3 compliant + rag.json extra_corpus slug BUG FIX.
|
||||
- ✅ **Broadcast AI_INFRA** (adoption + infra retrospective + 5 đề xuất) — file `docs/governance/BROADCAST-OUT-*` + RAG `store_memory` (rerank 0.91-0.96 cross-project discoverable).
|
||||
|
||||
**⚙️ NEW slash command LIVE:** `/session-start` + `/session-end` (`.claude/commands/`) — dùng thay paste prompt thủ công.
|
||||
|
||||
**⚠️ RAG MCP outage S40:** máy treo full ổ C → MCP rớt nhiều lần. Recovery: **quit hẳn + relaunch FRESH + approve trust `.mcp.json`** (KHÔNG resume — cached config). server.py/env/key/Qdrant verified healthy (lỗi thuần Claude Code client). Memory `[[rag-mcp-recovery-and-concurrency]]`.
|
||||
|
||||
**⚠️⚠️ CONCURRENCY CHƯA giải quyết:** session SE **thứ 2 chạy song song** S40 → append "BROADCAST 2" vào `docs/governance/BROADCAST-OUT-SOLUTION-ERP-2026-05-29.md` (**UNCOMMITTED**, M trong git) + `.mcp.json` untracked. Anh main quyết: commit chung / để session kia tự / gộp dup. **TRÁNH 2 session SE cùng sửa repo.**
|
||||
|
||||
**⏳ Standing items đã broadcast cho AI_INFRA (infra op):** re-index SE (path fix → 27 memory entries + S38-S40 content) · registry sync · verify auto_reindex hook (last_indexed lag) · **search_code corpus gap** (chỉ index .md, thiếu src/*.cs + fe/*.tsx) · chunk 512 trial 2026-06-16.
|
||||
|
||||
**Next S41 (anh main pick) — FOCUS PRODUCT:**
|
||||
1. **Phase 11 P11-A** — wire ApproveV2 + LevelOpinions 4 module (full 5-agent end-to-end)
|
||||
2. **Test coverage gaps** — 🟪 test-specialist Gap1 (Holiday UNIQUE CRITICAL) + Gap3 (gotcha #44 ~50 LOC)
|
||||
3. **Phase 9 Ops** (anh main coordinate: SMTP + rotate creds + UAT)
|
||||
4. (coord) Giải quyết concurrency: BROADCAST 2 uncommitted + `.mcp.json` untracked
|
||||
|
||||
---
|
||||
|
||||
## S39 (2026-05-29) — ⚙️ INFRA: Opus 4.8 1M + Multi-agent 4→7 + budget +50%
|
||||
|
||||
Pure infra/governance, 1 commit `fd0554a` (docs CI skip). 7 agent: 🟦 investigator-codebase (internal SQL/EF/grep) + 🟦 investigator-api (external docs/CVE/lib) + 🟨 implementer-backend (.NET) + 🟧 implementer-frontend (FE 2 app) + 🟪 test-specialist (tests/) + 🟥 reviewer + 🟩 cicd-monitor. `model: inherit` (Opus 4.8 1M). 5 RAG MCP/agent. Skill re-distribute (README matrix). 2 gotcha NEW: **#54** (529 Overload spawn fail → em main solo fallback) + **#55** (truncation mid-exploration → brief ≤8K + pre-supply snippet).
|
||||
→ detail `docs/changelog/sessions/2026-05-29-S36-S39-phase10-complete-7agent.md`
|
||||
|
||||
## S38 (2026-05-28) — 🎊 PHASE 10 COMPLETE 11/11
|
||||
|
||||
Mig 39+40 + BE ~1100 LOC mega + FE 5 file × 2 app SHA256 IDENTICAL + 8 menu. Run #247 PASS 3m25s. G-O4 Đơn từ + G-O5 Đặt xe + G-O6 Ticket CNTT + G-P1 Chấm công + G-H3 Dashboard NS (SKELETON combo). Trade-off rõ commit: ApproveV2 advance level + LevelOpinions + LeaveBalance + CodeGen atomic + Vehicle/Driver catalog + auto-assign/SLA **DEFER Phase 11**. NEW prod: sidebar Văn phòng số 11 sub-menu + Nhân sự Dashboard + GPS check-in + ticket kanban.
|
||||
→ same session log
|
||||
|
||||
---
|
||||
|
||||
> **Older S37→S6:** per-session logs đầy đủ trong `docs/changelog/sessions/` + `docs/_archive/HANDOFF-preS40-fullhistory.md`.
|
||||
Detail đầy đủ → `docs/changelog/sessions/` + `docs/_archive/HANDOFF-preS40-fullhistory.md`.
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
| FE pages | **67** | WorkflowAppDetailPage (admin+user SHA256 identical) |
|
||||
| Menu keys | **~53** | BE `MenuKeys` const (FE menuKeys.ts mirror 54) |
|
||||
| Tests | **154 PASS** | 58 Domain + 96 Infra · 0 fail / 0 skip · +11 LeaveBalance/guard S43 |
|
||||
| Gotchas | **55** | `docs/gotchas.md` (latest #54 529-fallback, #55 truncation-mid-exploration) |
|
||||
| Gotchas | **56** | `docs/gotchas.md` (latest #56 CWD-drift stray memory S42-43) |
|
||||
| User memory | 27 | + `MEMORY.md` index |
|
||||
| Skills | 6 | 3 domain + 3 ops |
|
||||
| Sub-agents | **7** | Opus 4.8 1M (S39 split 4→7) |
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
# Session S42-S43 — 2026-05-30 — Phase 11 P11-A + P11-B (WorkflowApps ApproveV2 + LeaveBalance)
|
||||
|
||||
> 7-agent end-to-end. S42 P11-A wire + Max re-review fix. S43 P11-B LeaveBalance. Agents upgrade High→Max giữa S42-S43 → chất lượng cải thiện rõ rệt.
|
||||
|
||||
## Commit chain (8)
|
||||
| SHA | Scope | Gitea |
|
||||
|---|---|---|
|
||||
| `e7b66cd` | P11-A wire ApproveV2 + LevelOpinions 4 module + Mig 41 | #364 PASS |
|
||||
| `75df04e` | P11-A fix 2 bug picker (Max re-review) + SetWorkflow endpoint | #365 PASS |
|
||||
| `e47ef1d` | ProposalCreatePage workflow dropdown shape (latent S37 bug, chip task) | (range) |
|
||||
| `ffb2062`+`0db5e1f` | Docs STATUS reconcile P11-A | CI-skip |
|
||||
| `82d7fcf` | P11-B LeaveBalance + Mig 42 | #367 PASS |
|
||||
| `efc5f5f` | Docs STATUS P11-B | CI-skip |
|
||||
|
||||
## S42 — P11-A: wire ApproveV2 + LevelOpinions 4 WorkflowApps module
|
||||
|
||||
**Reference:** Proposal (Mig 38) = mirror 1:1 (cùng namespace Office, cùng WorkflowAppStatus 5-state) — tốt hơn PE/Contract.
|
||||
|
||||
**Schema (Mig 41 `WireWorkflowAppsApprovalV2`):** +4 `{Leave,Ot,Travel,Vehicle}LevelOpinions` (UNIQUE composite + Cascade parent + Restrict Level) + `WorkflowAppCodeSequences` (shared atomic MaDonTu — gộp P11-F cho 4 module) + 4 cột `RejectedFromStatus` + enum `TravelRequest=9`. 84→89 tables.
|
||||
|
||||
**BE:** 30 handler (GetById/Update/Submit/Approve-UPSERT-advance/Reject/Return) × 4 module + 8 controller route + seed 4 WF mẫu (QT-NP/OT/CT/XE-V2-001, AppType 5/6/7/9). ItTicket KHÔNG đụng (kanban).
|
||||
|
||||
**FE:** `WorkflowAppDetailPage.tsx` declarative 4-kind (admin+user SHA256 identical) — status + opinion timeline + Submit/Approve/Reject/Return.
|
||||
|
||||
**⚠️ Max re-review phát hiện 2 BUG FE picker (agents chạy High để lọt):**
|
||||
1. `pinWorkflow` PUT `/{id}` chỉ gửi `{approvalWorkflowId}` → UpdateDraft validator (Reason/NumDays) fail → 400.
|
||||
2. fetch workflow expect flat array nhưng endpoint trả `AwAdminOverviewDto {types:[...]}` → picker rỗng/crash. Agent copy nhầm pattern hỏng `ProposalCreatePage` thay vì proven PE/Contract.
|
||||
**Fix:** dedicated endpoint `PUT /{id}/workflow` (set workflow only, verify ApplicableType) + fetch mirror `data.types.find(t=>applicableType===X)?.history.filter(isUserSelectable)`. **Bonus:** ProposalCreatePage có bug #2 có sẵn từ S37 (latent) → chip task `e47ef1d`.
|
||||
|
||||
**Test:** +11 ApproveV2 + +3 SetWorkflow. Auth-verified prod dropdown shape thật.
|
||||
|
||||
## S43 — P11-B: LeaveBalance business logic
|
||||
|
||||
**Decision (anh main chốt):** (1) số dư không đủ → **cho phép + cảnh báo** (âm OK) · (2) FE **tích hợp trang đơn nghỉ** (không trang riêng).
|
||||
|
||||
**Schema (Mig 42 `AddLeaveBalances`):** `LeaveBalances` (User×LeaveType×Year + Entitled/Used/Adjustment, UNIQUE composite + FK LeaveTypes Restrict, decimal 5,2). Remaining = Entitled+Adjustment−Used (computed). 90→91 tables.
|
||||
|
||||
**Trừ phép:** hook `ApproveLeaveRequestHandler` nhánh terminal DaDuyet — **exactly-once** (guard Status!=DaGuiDuyet chặn re-approve), upsert auto-create từ DaysPerYear, UsedDays+=NumDays, Year=StartDate.Year.
|
||||
|
||||
**FK invariant guard (em Max-review thêm sau test reveal):** Create + UpdateDraft validate LeaveTypeId tồn tại → ConflictException. Đóng cửa hẳn (grep xác nhận 2 write site duy nhất) → bogus type không thể tới deduction FK insert (tránh 500 kẹt đơn).
|
||||
|
||||
**CQRS:** GetMy (self lazy-merge active LeaveType) + GetUser (admin) + Adjust (admin upsert). Embed balance NGƯỜI TẠO vào leave detail DTO (approver xem đúng — KHÔNG dùng /my = viewer).
|
||||
|
||||
**FE:** block "Số dư phép" + cảnh báo vượt (kind=leave, SHA256 identical).
|
||||
|
||||
**Test:** +11 (deduction single/multi-level/accumulate/negative/reject-return-no-deduct + lazy-merge + adjust + Create guard) + repair 2 template terminal FK-fail. 130→**154 PASS**.
|
||||
|
||||
## Lessons (→ gotcha/memory)
|
||||
- **High→Max upgrade tác động lớn:** P11-A High → truncate 3× + lọt 2 FE bug + 1 sai run-id. P11-B Max → 0 truncate, test-specialist tự tìm FK risk, reviewer thorough no-truncate, 0 bug lọt. → memory `feedback_high_to_max_multiagent_quality`.
|
||||
- **WIRE FE phải đọc reference proven (không đoán):** 2 bug P11-A do agent đoán endpoint/shape. Brief FE agent BẮT BUỘC chỉ file reference proven cụ thể.
|
||||
- **FK-invariant-at-write-doors pattern:** thêm deduction/insert có FK → enforce FK validity tại MỌI write door (Create+Update), không assume. Test reveal gap.
|
||||
- **Gotcha #56 CWD-drift stray memory:** `cd` trước spawn → agent ghi MEMORY nhầm `fe-user/.claude`. 3× recover.
|
||||
|
||||
## State cuối
|
||||
42 mig · 91 tables · ~241 endpoint · 67 FE page · **154 test** · 56 gotcha · bundle `Krjvg_3j`/`6sNStgxa`. Phase 11: P11-A + P11-B DONE. Next: P11-C..F.
|
||||
|
||||
## Carry-over (chưa đụng)
|
||||
- `M docs/governance/BROADCAST-OUT-...-2026-05-29.md` + `?? .mcp.json` (untracked) — anh main quyết (từ S40).
|
||||
- RAG `solution_erp` last_indexed S41 (2407 chunks) — S42-S43 content chưa index, stopgap store_memory. Flag AI_INFRA re-index.
|
||||
- cicd flag: skill `iis-deploy-runbook` IIS path stale · `.claude/agent-memory/**/*.md` không trong paths-ignore (memory commit trigger CI).
|
||||
@ -1029,6 +1029,21 @@ for h in resp.points: # ← .points không phải iterable trực tiếp
|
||||
|
||||
---
|
||||
|
||||
### 56. Sub-agent ghi MEMORY nhầm path do CWD drift (Session 42-43 × 3 occurrence)
|
||||
|
||||
**Triệu chứng:** Sau khi em main `cd fe-user` (PowerShell npm build) rồi spawn agent trong CÙNG message → agent (test-specialist S42, reviewer + cicd-monitor S43) ghi MEMORY vào `fe-user/.claude/agent-memory/<name>/` thay vì root `.claude/agent-memory/<name>/`. Agent KHÔNG thấy root MEMORY (CWD=fe-user) → viết lại minimal from scratch (mất history L1). Stray `?? fe-user/.claude/` untracked, dễ commit nhầm.
|
||||
|
||||
**Root cause:** Agent relative-path resolution dùng CWD shell hiện tại (đã drift sang fe-user do `cd` trước đó — PowerShell CWD persist cross-call). Path memory relative `.claude/...` → resolve sai gốc.
|
||||
|
||||
**Mitigation:**
|
||||
- KHÔNG `cd` (đặc biệt PowerShell) TRƯỚC khi spawn agent. Dùng absolute path / `dotnet --project` / `git -C` / `npm --prefix` thay `cd`.
|
||||
- Em main recovery: đọc stray → merge entry mới vào root MEMORY (append Recent activity) → `rm -rf fe-user/.claude` → KHÔNG stage stray.
|
||||
- Stage chọn lọc (`git add <path cụ thể>`, KHÔNG `-A`) để stray + carry-over không lọt commit.
|
||||
|
||||
**References:** S42 test-specialist + S43 reviewer/cicd-monitor — cùng pattern, 3× recover thủ công.
|
||||
|
||||
---
|
||||
|
||||
## Checklist debug bug mới
|
||||
|
||||
1. Build pass không? → fail → check using + package version compat
|
||||
|
||||
Reference in New Issue
Block a user