feat: complete llm sourcegen plan

This commit is contained in:
thanhnv
2026-07-09 00:59:28 +09:00
parent c800f7edf7
commit fafccc47ad
16 changed files with 700 additions and 85 deletions
+2 -2
View File
@@ -10,7 +10,7 @@
> gì phải làm"**. Control **đã implement+test** → xem `CASAN_HARDENING_STATUS.md`.
> Mục lục plan → `CASAN_PLAN_00_INDEX.md`. Ba file không lặp trạng thái chi
> tiết; Index chỉ trỏ tới hai file này.
> Test hiện tại: **218 PASS / 0 FAIL** trên 13 core harness suite; **Plan-16 security remediation 33 SEC suite = 181 PASS / 0 FAIL** (WSL, đã nối `ci-harness-gate.sh`); local-prod Docker infra lab **2 PASS / 0 FAIL** (`infra-lab verify`: 7/0 internal checks); `phase3-model-router` riêng **11 PASS / 0 FAIL** (3 case cần Ollama live); `phase2-sourcegen` riêng **3 PASS / 0 FAIL**; frontend Vitest **16 PASS / 0 FAIL**. Backend `npm test` còn bị chặn bởi test-infra cũ (`schema.prisma` MySQL nhưng `setup-sqlite.mjs` chạy SQLite).
> Test hiện tại: **218 PASS / 0 FAIL** trên 13 core harness suite; **Plan-16 security remediation 33 SEC suite = 181 PASS / 0 FAIL** (WSL, đã nối `ci-harness-gate.sh`); local-prod Docker infra lab **2 PASS / 0 FAIL** (`infra-lab verify`: 7/0 internal checks); `phase3-model-router` riêng **11 PASS / 0 FAIL** (3 case cần Ollama live); `phase2-sourcegen` riêng **10 PASS / 0 FAIL**; frontend Vitest **16 PASS / 0 FAIL**; backend `npm test` **46 PASS / 0 FAIL / 3 SKIP** (LLM judge thiếu Anthropic key).
> Điểm công tâm vẫn quanh **~81/100**, harness thấp nhất 80; TIER 2 infra thật vẫn là trần Strong.
> Nguồn liên quan: `CASAN_HARDENING_STATUS.md` (chi tiết control) · `evidence/scoring-run-report.md` (điểm).
@@ -48,7 +48,7 @@
|---|:--:|---|
| **10 Traceability + H3 Eval** | ✅ MVP done+test | Đã nối traceability vào Evidence Pack + **symbol/line-level refs** (missing symbol/line ⇒ gate FAIL, phase10 6/0 WSL) + enforce trong CI (`ci-harness-gate.sh`). Sau MVP: H3 eval-set độc lập (nhiều model) + enrich symbol refs cho FR-02→FR-05. |
| **03 Cloud patch** | 🟡 MVP done+test | `model-call.py` đã hỗ trợ `openai:<model>` và `anthropic:<model>` qua endpoint hard-pin + API key env; parser token usage và malformed payload có deterministic test. Còn live smoke với key thật + billing usage API ground truth. |
| **02 LLM source-gen** | 🟡 đợt A MVP done+test | `01-srs` và `02-bd` hỗ trợ `CASAN_GEN_MODE=model`: gọi `model-router.sh --role generate`, scan H4 draft bằng `artifact-scan.sh`, validate token bắt buộc, fallback template nếu lỗi. Test `phase2-sourcegen` 3/0. Còn đợt B/C/D + full live pipeline smoke. |
| **02 LLM source-gen** | ✅ **A–D done+test (offline/local)** | `01-srs`, `02-bd`, `03-spec`, `05-plan`, `07-dd`, `08-testkit`, `09-tasks`, `10-implement` hỗ trợ `CASAN_GEN_MODE=model`: gọi `model-router.sh --role generate`, scan H4 draft bằng `artifact-scan.sh`, validate token bắt buộc, ghi H5 sourcegen audit + H6 telemetry, fallback template nếu lỗi. Real pipeline có STEP10 implement draft + STEP12 run-tests gate; retry/escalation loops STEP5→STEP3, STEP7→STEP6, STEP11→STEP10. Test `phase2-sourcegen` **10/0**; full template pipeline smoke trong `/tmp` tới STEP12 PASS; backend **46/0/3skip**, frontend **16/0**. Cloud OpenAI/Anthropic live smoke + billing ground truth thuộc Plan-03 (cần key thật). |
| **04 Self-improve** | � core done+test | `packages/casan-harness/scripts/bash/self-improve.py`: `propose` đọc metrics/drift → proposal dry-run (không ghi); `apply` bắt buộc approval, áp qua governed store (audit); sensitive/loosen luôn cần duyệt. `phase-selfimprove-tests.sh` 7/0 (WSL), nối CI. Còn: luật đề xuất phong phú hơn (corpus/model escalation), chạy định kỳ CI (05). |
| **05 CI/CD** | 🟡 CI gate MVP done | `packages/casan-harness/scripts/bash/ci-harness-gate.sh` chạy các suite harness/hardening/sourcegen/traceability/frontend theo thứ tự an toàn, có timeout/filter; `.gitea/workflows/harness-ci.yml` gọi gate trên push/PR. Filtered local verify PASS=2/0. Còn: full gate xanh trên runner thật, xử lý A6 nếu còn chậm/treo, bật Docker infra lab nếu runner hỗ trợ, package/release artifact `fpt-casan-sdd-harness`. |
| **06 Onboard dự án 2** | 📋 chưa bắt đầu (🔓 **đã mở khoá** — 01 done) | Chứng minh reuse: cắm 1 repo khác + golden/corpus/input, đăng ký qua `verify-harness-reuse.sh`, không sửa gate. Phụ thuộc 01 ✅. App mới chỉ cần `apps/<project>/domain/` + set `CASAN_DOMAIN_ROOT` (đã có `domain_root` per-project trong `project-registry.json`). |