pqhuy1987 03264581ff [CLAUDE] PurchaseEvaluation Tests: Chunk N1+N2 — HOTFIX per-NV lookup site discrimination Allow* flag (BE bug 2 ngày prod)
Bro UAT 2026-05-15 screenshot phát hiện: Admin Designer tick TRUE 7 flag cho
NV Test (UAT V2) slot Bước 2 Cấp 1 (4 NV cùng Cấp, OR-of-N Mig 29). Actor
login → dialog ✓ Duyệt KHÔNG có checkbox F2 skipToFinal + dialog ← Trả lại
CHỈ 1 radio Drafter + KHÔNG có F3+F4 Edit options.

Investigator audit confirm Hypothesis B: BE handler
`PurchaseEvaluationFeatures.cs:765` `FirstOrDefault(l => l.Order ==
curLevelOrder)` THIẾU discriminator `ApproverUserId == currentUser.UserId`.
Schema Mig 29 (S21 t5 2026-05-13) refactor: 1 row per ApproverUserId, OR-of-N
cùng Order → handler luôn lấy row đầu DB (Lê Văn Bính / Trần Xuân Lưu —
chỉ Drafter flag), bỏ qua admin tick per-NV của actor thật.

Bug PRESENT từ Mig 29 deploy 2026-05-13 (2 NGÀY PROD) nhưng chỉ bộc lộ khi
lần đầu admin tick selectively per-NV. Trước đây tất cả slot FALSE → mọi
actor đều thấy "không có options", behavior giống nhau, không lộ.

Cumulative gap analysis: Mig 29 + Mig 30 + Mig 31 wire 8 surface points đúng
nhưng MISS point 9 lookup discrimination → 3× refactor cùng bug. Point 9
mới được catch Plan N S23 t4 (em main + Reviewer + Implementer all MISS
xuyên 3 plan).

N1 BE fix (5 LOC line 765-779):
```csharp
var curLevel = curStep?.Levels.FirstOrDefault(l =>
    l.Order == curLevelOrder && l.ApproverUserId == currentUser.UserId)
    ?? curStep?.Levels.FirstOrDefault(l => l.Order == curLevelOrder); // admin/non-approver fallback
```

N2 Regression test (new file `GetPurchaseEvaluationCurrentLevelOptionsTests.cs`):
- `GetPe_PerNvLookup_ActorMatchesSlot_ReturnsActorSpecificFlags`:
  Seed 4 Level cùng Order=1 (mỗi Level distinct flag profile) × 4 actor →
  assert mỗi actor nhận flag riêng (KHÔNG profile khác). Critical assertion:
  Actor C → AllowApproverSkipToFinal=true (bug bro UAT regression).
- `GetPe_PerNvLookup_AdminNonApprover_FallsBackToFirstRow`:
  Admin actor (NON-match) → fallback FirstOrDefault EF SQLite non-deterministic
  → weak assert NOT null + match exactly 1 of 4 distinct profile.

Pattern reusable saved memory `feedback_per_nv_permission_scope.md` CRITICAL
HOTFIX S23 t4 section:
- Wire checklist 9 surface points (NOT 8 — thêm point 9 lookup discrimination)
- Audit cho future flag F5+: grep `FirstOrDefault.*Order ==` enumerate all
  lookup sites, verify discriminator role-context

Verify:
- dotnet build src/Backend/SolutionErp.Application clean (0 warning, 0 error)
- dotnet test SolutionErp.slnx **108/108 PASS** (+2 từ 106: 58 Domain + 50 Infra)
- N2 2 test individual PASS

Pending Chunk N4: docs + memory update commit + push remote.
Pending CICD Monitor post-deploy verify (spawn sau push).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 12:41:56 +07:00

SOLUTION_ERP

Hệ thống quản lý Hợp đồng Nhà cung cấp / Thầu phụ / Tổ đội cho Công ty TNHH Xây dựng Solutions.

📘 AI context: CLAUDE.md (pointer) → docs/CLAUDE.md (full)

Quick start (dev)

Yêu cầu: .NET 10 SDK, Node 20+, SQL Server (local hoặc qua Docker).

# 1. DB — chạy SQL Server qua Docker (nếu chưa có local)
docker compose up -d

# 2. Backend — migration + run Api (port 5443)
dotnet ef database update --project src/Backend/SolutionErp.Infrastructure --startup-project src/Backend/SolutionErp.Api
dotnet run --project src/Backend/SolutionErp.Api

# 3. Frontend admin (port 8082) — terminal mới
cd fe-admin
npm install
npm run dev

# 4. Frontend user (port 8080) — terminal mới
cd fe-user
npm install
npm run dev

Admin mặc định (sẽ seed sau Phase 1): admin@solutionerp.local / Admin@123456

Architecture

fe-admin (:8082)          fe-user (:8080)
       │                        │
       └────── /api proxy ──────┘
                  ▼
         SolutionErp.Api (:5443)
                  │
   ┌──────────────┼──────────────┐
   ▼              ▼              ▼
 Application   Domain      Infrastructure ── SQL Server

Tech stack

  • Backend: .NET 10 + Clean Architecture + CQRS (MediatR) + FluentValidation + AutoMapper + EF Core + ASP.NET Identity + JWT
  • Frontend: React 18 + Vite + TypeScript + Tailwind + shadcn/ui + TanStack Query
  • DB: SQL Server 2022
  • Deploy: Windows Server + IIS

Roadmap

Phase Tuần Focus
0 Draft T1 Scaffold, parse FORM + QUY_TRINH
1 Alpha Core T2-4 Auth, Permission, CRUD master
2 Form Engine T5-6 Render template docx/xlsx
3 Workflow T7-9 State machine 9 phase
4 Report + Polish T10-11 Dashboard + Excel export
5 Production T12-13 CI/CD IIS, UAT, go-live

Chi tiết ở docs/changelog/migration-todos.md.

License

Proprietary — Công ty TNHH Xây dựng Solutions.

Description
H? th?ng qu?n l� H?p d?ng NCC/Th?u ph?/T? d?i � .NET 10 Clean Arch + 2 React FE
Readme 8.6 MiB
Languages
C# 55%
TypeScript 42.7%
PowerShell 1.3%
JavaScript 0.3%
CSS 0.3%
Other 0.3%