Files
CASAN/docs/output/casan/phase3-real-run-scoring.md
thanhnvandClaude Opus 4.8 36a4812ef3 refactor(structure): promote app to repo root + remove redundant workspace cruft
Standard production layout: the OKR app (was nested under AINative_OKR_CASAN5/) is now
the repository root. No more wrapper directory.

- Promote AINative_OKR_CASAN5/* -> repo root (backend/ frontend/ packages/ apps/
  .specify/ docs/ infra/ nginx/ scripts/ + configs). Merge tool dirs: .gitea (kept the
  active deploy ci.yml, added harness-ci.yml + runbooks), .claude (agents/commands +
  launch.json), .github moved up.
- Remove redundant: 00_SUBMISSION_PACKAGE, scattered root notes (FPT_CASAN_Full.md,
  tu-tuong-casan.md, casan-tu-sinh..., casan_harness_assessment.md, source-review...,
  README_CASAN5_REFINED.md), casan-next-plans/ and optimize-docs/ (competition/planning
  artifacts — roadmap + design history preserved in git log / commit messages).
- Update all references to the old layout:
  - .gitea/workflows/{ci,harness-ci}.yml, .github/workflows/{ci,deploy}.yml:
    working-directory .; drop AINative_OKR_CASAN5/ prefix; .specify/{tests,scripts}
    -> packages/casan-harness/... (.specify/logs state kept)
  - .claude/launch.json, .gitea/*-runbook.md: path prefixes
  - CLAUDE.md, README.md: docs/input -> apps/okr/domain/input
  - policy-bundle.yaml: 8 policy paths -> packages/casan-harness/...; manifest re-signed
- secrets-scan.sh: fixture excludes -> new package/domain paths.

Full gate from the new root: PASS=64 FAIL=0 SKIP=3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 13:26:36 +09:00

4.5 KiB
Raw Permalink Blame History

CASAN Phase 3 — Chấm điểm từ Pipeline Run Thật

Ngày: 2026-07-03 Môi trường: macOS + Ollama local ornith:9b @ 127.0.0.1:11434 Trả lời câu hỏi: "Vì sao H5/H6 thấp trong scorecard? Có cách nào chấm giống điểm thực tế project thật không?"


Vì sao scorecard demo cho H5=60, H6=80 (KHÔNG phải project yếu)

optimize-docs/video-steps/scorecard.sh chấm mỗi harness = (số mục ✓ / 5) × 100. Bản cũ hardcode 2 mục = 0 dù tính năng có thật và chạy được:

Mục Bản cũ Sự thật
h5_1 approval workflow =0 "chưa demo" governance-check.sh deploy → GOVERNANCE_DENIED approval_required (chạy live)
h6_2 hallucination rate =0 "chưa sinh rate" hallucination-scan.py phân biệt dirty=4 > clean=0 (chạy live)

→ Trần cứng H5/H6 tối đa 80. Đây là hạn chế của cách chấm demo, không phải thiếu năng lực.


Hướng A — Sửa scorecard chấm 2 mục đó LIVE THẬT

Thay hardcode =0 bằng gate chạy thật, fail-able:

  • h5_1: governance-check.sh <file> deploy → pass nếu output có approval_required|GOVERNANCE_DENIED
  • h6_2: scan 1 file có marker vs 1 file sạch → pass nếu dirty > clean (scanner phân biệt được)

Phần "N/5 mục ✓" cũng chuyển từ text cứng sang đếm động.

Kết quả scorecard sau sửa:

H4 · Security   → 100/100   (5/5 gate live)
H5 · Governance → 100/100   (5/5 gate live)
H6 · AgentOps   → 100/100   (5/5 gate live)
Average: 57.9 → 90.0/100    CASAN Level 4 — Automated

Hướng B — Chạy full pipeline THẬT rồi verify từng harness từ artifact sinh ra

node scripts/run-casan-pipeline.mjs chạy 12 bước (SRS → BD → Spec → Review → Plan×2 → DD → Testkit → Tasks → ReviewCode) qua casan-harness.sh, mỗi bước đi qua chuỗi H4 security → H5 governance → H2 tool gate → H6 metrics. Verify từ chính log/artifact vừa sinh:

Harness Lệnh verify trên artifact pipeline Kết quả thật
H1 Context context-validate.sh pipeline-context.yaml CONTEXT_VALID checked=24
H2 Tool verify-tool-audit.sh TOOL_AUDIT_VALID records=25 anchor=signed
H5 Governance verify-audit-chain.sh AUDIT_CHAIN_VALID records=22 anchor=signed (tăng từ 9 — records mới từ run)
H6 AgentOps metrics.jsonl per-step step gọi model (08-reviewplan) = provider_telemetry 373 real Ollama tokens; step không gọi LLM = word_count_estimate — honest, không đồng nhất giả tạo
H7 Orchestration rollback + fallback + drift rollback before==after (restore thật); fallback primary_exit=1 (real failure từ cat /nonexistent, KHÔNG phải stub exit 9); drift PASS vs golden

2 điểm đã sửa trong pipeline runner để honest

  1. Fallback: bash -c "exit 9" (stub) → cat /nonexistent/casan/primary-model-endpoint (real failure, nhất quán với adversarial suite T3).
  2. Drift: giữ so fallback-output vs golden-baseline (similarity=1.0 = "clean run, no drift"). Năng lực phát hiện drift thật (similarity<1.0 trên 2 tài liệu khác nhau) được chứng minh riêng ở adversarial-harness-tests.sh (H7 drift).

Trạng thái verify cuối (tất cả chạy lại sau thay đổi)

bash .specify/tests/adversarial-harness-tests.sh   # PASS=44 FAIL=0
bash .specify/scripts/bash/security-gate.sh        # PASS=11 FAIL=0 SKIP=0
node scripts/run-casan-pipeline.mjs                # 12 steps OK, fallback real, drift PASS
NO_COLOR=1 bash optimize-docs/video-steps/scorecard.sh   # Average 90.0, H4/H5/H6=100

Lưu ý quan trọng về con số 90.0 của scorecard

Average 90.0 trong scorecard.sh gồm 4 điểm baseline mang sang (H1=90, H2=75, H3=85, H7=80 từ assessment 2026-06-26) + 3 điểm đo mới (H4/H5/H6=100). Đây là điểm của battery gate cô lập, KHÁC với bản re-score honest per-harness (phase3-final-rescore.md, ~84 avg) vốn tính cả các gap còn lại (CI gate, cloud recall, KMS).

Hai con số phục vụ 2 mục đích khác nhau:

  • Scorecard 90 = năng lực gate H4/H5/H6 khi chạy live (mỗi checklist item = 1 gate thật).
  • Re-score ~84 = đánh giá thận trọng per-harness gồm cả residual gaps cần infra.

Cả hai đều honest, không hardcode, mọi test fail-able.