Files
solution-erp/docs/governance/adap-reports/2026-06-08-Agent-database-codebase-agents.md
pqhuy1987 d8cd111532 [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>
2026-06-08 15:24:45 +07:00

49 lines
7.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# adap-report — 2026-06-08-Agent-database-codebase-agents
> SISTER = SOLUTION_ERP. Report-format LOCK (5 trường). Generated 2026-06-08 (S52), apply by em main solo (governance task — 0 agent spawned; HMW-mode ON nhưng adoption = single-writer file-work, parallel với investigator P11 recon đang chạy). Agent `.md` **chưa runtime-live pre-restart** (no hot-reload).
## 1. id-broadcast
`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
**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:**
- **database-agent = ADOPT (tailored READ-advisory).** STRONG-FIT 6/6 (broadcast): SE = .NET 10 + EF Core 10 + SQL Server single `ApplicationDbContext`. Differentiator vs roster hiện có: KHÔNG sub nào OWN DB-layer như specialty (investigator = broad audit · reviewer = broad pre-commit · implementer-backend = author). DB11 concurrency floor lấp gap THẬT: **S43 LeaveBalance trừ phép KHÔNG RowVersion = lost-update risk**.
- **codebase-agent = SKIP n-a** (KHÔNG behind): (1) `investigator-codebase` đã cover grep/symbol/reference-mirror/architecture-map (CB1/CB2/CB5/CB7 overlap) — broadcast §B.30 chính nó nói "investigator đủ → skip, KHÔNG thêm trùng"; (2) skill `csharp-lsp` = **Windows no-op** (`csharp-ls` không trên PATH — agents/README §H3 đã ghi; CB1 LSP-semantic-nav = nền tảng codebase-agent → absent = floor rỗng). Re-assess khi cần LSP-rename refactor an-toàn quy-mô-lớn.
**Files written/edited (repo SOLUTION_ERP):**
- **NEW** `.claude/agents/database-agent.md` — floor DB1DB11 đầy đủ (canonical, 0 hạ) + FORM SE (READ-advisory tier · skill `sql-database-assistant`+`ef-core-migration` · boundary ⟂ implementer-backend/investigator/reviewer · DB11 tie-in S43). `model: inherit` · `tools:` 4-RAG-read + Read/Grep/Glob/Bash/Skill (no Edit/Write/store_memory) · `description` block-scalar `|` parse-safe.
- **NEW** `.claude/agent-memory/database-agent/MEMORY.md` — seed (vai + SE facts 45mig/92tbl + DB11 S43-gap + boundary + G-015).
- **EDIT** `.claude/agents/README.md` (5-điểm): title 10→**11-agent** · arch line (9 product/quality + 2 monitor) + upgrade-note S52 · skill matrix +database-agent row · decision tree +nhánh DB-design/perf/concurrency · boundary matrix +row + Mig-design row note.
**SELF-CHECK (broadcast database-agent):**
- frontmatter `model: inherit` — KHÔNG `…[1m]` (gotcha #37). ✓
- `color:` unique — **OMIT** (lý do §4; precedent 2 monitor). ✓ (parse-safe)
- Đủ DB1DB11 (THÊM only-if-increase, 0 hạ floor) · DB2 destructive-guard + DB11 transaction/concurrency hiện diện rõ. ✓ (executed-file)
- Skill `sql-database-assistant` (standalone available) + `ef-core-migration` (project skill registry) — present; **active-verify pending** (tooling-auditor H1 @session-end confirm). ⏳
- `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: **`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.
- **FORM tailored SE:**
- (a) **READ-advisory tier** (no Edit/Write) — SE `implementer-backend` đã author trọn BE stack cohesive (3-file rule). Tách migration→database-agent = phá coupling entity↔migration. → database-agent = DESIGN/REVIEW/PERF/CONCURRENCY-advise, implementer-backend author. Khác template default "WRITE-tier nếu sinh migration" = tailoring hợp roster (§F4 form tự do, floor giữ).
- (b) **skill** = `sql-database-assistant` (SQL Server first-class) + **pair `ef-core-migration`** (template warn sql-database-assistant KHÔNG cover EF-Core → DB3 + skill này gánh; giữ pin EF Core 10/dbo).
- (c) **color OMIT** — 8 màu standard (blue/cyan/green/orange/pink/purple/red/yellow) đã dùng hết bởi 8 product/quality sub; value lạ = risk gotcha #37 (reject cả file → agent không spawn). Theo precedent 2 monitor (cũng omit). Doc-emoji nếu cần.
- (d) **tools 4-RAG-read** + `model: inherit` (SE convention, khác AI_INFRA 2-RAG/effort:max).
- (e) **boundary doc** ⟂ implementer-backend (author) / investigator-codebase (broad) / reviewer (pre-commit) — tránh roster-overlap mơ hồ.
- (f) **SE-fact embed:** 2 DB instance (Dev/Design designtime-gotcha) · gotcha #57 filtered-unique · codegen Serializable pattern · S43 lost-update gap.
- **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 = 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".
- **Restart-batch:** database-agent (S52) gộp chung restart với mọi agent/command `.md` pending khác (nếu có) → 1 restart.
- **AI_INFRA `/adap-audit` Đợt-2** đọc cross-repo agent `.md` verify floor-gate 2-way (KHÔNG cần copy report về).