[CLAUDE] Docs: S53 closeout — gotcha #57 EXT Master (Mig 47) + P11-D/E + database-agent verified-runtime + doc-drift

Session 53 closeout (HMW-mode ON, 'làm hết' full close). Code already shipped in 44b9e54 (Mig 47, Run #260) + dbf6648 (C+D, Run #261), both prod-verified.

- STATUS/HANDOFF: S53 entry (mig 46->47, test 200->203, menu +Off_AttendanceReport, bundle admin DfCfHUE9, database-agent verified-runtime).
- Doc-drift E (H1 top-5): ef-core skill 43->47, agents/README roster 10->11 + plugin nac, CLAUDE.md root 45->47 mig + 186->203 test, docs/CLAUDE.md 56->57 gotcha + 91->92 ERD.
- adap-report: database-agent executed-file -> verified-runtime (spawn-test caught Mig 46-unapplied-local).
- session log 2026-06-08-S53 + 4 agent diaries (S53 work).
- Memory: +project_database_agent_verified_local_drift (user-memory, outside repo).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-06-08 15:24:45 +07:00
parent dbf66489a9
commit d8cd111532
13 changed files with 155 additions and 31 deletions

View File

@ -62,12 +62,12 @@ SOLUTION_ERP/
│ ├── PROJECT-MAP.md bản đồ tổng quan
│ ├── rules.md coding conventions
│ ├── architecture.md layered + PE §9 + Budget §10 + Testing §11
│ ├── gotchas.md 56 pitfall đã gặp
│ ├── gotchas.md 57 pitfall đã gặp
│ ├── forms-spec.md 8 form catalog + RG-001
│ ├── workflow-contract.md 9 phase HĐ + role matrix
│ ├── database/
│ │ ├── database-guide.md conventions + migration workflow
│ │ └── schema-diagram.md ERD 91 bảng (+§11 PE +§12 Budget +§13 PEDeptOpinions +§14 Contract V2 LevelOpinions; §16+ Mig 27-42 pending)
│ │ └── schema-diagram.md ERD 92 bảng (+§11 PE +§12 Budget +§13 PEDeptOpinions +§14 Contract V2 LevelOpinions; §16+ Mig 27-47 pending)
│ ├── flows/ 6 sequence diagram (auth/permission/contract/form/sla + PE ref architecture)
│ ├── guides/ setup, cicd, deploy, runbook, security
│ ├── changelog/

View File

@ -2,7 +2,27 @@
> **Tiering rule (S40):** giữ **2-3 session gần nhất**. Cũ hơn → `docs/changelog/sessions/`. Full brief history pre-S40 → `docs/_archive/HANDOFF-preS40-fullhistory.md`.
**Last updated:** 2026-06-08 (Session 52**Phase 11 product backlog ĐÓNG TRỌN (P11-D+E+F deployed prod)** + database-agent adopt. HMW-mode ON. 3 commit (`e9ee97f`+`6a66429`+`dcf76f8`). Test 186→**200**. Mig 46. Bundle admin `DYfjnpY0`/user `_3S0BPJ2` (deploy verified curl độc lập). ⚠️ **Session-limit hit giữa Wave 2** → recovery on-disk + em main solo FE + curl-self-verify. 🔴 database-agent CHỜ CLI restart. Prev S51: P11-C Vehicle+Driver.)
**Last updated:** 2026-06-08 (Session 53**gotcha #57 EXT Master (Mig 47) + P11-D reassign-UI + P11-E menu-key + database-agent verified-runtime — all prod-verified**. HMW-mode ON, "làm hết" full closeout. 2 code commit (`44b9e54` Mig 47 Run #260 + `dbf6648` C+D Run #261). Test 200→**203**. Bundle admin `DYfjnpY0``DfCfHUE9`/user `_3S0BPJ2` unchanged. Bonus Mig 46 local catch-up. ⚠️ cicd-monitor truncated 2× → curl-self-recovered. Prev S52: P11-D+E+F deployed + database-agent adopt.)
---
## S53 (2026-06-08) — gotcha #57 EXT Master (Mig 47) + P11-D reassign-UI + P11-E menu-key + database-agent verified-runtime (HMW-mode ON · "làm hết" full closeout · all prod-verified)
**User: `/session-start` → "Workflow làm nhanh" (Task B) → "làm hết luôn đi" (C+D+E+session-end). 2 code commit + docs closeout, all Gitea-verified prod.**
**Done:**
- **Bootstrap (3 governance agents):** database-agent **verified-runtime** spawn-test (first real spawn since S52 adopt — CLI restart confirmed; caught **Mig 46 committed-but-unapplied-local** drift) · H1 tooling-auditor + H2 harvest-curator re-report (S52 closeout debt cleared; H2 0-orphan, S52 proxy-append verified present).
- **Task B — Mig 47 `FilterMasterCatalogUniqueIndexesByIsDeleted`** (`44b9e54`, Run #260): gotcha #57 EXT to 3 Master (Department/Supplier/Project) filtered-unique Code. Workflow test-specialist→implementer-backend→reviewer (PASS). Test 200→203. Prod: 3 indexes `filter_definition` NULL→`([IsDeleted]=(0))` live. **gotcha #57 EXT backlog CLOSED (6× cumulative: Holiday 43 + 3 HRM 45 + 3 Master 47).** Bonus: Mig 46 local catch-up (Dev+Design).
- **Task C+D** (`dbf6648`, Run #261): C = ItTicket admin reassign-UI (fe-admin only divergence; per-card dialog reuse `PUT /assign` + `GET /users`). D = `Off_AttendanceReport` menu-key leaf (no migration, DbInitializer idempotent seed, admin-perm auto via `All[]`, 5 mirror points byte-identical). Workflow implementer-backend→implementer-frontend→reviewer (PASS). Prod: menu row seeded + admin bundle `DfCfHUE9` rotated / user unchanged.
- **Doc-drift E + closeout:** H1 top-5 patched (ef-core 43→47, roster 10→11, CLAUDE.md root 45→47/186→203, docs/CLAUDE.md 56→57/91→92) · database-agent adap-report→verified-runtime · STATUS/HANDOFF/session log.
**⚠️ Lessons:** cicd-monitor truncated 2× (gotcha #53/#55) → curl-self-verify recovery (Gitea run + bundle hashes public, no re-spawn). database-agent first spawn earned ROI immediately (caught local-DB drift that SQLite-tests + CI-prod both miss). Menu-key = 5 mirror points (gotcha #50) — reviewer byte-verified all 5.
**🔴 NEXT SESSION (anh pick):**
- **Phase 9 Ops** (go-live blockers — anh main coordinate): SMTP outbound · rotate creds · SQL auto-backup register · UAT 2-3 real user 1 tuần.
- **Monthly drift audit 2026-07-01** (cron) — investigator-codebase ground-truth + H1 chốt.
- **Optional minor:** mirror ItTicket reassign to fe-user (nếu employee cần) · RAG re-index S42-S53 (AI_INFRA op, stale 05-29).
- **Cert** `api.solutions.com.vn` expire ~2026-07-23 (auto-renew ~06-23).
---

View File

@ -3,7 +3,7 @@
> **Update rule:** trước khi bắt đầu 1 task → ghi row `🔥 In Progress`. Xong → `✅ Recently Done`.
> **Tiering rule (S40):** chỉ giữ **state hiện tại + 3 session gần nhất** ở file này. Session cũ hơn → `docs/changelog/sessions/`. Full history pre-S40 → `docs/_archive/STATUS-preS40-fullhistory.md`. (Tránh over-context — xóa double, không cắt nội dung.)
**Last updated:** 2026-06-08 (Session 52**Phase 11 product backlog ĐÓNG TRỌN: P11-D+E+F deployed prod** + database-agent adopt, HMW-mode ON): 3 commit — `e9ee97f` (database-agent DB1DB11 read-advisory, roster 10→11, executed-file CHỜ restart) + `6a66429` Wave 1 (P11-E AttendanceReport+Excel+OtPolicy multiplier + P11-F MaTicket codegen, migration-free) + `dcf76f8` Wave 2 (P11-D ItTicket round-robin assign dept-IT + SLA timer, Mig 46). Test 186→**200**. Bundle admin `DYfjnpY0`/user `_3S0BPJ2` (cả 2 deploy verified curl độc lập — Wave 1 BE 401 wired + Wave 2 /assign 401 + Mig 46 applied health-200). ⚠️ **Session-limit hit giữa Wave 2** → recovery: BE/test verify-on-disk + em main solo FE redo + curl-self-verify thay cicd-spawn (multi-agent resilience, git/disk/prod = source-of-truth). RAG recovered (chunk 2416 rerank live) nhưng stale 05-29. Prev S51: P11-C Vehicle+Driver.)
**Last updated:** 2026-06-08 (Session 53**gotcha #57 EXT Master (Mig 47) + P11-D reassign-UI + P11-E menu-key — all prod-verified · database-agent verified-runtime; HMW-mode ON, "làm hết" full closeout**: 2 code commit `44b9e54` (Mig 47, Run #260) + `dbf6648` (C+D, Run #261) → test 200→**203**, bundle admin `DYfjnpY0``DfCfHUE9` / user `_3S0BPJ2` unchanged. Bonus: Mig 46 local catch-up. cicd-monitor truncated 2× → curl-self-recovered.) Prev S52 (Phase 11 P11-D+E+F deployed + database-agent adopt, HMW-mode ON): 3 commit — `e9ee97f` (database-agent DB1DB11 read-advisory, roster 10→11, executed-file CHỜ restart) + `6a66429` Wave 1 (P11-E AttendanceReport+Excel+OtPolicy multiplier + P11-F MaTicket codegen, migration-free) + `dcf76f8` Wave 2 (P11-D ItTicket round-robin assign dept-IT + SLA timer, Mig 46). Test 186→**200**. Bundle admin `DYfjnpY0`/user `_3S0BPJ2` (cả 2 deploy verified curl độc lập — Wave 1 BE 401 wired + Wave 2 /assign 401 + Mig 46 applied health-200). ⚠️ **Session-limit hit giữa Wave 2** → recovery: BE/test verify-on-disk + em main solo FE redo + curl-self-verify thay cicd-spawn (multi-agent resilience, git/disk/prod = source-of-truth). RAG recovered (chunk 2416 rerank live) nhưng stale 05-29. Prev S51: P11-C Vehicle+Driver.)
---
@ -11,30 +11,30 @@
| Metric | Value | Note |
|---|---|---|
| Migrations | **46** | +S52 Mig 46 `AddSlaFieldsToItTicket` (P11-D: 3 column SlaDueAt/SlaWarnedSent/SlaBreached vào ItTicket — KHÔNG bảng mới) |
| Migrations | **47** | +S53 Mig 47 `FilterMasterCatalogUniqueIndexesByIsDeleted` (gotcha #57 EXT: Department/Supplier/Project filtered-unique Code — index-only, no new table) |
| SQL tables | **92** | unchanged S52 (Mig 46 = AddColumn, no new table; cicd `sys.tables` ground-truth) |
| API endpoints | **~252** | +3 S52 (attendances/report + report/excel + it-tickets/{id}/assign) |
| FE pages | **68** | +1 S52 AttendanceReportPage (fe-admin); ItTicketsPage upgrade in-place (P11-D badge) |
| Menu keys | **~55** | unchanged S52 (report via button, ticket dùng menu sẵn — no new key) |
| Tests | **200 PASS** | 58 Domain + 142 Infra · 0 fail / 0 skip · +5 Wave1 (codegen+aggregate) +9 Wave2 (`ItTicketAssignSlaTests` round-robin/SLA-due) |
| Menu keys | **~56** | +1 S53 `Off_AttendanceReport` (P11-E promote → sidebar leaf under Văn phòng số, order 8) |
| Tests | **203 PASS** | 58 Domain + 145 Infra · 0 fail / 0 skip · +3 S53 `MasterCatalogFilteredUniqueTests` (gotcha #57 EXT Master RED→GREEN) |
| Gotchas | **57** | unchanged S52 (#57 soft-delete UNIQUE filter; ext backlog 3 Master worktree still open) |
| User memory | **17** | (unchanged S52 — em main solo session, no new feedback entry) |
| User memory | **18** | +1 S53 `project_database_agent_verified_local_drift` (read-advisory DB lens catches local-DB drift) |
| Skills | 6 | 3 domain + 3 ops |
| Sub-agents | **11** | Opus 4.8 1M · 9 product/quality (7 core + frontend-designer + **database-agent S52** read-advisory) + 2 monitor INFORM-only (tooling-auditor H1 + harvest-curator H2). ⚠️ database-agent executed-file CHỜ CLI restart → verified-runtime |
| Sub-agents | **11** | Opus 4.8 1M · 9 product/quality (7 core + frontend-designer + database-agent) + 2 monitor INFORM-only (tooling-auditor H1 + harvest-curator H2). database-agent **verified-runtime S53** (spawn-test PASSED — caught Mig 46-unapplied-local drift) |
| RAG chunks | **2416** | Recovered S52 (S51 Qdrant DOWN → nay alive, rerank live 0.9375). Stale `last_indexed 05-29` (S42-S52 via store_memory stopgap; full re-index = AI_INFRA op cần VOYAGE_API_KEY). |
**Bundle hash live (prod):** admin `DYfjnpY0` · user `_3S0BPJ2` (S52 — rotated by P11-D Wave 2, cả 2 app). Deploy verified curl độc lập (no cicd-spawn do session-limit): api health 200 (→ Mig 46 applied) · GET /it-tickets 401 + PUT /assign 401 (P11-D wired) · /attendances/report 401 (P11-E Wave 1) · cả 2 bundle rotate.
**Bundle hash live (prod):** admin `DfCfHUE9` · user `_3S0BPJ2` (S53 admin rotated by Task C+D FE; user unchanged BE+menu-only). Deploy verified (Run #260 Mig 47 + Run #261 C+D): 3 Master Code indexes `filter_definition`=`([IsDeleted]=(0))` live · `Off_AttendanceReport` MenuItems row seeded prod · health 200 · /users + /it-tickets 401 wired.
**Phase:** ✅ Phase 10 COMPLETE · ✅ **Phase 11 product backlog ĐÓNG TRỌN** — P11-A/B/C/**D/E/F** ALL DONE (deployed prod) · 🚫 Phase 9 Ops blocked (anh main coordinate).
> ⚠️ **Count drift fixed S40:** endpoints ~223→**211**, FE pages 53→**65**, menu keys 85→**~53**. Tables **84 confirmed correct** (DbSet 77 + Identity 7). 3 số "khó fake" (mig/gotcha/git) luôn đúng. Cause: số "incremented mỗi session" over/under-count optimistic — re-ground định kỳ.
---
## 🔥 In Progress (S52)
## 🔥 In Progress (S53)
| Task | Owner | Status |
|---|---|---|
| _(none — S52 ĐÓNG TRỌN Phase 11 product backlog (P11-D+E+F deployed prod) + database-agent adopt. **🔴 NEXT-FIRST: anh restart CLI** → activate database-agent (registry load) → spawn-test verified-runtime. **NEXT (anh pick):** Phase 9 Ops (SMTP/creds/backup/UAT real-user) · follow-up minor: ItTicket reassign-UI (endpoint `/assign` sẵn, UI defer) + P11-E menu-key promote (hiện via button) + gotcha #57 EXT Master = **Mig 47** (Mig 46 đã dùng cho P11-D).)_ | 👤 | ✅ |
| _(none — S53 "làm hết" closeout DONE: gotcha #57 EXT Master (Mig 47) + P11-D reassign-UI + P11-E menu-key all **prod-verified** · database-agent **verified-runtime** · Mig 46 local catch-up · doc-drift E patched. **NEXT (anh pick):** Phase 9 Ops (SMTP/creds/backup/UAT real-user — anh main coordinate) · monthly drift audit **2026-07-01** · optional: mirror ItTicket reassign to fe-user nếu cần.)_ | 👤 | ✅ |
**S40 done:** ✅ Consolidation (`d2f52ba`) · ✅ Curate 4 agent MEMORY >25KB→<8.4KB (`78c9de3`) · RAG catch-up chunk S37-S40 (rerank 0.867) · **AI_INFRA bulletin 2026-05-29 adopt 4/4** (MỤC2 Tiered Memory Policy v1 `6f08d1f` + MỤC3 /session-start+/session-end slash commands `c8ff5e1`). Full RAG re-index = AI_INFRA op (cần VOYAGE_API_KEY).
@ -44,6 +44,15 @@
## ✅ Recently Done (newest on top — 3 session; cũ hơn → session logs)
### S53 (2026-06-08) — ✅ gotcha #57 EXT Master (Mig 47) + P11-D reassign-UI + P11-E menu-key — all prod-verified · database-agent verified-runtime (HMW-mode ON, "làm hết" full closeout)
- **2 code commit deployed prod:** `44b9e54` Task B (Mig 47 `FilterMasterCatalogUniqueIndexesByIsDeleted` Department/Supplier/Project filtered-unique Code, gotcha #57 EXT) Run #260 · `dbf6648` Task C+D Run #261. Test 200→**203** (+3 `MasterCatalogFilteredUniqueTests` REDGREEN). Bundle admin `DYfjnpY0`→**`DfCfHUE9`** (rotated C+D FE) · user `_3S0BPJ2` unchanged.
- **Bootstrap:** database-agent **verified-runtime** (first real spawn since S52 adopt caught **Mig 46 committed-but-unapplied-local** drift that 203 SQLite-tests + CI-applied-prod both MISS bonus closed via Mig 47 deploy applying 46+47 to LocalDB Dev+Design). H1+H2 monitors re-reported (S52 closeout debt cleared; H2 confirmed S52 proxy-append present, 0 orphan).
- **Task B (Mig 47, Run #260):** workflow 🟪 test-specialist 🟨 implementer-backend 🟥 reviewer (PASS 0 issues). 3 prod indexes `filter_definition` NULL`([IsDeleted]=(0))` live. gotcha #57 EXT cumulative now **6×** (Holiday 43 + 3 HRM 45 + 3 Master 47) **backlog CLOSED**. Root cause: app dup-check `AnyAsync(Code==req)` đi qua `HasQueryFilter(!IsDeleted)` (bỏ qua soft-deleted) nhưng bare unique index đếm cả delete+re-add = UNIQUE-500 reachable.
- **Task C+D (`dbf6648`, Run #261):** workflow 🟨 implementer-backend 🟧 implementer-frontend 🟥 reviewer (PASS 0 issues). C = ItTicket admin reassign dialog (fe-admin only, intentional mirror-break; reuse `PUT /assign` + `GET /users`). D = `Off_AttendanceReport` menu leaf (order 8, no migration DbInitializer idempotent seed, admin-perm auto via `All[]`, menu-key byte-identical 5 mirror points). Prod: menu row seeded + admin bundle rotated + smoke 200/401.
- **Doc-drift E:** H1 top-5 patched (ef-core skill 4347, agents/README roster 1011, CLAUDE.md root 4547 mig + 186203 test, docs/CLAUDE.md 5657 + 9192 ERD). database-agent adap-report verified-runtime.
- **cicd-monitor truncated 2×** (gotcha #53/#55; C+D verify cut mid-Q3) recovered via curl-self-verify (Gitea run + bundle hashes public; menu-row from agent's pre-truncation sqlcmd). `feedback_agent_kill_recovery` reinforced.
- session log `2026-06-08-S53-gotcha57-ext-p11-cd-closeout.md`.
### S52 (2026-06-08) — 🎉 Phase 11 product backlog ĐÓNG TRỌN (P11-D+E+F deployed) + database-agent adopt — HMW-mode ON, session-limit recovery
- **3 commit deployed prod:** `e9ee97f` (database-agent governance .md, CI-skip) + `6a66429` Wave 1 (P11-E+F code) + `dcf76f8` Wave 2 (P11-D, Mig 46). Test 186191→**200**. Bundle admin `DYfjnpY0`/user `_3S0BPJ2` (cả 2 rotate; deploy verified curl độc lập không cicd-spawn do limit).
- **🔌 database-agent adopt** (AI_INFRA broadcast `2026-06-08-Agent-database-codebase-agents`): floor DB1DB11 **READ-advisory tier** (implementer-backend vẫn author file) · skill `sql-database-assistant`+`ef-core-migration` · color OMIT (8 standard hết mirror monitor precedent) · `store_memory` strip · DB11 RowVersion tie-in S43 lost-update gap. **codebase-agent SKIP n-a** (investigator cover + csharp-lsp Windows no-op). Roster 10→**11**. Nấc executed-file **🔴 CHỜ CLI restart** verified-runtime. adap-report 5-trường LOCK written.

View File

@ -0,0 +1,88 @@
# Session 53 — gotcha #57 EXT Master (Mig 47) + P11-D reassign-UI + P11-E menu-key + database-agent verified-runtime
**Date:** 2026-06-08 · **Mode:** HMW-mode ON · **Theme:** "làm hết luôn đi" — full close of remaining Phase 11 follow-ups + governance + doc-drift, all prod-verified.
**User flow:** `/session-start` → "Workflow làm nhanh" (Task B gotcha #57 EXT) → "làm hết luôn đi" (Task C + D + doc-drift E + `/session-end`).
---
## Outcome
| Metric | Before (S52) | After (S53) |
|---|---|---|
| Migrations | 46 | **47** (Mig 47 `FilterMasterCatalogUniqueIndexesByIsDeleted`) |
| Tests | 200 | **203** (+3 `MasterCatalogFilteredUniqueTests`) |
| Menu keys | ~55 | **~56** (+`Off_AttendanceReport`) |
| Sub-agents | 11 (database-agent executed-file) | 11 (database-agent **verified-runtime**) |
| Bundle admin | `DYfjnpY0` | **`DfCfHUE9`** (rotated by C+D FE) |
| Bundle user | `_3S0BPJ2` | `_3S0BPJ2` (unchanged — fe-user untouched) |
| Tables | 92 | 92 (Mig 47 index-only) |
**2 code commits, both Gitea-verified prod:**
- `44b9e54` — Task B (Mig 47, gotcha #57 EXT Master) → Run #260 success
- `dbf6648` — Task C + D (ItTicket reassign-UI + AttendanceReport menu-key) → Run #261 success
---
## Part 1 — Bootstrap (3 governance agents)
- **🔵 database-agent → VERIFIED-RUNTIME** (first real spawn since S52 adopt). CLI restart confirmed (registry loaded it). Spawn-test: connected LocalDB `(localdb)\MSSQLLocalDB` Dev+Design, read `__EFMigrationsHistory`, introspected `ItTickets`, queried `sys.tables`. **Caught 2 real drifts** the rest of the toolchain missed:
1. **Mig 46 committed-but-unapplied-local** — the migration file + snapshot were on disk (3-file committed S52) and prod had it (CI-applied), but local `SolutionErp_Dev`/`_Design` were stuck at Mig 45 (S52 session-limit killed the local `database update`). 203 SQLite tests + green prod both **miss** this — local DB is the one surface nothing else verifies. → Closed as a bonus when Mig 47's `database update` applied 46+47 to both local instances.
2. table-count: raw `sys.tables` = 93 = 92 domain + `__EFMigrationsHistory` (docs' "92 domain" correct).
- **🟫 tooling-auditor (H1)** re-report: top-5 doc-drift (ef-core skill 43, roster 10→11, CLAUDE.md root 45, docs/CLAUDE.md 56→57/91→92). Patched at session-end (Part 4).
- **⬜ harvest-curator (H2)** re-report: 🟢 clean. S52 proxy-append (Wave-2 killed-mid implementer-backend + test-specialist diaries) **verified present, 0 orphan**. 11 diaries byte>0. 1 cosmetic flagged (`s??``s52` placeholder).
## Part 2 — Task B: gotcha #57 EXT Master (Mig 47)
**Workflow:** 🟪 test-specialist (RED) → 🟨 implementer-backend (fix+Mig47+GREEN) → 🟥 reviewer (PASS, 0 issues).
- 3 Master configs (Department:18 / Project:19 / Supplier:24) → unique Code index `.HasFilter("[IsDeleted] = 0")` (byte-for-byte from the existing 13 filtered indexes). Mig 47 = 3× DropIndex+CreateIndex filtered (Up) / reverse (Down).
- **Root cause** (test-specialist pinned it): app-level dup-check `db.X.AnyAsync(x => x.Code == req.Code)` runs *through* `HasQueryFilter(!IsDeleted)` → ignores the soft-deleted row → says "Code free"; the **bare** DB unique index counts the soft-deleted row → UNIQUE-500. Admin delete+re-add same Code = reachable 500. `.HasFilter` aligns the index with the query filter.
- test-before RED confirmed (3× `SqliteException UNIQUE`) → GREEN after fix. Test 200→203.
- Prod (Run #260): 3 indexes `filter_definition` NULL → `([IsDeleted]=(0))` live (cicd sqlcmd).
- **gotcha #57 EXT backlog CLOSED** — cumulative 6× (Holiday Mig 43 S45 + 3 HRM Mig 45 S51 + 3 Master Mig 47 S53).
## Part 3 — Task C+D (one commit `dbf6648`)
**Workflow:** 🟨 implementer-backend (D-BE) → 🟧 implementer-frontend (C + D-FE) → 🟥 reviewer (PASS, 0 issues).
- **Task C — ItTicket admin reassign-UI** (fe-admin ONLY, intentional mirror-break): per-card pencil → Dialog with user Select (reuse existing `GET /users` pagedSize 200) → `PUT /it-tickets/{id}/assign` (Admin-only, 204 handled) → invalidate `['it-tickets']`. fe-user `ItTicketsPage` untouched (employees don't reassign). Top comment updated to flag divergence.
- **Task D — AttendanceReport menu-key** (no migration): `MenuKeys.OffAttendanceReport = "Off_AttendanceReport"` + `All[]` + DbInitializer seed `(…, "Báo cáo chấm công", MenuKeys.Off, 8, "FileBarChart")`. Admin-perm auto via `SeedAdminPermissionsAsync` iterating `All`. Idempotent seed → prod gets leaf on restart. FE: `menuKeys.ts` const + `Layout.tsx` staticMap → existing `/attendance/report` route (only 2 of 4-place needed; page+route from S52).
- **Menu-key = 5 mirror points** (gotcha #50) — reviewer byte-verified `"Off_AttendanceReport"` identical at: BE const, BE `All[]`, DbInitializer seed, FE `menuKeys.ts`, FE Layout staticMap.
- Prod (Run #261): `Off_AttendanceReport` MenuItems row seeded (ParentKey=Off, Order=8) · admin bundle `DfCfHUE9` rotated / user `_3S0BPJ2` unchanged · smoke health 200, /users + /it-tickets 401.
## Part 4 — Closeout (doc-drift E + session-end)
- **Doc-drift E (H1 top-5 patched):** ef-core SKILL.md + skills/README (43→47, Mig 47, S45→S53) · agents/README roster 10→11 (×3) + plugin "18 enabled"→"18 registered/15 enabled" · CLAUDE.md root 45→47 mig + 186→203 test + Mig list +46+47 · docs/CLAUDE.md 56→57 gotcha + 91→92 ERD + Mig 27-47.
- database-agent adap-report: executed-file → **verified-runtime** (§2 nấc + §5 caveat #1 + commit-sha `e9ee97f`).
---
## §L.b(d) Spawn-records (4-field {agent · task · nấc · evidence})
| Agent | Task | Nấc | Evidence |
|---|---|---|---|
| 🔵 database-agent | verified-runtime spawn-test (introspect ItTickets/migrations) | **verified** | LocalDB connect + `__EFMigrationsHistory` read + caught Mig 46-unapplied-local + table-count 93 |
| 🟫 tooling-auditor (H1) | session-start re-report (4-mặt freshness diff vs S50) | verified | top-5 doc-drift coords → all patched Part 4 |
| ⬜ harvest-curator (H2) | session-start re-report + session-end gate (5-trục) | verified | 11 diaries byte>0, S52 proxy-append present, 0 orphan |
| 🟪 test-specialist | Mig 47 test-before (3 `MasterCatalogFilteredUniqueTests`) | verified | RED 3× SqliteException → GREEN; 200→203 |
| 🟨 implementer-backend | Mig 47 (configs+migration) + D-BE (MenuKeys+DbInitializer) | verified | Run #260 + #261; dotnet build 0-err; em-main re-verified |
| 🟧 implementer-frontend | C reassign-UI + D-FE menu wiring (fe-admin) | verified | npm build 0-err; admin bundle `DfCfHUE9` rotated prod |
| 🟥 reviewer | Mig 47 pre-commit + C+D pre-commit | verified | 2× PASS 0-issues; em-main confirmed builds + git scope |
| 🟩 cicd-monitor | Mig 47 prod verify + C+D prod verify | partial (truncated 2×) | Run #260/#261 success + filter_definition + menu-row; **gaps curl-self-recovered** |
## §L.a — Deterministic detect (AS scan)
- **AS-truncation (gotcha #53/#55):** cicd-monitor truncated output 2× (C+D verify cut mid-Q3 on its own `AspNetRoles` query typo). **Guard held** (not a new RCA — existing `feedback_agent_kill_recovery` guard): em-main curl-self-verified the gaps (Gitea run #261 + bundle hashes via public curl; menu-row from agent's pre-truncation sqlcmd). No prod impact, no re-spawn needed. Active-Guard "curl-self-verify recovery" → marked verified (2nd consecutive session held: S52 session-limit + S53 truncation).
- No bug-production (all 203 green, both deploys verified). No new RCA entry.
## Lessons
1. **Read-advisory DB lens earns its seat on first spawn.** database-agent caught a committed-but-unapplied-local migration that *every other green signal missed* (SQLite tests build from snapshot, prod uses CI-applied DB). Local DB is the unverified surface.
2. **cicd-monitor truncation is now a 2-session pattern** → curl-self-verify (public Gitea API + bundle HTTP) is the reliable recovery; don't re-trust a 2nd agent round-trip. Bundle-hash diff is content-addressed ground truth for "right FE shipped".
3. **Hybrid scout→pipeline** (em-main recon inline → Workflow with exact coords) kept both workflows tight + 0-issue reviews.
## Next session (anh pick)
- **Phase 9 Ops** (anh main coordinate): SMTP · rotate creds · SQL auto-backup register · UAT real user.
- **Monthly drift audit 2026-07-01** (cron).
- Optional: mirror ItTicket reassign to fe-user · RAG re-index S42-S53 (AI_INFRA op).

View File

@ -6,7 +6,7 @@
`2026-06-08-Agent-database-codebase-agents` (from: ai_infra · category: **Agent** · reviewer_gate: **PASS_WITH_FIXES-applied** · nac: published · targets: **all-fit** · content_sha256 `76de8f24…`). 2 agent KHUNG: **A `database-agent`** (floor DB1DB11, EF-Core/SQL-Server-centric) + **B `codebase-agent`** (floor CB1CB8, .NET semantic + LSP). Recon-grounded: AI_INFRA quét 6/6 sister = .NET + EF Core + SQL Server → 2 floor universal.
## 2. nac G-011
**executed-file** (database-agent.md tailored + agent-memory seed + agents/README roster 10→11 5-điểm sync) → **VERIFIED-pending CLI restart** (agent `.md` no hot-reload → cần (a) anh restart Claude Code để registry load `database-agent`, (b) 1 spawn-test task DB nhỏ — đọc schema 1 bảng `sys.tables` / introspect ItTicket — confirm load OK + chạy DB1DB11 thật). **codebase-agent = SKIP n-a** (KHÔNG executed — lý do §3).
**VERIFIED-RUNTIME (S53 2026-06-08)** — CLI restarted (registry loaded `database-agent`), spawn-test ran live: connected LocalDB `(localdb)\MSSQLLocalDB` (Dev+Design), read `__EFMigrationsHistory`, introspected `ItTickets` schema, queried `sys.tables`/`sys.columns`**caught 2 real drifts** (Mig 46 committed-but-unapplied-local + table-count 93 raw = 92 domain + `__EFMigrationsHistory`). DB1/DB10 floor exercised. (S52 executed-file → S53 upgraded.) **codebase-agent = SKIP n-a** (KHÔNG executed — lý do §3).
## 3. evidence
**PROJECT-FIT:**
@ -26,7 +26,7 @@
- `store_memory` KHÔNG trong `tools:` (adap #1) · 4 RAG-read giữ. ✓ (`grep store_memory .claude/agents/database-agent.md` = 0 post-write)
- Restart + spawn-test → verified-runtime. ⏳ (defer session-end/next-session)
commit-sha: **pending S52** (governance .md → CI path-ignore skip; fill sau commit).
commit-sha: **`e9ee97f`** (S52 adopt, governance .md → CI path-ignore skip) · **verified-runtime S53** (this session, spawn-test).
## 4. tailored-gì + skip-gì-vì-sao
- **FUNCTION-floor adopt FULLY:** DB1DB11 giữ đủ canonical (0 hạ). DB2 destructive-guard + DB11 RowVersion concurrency + DB3 EF-Core discipline + DB6 3-file rule — nguyên vẹn.
@ -40,7 +40,7 @@ commit-sha: **pending S52** (governance .md → CI path-ignore skip; fill sau co
- **SKIP codebase-agent = n-a** (KHÔNG behind — investigator cover + csharp-lsp Windows no-op; §3). Đúng floor broadcast "skip nếu investigator đủ, KHÔNG thêm trùng".
## 5. honest-caveat
- **Nấc = executed-file, KHÔNG verified-runtime.** database-agent CHƯA spawn lần nào (agent `.md` no hot-reload) → DB1DB11 mới là floor-trong-file, chưa chạy thật. Anh restart CLI → spawn-test mới upgrade verified-runtime. KHÔNG claim "database-agent đang hoạt động".
- **Nấc = VERIFIED-RUNTIME (S53 2026-06-08).** database-agent spawn-test PASSED — load OK + DB1/DB10 introspection chạy thật (LocalDB connect + `__EFMigrationsHistory` read + schema introspect). **Value-add proven on first spawn:** read-advisory DB lens caught local-DB drift (Mig 46 unapplied) mà 200/203 tests (SQLite) + prod (CI-applied) đều MISS — đúng gap roster cũ không cover. (S52 executed-file → S53 upgraded; KHÔNG còn pre-restart caveat.)
- **G-015 KHÔNG overclaim:** DB7 scope-DB-only + READ-advisory tier = **PHÂN-VAI**, KHÔNG "read-only enforced" — agent giữ `Bash` (write-channel shell mở) + Skill. Containment thật = em main single-writer + git-diff post-session (defense-in-depth), KHÔNG allowlist đơn-độc.
- **Value-add chưa proven-runtime:** lý-lẽ "lấp DB-layer gap + DB11 vá S43 lost-update" = thiết-kế-hợp-lý, nhưng ROI thực phụ thuộc tần-suất task DB-design/concurrency phát sinh. Nếu sau vài session database-agent idle (investigator+reviewer đã đủ) → re-assess prune (tránh roster bloat 11-agent). Theo dõi @tooling-auditor H1 (idle/scope-drift check).
- **skill active-verify pending:** `sql-database-assistant` present trong skill-list nhưng chưa smoke-test trong vai database-agent; `ef-core-migration` project skill OK. tooling-auditor H1 @session-end confirm "đã-map-vai chưa".