wal: flush 20260717T1035

This commit is contained in:
pqhuy1987
2026-07-17 10:35:19 +07:00
parent 3ad4f2c53e
commit 38b6d196d6
6 changed files with 48 additions and 14 deletions

View File

@ -1,20 +1,20 @@
# WAL — auto-generated, không sửa tay
updated: 2026-07-17 | session: S133 | branch: main
goal: PE budget FREEZE-at-DaDuyet (UAT anh Kiệt 07-16): phiếu DaDuyet bất biến NS, live = bản mới nhất; pipeline /fable-real invest → spec → hmw Opus MAX implement → review → deploy
goal: PE budget FREEZE-at-DaDuyet (UAT anh Kiệt 07-16): phiếu DaDuyet bất biến NS; pipeline invest → spec → implement → review → deploy
chain:
[x] 1. wf: hmw fable-real investigator-codebase — wf_348f6155-167 · #53 return-fail → disk 22.5KB cứu · lead verify 7/7 PASS
[x] 2. spec ghi + errata INV-A (query = GetPurchaseEvaluationQuery): runs/2026-07-17-S133-pe-budget-freeze-daduyet/spec-pe-budget-freeze-daduyet-17-07-2026.md
[x] 3. wf: hmw INV-A 2-task — wf_d9639faa-97a · T0 RED thật (Failed 1/1, found 999tr @:184, prod sạch) · FE 4 file, hash mirror 5534addb ×2, budgetFrozen 4 file · lead verify đĩa PASS
[!] 4. wf: hmw INV-B 1-task implementer-backend (Domain 11 col + Config + Mig 67 3-file backfill idempotent + PeBudgetAccumulator + helper 4-site :861/:899/:931/:1053 + display-gate GetPurchaseEvaluationQuery + 2 terminal-guard + build slnx + T0 GREEN không-sửa-test) — wf_4bef08b8-730
[ ] 5. wf: hmw INV-C 1-task test-specialist (T1-T9 + full suite PASS ≥510+8)
[ ] 6. reviewer pre-commit (mig+financial) → em main npm build ×2 re-verify + commit push → cicd-monitor verify prod
[ ] 7. harvest + docs closeout (STATUS Mig 67 · HANDOFF · session-log)
[x] 1. fable-real invest — wf_348f6155-167 (#53 → disk 22.5KB cứu, verify 7/7)
[x] 2. spec + errata runs/2026-07-17-S133-pe-budget-freeze-daduyet/spec-pe-budget-freeze-daduyet-17-07-2026.md
[x] 3. INV-A — wf_d9639faa-97a: T0 RED thật @:184 · FE 4 file hash 5534addb ×2 · 0-garble
[x] 4. INV-B — wf_4bef08b8-730: lane sửa 6 file + accumulator XONG, #53 chết trước mig → em-main solo Mig 67 (11 AddColumn + backfill OUTER APPLY) + apply 2 DB (Dev catch-up cả Mig 66 lag) + filter 44/44 T0 GREEN
[!] 5. wf: hmw INV-C 1-task test-specialist (T1-T9 vào PeBudgetFreezeTests + full suite ≥510+N 0-fail) — wf_75c6bfd3-754
[ ] 6. reviewer pre-commit (mig+financial+3-bản-predicate) → em main npm build ×2 + commit push → cicd-monitor verify prod
[ ] 7. docs closeout (STATUS Mig 67 · HANDOFF · session-log) + harvest còn lại
next: chờ INV-B return → verify (build slnx 0-err · T0 GREEN · 4 site snapshot-call · mig 3-file) → phóng INV-C
next: chờ INV-C return → verify full-suite count → reviewer
verify:
- dotnet test SolutionErp.slnx --filter PeBudgetFreeze --nologo (GREEN sau INV-B)
- grep -rn "Phase = PurchaseEvaluationPhase.DaDuyet" src/Backend/ (4 hit, mỗi hit snapshot-call kề ≤6 dòng trước)
- grep -c AddColumn <Mig67>.cs = 11 · git status Migrations/ 3 file
- git hash-object 2 PeDetailTabs = 5534addb (FE không bị INV-B đụng)
- dotnet test SolutionErp.slnx --nologo (0 fail, tổng = 510 + test mới INV-C)
- git status --porcelain (Migrations 3 file mới + BE 6 M + accumulator + tests + FE 4 M)
- grep -c "ApplyBudgetSnapshotOnFinalizeAsync" src/Backend/SolutionErp.Infrastructure/Services/PurchaseEvaluationWorkflowService.cs = 5
- sqlcmd Dev: PurchaseEvaluations Phase=7 → chua_snapshot=0 (đã chạy: 1/0 ✓)

View File

@ -1,5 +1,7 @@
# Implementer-Backend Agent — Persistent Memory
- **S133 (07-17) PE budget-freeze BE [wf_4bef08b8-730 INV-B · #53 return-fail → disk-truth + em-main-solo hoàn tất; entry on-behalf]:** lane sửa XONG 6 file + `PeBudgetAccumulator.cs` mới (Domain 11 props ApprovedBudget* + Config precision/maxlength + DTO append `BudgetFrozen=false` cuối positional-record + display-gate frozen/live 2-nhánh trong GetPurchaseEvaluationQuery + helper `ApplyBudgetSnapshotOnFinalizeAsync` gọi 4-site `:862/:901/:934/:1109` + 2 terminal-guard block-CẢ-Admin) rồi CHẾT TRƯỚC bước sinh migration → em-main solo: scaffold Mig 67 sạch 11 AddColumn (0 RenameColumn #63) + backfill `Sql()` OUTER APPLY ×3 khớp accumulator TỪNG điều kiện (Suppliers/Quotes = BaseEntity KHÔNG soft-delete filter → SQL không thêm IsDeleted trên s/q; WorkItemId-null → 4 lũy kế NULL mirror helper, SnapshotAt vẫn set) + apply 2 DB — **Dev lòi drift Mig 66 committed-chưa-apply-local, catch-up luôn** — + filter test 44/44 (T0 RED→GREEN không sửa test). Phát hiện đáng giữ của lane: `TransitionAsync` KHÔNG SaveChanges nội bộ `:537` → snapshot flush qua SaveChanges của caller (mirror ApprovedPrice pattern); khuôn backfill THẬT Mig 61/65 = plain `Sql()` KHÔNG C# provider-guard (SQLite EnsureCreated không replay = guard kiến trúc). Tag `[s133, pe-budget-freeze, mig67, 53-writelane-disk-recover]`
> **Persistent diary cross-session.** Auto-injected first ~200 lines at spawn (L1 HOT).
> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53).
> Full verbatim history pre-S40 → git `d2f52ba` + `archive/2026-05-q1..q4.md` + `archive/2026-06.md`. 🗺️ **Lookup map (Harness-9 S70): `archive/_INDEX.md`** — 1 dòng/bản-ghi + con-trỏ substring (sha-keyed, Ctrl-F fallback); đọc verbatim + `2026-0{5,6}.gist.md` (nén 4-field) theo nhu cầu.

View File

@ -1,5 +1,7 @@
# Implementer-Frontend Agent — Persistent Memory
- **S133 (07-17) PE budget-freeze FE types+badge [wf_d9639faa-97a INV-A, return sạch]:** 4 file — types 2-app +`budgetFrozen: boolean` (fe-user `:333` · fe-admin `:331` — 2 file KHÔNG mirror nhưng block PeBudgetSummary nội-dung identical → 1 old_string dùng chung cả 2); PeDetailTabs 2-app byte-identical: badge amber `🔒 Ngân sách chốt tại thời điểm duyệt` @ header `PeBudgetSummaryTable` `:1350-1359` (div `bg-[#1F7DC1]` → +flex justify-between; `normal-case tracking-normal` OVERRIDE `uppercase tracking-wide` của header; non-frozen = 1 span trong flex → appearance giữ nguyên). Gotcha mới đáng nhớ: className header LẶP 2 chỗ (`:1350` budget + `:1931` winners) → Edit anchor PHẢI kèm text visible "Tổng hợp ngân sách trình ký" mới unique. Hash sau sửa `5534addb` ×2 = mirror giữ; npm build ×2 PASS. Tag `[s133, budgetfrozen-badge, anchor-by-visible-text]`
> **Persistent diary cross-session.** Auto-injected first ~200 lines at spawn (L1 HOT).
> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53).
> **NEW agent S39 (2026-05-29)** — split từ implementer (FE 2 app half). Backend scaffold history ở `implementer-backend`.

