Anh main yêu cầu tăng tốc + chất lượng SOLUTION_ERP: tham khảo BVAAU 7-agent config + budget token +50% + thêm 3 sub-agent. Adapted (NOT copied) — SOLUTION_ERP 2-FE-app fit + giữ 6 skill proven battle-test 38 session. Split 4→7 agent (anh main chốt via AskUserQuestion): - investigator → SPLIT: investigator-codebase (cyan, internal SQL/EF/grep) + investigator-api (blue, external docs/CVE/lib/cross-project) - implementer → SPLIT: implementer-backend (yellow, .NET Domain+App+Infra+Api) + implementer-frontend (orange, FE 2 app cookie-cutter mirror SHA256) [anh chốt backend/frontend thay domain/infra BVAAU — fit 2 React app + giảm gotcha #53 truncate] - test-specialist NEW (purple, dedicated tests/ — anh chốt full test layer) - reviewer (red) + cicd-monitor (green) giữ Tool grant +3 RAG MCP all 7 agent (search_code BM25 + store_memory + list_projects) — BVAAU port, MCP server verified support. Prior chỉ 2 (search_memory + cross_project). Skill re-distribute 6 skill across 7 agent (xem README matrix). Memory: rename investigator→investigator-codebase + implementer→implementer-backend (giữ history) + seed 3 new MEMORY (investigator-api/implementer-frontend/test-specialist) extract relevant patterns. Delete old investigator.md + implementer.md. README rewrite: 7-agent architecture + decision tree split-routing + phân việc matrix boundary + token budget +50% cost reality (~1.05M opt / ~2M heavy ceiling) + anti-truncation rules (gotcha #53 5× mitigation: brief ≤8K + curate pre-spawn + entry ≤1.5K + 529 fallback solo). ⚠️ Anh main RESTART Claude Code CLI để registry hot-reload 7 agent (per S27 lesson model:inherit + new files). Verify post-restart: smoke spawn 3 new agent confirm load. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3.4 KiB
Test-Specialist Agent — Persistent Memory
Persistent diary cross-session. Auto-injected first 200 lines / 25KB at spawn. Update BEFORE every stop. Curate when > 25KB. Keep entry ≤ 1.5K chars (gotcha #53). NEW agent S39 (2026-05-29) — dedicated test layer (tách khỏi implementer Case 3).
🎯 Role baseline
WRITE specialist độc quyền tests/**. xUnit + FluentAssertions 7.2 + EF SQLite TestApplicationDbContext + IdentityFixture. Tools: Read, Edit, Write, Bash, Grep, Glob + 5 RAG. Skills: contract-workflow + permission-matrix.
🚫 Split boundary
- ✅ MINE:
tests/SolutionErp.{Domain,Infrastructure}.Tests/** - ❌ NOT: production code
src/Backend/**+fe-*/**→ test reveal bug → REPORT em main, KHÔNG fix - ❌ NOT: decide WHAT to test (test plan) → em main + reviewer chốt priority
📊 Baseline 130 PASS (58 Domain + 72 Infra)
Run: dotnet test SolutionErp.slnx --nologo --verbosity minimal
⏱️ Timing rules (docs/rules.md §7)
- Feature mới = test-after (UAT ổn → viết, Phase 9 skip per
feedback_uat_skip_verify) - Bug fix = test-before BẮT BUỘC (reproduce → fix)
- Critical algo = test-before merge (codegen/guard/financial/security)
- Skip: DTO mapping, CRUD master, FE snapshot
📋 Patterns proven (apply confidently)
Pattern 10 Reflection authz regression (~50 LOC)
Catch class-level [Authorize(Policy=...)] regression: typeof(Ctrl).GetCustomAttribute<AuthorizeAttribute>().Policy.Should().Be(...). KHÔNG WebApplicationFactory heavy. Cho gotcha #44 silent 403.
Pattern 11 Test infra helper cookie-cutter
SeedWorkflowAsync (1 Step DepartmentId=null skip FK + 2 Levels) + SeedApproversAsync (N user fix.CreateUserAsync). Reusable PE/Contract/Proposal workflow test.
Pattern 12 InternalsVisibleTo
Expose internal helper via <InternalsVisibleTo Include="SolutionErp.Infrastructure.Tests" /> csproj.
Spec drift detection BEFORE write (S34 lesson)
Test theo CODE (single source truth), document mismatch header comment + report. Vd soft-delete UNIQUE: code chặn opt-out → test theo code, flag drift.
gotcha #48 SQLite tie-break
OrderByDescending(CreatedAt).First() pick wrong khi 2+ Add() cùng CreatedAt frozen-clock → discriminator filter .Where(Summary.Contains("Chuyển phase")) BEFORE OrderBy.
🎯 Coverage gap backlog (priority — Reviewer flagged S36)
- CRITICAL: HrmConfig 16 endpoint (S35) — Holiday composite UNIQUE (Year,Date) Update 0 test
- MAJOR: EmployeeSatellite 15 endpoint (S34) — cascade + FK invariant 0 test
- MAJOR: gotcha #44 regression MISS EmployeesController + HrmConfigsController
- Phase 10.3 Proposal ApproveV2 (S37) + Workflow Apps skeleton (S38) — test-after khi UAT confirm
📅 Recent activity (last 10 FIFO)
- 2026-05-29 (S39 agent split setup): NEW dedicated agent. Seeded test patterns (10 reflection authz + 11 infra helper + 12 InternalsVisibleTo + #48 SQLite tie-break + spec drift S34). Inherited coverage gap backlog 4 priority items từ S36 Reviewer audit (130 PASS baseline). First spawn pending em main S39+ test bundle task (recommend Gap 1 Holiday composite UNIQUE first).
⚠️ Anti-patterns (DO NOT)
- ❌ Touch production code → REPORT bug · 2. ❌ Skip MEMORY · 3. ❌ Test không chạy (dotnet test must PASS) · 4. ❌
git add -A· 5. ❌ Push remote · 6. ❌ Assertion trivial
🔄 Curate trigger
Size > 25KB → archive. Commit scope (em main commits): Tests.