[CLAUDE] Docs+Memory: S32 Phase 9 stabilize batch — Plan A3 MEMORY curate 3 agents + Plan B-Wrap spec BW1-BW7 defer + Plan C1 ops status update
Phase 9 stabilize sequential batch S32: - Plan A2 DONE: RAG re-ingest 166 files / 2988 chunks / 75.7s. Verify gotcha #52 query rerank 0.906 (was 0.516 < 0.7 threshold). Phase 10 backlog query rerank 0.758 semantic match good. - Plan A3 DONE: MEMORY curate 3 agents OVER 25KB threshold. Implementer 38.4 -> 27.5KB (5 verbose S25-S29 entries archived q2 - Patterns 1-19 + 12-bis + 16-bis foundation preserved). Investigator 27.7 -> 19KB (4 verbose S25-S26-S29 entries archived q2). CICD Monitor 27 -> 24.2KB (Run #231 PARTIAL detail archived q2 - S29 wrap summary preserves key findings). Reviewer 24.39KB unchanged (self-curated S32 startup). Total 117.9 -> 95.7KB (-22KB ~18%). - Plan B-Wrap spec BW1-BW7 documented detailed (migration-todos D-Bis section): BW1 happy path step advance + BW2 terminal gen ma HD + BW3 skipToFinal F2 admin opt-in + BW4 ForbiddenException + BW5 ApplicableType=Contract validation (Reviewer S29 MAJOR catch) + BW6 Mig 32+33 schema persistence UNIQUE composite + BW7 V1 fallback ConflictException. Defer dedicated session ~2h chot anh main S32 (test infra IChangelogService + IContractCodeGenerator mocks first-time). - Plan C1 ops status update: backup-sql.ps1 ready (register Task Scheduler manual cmd documented). win-acme cert api.solutions.com.vn notAfter=2026-07-23 (auto-renew ~2026-06-23 NOT 2026-06-18 stale STATUS.md note). SMTP + Rotate creds BLOCKED chờ anh main coordinate. Refs: docs/STATUS.md S31 wrap. docs/HANDOFF.md S31. gotcha #52 qdrant-client search removed (RAG layer stable post-S31 fix + S32 re-ingest gotchas hit). gotcha #51 INFRASTRUCTURE vs DEMO seed (Phase 10.3 enum extend caution). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -178,15 +178,7 @@ Bug latency observed when miss points 9-10: 2-3 days prod silent (Mig 28-29 depl
|
|||||||
|
|
||||||
- **2026-05-22 (S29 wrap — Run #229-#232 verify PASS + Plan B CICD CRITICAL DemoSeed gate catch — gotcha #51 NEW INFRASTRUCTURE vs DEMO):** S29 cumulative 2 big plans + 4 Run. **Plan CA (admin → eoffice move 7 commits):** Run #229 sha=68bcedd PASS 3m32s (5 chunks A+B+C+D+D2 batch — bundle hash rotate ×2 app + login catalog.manager 200 + JWT claims valid) + Run #230 sha=e55d96b PASS 3m24s (Hotfix 1 resolvePath staticMap — fe-user bundle rotate only, no BE change). **Plan B Contract V2 wire (mirror PE Mig 22-26 11 commits):** Run #231 sha=3e92584 PASS 10 chunks + Hotfix Reviewer — bundle rotate fe-admin `leEMWFLU→BBADl46y` + fe-user `Dgn1iU9E→DA_VI3zO` + Mig 32+33 prod apply confirmed. **Run #232 sha=38f1c4d PASS Hotfix CICD `SeedSampleContractWorkflowV2` out of DemoSeed gate** — CRITICAL CATCH agentId a2ea2e3a5dbe271b5 ~90K: nested inside `if (!demoSeedDisabled)` DbInitializer.cs:105-111, prod `DemoSeed:Disabled=true` (Plan T S23 t10) → seed SKIP → QT-HD-V2-001 KHÔNG tồn tại prod → Drafter Workspace dropdown V2 EMPTY → V2 contract path BLOCKED end-to-end UAT. Smoking gun log: "DemoSeed:Disabled=true → skip workflow + contracts + PE + sample V2 seed (Plan T S23 t10 + Plan B Chunk A2 Contract V2)". CICD Monitor agent fail 529 transient × 2 (Anthropic API overload) Plan CA verify → em main fallback manual smoke Bash curl + sqlcmd direct. **Patterns proven NEW:** Discovery #6 INFRASTRUCTURE vs DEMO seed phân biệt → gotcha #51 sẽ docs. **Smart Friend ROI 4× cumulative:** S22 #44 + S25 #48 + S29 Plan B Reviewer ApplicableType + S29 Plan B CICD DemoSeed gate. **Anti-patterns observed:** (a) Implementer A2 mirror PE V2 seed pattern (gated) cho Contract V2 — Plan B should treat differently vì V2 path BLOCKED if seed skip. (b) Em main miss noticing seed inside DemoSeed gate khi review Chunk A2. 0 prod regression observed S29 cumulative.
|
- **2026-05-22 (S29 wrap — Run #229-#232 verify PASS + Plan B CICD CRITICAL DemoSeed gate catch — gotcha #51 NEW INFRASTRUCTURE vs DEMO):** S29 cumulative 2 big plans + 4 Run. **Plan CA (admin → eoffice move 7 commits):** Run #229 sha=68bcedd PASS 3m32s (5 chunks A+B+C+D+D2 batch — bundle hash rotate ×2 app + login catalog.manager 200 + JWT claims valid) + Run #230 sha=e55d96b PASS 3m24s (Hotfix 1 resolvePath staticMap — fe-user bundle rotate only, no BE change). **Plan B Contract V2 wire (mirror PE Mig 22-26 11 commits):** Run #231 sha=3e92584 PASS 10 chunks + Hotfix Reviewer — bundle rotate fe-admin `leEMWFLU→BBADl46y` + fe-user `Dgn1iU9E→DA_VI3zO` + Mig 32+33 prod apply confirmed. **Run #232 sha=38f1c4d PASS Hotfix CICD `SeedSampleContractWorkflowV2` out of DemoSeed gate** — CRITICAL CATCH agentId a2ea2e3a5dbe271b5 ~90K: nested inside `if (!demoSeedDisabled)` DbInitializer.cs:105-111, prod `DemoSeed:Disabled=true` (Plan T S23 t10) → seed SKIP → QT-HD-V2-001 KHÔNG tồn tại prod → Drafter Workspace dropdown V2 EMPTY → V2 contract path BLOCKED end-to-end UAT. Smoking gun log: "DemoSeed:Disabled=true → skip workflow + contracts + PE + sample V2 seed (Plan T S23 t10 + Plan B Chunk A2 Contract V2)". CICD Monitor agent fail 529 transient × 2 (Anthropic API overload) Plan CA verify → em main fallback manual smoke Bash curl + sqlcmd direct. **Patterns proven NEW:** Discovery #6 INFRASTRUCTURE vs DEMO seed phân biệt → gotcha #51 sẽ docs. **Smart Friend ROI 4× cumulative:** S22 #44 + S25 #48 + S29 Plan B Reviewer ApplicableType + S29 Plan B CICD DemoSeed gate. **Anti-patterns observed:** (a) Implementer A2 mirror PE V2 seed pattern (gated) cho Contract V2 — Plan B should treat differently vì V2 path BLOCKED if seed skip. (b) Em main miss noticing seed inside DemoSeed gate khi review Chunk A2. 0 prod regression observed S29 cumulative.
|
||||||
|
|
||||||
- **2026-05-22 12:54-12:58 — Run #231 (id=345) Plan B Contract V2 wire kick-off VERDICT=PARTIAL (PASS deploy + PARTIAL seed):** Push range `6eec8d7..3e92584` 11 commits (1 docs MCP RAG tools sub-agent + 2 Mig BE A1+A2+C + 1 Service B+B2 ApproveV2Async ~150 LOC + 1 DTO E1+E2 + 6 FE × 2 app Workspace D + Section 5 E3 + 1 Hotfix Reviewer ApplicableType=Contract guard). CI status=success duration **3m30s** (12:54:24→12:57:54). **Bundle hash 2/2 ROTATED:** admin `leEMWFLU→BBADl46y` + user `Dgn1iU9E→DA_VI3zO` (FE shipped OK). **Mig 32 + Mig 33 BOTH applied prod:** sqlcmd TOP 2 = `20260522052240_AddContractLevelOpinions` + `20260522051059_AddApprovalWorkflowToContract`. **Contract V2 cols verified:** `ApprovalWorkflowId` + `CurrentApprovalLevelOrder` exist. **ContractLevelOpinions table exists, 0 rows** (no Contract V2 created yet — expected). **API health 200 + 5/5 smoke 200** (contracts/PE/menus/AW-v2 filter / AW-v2 all). **V1 backward compat OK:** 7 contracts V1 preserved untouched.
|
- **Archived Run #231 PARTIAL detail (Plan B Contract V2 kick-off DemoSeed gap discovery) → `archive/2026-05-q2.md` 2026-05-26 S32 curate.** KEY findings preserved in S29 wrap entry above: Run #231 PASS deploy + Mig 32+33 + bundle rotate, gap = ApplicableType=3 ZERO seed (DemoSeed gate), resolved by Run #232 Hotfix CICD → gotcha #51 added.
|
||||||
|
|
||||||
**CRITICAL DISCOVERY #6 (NEW gotcha to add) — DemoSeed feature flag gates Plan B Chunk A2 sample V2 workflow seed:** API log evidence `2026-05-22 12:57:44 [INF] DemoSeed:Disabled=true → skip workflow + contracts + PE + sample V2 seed (Plan T S23 t10 + Plan B Chunk A2 Contract V2)`. Result: **QT-HD-V2-001 NOT seeded in prod** (0 rows ApplicableType=3 — only ApplicableType=1 has 2 workflows QT-DN-V2-001 v1+v2 seeded historically pre-flag). V2 endpoint returns `{"active":null,"history":[]}` cho ApplicableType=3 → FE Workspace Contract Create dropdown EMPTY → user CAN'T pick V2 workflow → V2 wire E2E NOT testable UAT mode. **Fix options (escalate em main):** (a) admin manually create QT-HD-V2-001 via FE Admin Designer V2 UI post-deploy (preferred — production-safe) OR (b) carve seed out of DemoSeed gate (Plan T S23 t10 design opposite — DemoSeed flag intentional UAT clean-state). Decision NOT for CICD Monitor — escalating.
|
|
||||||
|
|
||||||
**0 new tests added Plan B (~150 LOC ApproveV2Async NO test cover)** — test gate 111 unchanged baseline (UAT skip-test per `feedback_uat_skip_verify`, but Plan B ApproveV2Async is exact gotcha #48 high-risk pattern: Service refactor > 100 LOC touching changelog/audit paths. Recommend Plan B+1 test addition next chunk before scaling).
|
|
||||||
|
|
||||||
**SlaExpiryJob ERR cluster (5 entries 12:58:16):** pre-existing V1 SLA jobs auto-approve fail on legacy contracts `ConflictException Transition X→Y không hỗ trợ` (DangInKy→DangKiemTraCCM / DangSoanThao→DangGopY / DangGopY→DangDamPhan / DangTrinhKy→DongDau). **UNRELATED to Plan B** (V1 phase enum transitions, no V2 involvement). Pre-existing prod noise — escalate em main for separate investigation if cleanup desired.
|
|
||||||
|
|
||||||
**0 regression observed prod.** Plan B BE schema + FE wire shipped successfully; seed gap is feature-flag design choice not deploy failure.
|
|
||||||
|
|
||||||
- **2026-05-22 (S28 wrap — Layer A governance apply, NO Run S28):** Zero git push remote cả S28 (all local docs + memory + RAG store chunks) → 0 deploy event, bundle hash 2/2 unchanged Run #227 baseline, Mig 31 prod unchanged, 111 test baseline unchanged. **Timeline:** t1 startup 9-step + smoke test pass (registry hot-reload OK post-S27 model:inherit fix + 3,462 RAG chunks indexed) → t2-t4 RAG ROI verdict + over-reach mistake + scope-down → t5 Layer A governance apply. **Layer A 3 rule cụ thể:** (1) **4-category default tags mandatory** cho mọi chunk forward — CICD scope: `pattern`, `gotcha`, `session-wrap`, `cicd` + tag bổ sung `phase-9` + optional `commit:<sha7>` cross-ref + `severity:p0..p3`. (2) **source_path convention** for retrieval: `solution_erp/audit/cicd-<run-id>-<date>` cho per-Run audit chunks; `solution_erp/session/cicd-wrap-<date>` cho session wrap. (3) **Weekly Friday eval ritual** starting **2026-05-29** Friday 5 metric: query/session count + hit rate (rerank ≥0.7) + store noise % + RAG vs MD ratio + Voyage embed cost/week. 10 golden query draft sẵn cross-stack scenarios: Plan B Contract V2 wire kick-off + gotcha #48 SQLite tie-break + per-NV 10-surface checklist + cookie-cutter mirror PE→Contract + controller body record param count + FE merge synthetic Policy V2 + EF backfill idempotent + Smart Friend agent eval + DemoSeed feature flag + Run #215+#216 fail-fix pair pattern. **ABANDONED rule cũ:** "mọi tương tác mandatory RAG" → wastes ~30K query overhead khi single Run verify Bash poll đủ context. **Foundation kept:** 10-surface-point per-NV checklist (S22+5 → S23 t6) vẫn promoted MEMORY foundation cho future per-NV refactor verify. **Forward S28+:** chờ catch first CICD Run đầu Plan B Contract V2 wire khi bro push commit BE/FE/Mig (Mig 32+ expected).
|
- **2026-05-22 (S28 wrap — Layer A governance apply, NO Run S28):** Zero git push remote cả S28 (all local docs + memory + RAG store chunks) → 0 deploy event, bundle hash 2/2 unchanged Run #227 baseline, Mig 31 prod unchanged, 111 test baseline unchanged. **Timeline:** t1 startup 9-step + smoke test pass (registry hot-reload OK post-S27 model:inherit fix + 3,462 RAG chunks indexed) → t2-t4 RAG ROI verdict + over-reach mistake + scope-down → t5 Layer A governance apply. **Layer A 3 rule cụ thể:** (1) **4-category default tags mandatory** cho mọi chunk forward — CICD scope: `pattern`, `gotcha`, `session-wrap`, `cicd` + tag bổ sung `phase-9` + optional `commit:<sha7>` cross-ref + `severity:p0..p3`. (2) **source_path convention** for retrieval: `solution_erp/audit/cicd-<run-id>-<date>` cho per-Run audit chunks; `solution_erp/session/cicd-wrap-<date>` cho session wrap. (3) **Weekly Friday eval ritual** starting **2026-05-29** Friday 5 metric: query/session count + hit rate (rerank ≥0.7) + store noise % + RAG vs MD ratio + Voyage embed cost/week. 10 golden query draft sẵn cross-stack scenarios: Plan B Contract V2 wire kick-off + gotcha #48 SQLite tie-break + per-NV 10-surface checklist + cookie-cutter mirror PE→Contract + controller body record param count + FE merge synthetic Policy V2 + EF backfill idempotent + Smart Friend agent eval + DemoSeed feature flag + Run #215+#216 fail-fix pair pattern. **ABANDONED rule cũ:** "mọi tương tác mandatory RAG" → wastes ~30K query overhead khi single Run verify Bash poll đủ context. **Foundation kept:** 10-surface-point per-NV checklist (S22+5 → S23 t6) vẫn promoted MEMORY foundation cho future per-NV refactor verify. **Forward S28+:** chờ catch first CICD Run đầu Plan B Contract V2 wire khi bro push commit BE/FE/Mig (Mig 32+ expected).
|
||||||
|
|
||||||
@ -220,4 +212,4 @@ Bug latency observed when miss points 9-10: 2-3 days prod silent (Mig 28-29 depl
|
|||||||
- Duplicate failure patterns → merge into single entry (vd act_runner timeout x3 → 1 entry)
|
- Duplicate failure patterns → merge into single entry (vd act_runner timeout x3 → 1 entry)
|
||||||
- Stale > 3 months → remove
|
- Stale > 3 months → remove
|
||||||
|
|
||||||
**Last curate: 2026-05-22 em main full curate** — archived 14 verbose Run entries (#186-#221) S21 t3 → S25 Plan AF → `archive/2026-05-runs.md` (~50KB content moved). KEEP in MEMORY: Run #215+#216 pair (gotcha #48 lesson critical), Run #222-#227 S26 summary (Plan AG series), 2026-05-12 setup, S22 chốt cuối verify summary. 8 key patterns extracted to archive header. **10-surface-point per-NV checklist** promoted to foundation. Memory size before: ~72KB (vượt 50KB hard threshold per HANDOFF flag) → after: target ~25-28KB. Next curate trigger: > 50KB OR next major Phase wire (Plan B Contract V2). Per `feedback_md_compact_narrative.md` §6.5 KEEP narrative — archive preserves full verbose entries cho cross-session audit retrieve.
|
**Last curate: 2026-05-26 S32 em main proxy curate** (post-S31 RAG fix) — archived 1 verbose Run #231 PARTIAL detail → `archive/2026-05-q2.md`. KEEP in MEMORY: S32 startup, S29 wrap summary (Run #229-#232 cumulative), S28 Layer A governance, S27 hot-reload pitfall, S22 curate, Run #215+#216 pair gotcha #48 critical, S26 Run #222-#227 summary, 2026-05-12 setup. Foundation 10-surface-point per-NV checklist + Stage 0-5 checklist + Discovery #6 INFRASTRUCTURE vs DEMO seed (Stage 4.6) preserved. MEMORY size before: 27 KB → after: ~24 KB. **Previous curate: 2026-05-22** — archived 14 verbose Run #186-#221 → `archive/2026-05-runs.md`. Next trigger: > 25KB OR Plan G-H1 kick off.
|
||||||
|
|||||||
24
.claude/agent-memory/cicd-monitor/archive/2026-05-q2.md
Normal file
24
.claude/agent-memory/cicd-monitor/archive/2026-05-q2.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# CI/CD Monitor Agent — Archive Recent Runs Q2 2026-05 (Plan B detail)
|
||||||
|
|
||||||
|
> **Archived:** 2026-05-26 S32 em main proxy curate session (post-S31 RAG fix).
|
||||||
|
> **Scope:** 1 verbose Run #231 entry (Plan B Contract V2 wire kick-off PARTIAL) — moved from MEMORY.md để giữ slim < 25KB threshold (was 27KB → target ~24KB).
|
||||||
|
> **Rule §6.5 compliance:** KHÔNG cắt narrative — full verbose entry preserved cho cross-session audit.
|
||||||
|
> **KEEP in MEMORY:** S32 startup, S29 wrap summary (Run #229-#232 cumulative aggregate including #231 + #232 hotfix DemoSeed gate catch), S28 Layer A governance, S27 hot-reload pitfall, S22 curate session, Run #215+#216 pair (gotcha #48 critical lesson), 2026-05-12 setup. Foundation 10-surface-point per-NV checklist preserved.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Archive entries (FIFO chronological — earliest first)
|
||||||
|
|
||||||
|
### 2026-05-22 12:54-12:58 — Run #231 (id=345) Plan B Contract V2 wire kick-off VERDICT=PARTIAL (PASS deploy + PARTIAL seed)
|
||||||
|
|
||||||
|
Push range `6eec8d7..3e92584` 11 commits (1 docs MCP RAG tools sub-agent + 2 Mig BE A1+A2+C + 1 Service B+B2 ApproveV2Async ~150 LOC + 1 DTO E1+E2 + 6 FE × 2 app Workspace D + Section 5 E3 + 1 Hotfix Reviewer ApplicableType=Contract guard). CI status=success duration **3m30s** (12:54:24→12:57:54). **Bundle hash 2/2 ROTATED:** admin `leEMWFLU→BBADl46y` + user `Dgn1iU9E→DA_VI3zO` (FE shipped OK). **Mig 32 + Mig 33 BOTH applied prod:** sqlcmd TOP 2 = `20260522052240_AddContractLevelOpinions` + `20260522051059_AddApprovalWorkflowToContract`. **Contract V2 cols verified:** `ApprovalWorkflowId` + `CurrentApprovalLevelOrder` exist. **ContractLevelOpinions table exists, 0 rows** (no Contract V2 created yet — expected). **API health 200 + 5/5 smoke 200** (contracts/PE/menus/AW-v2 filter / AW-v2 all). **V1 backward compat OK:** 7 contracts V1 preserved untouched.
|
||||||
|
|
||||||
|
**CRITICAL DISCOVERY #6 (NEW gotcha to add) — DemoSeed feature flag gates Plan B Chunk A2 sample V2 workflow seed:** API log evidence `2026-05-22 12:57:44 [INF] DemoSeed:Disabled=true → skip workflow + contracts + PE + sample V2 seed (Plan T S23 t10 + Plan B Chunk A2 Contract V2)`. Result: **QT-HD-V2-001 NOT seeded in prod** (0 rows ApplicableType=3 — only ApplicableType=1 has 2 workflows QT-DN-V2-001 v1+v2 seeded historically pre-flag). V2 endpoint returns `{"active":null,"history":[]}` cho ApplicableType=3 → FE Workspace Contract Create dropdown EMPTY → user CAN'T pick V2 workflow → V2 wire E2E NOT testable UAT mode. **Fix options (escalate em main):** (a) admin manually create QT-HD-V2-001 via FE Admin Designer V2 UI post-deploy (preferred — production-safe) OR (b) carve seed out of DemoSeed gate (Plan T S23 t10 design opposite — DemoSeed flag intentional UAT clean-state). Decision NOT for CICD Monitor — escalating.
|
||||||
|
|
||||||
|
**0 new tests added Plan B (~150 LOC ApproveV2Async NO test cover)** — test gate 111 unchanged baseline (UAT skip-test per `feedback_uat_skip_verify`, but Plan B ApproveV2Async is exact gotcha #48 high-risk pattern: Service refactor > 100 LOC touching changelog/audit paths. Recommend Plan B+1 test addition next chunk before scaling).
|
||||||
|
|
||||||
|
**SlaExpiryJob ERR cluster (5 entries 12:58:16):** pre-existing V1 SLA jobs auto-approve fail on legacy contracts `ConflictException Transition X→Y không hỗ trợ` (DangInKy→DangKiemTraCCM / DangSoanThao→DangGopY / DangGopY→DangDamPhan / DangTrinhKy→DongDau). **UNRELATED to Plan B** (V1 phase enum transitions, no V2 involvement). Pre-existing prod noise — escalate em main for separate investigation if cleanup desired.
|
||||||
|
|
||||||
|
**0 regression observed prod.** Plan B BE schema + FE wire shipped successfully; seed gap is feature-flag design choice not deploy failure.
|
||||||
|
|
||||||
|
**Resolution:** Run #232 sha=`38f1c4d` Hotfix CICD — `SeedSampleContractWorkflowV2` carved out of DemoSeed gate (option B). Gotcha #51 added to docs/gotchas.md cumulative.
|
||||||
@ -328,15 +328,7 @@ KHÔNG `*` / `latest`. Critical pins:
|
|||||||
|
|
||||||
- **2026-05-22 (S29 wrap — Plan CA Chunk B + Plan B 4 chunks Case 2 cookie-cutter + 1 stopped E3 + Pattern 12-bis NEW):** Implementer = busiest agent S29 với 5 spawn total. **Plan CA Chunk B (~10K):** 4 master pages mirror fe-admin→fe-user byte-identical SHA256, touch 6 file (4 page + App.tsx +5 route + menuKeys.ts +5 key Catalogs*), 948 LOC mirror PASS 0 TS err. Saved `pattern_master_page_mirror.md`. **Plan B 4 spawn cumulative:** (A2 Mig 32 ~25K) schema +column FK Restrict IX + Configuration + DbInitializer SeedSampleContractWorkflowV2 — **stash em main WIP ContractWorkflowService.cs** để build verify clean (em main + Implementer parallel touch BE → race condition trick); (C Mig 33 ContractLevelOpinions ~25K) entity + Mig + Config + DbSet + Contract.cs +LevelOpinions nav — **Pattern 12-bis NEW cross-module entity cookie-cutter mirror PE→Contract** scaffold 4-file pattern documented Patterns section; (D FE Workspace V2 ~12K) ContractCreatePage × 2 app +useQuery V2 + Select dropdown wire ApprovalWorkflowId, 88 LOC mirror byte-similar; (E3 stopped mid-task) FE Section 5 V2 STOPPED at "check ContractDetail type" judgment call → em main solo finish. **Lessons:** (1) **Race condition em main + Implementer parallel BE** → stash trick works but adds overhead. Forward SEQUENTIAL chunks A→B→C khi cùng touch BE, NOT parallel. (2) **Complex FE feature mirror với type extend + new component** → em main solo more reliable than Implementer khi spec ambiguity > 20% in Read-required component inspection. (3) Pattern 16-bis 4-place mirror cross-app reinforced 2× (Plan CA Chunk B + Plan B Chunk D) — verify Layout staticMap khi page move/route enhance. **Patterns proven NEW S29:** Pattern 12-bis cross-module entity scaffold + Pattern 16-bis 4-place mirror reinforced. **Anti-pattern observed:** (a) Implementer E3 stopped mid-task FE complex judgment — em main miss provide concrete component template trong prompt. (b) Race condition parallel BE → stash workaround. Tag: `[pattern, phase-9, frontend+infra]`. KHÔNG curate (33.2KB OK borderline > 25KB threshold but close — defer to next session em main full curate khi S30 wrap).
|
- **2026-05-22 (S29 wrap — Plan CA Chunk B + Plan B 4 chunks Case 2 cookie-cutter + 1 stopped E3 + Pattern 12-bis NEW):** Implementer = busiest agent S29 với 5 spawn total. **Plan CA Chunk B (~10K):** 4 master pages mirror fe-admin→fe-user byte-identical SHA256, touch 6 file (4 page + App.tsx +5 route + menuKeys.ts +5 key Catalogs*), 948 LOC mirror PASS 0 TS err. Saved `pattern_master_page_mirror.md`. **Plan B 4 spawn cumulative:** (A2 Mig 32 ~25K) schema +column FK Restrict IX + Configuration + DbInitializer SeedSampleContractWorkflowV2 — **stash em main WIP ContractWorkflowService.cs** để build verify clean (em main + Implementer parallel touch BE → race condition trick); (C Mig 33 ContractLevelOpinions ~25K) entity + Mig + Config + DbSet + Contract.cs +LevelOpinions nav — **Pattern 12-bis NEW cross-module entity cookie-cutter mirror PE→Contract** scaffold 4-file pattern documented Patterns section; (D FE Workspace V2 ~12K) ContractCreatePage × 2 app +useQuery V2 + Select dropdown wire ApprovalWorkflowId, 88 LOC mirror byte-similar; (E3 stopped mid-task) FE Section 5 V2 STOPPED at "check ContractDetail type" judgment call → em main solo finish. **Lessons:** (1) **Race condition em main + Implementer parallel BE** → stash trick works but adds overhead. Forward SEQUENTIAL chunks A→B→C khi cùng touch BE, NOT parallel. (2) **Complex FE feature mirror với type extend + new component** → em main solo more reliable than Implementer khi spec ambiguity > 20% in Read-required component inspection. (3) Pattern 16-bis 4-place mirror cross-app reinforced 2× (Plan CA Chunk B + Plan B Chunk D) — verify Layout staticMap khi page move/route enhance. **Patterns proven NEW S29:** Pattern 12-bis cross-module entity scaffold + Pattern 16-bis 4-place mirror reinforced. **Anti-pattern observed:** (a) Implementer E3 stopped mid-task FE complex judgment — em main miss provide concrete component template trong prompt. (b) Race condition parallel BE → stash workaround. Tag: `[pattern, phase-9, frontend+infra]`. KHÔNG curate (33.2KB OK borderline > 25KB threshold but close — defer to next session em main full curate khi S30 wrap).
|
||||||
|
|
||||||
- **2026-05-22 (S29 Plan B Chunk D PASS — FE ContractCreatePage V2 Workspace dropdown × 2 app cookie-cutter mirror PE):** Spec deterministic 100% từ em main reference `fe-user/src/components/pe/PeWorkspaceCreateView.tsx` (canonical V2 dropdown lines 80-89 useQuery + lines 152-172 Select UI). 2 file mirror × 2 app `fe-admin/fe-user/src/pages/contracts/ContractCreatePage.tsx`: +44 LOC each = +88 LOC total byte-similar (git diff stat verify). Changes: (1) `useState approvalWorkflowId = ''` mới + (2) `useQuery approval-workflows-v2-contract` filter ApplicableType=3 client-side filter isUserSelectable=true (mirror PE Mig 25 pattern Plan AA S24) + (3) `Select dropdown "Quy trình duyệt V2 (tùy chọn)"` placement giữa FormFields + Budget section, blank = V1 fallback hint "(đã add ContractHeaderForm function, KHÔNG add ContractEditForm function vì spec scope CreatePage workspace only - edit-mode update endpoint defer)" + (4) Wire `approvalWorkflowId: approvalWorkflowId || null` vào CreateContractCommand POST body. BE precondition verify: `CreateContractCommand` record line 17-36 ContractFeatures.cs đã có `Guid? ApprovalWorkflowId = null` field (em main commit Chunk E1 PRIOR — comment marker "[Plan B S29 2026-05-22 Chunk E1] Drafter pick V2 workflow lúc create"). FE wire safe — no DTO mismatch. Build verify: `npm --prefix fe-admin run build` PASS 0 TS err 1926 modules 1.40MB gzip 358KB 16.07s; `npm --prefix fe-user run build` PASS 0 TS err 1916 modules 1.32MB gzip 343KB 8.84s. Pre-existing CSS @import warn + INEFFECTIVE_DYNAMIC_IMPORT realtime.ts warn unchanged (baseline noise). **Pattern 16-bis 4-place mirror check applied:** (1) Page file × 2 app DONE byte-similar; (2) App.tsx Routes N/A (enhance existing `/contracts/new` route - không route mới); (3) menuKeys.ts N/A (không menu key mới — page enhancement); (4) Layout staticMap N/A (route unchanged). Token ~12k Case 2 cookie-cutter (4 Read PE source + 2 Edit per file × 2 = 4 Edit total + 2 npm build + 1 git commit + memory update). Commit `62b50d1` clean 2 file. KHÔNG push remote — em main coordinate Chunk E final batch. **Pattern 5 mirror 2 app §3.9 applied 9th cumulative S20-S29** (proven IDENTICAL bytes hash check sau edit batch — git diff stat confirm). **Pattern 12-bis cross-module FE cookie-cutter mirror** demonstrated: PE PeWorkspaceCreateView V2 dropdown → Contract ContractCreatePage V2 dropdown clean (same useQuery shape, same Select markup, same filter logic, same POST body wire) — discriminator field ApplicableType=3 swap from `defaultType` (PE 1/2). Reusable pattern future Budget V2 / any cross-module entity với V2 workflow integration. Tag: `[pattern, phase-9, frontend]`.
|
- **5 verbose entries S25-S29 archived to `archive/2026-05-q2.md` 2026-05-26 S32 curate:** S29 Plan B Chunk D detail + S27 Plan CA Chunk B detail + S26 t1 Plan AG Phase 1 detail + S25 wrap + S25 Plan AB Chunk A. KEY takeaways preserved in S29 wrap entry above. Patterns 16-19 NEW S25-S26 reference foundation section line 165-283.
|
||||||
|
|
||||||
- **2026-05-22 (S27 Plan CA Chunk B — Move 4 master pages fe-admin → fe-user, Case 2 cookie-cutter):** Spec từ em main deterministic 100% (Investigator pre-verify fe-user parity DataTable/PageHeader/PermissionGuard/usePermission/6 shadcn ui/types/master.ts byte-identical). Execute parallel: 4 `Write` cho master pages + 1 `Edit` menuKeys.ts (+5 key Catalogs*) + 2 `Edit` App.tsx (import + route block). LOC delta `+962` (4 file 948 LOC mirror + 14 LOC App.tsx + menuKeys.ts). Verify SHA256 byte-identical 4 file: `C1760788...` / `BDF0529E...` / `68213D62...` / `6F482614...` all match admin source. `npm run build` fe-user PASS 0 TS err 1916 modules 14.14s (pre-existing CSS @import + chunk-size + INEFFECTIVE_DYNAMIC_IMPORT warn unchanged). Commit `06a441c` 6 file changed. **Pattern 16 NEW** — byte-identical mirror admin → user khi parity confirmed (memory `pattern_master_page_mirror.md`): copy nguyên file (KHÔNG modify), verify SHA256 post-write, regression-safe vì admin code đã UAT pass. **Token cost ~10k Case 2** (4 file mirror cookie-cutter, NO logic decision). KHÔNG push remote (Chunk A em main solo BE parallel chưa xong, Chunk C sidebar filter + Chunk D smoke verify defer). Tag schema S28: `[pattern, phase-9, frontend]` cho Pattern 16. **Gotcha S27**: PowerShell `$_` variable in `ForEach-Object` block bị Bash tool shell-escape eaten — workaround dùng `Get-FileHash file1, file2, ... -Algorithm SHA256 | Format-Table` list literal thay vì pipeline iterate.
|
|
||||||
|
|
||||||
- **2026-05-21 (S26 t1, Plan AG Chunk A+B+C PASS — Phase 1 PE List tree view 2-level):** UAT feedback bro Tra Sol "đám rừng" flat list → Outlook folder tree. **3 chunk cumulative 1 commit** `0bf6c7e` 2 file +346/-116 LOC = +115 LOC each. Mirror 2 app §3.9 IDENTICAL post-edit (SHA256 verify match `21001E90...`). Chunk A useMemo group nested: `ProjectGroup{projectId, projectName, goiThauList[], totalCount}` + `GoiThauGroup{displayName, normalizedKey, items[]}`. Normalize trim + toLowerCase group key, display raw đầu tiên trong group. Fallback "(Dự án đã xoá)" empty projectName + "(Chưa phân loại)" empty TenGoiThau. Sort vi locale 2 cấp A-Z. Filter pendingMe → DaGuiDuyet áp dụng TRƯỚC group (empty state đúng). Chunk B UI `<details>/<summary>` HTML native 2-level — fe-user no shadcn Accordion → native browser disclosure widget free. Tailwind v3 named groups `group/proj` + `group/gt` cho chevron rotation `group-open/proj:rotate-90`. `[&::-webkit-details-marker]:hidden` ẩn default disclosure triangle browser. 📁 + 📄 emoji icon inline + count badge `rounded-full bg-slate-200/100`. PE card content preserve nguyên (text + badge + date format + contractId hint — line 209-248 cũ). Chunk C localStorage persist Set<string> key `pe_list_expanded_groups`. Project key: `projectId or '__no_project__'`. Gói thầu key: `${projectId}::${normalizedGoiThau}`. Default empty Set (all collapse) — Outlook-style closed default. `try/catch` defensive cho localStorage (storage quota / private browsing). Header badge `pendingMe ? totalRowCount : list.data?.total` (replace `rows.length`). Empty state check `projectGroups.length === 0` (replace `rows.length === 0`). Import `useMemo, useState` từ 'react' (file pre-existing chỉ import từ tanstack). Build: fe-user PASS 0 TS err 1291.33 KB gzip 337.00 KB 1907 modules 16.05s; fe-admin PASS 0 TS err 1402.68 KB gzip 357.51 KB 1926 modules 6.86s. Pre-existing CSS @import warn + INEFFECTIVE_DYNAMIC_IMPORT realtime.ts unchanged. KHÔNG ops git push (em main verify Reviewer rồi push). Token ~16k (close to ~14k baseline Case 2 mirror 2 app). **Pattern 19 NEW**: HTML native `<details>/<summary>` + Tailwind named groups (`group/<name>`) + localStorage Set<string> persist cho hierarchical UI when no Accordion lib available. Free open/close state native browser (Space/Enter keyboard accessible) + 0 JS state per node + serialize/deserialize Set ↔ JSON array string. Tailwind v3 named groups syntax `group/proj` parent + `group-open/proj:rotate-90` child differs from default unnamed `group` + `group-open:rotate-90` — critical when nested groups cùng level cần distinct event scope. Reusable cho future tree views: Project explorer · Dept hierarchy · Permission tree · Workflow definition step list (vs HTML5 native vs shadcn vs JS library). Anti-pattern: nested same-name `group` would inherit parent state → both rotate sync. **Pattern 5 mirror 2 app §3.9 applied 8th cumulative S20-S26** (proven reliable IDENTICAL hash check sau edit batch — recommend tooling `git diff fe-admin/X fe-user/X` after every multi-file edit batch).
|
|
||||||
|
|
||||||
- **2026-05-19 (S25 wrap — Plan AB Chunk A Case 1 + 6 follow-up plans em main solo):** Plan AB Chunk A spawn 1× ~12K Case 1 cookie-cutter mirror. BE refactor ApplyReturnModeAsync Drafter early return → common path (line 280-287 → if/else block) + single Changelog.Add() ở cuối hàm với modeName switch enum + actorName resolve via userManager.FindByIdAsync mirror LogTransitionAsync pattern. FE × 2 app HistoryTab filter relax (PE_ENTITY_HEADER=1 + summary contains 'ngân sách' for Bug 1 + Workflow summary contains 'Trả lại' for Bug 2). KHÔNG TS test (UAT mode skip). KHÔNG migration. KHÔNG endpoint. Commit cdfd542 3 file +146/-95 LOC PASS. **Em main solo từ Plan AC** (cross-stack reasoning + UAT iteration borderline scope — Implementer would REFUSE per criteria #4 tight coupling BE+FE same plan). AC capture pre-call Step/Level + add Approval row Reject branch + skipToFinal comment + FE Decision badge × 2 app. AC2 FE merge synthetic Reject + dedupe timestamp 5s bucket. AD drop phase badges + extractNextTargetHint regex parse. AE BE batch 9 Changelog.Add sites UserName preventive fix. AF FE userMap fallback từ embedded domain data PeDetailBundle. **Pattern 16 NEW** (cumulative S25): Preventive systemic batch fix khi audit phát hiện 9 sites cùng bug pattern — replace_all=true với context-aware key (UserId line + Summary line) — 1 pass cover N sites idempotent. **Pattern 17 NEW**: FE merge synthetic rows từ Changelog cho audit historical recovery — pattern reusable cho Contract V2 + Budget V2 audit visualization without DB write. **Pattern 18 NEW**: FE userMap fallback từ embedded domain data (drafter + approvals + approvalFlow + levelOpinions + departmentOpinions) — no extra API fetch cho historical name resolve.
|
|
||||||
|
|
||||||
- **2026-05-19 (S25, Plan AB Chunk A PASS):** Bug 1+2 fix Changelog visibility audit log UAT. Commit `cdfd542` 3 file +146/-95 LOC. **BE** `PurchaseEvaluationWorkflowService.cs` `ApplyReturnModeAsync` lines 215-378 refactor: Drafter early return (line 282-287) → if/else common path, `summary = "Trả về Người soạn thảo"` thay vì return early, SLA reset move bên trong else block 3 mode còn lại (Drafter có riêng `evaluation.SlaDeadline = null`). Single Changelog.Add() ở cuối hàm cover 4 mode uniform: `EntityType=Workflow + Action=Update + Summary=$"Trả lại ({modeName}): {summary}"` với modeName switch ("Người soạn thảo"/"1 Cấp"/"1 Bước"/"Người chỉ định"). `actorName` resolve qua `userManager.FindByIdAsync` mirror pattern existing line 660-667 (LogTransition helper). KHÔNG SaveChangesAsync mới — caller `TransitionAsync` line 100 đã có downstream save. **FE** 2 file `PeDetailTabs.tsx` × 2 app mirror exact: filter extend `if (l.summary?.includes('Trả lại')) return true` (Workflow entity) + `if (l.entityType === PE_ENTITY_HEADER && l.summary?.toLowerCase().includes('ngân sách')) return true` (Header entity new const = 1). Empty placeholder + comment 3-source rewrite (UAT 2026-05-08 + 2026-05-19 + bullet list 5 filter rule). Verify: BE build clean 0 err 2 pre-existing DocxRenderer warn (20.27s), fe-user 1907 modules 16.62s 0 TS err, fe-admin 1926 modules 6.98s 0 TS err. Test SKIP per UAT mode `feedback_uat_skip_verify` Phase 9 (111 baseline preserve). **NEW pattern observed (cumulative)**: `Changelog log common path refactor + FE filter substring summary discrimination`. Reusable cho future audit log derived state (vd Adjust*/Return*/Reset* action): refactor early return → if/else common path để single log call cover N branch, FE filter qua substring summary keyword chứ KHÔNG enum field strict (action verb tiếng Việt "Trả lại"/"ngân sách" dễ maintain hơn enum + cho FE flexibility filter mới mà không cần BE schema migrate). Cross-ref Pattern 4 `feedback_service_hook_vs_endpoint` (state X derived của action Y → log trong handler Y, KHÔNG endpoint /X riêng — Bug 2 ApplyReturnModeAsync log trong service hook KHÔNG endpoint /return-changelog rời). Pattern 5 mirror 2 app §3.9 applied 7th cumulative. Token ~12k. Diff: BE +83/-49 (refactor + new log block ~40 LOC), FE × 2 app +14/-6 each (filter + comment). KHÔNG ops git push (em main verify Reviewer rồi mới push).
|
|
||||||
|
|
||||||
- **2026-05-22 (S28 wrap — Layer A governance distributed active, Implementer policy local apply):** S28 em main solo cả buổi (KHÔNG Implementer work code thực sự). Timeline: t1 RAG ROI verdict marginal-short/transform-long → t2 bro feedback "ghi mọi tương tác" → t3 em đề xuất 2-week monitoring 5 metric → t4 bro caught self-authorize cross-project rule mistake → t5 governance broadcast Layer A active 3-Layer distributed scope-down về SOLUTION_ERP self-discipline. **Implementer perspective về Layer A governance:** (1) Pattern proven ≥ 2× qualifies Layer B nominate. **Pattern 7 per-NV admin opt-in flag (Mig 29 AllowDrafterEdit + Mig 30 AllowApproverEditSection1 + Mig 31 AllowEarlyApprove + AllowDelegate) đã proven 4× — strong candidate Layer B promote khi unfreeze.** (2) Tag schema mandatory áp dụng forward: store Pattern chunk với format `[pattern, phase-<N>, <bc>]` — vd Pattern 19 HTML details tree view → `[pattern, phase-9, frontend]`; Pattern 18 FE userMap fallback → `[pattern, phase-9, frontend]`; Pattern 16 preventive batch fix → `[pattern, phase-9, cross-cutting]`. (3) source_path convention: `solution_erp/pattern/<topic>-<date>` — vd `solution_erp/pattern/tailwind-jit-palette-2026-05-19` cho Pattern 14, `solution_erp/pattern/per-nv-flag-2026-05-15` cho Pattern 7. (4) **KHÔNG self-authorize cross-project rule (lesson S28 t4)** — distributed governance respects boundary, Implementer agent KHÔNG override Layer A scope cho cross-project (vd "NamGroup follow SOLUTION_ERP Pattern 19" → REFUSE cross-project assertion, route lên Layer B human review). (5) Quên rule cũ "mọi tương tác mandatory store" — **ABANDONED** (was self-authorize over-reach). Forward S28+ commit: Implementer apply tag schema `[type, phase, bc-or-module]` mandatory cho mỗi Pattern entry mới + scope discipline strict SOLUTION_ERP only + KHÔNG cross-project rule assertion + 4-category default (pattern/architecture/decision/gotcha) + skip list (ephemeral, code, log) + 11 phase enum (phase-9 UAT ACTIVE) + 8 BC + 5 cross-cutting + optional prefix.
|
- **2026-05-22 (S28 wrap — Layer A governance distributed active, Implementer policy local apply):** S28 em main solo cả buổi (KHÔNG Implementer work code thực sự). Timeline: t1 RAG ROI verdict marginal-short/transform-long → t2 bro feedback "ghi mọi tương tác" → t3 em đề xuất 2-week monitoring 5 metric → t4 bro caught self-authorize cross-project rule mistake → t5 governance broadcast Layer A active 3-Layer distributed scope-down về SOLUTION_ERP self-discipline. **Implementer perspective về Layer A governance:** (1) Pattern proven ≥ 2× qualifies Layer B nominate. **Pattern 7 per-NV admin opt-in flag (Mig 29 AllowDrafterEdit + Mig 30 AllowApproverEditSection1 + Mig 31 AllowEarlyApprove + AllowDelegate) đã proven 4× — strong candidate Layer B promote khi unfreeze.** (2) Tag schema mandatory áp dụng forward: store Pattern chunk với format `[pattern, phase-<N>, <bc>]` — vd Pattern 19 HTML details tree view → `[pattern, phase-9, frontend]`; Pattern 18 FE userMap fallback → `[pattern, phase-9, frontend]`; Pattern 16 preventive batch fix → `[pattern, phase-9, cross-cutting]`. (3) source_path convention: `solution_erp/pattern/<topic>-<date>` — vd `solution_erp/pattern/tailwind-jit-palette-2026-05-19` cho Pattern 14, `solution_erp/pattern/per-nv-flag-2026-05-15` cho Pattern 7. (4) **KHÔNG self-authorize cross-project rule (lesson S28 t4)** — distributed governance respects boundary, Implementer agent KHÔNG override Layer A scope cho cross-project (vd "NamGroup follow SOLUTION_ERP Pattern 19" → REFUSE cross-project assertion, route lên Layer B human review). (5) Quên rule cũ "mọi tương tác mandatory store" — **ABANDONED** (was self-authorize over-reach). Forward S28+ commit: Implementer apply tag schema `[type, phase, bc-or-module]` mandatory cho mỗi Pattern entry mới + scope discipline strict SOLUTION_ERP only + KHÔNG cross-project rule assertion + 4-category default (pattern/architecture/decision/gotcha) + skip list (ephemeral, code, log) + 11 phase enum (phase-9 UAT ACTIVE) + 8 BC + 5 cross-cutting + optional prefix.
|
||||||
|
|
||||||
@ -367,4 +359,4 @@ KHÔNG `*` / `latest`. Critical pins:
|
|||||||
- Duplicate entries detected → merge
|
- Duplicate entries detected → merge
|
||||||
- Stale > 3 months → remove
|
- Stale > 3 months → remove
|
||||||
|
|
||||||
**Last curate: 2026-05-22 em main full curate** — archived 12 verbose entries (S21 t3 → S24 Plan AA) → `archive/2026-05-q1.md`. KEEP: S26 Plan AG, S25 wrap, S25 Plan AB, setup baseline. Patterns 1-19 foundation preserved. Per `feedback_md_compact_narrative.md` §6.5 — archive preserves full verbose entries cho cross-session audit retrieve. Next curate trigger: > 25KB OR Plan B Contract V2 wire complete.
|
**Last curate: 2026-05-26 S32 em main proxy curate** (post-S31 RAG fix) — archived 5 verbose entries (S25 Plan AB → S29 Plan B Chunk D detail + S27 Plan CA Chunk B detail + S26 Plan AG) → `archive/2026-05-q2.md`. KEEP: S32 startup (latest), S29 wrap (5-spawn summary cumulative), S28 Layer A governance, S27 retrospective REFUSE analysis, S22 curate session lesson, S11 setup baseline. Patterns 1-19 + 12-bis + 16-bis foundation section preserved untouched. MEMORY size before: 38.4 KB → after: target ~21 KB. Per `feedback_md_compact_narrative.md` §6.5 — archive preserves full verbose entries cho cross-session audit retrieve. **Previous curate: 2026-05-22** — archived 12 verbose (S21 t3 → S24 Plan AA) → `archive/2026-05-q1.md`. Next trigger: > 25KB OR Plan G-H1 kick off.
|
||||||
|
|||||||
30
.claude/agent-memory/implementer/archive/2026-05-q2.md
Normal file
30
.claude/agent-memory/implementer/archive/2026-05-q2.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Implementer Agent — Archive Recent Activity Q2 2026-05 (S25-S29 verbose)
|
||||||
|
|
||||||
|
> **Archived:** 2026-05-26 S32 em main proxy curate session (post-S31 RAG fix).
|
||||||
|
> **Scope:** 5 verbose Recent activity entries S25 Plan AB → S29 Plan B Chunk D — moved from MEMORY.md để giữ slim < 25KB threshold (was 38.4KB → target ~21KB).
|
||||||
|
> **Rule §6.5 compliance:** KHÔNG cắt narrative — full verbose entries preserved cho cross-session audit.
|
||||||
|
> **KEEP in MEMORY:** S32 startup (latest), S29 wrap (Plan CA + Plan B 5-spawn summary cumulative), S28 Layer A governance, S27 retrospective REFUSE analysis, S22 curate session lesson, S11 setup baseline. Patterns 1-19 + 12-bis + 16-bis foundation section preserved untouched.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Archive entries (FIFO chronological — earliest first)
|
||||||
|
|
||||||
|
### 2026-05-19 (S25, Plan AB Chunk A PASS)
|
||||||
|
|
||||||
|
Bug 1+2 fix Changelog visibility audit log UAT. Commit `cdfd542` 3 file +146/-95 LOC. **BE** `PurchaseEvaluationWorkflowService.cs` `ApplyReturnModeAsync` lines 215-378 refactor: Drafter early return (line 282-287) → if/else common path, `summary = "Trả về Người soạn thảo"` thay vì return early, SLA reset move bên trong else block 3 mode còn lại (Drafter có riêng `evaluation.SlaDeadline = null`). Single Changelog.Add() ở cuối hàm cover 4 mode uniform: `EntityType=Workflow + Action=Update + Summary=$"Trả lại ({modeName}): {summary}"` với modeName switch ("Người soạn thảo"/"1 Cấp"/"1 Bước"/"Người chỉ định"). `actorName` resolve qua `userManager.FindByIdAsync` mirror pattern existing line 660-667 (LogTransition helper). KHÔNG SaveChangesAsync mới — caller `TransitionAsync` line 100 đã có downstream save. **FE** 2 file `PeDetailTabs.tsx` × 2 app mirror exact: filter extend `if (l.summary?.includes('Trả lại')) return true` (Workflow entity) + `if (l.entityType === PE_ENTITY_HEADER && l.summary?.toLowerCase().includes('ngân sách')) return true` (Header entity new const = 1). Empty placeholder + comment 3-source rewrite (UAT 2026-05-08 + 2026-05-19 + bullet list 5 filter rule). Verify: BE build clean 0 err 2 pre-existing DocxRenderer warn (20.27s), fe-user 1907 modules 16.62s 0 TS err, fe-admin 1926 modules 6.98s 0 TS err. Test SKIP per UAT mode `feedback_uat_skip_verify` Phase 9 (111 baseline preserve). **NEW pattern observed (cumulative)**: `Changelog log common path refactor + FE filter substring summary discrimination`. Reusable cho future audit log derived state (vd Adjust*/Return*/Reset* action): refactor early return → if/else common path để single log call cover N branch, FE filter qua substring summary keyword chứ KHÔNG enum field strict (action verb tiếng Việt "Trả lại"/"ngân sách" dễ maintain hơn enum + cho FE flexibility filter mới mà không cần BE schema migrate). Cross-ref Pattern 4 `feedback_service_hook_vs_endpoint` (state X derived của action Y → log trong handler Y, KHÔNG endpoint /X riêng — Bug 2 ApplyReturnModeAsync log trong service hook KHÔNG endpoint /return-changelog rời). Pattern 5 mirror 2 app §3.9 applied 7th cumulative. Token ~12k. Diff: BE +83/-49 (refactor + new log block ~40 LOC), FE × 2 app +14/-6 each (filter + comment). KHÔNG ops git push (em main verify Reviewer rồi mới push).
|
||||||
|
|
||||||
|
### 2026-05-19 (S25 wrap — Plan AB Chunk A Case 1 + 6 follow-up plans em main solo)
|
||||||
|
|
||||||
|
Plan AB Chunk A spawn 1× ~12K Case 1 cookie-cutter mirror. BE refactor ApplyReturnModeAsync Drafter early return → common path (line 280-287 → if/else block) + single Changelog.Add() ở cuối hàm với modeName switch enum + actorName resolve via userManager.FindByIdAsync mirror LogTransitionAsync pattern. FE × 2 app HistoryTab filter relax (PE_ENTITY_HEADER=1 + summary contains 'ngân sách' for Bug 1 + Workflow summary contains 'Trả lại' for Bug 2). KHÔNG TS test (UAT mode skip). KHÔNG migration. KHÔNG endpoint. Commit cdfd542 3 file +146/-95 LOC PASS. **Em main solo từ Plan AC** (cross-stack reasoning + UAT iteration borderline scope — Implementer would REFUSE per criteria #4 tight coupling BE+FE same plan). AC capture pre-call Step/Level + add Approval row Reject branch + skipToFinal comment + FE Decision badge × 2 app. AC2 FE merge synthetic Reject + dedupe timestamp 5s bucket. AD drop phase badges + extractNextTargetHint regex parse. AE BE batch 9 Changelog.Add sites UserName preventive fix. AF FE userMap fallback từ embedded domain data PeDetailBundle. **Pattern 16 NEW** (cumulative S25): Preventive systemic batch fix khi audit phát hiện 9 sites cùng bug pattern — replace_all=true với context-aware key (UserId line + Summary line) — 1 pass cover N sites idempotent. **Pattern 17 NEW**: FE merge synthetic rows từ Changelog cho audit historical recovery — pattern reusable cho Contract V2 + Budget V2 audit visualization without DB write. **Pattern 18 NEW**: FE userMap fallback từ embedded domain data (drafter + approvals + approvalFlow + levelOpinions + departmentOpinions) — no extra API fetch cho historical name resolve.
|
||||||
|
|
||||||
|
### 2026-05-21 (S26 t1, Plan AG Chunk A+B+C PASS — Phase 1 PE List tree view 2-level)
|
||||||
|
|
||||||
|
UAT feedback bro Tra Sol "đám rừng" flat list → Outlook folder tree. **3 chunk cumulative 1 commit** `0bf6c7e` 2 file +346/-116 LOC = +115 LOC each. Mirror 2 app §3.9 IDENTICAL post-edit (SHA256 verify match `21001E90...`). Chunk A useMemo group nested: `ProjectGroup{projectId, projectName, goiThauList[], totalCount}` + `GoiThauGroup{displayName, normalizedKey, items[]}`. Normalize trim + toLowerCase group key, display raw đầu tiên trong group. Fallback "(Dự án đã xoá)" empty projectName + "(Chưa phân loại)" empty TenGoiThau. Sort vi locale 2 cấp A-Z. Filter pendingMe → DaGuiDuyet áp dụng TRƯỚC group (empty state đúng). Chunk B UI `<details>/<summary>` HTML native 2-level — fe-user no shadcn Accordion → native browser disclosure widget free. Tailwind v3 named groups `group/proj` + `group/gt` cho chevron rotation `group-open/proj:rotate-90`. `[&::-webkit-details-marker]:hidden` ẩn default disclosure triangle browser. 📁 + 📄 emoji icon inline + count badge `rounded-full bg-slate-200/100`. PE card content preserve nguyên (text + badge + date format + contractId hint — line 209-248 cũ). Chunk C localStorage persist Set<string> key `pe_list_expanded_groups`. Project key: `projectId or '__no_project__'`. Gói thầu key: `${projectId}::${normalizedGoiThau}`. Default empty Set (all collapse) — Outlook-style closed default. `try/catch` defensive cho localStorage (storage quota / private browsing). Header badge `pendingMe ? totalRowCount : list.data?.total` (replace `rows.length`). Empty state check `projectGroups.length === 0` (replace `rows.length === 0`). Import `useMemo, useState` từ 'react' (file pre-existing chỉ import từ tanstack). Build: fe-user PASS 0 TS err 1291.33 KB gzip 337.00 KB 1907 modules 16.05s; fe-admin PASS 0 TS err 1402.68 KB gzip 357.51 KB 1926 modules 6.86s. Pre-existing CSS @import warn + INEFFECTIVE_DYNAMIC_IMPORT realtime.ts unchanged. KHÔNG ops git push (em main verify Reviewer rồi push). Token ~16k (close to ~14k baseline Case 2 mirror 2 app). **Pattern 19 NEW**: HTML native `<details>/<summary>` + Tailwind named groups (`group/<name>`) + localStorage Set<string> persist cho hierarchical UI when no Accordion lib available. Free open/close state native browser (Space/Enter keyboard accessible) + 0 JS state per node + serialize/deserialize Set ↔ JSON array string. Tailwind v3 named groups syntax `group/proj` parent + `group-open/proj:rotate-90` child differs from default unnamed `group` + `group-open:rotate-90` — critical when nested groups cùng level cần distinct event scope. Reusable cho future tree views: Project explorer · Dept hierarchy · Permission tree · Workflow definition step list (vs HTML5 native vs shadcn vs JS library). Anti-pattern: nested same-name `group` would inherit parent state → both rotate sync. **Pattern 5 mirror 2 app §3.9 applied 8th cumulative S20-S26** (proven reliable IDENTICAL hash check sau edit batch — recommend tooling `git diff fe-admin/X fe-user/X` after every multi-file edit batch).
|
||||||
|
|
||||||
|
### 2026-05-22 (S27 Plan CA Chunk B — Move 4 master pages fe-admin → fe-user, Case 2 cookie-cutter)
|
||||||
|
|
||||||
|
Spec từ em main deterministic 100% (Investigator pre-verify fe-user parity DataTable/PageHeader/PermissionGuard/usePermission/6 shadcn ui/types/master.ts byte-identical). Execute parallel: 4 `Write` cho master pages + 1 `Edit` menuKeys.ts (+5 key Catalogs*) + 2 `Edit` App.tsx (import + route block). LOC delta `+962` (4 file 948 LOC mirror + 14 LOC App.tsx + menuKeys.ts). Verify SHA256 byte-identical 4 file: `C1760788...` / `BDF0529E...` / `68213D62...` / `6F482614...` all match admin source. `npm run build` fe-user PASS 0 TS err 1916 modules 14.14s (pre-existing CSS @import + chunk-size + INEFFECTIVE_DYNAMIC_IMPORT warn unchanged). Commit `06a441c` 6 file changed. **Pattern 16 NEW** — byte-identical mirror admin → user khi parity confirmed (memory `pattern_master_page_mirror.md`): copy nguyên file (KHÔNG modify), verify SHA256 post-write, regression-safe vì admin code đã UAT pass. **Token cost ~10k Case 2** (4 file mirror cookie-cutter, NO logic decision). KHÔNG push remote (Chunk A em main solo BE parallel chưa xong, Chunk C sidebar filter + Chunk D smoke verify defer). Tag schema S28: `[pattern, phase-9, frontend]` cho Pattern 16. **Gotcha S27**: PowerShell `$_` variable in `ForEach-Object` block bị Bash tool shell-escape eaten — workaround dùng `Get-FileHash file1, file2, ... -Algorithm SHA256 | Format-Table` list literal thay vì pipeline iterate.
|
||||||
|
|
||||||
|
### 2026-05-22 (S29 Plan B Chunk D PASS — FE ContractCreatePage V2 Workspace dropdown × 2 app cookie-cutter mirror PE)
|
||||||
|
|
||||||
|
Spec deterministic 100% từ em main reference `fe-user/src/components/pe/PeWorkspaceCreateView.tsx` (canonical V2 dropdown lines 80-89 useQuery + lines 152-172 Select UI). 2 file mirror × 2 app `fe-admin/fe-user/src/pages/contracts/ContractCreatePage.tsx`: +44 LOC each = +88 LOC total byte-similar (git diff stat verify). Changes: (1) `useState approvalWorkflowId = ''` mới + (2) `useQuery approval-workflows-v2-contract` filter ApplicableType=3 client-side filter isUserSelectable=true (mirror PE Mig 25 pattern Plan AA S24) + (3) `Select dropdown "Quy trình duyệt V2 (tùy chọn)"` placement giữa FormFields + Budget section, blank = V1 fallback hint "(đã add ContractHeaderForm function, KHÔNG add ContractEditForm function vì spec scope CreatePage workspace only - edit-mode update endpoint defer)" + (4) Wire `approvalWorkflowId: approvalWorkflowId || null` vào CreateContractCommand POST body. BE precondition verify: `CreateContractCommand` record line 17-36 ContractFeatures.cs đã có `Guid? ApprovalWorkflowId = null` field (em main commit Chunk E1 PRIOR — comment marker "[Plan B S29 2026-05-22 Chunk E1] Drafter pick V2 workflow lúc create"). FE wire safe — no DTO mismatch. Build verify: `npm --prefix fe-admin run build` PASS 0 TS err 1926 modules 1.40MB gzip 358KB 16.07s; `npm --prefix fe-user run build` PASS 0 TS err 1916 modules 1.32MB gzip 343KB 8.84s. Pre-existing CSS @import warn + INEFFECTIVE_DYNAMIC_IMPORT realtime.ts warn unchanged (baseline noise). **Pattern 16-bis 4-place mirror check applied:** (1) Page file × 2 app DONE byte-similar; (2) App.tsx Routes N/A (enhance existing `/contracts/new` route - không route mới); (3) menuKeys.ts N/A (không menu key mới — page enhancement); (4) Layout staticMap N/A (route unchanged). Token ~12k Case 2 cookie-cutter (4 Read PE source + 2 Edit per file × 2 = 4 Edit total + 2 npm build + 1 git commit + memory update). Commit `62b50d1` clean 2 file. KHÔNG push remote — em main coordinate Chunk E final batch. **Pattern 5 mirror 2 app §3.9 applied 9th cumulative S20-S29** (proven IDENTICAL bytes hash check sau edit batch — git diff stat confirm). **Pattern 12-bis cross-module FE cookie-cutter mirror** demonstrated: PE PeWorkspaceCreateView V2 dropdown → Contract ContractCreatePage V2 dropdown clean (same useQuery shape, same Select markup, same filter logic, same POST body wire) — discriminator field ApplicableType=3 swap from `defaultType` (PE 1/2). Reusable pattern future Budget V2 / any cross-module entity với V2 workflow integration. Tag: `[pattern, phase-9, frontend]`.
|
||||||
@ -133,7 +133,7 @@ State machine 5 trạng thái phiếu PE: Nháp / Đã gửi duyệt / **Trả l
|
|||||||
|
|
||||||
- **2026-05-22 (S29 wrap — Plan CA + Plan B pre-flight 2 spawns + 3 patterns NEW):** S29 close 2 big plans cumulative. **Plan CA (Move Cấu hình danh mục admin → eoffice)** 7 commits `06a441c..6eec8d7` push deployed Run #229+#230 PASS. **Plan B (Contract V2 wire mirror PE V2 pattern Mig 22-26)** 11 commits `58898e8..38f1c4d` push deployed Run #231+#232 PASS. **Investigator role 2 spawn:** (1) **Plan CA pre-flight audit** (agentId a7ab5576c77ee3730, ~15K token): map 9 menu danh mục terrain + GOTCHA tree-inherit Catalogs↔Master + recommend chunk structure A/B/C/D. fe-user component parity verified (DataTable + PageHeader + PermissionGuard + 6 shadcn ui). DbInitializer SeedAdminPermissionsAsync admin role grant CRUD 27 menu key. Permission Matrix dynamic load /api/menus → tự reflect post-move. (2) **Plan B pre-flight audit Contract V1 state** (agentId abf91b30391fb0cdb, ~25K token): map `Contract.cs` 25 fields (V1 only) + `ContractPhase` enum 12 values (TraLai=98 + TuChoi=99 ready) + `ContractWorkflowService.cs` 220 LOC V1 only + sqlcmd prod 7 V1 contract (Phase 2-8 active workflow) + PE Mig 22-26 reference templates + impact assessment (COEXIST V1+V2, KHÔNG drop V1) + re-chunk 6 chunks (split A → A1 entity + A2 mig). 3 surprise: ApprovalWorkflows Prod ZERO ApplicableType=3 (Chunk A2 must seed sample) + `RejectedAtStepIndex` drift deprecated + ContractType 7 variants generic ApplicableType=3. **Patterns proven NEW Investigator perspective S29:** (a) **9-menu permission terrain map pattern** (Plan CA) — Investigator inventory file paths + line ranges + component parity check + recommend chunk before delegate Implementer. ROI cao. (b) **V1+V2 coexist boundary** (Plan B) — KHÔNG drop V1 vì 7 prod contract pinned. Mirror PE Mig 22-24 spec. (c) **Reference template paths cross-module mirror** (PE → Contract V2): Investigator cite EXACT line ranges (PE Mig 23:14-31, Mig 24:14-17, Mig 26 UNIQUE composite, Service ApproveV2Async 446-634, 519-546 UPSERT, 774-783 ResolveActor) → em main + Implementer chỉ cần mirror rename entity. ROI rất cao saving 30%+ time. **Anti-patterns observed:** (a) Investigator KHÔNG verify endpoint exists end-to-end qua live curl — defer to CICD Monitor stage 4. (b) Investigator output sometimes verbose >700 words → em main hỏi cô đọng <500 next time.
|
- **2026-05-22 (S29 wrap — Plan CA + Plan B pre-flight 2 spawns + 3 patterns NEW):** S29 close 2 big plans cumulative. **Plan CA (Move Cấu hình danh mục admin → eoffice)** 7 commits `06a441c..6eec8d7` push deployed Run #229+#230 PASS. **Plan B (Contract V2 wire mirror PE V2 pattern Mig 22-26)** 11 commits `58898e8..38f1c4d` push deployed Run #231+#232 PASS. **Investigator role 2 spawn:** (1) **Plan CA pre-flight audit** (agentId a7ab5576c77ee3730, ~15K token): map 9 menu danh mục terrain + GOTCHA tree-inherit Catalogs↔Master + recommend chunk structure A/B/C/D. fe-user component parity verified (DataTable + PageHeader + PermissionGuard + 6 shadcn ui). DbInitializer SeedAdminPermissionsAsync admin role grant CRUD 27 menu key. Permission Matrix dynamic load /api/menus → tự reflect post-move. (2) **Plan B pre-flight audit Contract V1 state** (agentId abf91b30391fb0cdb, ~25K token): map `Contract.cs` 25 fields (V1 only) + `ContractPhase` enum 12 values (TraLai=98 + TuChoi=99 ready) + `ContractWorkflowService.cs` 220 LOC V1 only + sqlcmd prod 7 V1 contract (Phase 2-8 active workflow) + PE Mig 22-26 reference templates + impact assessment (COEXIST V1+V2, KHÔNG drop V1) + re-chunk 6 chunks (split A → A1 entity + A2 mig). 3 surprise: ApprovalWorkflows Prod ZERO ApplicableType=3 (Chunk A2 must seed sample) + `RejectedAtStepIndex` drift deprecated + ContractType 7 variants generic ApplicableType=3. **Patterns proven NEW Investigator perspective S29:** (a) **9-menu permission terrain map pattern** (Plan CA) — Investigator inventory file paths + line ranges + component parity check + recommend chunk before delegate Implementer. ROI cao. (b) **V1+V2 coexist boundary** (Plan B) — KHÔNG drop V1 vì 7 prod contract pinned. Mirror PE Mig 22-24 spec. (c) **Reference template paths cross-module mirror** (PE → Contract V2): Investigator cite EXACT line ranges (PE Mig 23:14-31, Mig 24:14-17, Mig 26 UNIQUE composite, Service ApproveV2Async 446-634, 519-546 UPSERT, 774-783 ResolveActor) → em main + Implementer chỉ cần mirror rename entity. ROI rất cao saving 30%+ time. **Anti-patterns observed:** (a) Investigator KHÔNG verify endpoint exists end-to-end qua live curl — defer to CICD Monitor stage 4. (b) Investigator output sometimes verbose >700 words → em main hỏi cô đọng <500 next time.
|
||||||
|
|
||||||
- **2026-05-22 (Plan B Contract V2 wire pre-flight audit — Q1-Q5 + Bonus re-chunk):** Em main spawn Investigator pre-flight Plan B priority HIGH. 5Q audit + Bonus chunk refinement. Tag schema: `[audit, phase-9, contract]`. **Findings:** (Q1) `Contract.cs:8-58` 25 fields, V1 ready (WorkflowDefinitionId line 22 + CurrentWorkflowStepIndex line 39 + Phase line 12 + RejectedAtStepIndex line 40) MISSING `ApprovalWorkflowId Guid?` + `CurrentApprovalLevelOrder int?` → need Mig 32 add. (Q2) `ContractPhase.cs:14-28` 12 values ready ChoDuyet=10 + TraLai=98 + TuChoi=99 mirror PE. `ContractWorkflowService.cs:23-219` 220 LOC V1 ONLY. NO V2 branch. Match Dept+PositionLevel line 113-126. Gen mã HĐ line 148-155 trigger last step → Phase=DaPhatHanh (terminal khác PE DaDuyet). (Q3) Prod: 7 Contracts 100% V1Pinned (Mig 21 flat WorkflowDefinitionId), 6 in-workflow Phase 2-8 → MUST coexist V1+V2, KHÔNG drop V1. ApprovalWorkflows Prod: 2 rows `ApplicableType=1 (DuyetNcc)` ZERO `ApplicableType=3 (Contract)` chưa seed. (Q4) Mig 22 `20260508053749_AddApprovalWorkflowsV2.cs:14-127` 3 CREATE TABLE shared cho cả PE+Contract, Mig 32 chỉ cần ADD COLUMN tại `Contracts`. Mig 23 `20260508072821_AddApprovalWorkflowIdToPurchaseEvaluation.cs:14-31` template 15 LOC cookie-cutter rename Pe→Contract. Mig 24 `20260508074937_AddCurrentApprovalLevelOrderToPe.cs:14-17` 3 LOC. `ApproveV2Async` `PurchaseEvaluationWorkflowService.cs:446-634` 189 LOC clone mẫu — load AW.Steps.Levels + match actorId ∈ pendingLevelGroup.ApproverUserId (line 484-495) + UPSERT opinion (line 522-546) + advance level/step (line 605-633) + skipToFinal F2 (line 561-602). Branch entry pattern line 167-171 ternary `if (evaluation.ApprovalWorkflowId is Guid awId) ApproveV2Async else ApproveV1Legacy`. (Q5) Risk LOW — schema 80% shared. F1-F4 7 flags Mig 29+30+31 trên `ApprovalWorkflowLevels` (entity line 86-114) inherits FREE Contract. **Risk MEDIUM:** ContractType discriminator — 1 workflow serve ALL 7 ContractType vs per-type? PE chỉ 2 type. Defer Q em main. **Bonus re-chunk 6 chunks:** A1 entity 5 LOC (em main) + A2 Mig 32 cookie-cutter (Implementer) + B Service ternary 189 LOC clone adapt gen mã HĐ terminal (em main critical cross-stack) + C Mig 33 ContractLevelOpinions cookie-cutter (Implementer) + D FE-User Workspace Select V2 (Implementer mirror) + E FE Section 5 LevelOpinionsV2 dynamic (Implementer mirror). **Surprises:** (a) ApprovalWorkflows Prod ZERO ApplicableType=3 — recommend Chunk A2 include DbInitializer seed sample. (b) `RejectedAtStepIndex` Contract line 40 DEPRECATED chưa marked obsolete drift với PE line 50. (c) ContractType 7 variants vs ApprovalWorkflow generic ApplicableType=3 — future Mig 34 có thể cần `ContractTypes int[]` filter nếu Solutions cần per-type workflow. **Recommendation: PROCEED coexist V1+V2 pattern, 6 chunk re-chunk.** Token ~25K. source_path: `solution_erp/audit/investigator-plan-b-contract-v2-preflight-2026-05-22`.
|
- **Archived 4 verbose entries S25-S26-S29 → `archive/2026-05-q2.md` 2026-05-26 S32 curate:** S25 t1 5Q audit Bug Changelog detail + S26 Plan AG 5Q PE List tree view + S26 Plan AI RAG 4 study cases (Cursor/Cline/Continue/Sourcegraph) + Plan B Contract V2 Q1-Q5 audit detail. KEY recommendations preserved in S29 wrap entry above (Plan B re-chunk 6 chunks pattern + ApplicableType=3 ZERO Prod seed flag + PE Mig 22-26 reference template paths).
|
||||||
|
|
||||||
- **2026-05-22 (S28 wrap — Layer A governance internalized + tag schema mandatory forward):** S28 5-turn arc t1 RAG ROI verdict → t2 over-reach mistake → t4 bro caught → t5 Layer A active. Investigator agent absorb 3 rules forward: (1) **Tag schema mandatory** every RAG ingest `[<type>, phase-<N>, <bc-or-module>]` — type ∈ {bug, plan, audit, schema, ui-pattern, decision, retrospective, gotcha-doc}; phase enum 11 (`phase-9` UAT current); bc/module 8 domain {contract, pe, budget, master, identity, forms, notifications, audit-log} + 5 cross-cutting {cicd, infra, rag, governance, deploy}. (2) **4-category default + skip list** — skip ephemeral state ("S28 t3 startup ngày 22"), pure file paths không context, single-file < 5-line edit confirmation. Investigator output report tags MUST include all 3. (3) **NO self-authorize cross-project rule** — lesson S28 t4: stay scope-down SOLUTION_ERP self-discipline, don't generalize policy without bro consent. **Pre-flight audit query patterns Layer A §6.2** internalized: Pattern A `lookup_gotcha_<id>` (top_k=3, narrow), Pattern B `verify_precedent_pattern_X` (top_k=3 thay default 10 — broad similarity rerank surface 3 best matches), Pattern C `find_code_symbol_<class.method>` (top_k=5, symbol-anchor). **Weekly Friday eval ritual:** Investigator support Plan B Contract V2 wire pre-flight audit kick-off khi bro launch. Cumulative audit checklist (foundation cicd-monitor MEMORY S22+5→S23 t6 10-surface-point per-NV): (a) Contract entity V1 state inspect `Domain/Contracts/Contract.cs` + `WorkflowDefinitionId`, (b) Mig 22-23/26 PE V2 mirror reference confirm pattern reusable, (c) 4 PE V1-only audit migrate gap (per memory S22+4 Plan F ABORT), (d) 7 V1 contract scope drop boundary, (e) verify 10-surface-point per-NV checklist S22+5 cumulative reusable Contract V2 wire trước Mig 32 schema design. **source_path convention output:** `solution_erp/audit/investigator-<topic>-<date>` standardized cho tag schema BC=`pe` or `contract` switch per task. **Lesson abandoned:** S28 t2 "ghi RAG mọi tương tác" rule ABANDONED — Investigator KHÔNG mass-ingest, only specific findings with full tag schema. Audit retroactive S20-S26 "Investigator spawn" claims (memory log discrepancy registry NOT loaded vs token cost ghi 28-40K) defer S28+ priority #4 — uncertainty preserve cross-session, không retract memory unverified.
|
- **2026-05-22 (S28 wrap — Layer A governance internalized + tag schema mandatory forward):** S28 5-turn arc t1 RAG ROI verdict → t2 over-reach mistake → t4 bro caught → t5 Layer A active. Investigator agent absorb 3 rules forward: (1) **Tag schema mandatory** every RAG ingest `[<type>, phase-<N>, <bc-or-module>]` — type ∈ {bug, plan, audit, schema, ui-pattern, decision, retrospective, gotcha-doc}; phase enum 11 (`phase-9` UAT current); bc/module 8 domain {contract, pe, budget, master, identity, forms, notifications, audit-log} + 5 cross-cutting {cicd, infra, rag, governance, deploy}. (2) **4-category default + skip list** — skip ephemeral state ("S28 t3 startup ngày 22"), pure file paths không context, single-file < 5-line edit confirmation. Investigator output report tags MUST include all 3. (3) **NO self-authorize cross-project rule** — lesson S28 t4: stay scope-down SOLUTION_ERP self-discipline, don't generalize policy without bro consent. **Pre-flight audit query patterns Layer A §6.2** internalized: Pattern A `lookup_gotcha_<id>` (top_k=3, narrow), Pattern B `verify_precedent_pattern_X` (top_k=3 thay default 10 — broad similarity rerank surface 3 best matches), Pattern C `find_code_symbol_<class.method>` (top_k=5, symbol-anchor). **Weekly Friday eval ritual:** Investigator support Plan B Contract V2 wire pre-flight audit kick-off khi bro launch. Cumulative audit checklist (foundation cicd-monitor MEMORY S22+5→S23 t6 10-surface-point per-NV): (a) Contract entity V1 state inspect `Domain/Contracts/Contract.cs` + `WorkflowDefinitionId`, (b) Mig 22-23/26 PE V2 mirror reference confirm pattern reusable, (c) 4 PE V1-only audit migrate gap (per memory S22+4 Plan F ABORT), (d) 7 V1 contract scope drop boundary, (e) verify 10-surface-point per-NV checklist S22+5 cumulative reusable Contract V2 wire trước Mig 32 schema design. **source_path convention output:** `solution_erp/audit/investigator-<topic>-<date>` standardized cho tag schema BC=`pe` or `contract` switch per task. **Lesson abandoned:** S28 t2 "ghi RAG mọi tương tác" rule ABANDONED — Investigator KHÔNG mass-ingest, only specific findings with full tag schema. Audit retroactive S20-S26 "Investigator spawn" claims (memory log discrepancy registry NOT loaded vs token cost ghi 28-40K) defer S28+ priority #4 — uncertainty preserve cross-session, không retract memory unverified.
|
||||||
|
|
||||||
@ -143,13 +143,7 @@ State machine 5 trạng thái phiếu PE: Nháp / Đã gửi duyệt / **Trả l
|
|||||||
|
|
||||||
- **2026-05-22 (Curate session em main):** Archived 10 verbose Recent activity entries S21 → S24 Plan AA → `archive/2026-05-q1.md`. KEEP: S25 Bug audit + wrap, S26 Plan AG + Plan AI RAG, 2026-05-11 setup. Patterns proven section + Active workflow schemas section preserved. Memory size before: 34.9 KB → after: target ~20-22 KB.
|
- **2026-05-22 (Curate session em main):** Archived 10 verbose Recent activity entries S21 → S24 Plan AA → `archive/2026-05-q1.md`. KEEP: S25 Bug audit + wrap, S26 Plan AG + Plan AI RAG, 2026-05-11 setup. Patterns proven section + Active workflow schemas section preserved. Memory size before: 34.9 KB → after: target ~20-22 KB.
|
||||||
|
|
||||||
- **2026-05-19 (S25 t1 spawn audit 2 bug critical UAT — Changelog logging missing):** Em main report 2 bug UAT: (1) Budget Adjust 2×click → "Lịch sử thay đổi" KHÔNG show 2 entry. (2) Return Assignee mode F1 click → "Lịch sử thay đổi" KHÔNG show return action. Audit 5Q: Q1-DB state Prod SSH fail (auth), fallback code inspect. Q2-Budget handler: `PurchaseEvaluationFeatures.cs:379-387` **ĐÃ log changelog** EntityType=Header + Action=Update + summary diff → **code ĐÚNG, likelihood FE filter bug or UAT DB stale**. Q3-Return handler: `PurchaseEvaluationWorkflowService.cs:215-378 ApplyReturnModeAsync` **ZERO changelog log** — 4 mode branches (OneLevel/OneStep/Assignee/Drafter) mutate pointers only, return summary, caller `TransitionAsync:100 LogTransitionAsync` only logs phase transition KHÔNG log mode side-effect. Q4-Schema: `PurchaseEvaluationChangelog.cs` support EntityType=Workflow(5) enum but **ZERO code populate** — schema incomplete missing Kind/ChangeType subtype enum to disambiguate "budget adjust" vs "detail edit" vs "return mode" (all Header/Workflow entity cùng Action.Update). Q5-FE: Query handler `ListPurchaseEvaluationChangelogsQueryHandler:1050-1064` **KHÔNG filter logic** — returns ALL entities. FE query component unknown (fe-user source not easily searchable) but **likely filter EntityType == (Supplier|Detail|Quote)** omit Header+Workflow → Bug 1 Budget (Header type) hidden, Bug 2 Return (Workflow type unlogged vậy). Root cause B1: FE filter skip Header updates OR Schema gap (Header.Update collision: budget vs section 2 edit). Root cause B2: Handler **intentionally skip logging** (no companion audit table like PurchaseEvaluationApprovals for return history). Fix path B1: Option A (add Kind enum — 30 LOC schema+handlers) vs B (extend EntityType — 20 LOC) vs C (FE filter conditional show Budget — 10 LOC FE). Fix path B2: Add `db.PurchaseEvaluationChangelogs.Add()` per mode (15-25 LOC 1 file). Cross-ref pattern memory: S23 t3 lookup bug (Level.Order collision per-NV Mig 29) — schema Mig 29 OR-of-N refactor created similar subtype ambiguity. Surprise: `EntityType.Workflow=5` enum value design-only, unused 4+ mig history. Recommendation: B2 fix first (clear win, 1 file BE), then B1 design (schema + cross-module pattern audit Contracts). Token ~28k.
|
- **2026-05-19 (S25 wrap — Plan AB Bug 1+2 audit + 6 follow-up plans em main solo):** Pre-Plan AB audit ~28K confirm root cause: Bug 1 Budget Adjust Handler ĐÃ log Changelog (Header+Update) nhưng FE HistoryTab filter strict TraLai-only loại. Bug 2 ApplyReturnModeAsync 4 mode KHÔNG add Changelog.Add() — chỉ caller LogTransitionAsync log phase transition. Recommended fix path: BE add log return mode + FE filter relax + Decision badge differentiation. **Em main solo từ Plan AC** (cross-stack reasoning Implementer would REFUSE). Patterns reusable Contract V2 audit recovery + Budget changelog UI: synthetic recovery FE merge + userMap fallback + drop misleading badges + preventive batch fix systemic gap. CICD result: 7 commits `e23f51c..506cada` push remote, runs #215 FAIL Plan M tests SQLite tie-break re-emerge → #216-#221 PASS streak. Gotcha #48 SQLite tie-break pending docs.
|
||||||
|
|
||||||
- **2026-05-19 (S25 wrap — Plan AB Bug 1+2 audit + 6 follow-up plans em main solo):** Pre-Plan AB audit ~28K confirm root cause: Bug 1 Budget Adjust Handler ĐÃ log Changelog (Header+Update) nhưng FE HistoryTab filter strict TraLai-only loại. Bug 2 ApplyReturnModeAsync 4 mode KHÔNG add Changelog.Add() — chỉ caller LogTransitionAsync log phase transition. Recommended fix path: BE add log return mode + FE filter relax + Decision badge differentiation. **Subsequent em main solo follow-ups** (Plan AC..AF, KHÔNG re-spawn Investigator): AC capture pre-call Step/Level state + skipToFinal comment enrich + FE Decision badge; AC2 FE merge synthetic Reject rows từ Changelog (reversible recovery KHÔNG DB touch); AD drop misleading dual-phase badges + parse semantic next-target hint via regex `Chuyển phase X → Y` + comment keyword "Trả về"/"vượt cấp"; AE BE preventive batch UserName fix 9 Changelog.Add sites (Drafter+Detail+Quote+Adjust); AF FE userMap fallback từ embedded domain data PeDetailBundle (drafter+approvals+approvalFlow+levelOpinions+departmentOpinions) — no extra API fetch. **Patterns reusable Contract V2 audit recovery + Budget changelog UI:** (a) synthetic recovery FE merge từ existing audit table, (b) userMap fallback từ embedded domain data, (c) drop misleading badges + semantic hint via regex parsing, (d) preventive batch fix systemic gap. Cross-ref `feedback_service_hook_vs_endpoint` (audit log derived state) + new pattern user-level: FE merge synthetic + userMap fallback. **Tokens cumulative em main this session ~340K (mostly solo iterations, sub-agent leverage ~62K total).** **CICD result:** 7 commits `e23f51c..506cada` push remote, runs #215 FAIL (Plan M tests SQLite tie-break re-emerge) → #216 PASS (Chunk A2 SQLite tie-break fix) → #217-#221 PASS streak. Gotcha #48 SQLite tie-break pending docs.
|
|
||||||
|
|
||||||
- **2026-05-21 (S26 spawn Plan AG 5Q audit — PE List tree view feedback Tra Sol):** Bro UAT 2026-05-21 screenshot phàn nàn UI Duyệt NCC flat list "đám rừng" + propose Outlook-style folder template. Em main spawn Investigator audit 5Q: Q1 prod data scale (SSH auth fail, fallback code inspect — ~50-200 projects × 5-15 PE typical). Q2 Project entity `Master/Project.cs:5-14` extends AuditableEntity với Code+Name+dates+Budget+PM+Note, **MISSING MaxLength + navigation tới PE** → ready for Phase 2 ProjectPackage table mở rộng. Q3 PE List structure `PurchaseEvaluationsListPage.tsx:133` 3-panel grid `lg:grid-cols-[340px_1fr_360px]` flat `<ul><li>` line 199-252 + pageSize 50 + filter type/phase/awId/search. Q4 shadcn fe-user component GAP **THIẾU Accordion/Collapsible/Tree/Card/Badge** (chỉ Button/Dialog/Input/Label/Select/Textarea) → Phase 1 fallback HTML `<details>/<summary>` native + inline badge `<div>` (verified S24 Plan AA pattern). Q5 Mig 32 prep naming `AddProjectPackageTable` follow cumulative pattern. **Recommend Approach C Hybrid: Phase 1 FE-only group view ~160 LOC × 2 app (1-2 ngày) + Phase 2 ProjectPackage schema (3-5 ngày defer post-UAT). Implementer Case 2 cookie-cutter mirror 2 app ACCEPT.** Token ~30k.
|
|
||||||
|
|
||||||
- **2026-05-21 (S26 spawn Plan AI RAG distribution research — 4 study cases industry-validated):** Bro plan setup RAG cho 5 dự án cùng máy localhost share infrastructure. Investigator deep research 7Q: Anthropic patterns + community tools + multi-tenant architecture + distribution mechanism + auth + cost + sync. **Findings 4 study cases:** (1) **Cursor** — Merkle tree + Turbopuffer + 92% similarity reuse pattern, secret key derived Git commit hash, per-team index sharing cut indexing hours→seconds. (2) **Cline Memory Bank** — markdown + JIT retrieval + git-native sync. (3) **Continue.dev Hub** — slug-based YAML config sharing centralized. (4) **Sourcegraph Cody** — interesting anti-pattern, BỎ embeddings sang Search API + graph IR scale 100K+ repos enterprise (alternative if good search infra sẵn). **Multi-tenant 3 patterns:** Single index (pool, cheap), Per-tenant isolated (silo, expensive), Hybrid base+delta (Cursor pattern). **Distribution combo winner cho 5-dev team:** FastMCP HTTP server VPS Hetzner $15/tháng + git-sync embeddings snapshots committed to private repo. Auth JWT RS256 + role scopes + document-level ACL. Cost reality 5 dev ~$20/month vs cloud Qdrant $50/month. Sync git-based weekly cron (real-time chỉ cần khi team > 10 dev). **Surprise:** Voyage AI **200M tokens/month free tier cover 5 devs** comfortably — coi như chỉ tốn $15 VPS. **Anthropic standards 9/9 matched** + community best practices 6/7 matched (Sourcegraph alternative N/A cho memory-heavy). Plan AI architecture chốt với em main: User-level Global MCP (Pattern C — 1 server localhost serve 5 project) thay vì team VPS pattern (anh single dev 5 dự án). Token ~40k.
|
|
||||||
|
|
||||||
- **2026-05-11 (setup):** Investigator agent initialized. Baseline knowledge load complete (44 gotchas + 14 memory entries + 6 skills + 27 mig + 81 test pass cumulative). No investigations performed yet. Awaiting first SendMessage from em main.
|
- **2026-05-11 (setup):** Investigator agent initialized. Baseline knowledge load complete (44 gotchas + 14 memory entries + 6 skills + 27 mig + 81 test pass cumulative). No investigations performed yet. Awaiting first SendMessage from em main.
|
||||||
|
|
||||||
@ -161,5 +155,5 @@ State machine 5 trạng thái phiếu PE: Nháp / Đã gửi duyệt / **Trả l
|
|||||||
- Duplicate entries detected → merge
|
- Duplicate entries detected → merge
|
||||||
- Stale > 3 months → remove
|
- Stale > 3 months → remove
|
||||||
|
|
||||||
**Last curate: 2026-05-22 em main full curate** — archived 10 verbose entries (S21 → S24 Plan AA) → `archive/2026-05-q1.md`. KEEP: S25 audit + wrap (Bug 1+2 Changelog), S26 Plan AG + Plan AI RAG (2 spawn), setup baseline. Patterns + Active workflow schemas foundation preserved. Per `feedback_md_compact_narrative.md` §6.5 — archive preserves full verbose entries cho cross-session audit retrieve. Next curate trigger: > 25KB OR Plan B Contract V2 wire complete.
|
**Last curate: 2026-05-26 S32 em main proxy curate** (post-S31 RAG fix) — archived 4 verbose entries (S25 t1 5Q audit detail + S26 Plan AG 5Q + S26 Plan AI RAG research + Plan B Contract V2 Q1-Q5 audit detail) → `archive/2026-05-q2.md`. KEEP: S32 startup (latest), S29 wrap summary, S28 Layer A governance, S27 retrospective, S25 wrap summary, S22 curate session, S11 setup baseline. Patterns + Active workflow schemas foundation preserved untouched. MEMORY size before: 27.7 KB → after: target ~21 KB. **Previous curate: 2026-05-22** — archived 10 verbose (S21 → S24 Plan AA) → `archive/2026-05-q1.md`. Next trigger: > 25KB OR Plan G-H1 kick off.
|
||||||
|
|
||||||
|
|||||||
26
.claude/agent-memory/investigator/archive/2026-05-q2.md
Normal file
26
.claude/agent-memory/investigator/archive/2026-05-q2.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Investigator Agent — Archive Recent Activity Q2 2026-05 (S25-S29 verbose audit)
|
||||||
|
|
||||||
|
> **Archived:** 2026-05-26 S32 em main proxy curate session (post-S31 RAG fix).
|
||||||
|
> **Scope:** 4 verbose Recent activity entries — moved from MEMORY.md để giữ slim < 25KB threshold (was 27.7KB → target ~22KB).
|
||||||
|
> **Rule §6.5 compliance:** KHÔNG cắt narrative — full verbose entries preserved cho cross-session audit.
|
||||||
|
> **KEEP in MEMORY:** S32 startup (latest), S29 wrap summary (Plan CA + Plan B 2 spawn aggregate), S28 Layer A governance, S27 retrospective, S25 wrap (Bug 1+2 audit summary), S22 curate session, S11 setup baseline. Patterns + Active workflow schemas foundation preserved untouched.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Archive entries (FIFO chronological — earliest first)
|
||||||
|
|
||||||
|
### 2026-05-19 (S25 t1 spawn audit 2 bug critical UAT — Changelog logging missing)
|
||||||
|
|
||||||
|
Em main report 2 bug UAT: (1) Budget Adjust 2×click → "Lịch sử thay đổi" KHÔNG show 2 entry. (2) Return Assignee mode F1 click → "Lịch sử thay đổi" KHÔNG show return action. Audit 5Q: Q1-DB state Prod SSH fail (auth), fallback code inspect. Q2-Budget handler: `PurchaseEvaluationFeatures.cs:379-387` **ĐÃ log changelog** EntityType=Header + Action=Update + summary diff → **code ĐÚNG, likelihood FE filter bug or UAT DB stale**. Q3-Return handler: `PurchaseEvaluationWorkflowService.cs:215-378 ApplyReturnModeAsync` **ZERO changelog log** — 4 mode branches (OneLevel/OneStep/Assignee/Drafter) mutate pointers only, return summary, caller `TransitionAsync:100 LogTransitionAsync` only logs phase transition KHÔNG log mode side-effect. Q4-Schema: `PurchaseEvaluationChangelog.cs` support EntityType=Workflow(5) enum but **ZERO code populate** — schema incomplete missing Kind/ChangeType subtype enum to disambiguate "budget adjust" vs "detail edit" vs "return mode" (all Header/Workflow entity cùng Action.Update). Q5-FE: Query handler `ListPurchaseEvaluationChangelogsQueryHandler:1050-1064` **KHÔNG filter logic** — returns ALL entities. FE query component unknown (fe-user source not easily searchable) but **likely filter EntityType == (Supplier|Detail|Quote)** omit Header+Workflow → Bug 1 Budget (Header type) hidden, Bug 2 Return (Workflow type unlogged vậy). Root cause B1: FE filter skip Header updates OR Schema gap (Header.Update collision: budget vs section 2 edit). Root cause B2: Handler **intentionally skip logging** (no companion audit table like PurchaseEvaluationApprovals for return history). Fix path B1: Option A (add Kind enum — 30 LOC schema+handlers) vs B (extend EntityType — 20 LOC) vs C (FE filter conditional show Budget — 10 LOC FE). Fix path B2: Add `db.PurchaseEvaluationChangelogs.Add()` per mode (15-25 LOC 1 file). Cross-ref pattern memory: S23 t3 lookup bug (Level.Order collision per-NV Mig 29) — schema Mig 29 OR-of-N refactor created similar subtype ambiguity. Surprise: `EntityType.Workflow=5` enum value design-only, unused 4+ mig history. Recommendation: B2 fix first (clear win, 1 file BE), then B1 design (schema + cross-module pattern audit Contracts). Token ~28k.
|
||||||
|
|
||||||
|
### 2026-05-21 (S26 spawn Plan AG 5Q audit — PE List tree view feedback Tra Sol)
|
||||||
|
|
||||||
|
Bro UAT 2026-05-21 screenshot phàn nàn UI Duyệt NCC flat list "đám rừng" + propose Outlook-style folder template. Em main spawn Investigator audit 5Q: Q1 prod data scale (SSH auth fail, fallback code inspect — ~50-200 projects × 5-15 PE typical). Q2 Project entity `Master/Project.cs:5-14` extends AuditableEntity với Code+Name+dates+Budget+PM+Note, **MISSING MaxLength + navigation tới PE** → ready for Phase 2 ProjectPackage table mở rộng. Q3 PE List structure `PurchaseEvaluationsListPage.tsx:133` 3-panel grid `lg:grid-cols-[340px_1fr_360px]` flat `<ul><li>` line 199-252 + pageSize 50 + filter type/phase/awId/search. Q4 shadcn fe-user component GAP **THIẾU Accordion/Collapsible/Tree/Card/Badge** (chỉ Button/Dialog/Input/Label/Select/Textarea) → Phase 1 fallback HTML `<details>/<summary>` native + inline badge `<div>` (verified S24 Plan AA pattern). Q5 Mig 32 prep naming `AddProjectPackageTable` follow cumulative pattern. **Recommend Approach C Hybrid: Phase 1 FE-only group view ~160 LOC × 2 app (1-2 ngày) + Phase 2 ProjectPackage schema (3-5 ngày defer post-UAT). Implementer Case 2 cookie-cutter mirror 2 app ACCEPT.** Token ~30k.
|
||||||
|
|
||||||
|
### 2026-05-21 (S26 spawn Plan AI RAG distribution research — 4 study cases industry-validated)
|
||||||
|
|
||||||
|
Bro plan setup RAG cho 5 dự án cùng máy localhost share infrastructure. Investigator deep research 7Q: Anthropic patterns + community tools + multi-tenant architecture + distribution mechanism + auth + cost + sync. **Findings 4 study cases:** (1) **Cursor** — Merkle tree + Turbopuffer + 92% similarity reuse pattern, secret key derived Git commit hash, per-team index sharing cut indexing hours→seconds. (2) **Cline Memory Bank** — markdown + JIT retrieval + git-native sync. (3) **Continue.dev Hub** — slug-based YAML config sharing centralized. (4) **Sourcegraph Cody** — interesting anti-pattern, BỎ embeddings sang Search API + graph IR scale 100K+ repos enterprise (alternative if good search infra sẵn). **Multi-tenant 3 patterns:** Single index (pool, cheap), Per-tenant isolated (silo, expensive), Hybrid base+delta (Cursor pattern). **Distribution combo winner cho 5-dev team:** FastMCP HTTP server VPS Hetzner $15/tháng + git-sync embeddings snapshots committed to private repo. Auth JWT RS256 + role scopes + document-level ACL. Cost reality 5 dev ~$20/month vs cloud Qdrant $50/month. Sync git-based weekly cron (real-time chỉ cần khi team > 10 dev). **Surprise:** Voyage AI **200M tokens/month free tier cover 5 devs** comfortably — coi như chỉ tốn $15 VPS. **Anthropic standards 9/9 matched** + community best practices 6/7 matched (Sourcegraph alternative N/A cho memory-heavy). Plan AI architecture chốt với em main: User-level Global MCP (Pattern C — 1 server localhost serve 5 project) thay vì team VPS pattern (anh single dev 5 dự án). Token ~40k.
|
||||||
|
|
||||||
|
### 2026-05-22 (Plan B Contract V2 wire pre-flight audit — Q1-Q5 + Bonus re-chunk)
|
||||||
|
|
||||||
|
Em main spawn Investigator pre-flight Plan B priority HIGH. 5Q audit + Bonus chunk refinement. Tag schema: `[audit, phase-9, contract]`. **Findings:** (Q1) `Contract.cs:8-58` 25 fields, V1 ready (WorkflowDefinitionId line 22 + CurrentWorkflowStepIndex line 39 + Phase line 12 + RejectedAtStepIndex line 40) MISSING `ApprovalWorkflowId Guid?` + `CurrentApprovalLevelOrder int?` → need Mig 32 add. (Q2) `ContractPhase.cs:14-28` 12 values ready ChoDuyet=10 + TraLai=98 + TuChoi=99 mirror PE. `ContractWorkflowService.cs:23-219` 220 LOC V1 ONLY. NO V2 branch. Match Dept+PositionLevel line 113-126. Gen mã HĐ line 148-155 trigger last step → Phase=DaPhatHanh (terminal khác PE DaDuyet). (Q3) Prod: 7 Contracts 100% V1Pinned (Mig 21 flat WorkflowDefinitionId), 6 in-workflow Phase 2-8 → MUST coexist V1+V2, KHÔNG drop V1. ApprovalWorkflows Prod: 2 rows `ApplicableType=1 (DuyetNcc)` ZERO `ApplicableType=3 (Contract)` chưa seed. (Q4) Mig 22 `20260508053749_AddApprovalWorkflowsV2.cs:14-127` 3 CREATE TABLE shared cho cả PE+Contract, Mig 32 chỉ cần ADD COLUMN tại `Contracts`. Mig 23 `20260508072821_AddApprovalWorkflowIdToPurchaseEvaluation.cs:14-31` template 15 LOC cookie-cutter rename Pe→Contract. Mig 24 `20260508074937_AddCurrentApprovalLevelOrderToPe.cs:14-17` 3 LOC. `ApproveV2Async` `PurchaseEvaluationWorkflowService.cs:446-634` 189 LOC clone mẫu — load AW.Steps.Levels + match actorId ∈ pendingLevelGroup.ApproverUserId (line 484-495) + UPSERT opinion (line 522-546) + advance level/step (line 605-633) + skipToFinal F2 (line 561-602). Branch entry pattern line 167-171 ternary `if (evaluation.ApprovalWorkflowId is Guid awId) ApproveV2Async else ApproveV1Legacy`. (Q5) Risk LOW — schema 80% shared. F1-F4 7 flags Mig 29+30+31 trên `ApprovalWorkflowLevels` (entity line 86-114) inherits FREE Contract. **Risk MEDIUM:** ContractType discriminator — 1 workflow serve ALL 7 ContractType vs per-type? PE chỉ 2 type. Defer Q em main. **Bonus re-chunk 6 chunks:** A1 entity 5 LOC (em main) + A2 Mig 32 cookie-cutter (Implementer) + B Service ternary 189 LOC clone adapt gen mã HĐ terminal (em main critical cross-stack) + C Mig 33 ContractLevelOpinions cookie-cutter (Implementer) + D FE-User Workspace Select V2 (Implementer mirror) + E FE Section 5 LevelOpinionsV2 dynamic (Implementer mirror). **Surprises:** (a) ApprovalWorkflows Prod ZERO ApplicableType=3 — recommend Chunk A2 include DbInitializer seed sample. (b) `RejectedAtStepIndex` Contract line 40 DEPRECATED chưa marked obsolete drift với PE line 50. (c) ContractType 7 variants vs ApprovalWorkflow generic ApplicableType=3 — future Mig 34 có thể cần `ContractTypes int[]` filter nếu Solutions cần per-type workflow. **Recommendation: PROCEED coexist V1+V2 pattern, 6 chunk re-chunk.** Token ~25K. source_path: `solution_erp/audit/investigator-plan-b-contract-v2-preflight-2026-05-22`.
|
||||||
@ -534,12 +534,12 @@ User chỉ thị restructure menu PE: leaf "Thao tác" (Pe_*_Create) từ page C
|
|||||||
- [x] **Verify**: 2 build (fe-admin + fe-user) pass + dotnet test 83 pass mỗi chunk. Route `/new` cũ giữ tồn tại cho deep-link "Sửa header" button.
|
- [x] **Verify**: 2 build (fe-admin + fe-user) pass + dotnet test 83 pass mỗi chunk. Route `/new` cũ giữ tồn tại cho deep-link "Sửa header" button.
|
||||||
- [x] **KHÔNG đụng** BE / migration / schema / endpoint / test count.
|
- [x] **KHÔNG đụng** BE / migration / schema / endpoint / test count.
|
||||||
|
|
||||||
### A. Hard blockers (chờ user / ops)
|
### A. Hard blockers (chờ user / ops) — Plan C1 status S32 2026-05-26
|
||||||
|
|
||||||
- [ ] UAT thật 1 tuần với 2-3 user (30 demo: 16 sample + 14 Solutions thật)
|
- [ ] UAT thật 1 tuần với 2-3 user (30 demo: 16 sample + 14 Solutions thật) — anh main coordinate
|
||||||
- [ ] SMTP config → Email outbox (BLOCKED chờ user cấp host/user/pass)
|
- [ ] **SMTP config** → Email outbox — BLOCKED chờ anh main cấp host/user/pass + appsettings.Production.json update
|
||||||
- [ ] Rotate credentials (admin + 30 demo + SA + vrapp + JWT secret + Gitea runner token)
|
- [ ] **Rotate credentials** (admin + 30 demo + SA + vrapp + JWT secret + Gitea runner token) — BLOCKED chờ anh main approve cycle plan
|
||||||
- [ ] Schedule SQL backup daily Task Scheduler
|
- [ ] **Schedule SQL backup daily Task Scheduler** — `scripts/backup-sql.ps1` READY. Anh main register Task Scheduler trên VPS qua: `ssh vietreport-vps "Register-ScheduledTask -TaskName SolutionErpBackupDaily -Trigger (New-ScheduledTaskTrigger -Daily -At 2am) -Action (New-ScheduledTaskAction -Execute powershell.exe -Argument '-File C:\solution-erp\scripts\backup-sql.ps1 -Server .\SQLEXPRESS')"`
|
||||||
|
|
||||||
### B. PE feature gap còn lại
|
### B. PE feature gap còn lại
|
||||||
|
|
||||||
@ -560,10 +560,68 @@ User chỉ thị restructure menu PE: leaf "Thao tác" (Pe_*_Create) từ page C
|
|||||||
- [ ] **Phase 4** — API smoke tests (WebApplicationFactory) ~7 test
|
- [ ] **Phase 4** — API smoke tests (WebApplicationFactory) ~7 test
|
||||||
- [ ] **Phase 5** — FE Vitest cho lib utility (queryMatches, fmtMoney) ~10 test
|
- [ ] **Phase 5** — FE Vitest cho lib utility (queryMatches, fmtMoney) ~10 test
|
||||||
|
|
||||||
### E. Ops chưa xong
|
### D-Bis. Plan B-Wrap — Contract V2 test bundle (defer dedicated session ~2h post-S32 chốt anh main)
|
||||||
|
|
||||||
- [ ] Remove binding cũ `.huypham.vn` sau verify stable
|
> **Trigger:** S29 Plan B Contract V2 wire deploy prod 4 CI Runs PASS nhưng `ContractWorkflowService.ApproveV2Async` ~227 LOC NO test cover (UAT mode skip per `feedback_uat_skip_verify`). Risk gotcha #48 high (Service refactor > 100 LOC touching audit + changelog paths). Anh main chốt defer dedicated session post-Phase 9 stabilize.
|
||||||
- [ ] win-acme scheduled task fix unhealthy (cert expire 2026-06-18)
|
|
||||||
|
**Test infra dependencies (NEW — chưa có precedent từ PE):**
|
||||||
|
- ✅ `TestApplicationDbContext` SQLite existing reuse
|
||||||
|
- ✅ `IdentityFixture` existing reuse
|
||||||
|
- ✅ `FixedDateTime` existing reuse
|
||||||
|
- ✅ `NoOpNotificationService` existing reuse
|
||||||
|
- 🆕 `NoOpChangelogService` mock OR use real `ChangelogService` với TestApplicationDbContext
|
||||||
|
- 🆕 `TestContractCodeGenerator` mock (return predetermined `HD-TEST-001`) OR real với ContractCodeSequences seeded
|
||||||
|
- 🆕 `SeedContractAsync` helper + `SeedContractWorkflowAsync` helper + `SeedSupplierAndProjectAsync` helper
|
||||||
|
|
||||||
|
**File new test class:** `tests/SolutionErp.Infrastructure.Tests/Services/ContractWorkflowServiceApproveV2Tests.cs` (mirror `PurchaseEvaluationWorkflowServiceReturnModeTests.cs` structure)
|
||||||
|
|
||||||
|
#### BW1 — ApproveV2Async happy path step advance (Cấp 1 → Cấp 2 cùng Bước)
|
||||||
|
|
||||||
|
- [ ] Setup: 1 Step + 2 Levels OR-of-N + 2 approver
|
||||||
|
- [ ] Approver Cấp 1 TransitionAsync(Approve) → expect `contract.CurrentApprovalLevelOrder = 2` + Phase giữ ChoDuyet + SlaDeadline reset 7 ngày + ContractApproval row added + ContractLevelOpinion UPSERT Comment + LogTransition `"Hoàn tất Cấp 1, sang Cấp 2 cùng Bước 1"`
|
||||||
|
|
||||||
|
#### BW2 — ApproveV2Async terminal (Cấp cuối Bước cuối → DaPhatHanh + gen mã HĐ)
|
||||||
|
|
||||||
|
- [ ] Setup: 1 Step + 1 Level + 1 approver + Supplier(`SUP-001`) + Project(`PRJ-001`)
|
||||||
|
- [ ] Approver TransitionAsync(Approve) → expect `contract.Phase = DaPhatHanh` + `contract.MaHopDong != null` (gen via `IContractCodeGenerator.GenerateAsync`) + `contract.CurrentWorkflowStepIndex = null` + `contract.CurrentApprovalLevelOrder = null` + ContractApproval row + ContractLevelOpinion final + LogTransition transition
|
||||||
|
|
||||||
|
#### BW3 — ApproveV2Async skipToFinal F2 (admin opt-in `AllowApproverSkipToFinal` per slot)
|
||||||
|
|
||||||
|
- [ ] Setup: 3 Step × 2 Levels each + approver Cấp 1 Bước 1 với `AllowApproverSkipToFinal = true`
|
||||||
|
- [ ] Approver Cấp 1 Bước 1 TransitionAsync(Approve, skipToFinal=true) → expect `CurrentWorkflowStepIndex = 2` (Bước cuối) + `CurrentApprovalLevelOrder = 2` (Cấp cuối) + Phase giữ ChoDuyet + LogTransition `"[Approver skip thẳng tới Bước 3 Cấp 2..."` + ContractApproval comment prefix `"[Duyệt vượt cấp tới Cấp cuối]"`
|
||||||
|
|
||||||
|
#### BW4 — ApproveV2Async ForbiddenException khi actor không trong pendingLevelGroup.ApproverUserId
|
||||||
|
|
||||||
|
- [ ] Setup: 1 Step + 2 Levels OR-of-N với approver A, B + outsider C
|
||||||
|
- [ ] Outsider C TransitionAsync(Approve) → expect `ForbiddenException` message `"Bước 1 ... Cấp 1: bạn không có trong danh sách NV duyệt..."`
|
||||||
|
|
||||||
|
#### BW5 — `CreateContractCommand` ApplicableType=Contract validation (Reviewer S29 MAJOR catch)
|
||||||
|
|
||||||
|
- [ ] Test class mới `tests/SolutionErp.Infrastructure.Tests/Application/CreateContractCommandApplicableTypeTests.cs`
|
||||||
|
- [ ] Setup: ApprovalWorkflow với `ApplicableType = DuyetNcc` (id=1, PE-only)
|
||||||
|
- [ ] CreateContractCommand pin `ApprovalWorkflowId` trỏ workflow ApplicableType=1 → expect `ValidationException` `"Workflow phải ApplicableType=Contract"` (security catch — cross-module misuse)
|
||||||
|
|
||||||
|
#### BW6 — Mig 32+33 schema persistence test (ContractLevelOpinion UPSERT + UNIQUE composite)
|
||||||
|
|
||||||
|
- [ ] Test class mới `tests/SolutionErp.Infrastructure.Tests/Common/ContractV2SchemaPersistenceTests.cs`
|
||||||
|
- [ ] Setup: 1 Contract + 1 ApprovalWorkflowLevel
|
||||||
|
- [ ] Add 2 ContractLevelOpinion cùng (ContractId, ApprovalWorkflowLevelId) → expect `DbUpdateException` (UNIQUE composite Mig 33)
|
||||||
|
- [ ] Update existing Opinion via UPSERT pattern → expect 1 row only (mirror ApproveV2Async line 292-316)
|
||||||
|
- [ ] FK Cascade test: delete Contract → ContractLevelOpinions auto-deleted (Restrict on ApprovalWorkflowLevel)
|
||||||
|
|
||||||
|
#### BW7 — ContractWorkflowService V1 fallback skipToFinal ConflictException
|
||||||
|
|
||||||
|
- [ ] Setup: Contract V1 legacy (`WorkflowDefinitionId` pin, `ApprovalWorkflowId = null`)
|
||||||
|
- [ ] Approver TransitionAsync(Approve, skipToFinal=true, isAdmin=false) → expect `ConflictException` `"skipToFinal chỉ hỗ trợ HĐ V2 (ApprovalWorkflowsV2). HĐ V1 legacy không có per-Approver-slot flag."`
|
||||||
|
|
||||||
|
**Bundle review:** 🟥 Reviewer pre-commit verify 7 test scenario + verify NO regression baseline 111 PASS. Post-commit 🟩 CICD Monitor verify Run PASS bundle baseline preserve.
|
||||||
|
|
||||||
|
**Owner allocation:** 👤 Chủ trì Solo helper methods + mock services (3 file) + 🟨 Implementer Case 2 cookie-cutter mirror PE pattern cho 7 test method skeleton (deterministic spec above) + 🟥 Reviewer pre-commit + 🟩 CICD verify.
|
||||||
|
|
||||||
|
### E. Ops chưa xong — Plan C1 status S32 2026-05-26
|
||||||
|
|
||||||
|
- [ ] **Remove binding cũ `.huypham.vn`** sau verify stable — manual cmd `ssh vietreport-vps ; cd C:\solution-erp\scripts ; .\migrate-domains.ps1 -RemoveOld -SkipCert`
|
||||||
|
- [x] **win-acme cert status** — cert **api.solutions.com.vn** notAfter=`2026-07-23` (renewed 2026-04-24). Not urgent — auto-renewal ~2026-06-23 (30d before expire). STATUS.md note `2026-06-18` STALE (Plan F win-acme schedule task fix may have resolved silently). Re-verify auto-renew trigger date qua `ssh vietreport-vps "Get-ScheduledTask -TaskName 'win-acme*' | Select State,LastRunTime,NextRunTime"`
|
||||||
|
|
||||||
## 🔁 Skill governance (recurring)
|
## 🔁 Skill governance (recurring)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user