View File

@ -1,5 +1,7 @@
# Test-Specialist Agent — Persistent Memory
- **S133 (07-17) PE budget-freeze T0 REPRODUCE [wf_d9639faa-97a INV-A, return sạch]:** RED thật `Failed 1/1` — expected ProInitial 100tr, found 999tr @`PeBudgetFreezeTests.cs:184`. Flow chuẩn: đưa phiếu tới DaDuyet QUA `svc.TransitionAsync` (V2 1-Bước-1-Cấp `AllowApproverFinalize=true` + giá chốt), KHÔNG seed thẳng Phase (post-fix snapshot CHỈ set qua transition); mutate pair qua UpdatePeBudgetPro/Ccm (2 handler KHÔNG phase-guard = đúng cơ chế bug); 2 sanity-assert chống vacuous (Phase==DaDuyet + liveRec đổi thật) TRƯỚC assert chính. Bắt được lỗi spec: query THẬT = `GetPurchaseEvaluationQuery` (bundle `.BudgetSummary`), spec ghi nhầm GetPurchaseEvaluationDetailQuery → lead sửa spec. Sau INV-B: T0 GREEN trong 44/44 filter. Tag `[s133, pe-budget-freeze, t0-red-green, anti-vacuous-sanity-assert]`
> **Persistent diary cross-session.** Auto-injected first ~200 lines at spawn (L1 HOT).
> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53).
> **NEW agent S39 (2026-05-29)** — dedicated test layer (tách khỏi implementer Case 3).

View File

@ -22,7 +22,7 @@
- [x] 2. lead verify + ghi `spec-pe-budget-freeze-daduyet-17-07-2026.md` (OD1 CÓ · OD2 CÓ · OD3 KHÔNG)
- [ ] 3. hmw implement Opus MAX theo spec — 3 invocation staged:
- [x] INV-A (2-task ‖, wf_d9639faa-97a, 0-garble): T0 RED thật (`Failed 1/1` found 999tr @PeBudgetFreezeTests.cs:184, prod sạch — evidence sub-test-specialist-0.md) · FE 4 file (badge amber @ "Tổng hợp ngân sách trình ký" :1352, hash mirror `5534addb` ×2, npm build ×2 PASS) · errata spec: query = GetPurchaseEvaluationQuery (bundle prop BudgetSummary)
- [ ] INV-B (1-task): implementer-backend (Domain +11 col · Config · Mig 67 3-file + backfill idempotent · PeBudgetAccumulator · ApplyBudgetSnapshotOnFinalizeAsync 4-site · display-gate BudgetFrozen · 2 terminal-guard · build slnx · T0 GREEN)
- [x] INV-B (1-task, wf_4bef08b8-730, #53 return-fail ×2): lane XONG 6 file + PeBudgetAccumulator (helper 4-site :862/:901/:934/:1109 · display-gate · 2 guard) — chết trước mig → **em-main-solo Mig 67** (scaffold 11 AddColumn sạch + backfill Sql OUTER APPLY khớp accumulator; apply 2 DB, Dev catch-up Mig 66 lag; build slnx 0/0; filter 44/44 **T0 RED→GREEN**)
- [ ] INV-C (1-task): test-specialist T1-T9 + full suite
- [ ] 4. reviewer pre-commit → commit/push → cicd verify prod

View File

@ -0,0 +1,28 @@
# sub-implementer-backend-0 — INV-B pe-budget-freeze-daduyet (S133)
Role: implementer-backend. Task: implement TOÀN BỘ BE theo SPEC ② bước 1-8. T0 test ĐÃ TỒN TẠI + RED → mục tiêu TỰ GREEN, KHÔNG sửa test.
## Anchors verified (re-grep TRƯỚC edit — line trôi nhẹ)
- Domain `PurchaseEvaluation.cs`: props end ~:112 (`EndedByLevelFinalize`). Append 11 ApprovedBudget* props.
- `PurchaseEvaluationConfiguration.cs`: precision block :24-44 (mirror ApprovedPrice*/note pattern). HasQueryFilter(!IsDeleted) :74.
- DTO `PeBudgetSummaryDto` :331-349 (17-field positional record) → append `bool BudgetFrozen = false`.
- Query handler `GetPurchaseEvaluationQueryHandler` :853; budget block :905-973 (pairRec load :911-912; peers/lũy kế :917-943; currentProposal :947-951; fullAmount :957-962; DTO ctor :964-972).
- Workflow service `PurchaseEvaluationWorkflowService.cs` (ctor `IApplicationDbContext db, IDateTime dateTime, ...`). Finalize 4 site: :861 (AllowApproverFinalize) · :899 (CCM-threshold) · :931 (all-steps) · :1053 (V1 legacy — CHỈ budget-snapshot, KHÔNG ApplyApprovedPrice). ApplyApprovedPriceOnFinalize :955.
- Guard 7a `SetPeCcmBudgetPeriodCommandHandler` PeWorkItemBudgetFeatures.cs:228 (sau load+NotFound :230-231).
- Guard 7b `AdjustPurchaseEvaluationBudgetCommandHandler` PurchaseEvaluationFeatures.cs:358 (sau load+NotFound :360-361, TRƯỚC isAdmin block :363).
- Enum: DaDuyet=7, ChoDuyet=10, TraLai=98, TuChoi=99.
- NAMING TRAP: PeWorkItemBudget.InitialAmount/AdjustmentAmount = CCM; ProInitialAmount/ProAdjustmentAmount = PRO.
## Regression scan (tests trong acceptance filter)
- PeWorkItemBudgetTests: MỌI queried-PE ở non-terminal (DangSoanThao/ChoDuyet); DaDuyet chỉ là PEER lũy kế → frozen-gate KHÔNG kích cho queried PE → live(else) branch → behavior-preserving qua accumulator. AdjustBudget tests đều DangSoanThao → guard 7b không fire.
- PeCcmBudgetPeriodSetterAuthzTests: mọi seed Phase=ChoDuyet → guard 7a không fire. (Không trong filter nhưng verify để 0 regression FULL.)
- T0 PeBudgetFreezeTests: dùng UpdatePeBudgetPro/Ccm (KHÔNG guard) → snapshot chốt 100tr/200tr, live đổi 999/888, frozen branch đọc snapshot.
## TransitionAsync KHÔNG SaveChanges nội-bộ (:537 "caller có downstream save")
→ Trong T0, snapshot flush qua UpdatePeBudgetPro/Ccm SaveChanges (shared context, pe tracked). Mirror ApprovedPrice pattern (đã proven).
## Backfill pattern (mirror Mig 61/65)
- Plain `migrationBuilder.Sql()` T-SQL, KHÔNG C# ActiveProvider guard (SQLite tests EnsureCreated no-replay = "guard" kiến-trúc). Idempotent WHERE. Down no-op cho backfill data (nhưng Down MUST DropColumn ×11 cho schema).
## Progress log
(cập nhật trong lúc làm)