세션 평가·라이브코치·교수자 분석 라운드 마감 + 문서 정리 + 코드품질 리팩터

- 누적 작업트리 커밋: 회기 평가 복구·durable 저장, 라이브 코치 이력/근거, 교수자 학생분석, 음성 비언어 메타, PII 마스킹, 운영 티켓/헬스 등
- 문서: 완료 기록 docs/archive/ 냉동 보관, docs/ 단일 인덱스(docs/README.md)+통합 TODO(docs/TODO.md)로 정리
- 리팩터(행위 보존): Stage enum SSOT(taxonomy 소유·state_machine re-export), store recent/masked_turns 중복 제거, speaker_ko_label 단일 헬퍼, _list_sessions N+1 제거(state/turns 배치 + 턴평가 하이드레이션 배치)
- 검증: 백엔드 pytest 352 passed, _list_sessions E2E chromium-single-run 2 passed
This commit is contained in:
Yun Chan 2026-07-02 02:50:36 +09:00
parent 7c41c3ce79
commit 778e8526d4
108 changed files with 6457 additions and 455 deletions

View file

@ -26,6 +26,33 @@ def sha256(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def valid_dataset_item() -> dict[str, object]:
return {
"schema": "phase3_dataset_item_v1",
"item_id": "DI-000001",
"participant_key": "PX-0001",
"session_key": "SX-0001",
"turn_key": "TX-000001",
"persona_id": "P1",
"stage": "rapport",
"speaker": "client",
"text_masked": "요즘 [NAME] 관련 고민이 있습니다.",
"techniques": [],
"client_states": [],
"feedback_scores": [],
"supervisor_comments": [],
"source_refs": {
"session_started_at": "2026-06-27T00:00:00Z",
"export_manifest_id": "phase3-fixture",
},
"privacy": {
"direct_identifiers_removed": True,
"pii_scan_status": "pass",
"consent_scope": "recursive_learning_seed",
},
}
class Phase3ArtifactCheckerTests(unittest.TestCase):
def make_root(self) -> Path:
tmp = tempfile.TemporaryDirectory()
@ -66,7 +93,10 @@ class Phase3ArtifactCheckerTests(unittest.TestCase):
root / "04-privacy" / "privacy_audit.md",
"# Privacy audit\n\nLegal/privacy reviewer: reviewer@example.invalid\n",
)
write_text(root / "03-export" / "anonymized_dataset.jsonl", "{}\n")
write_text(
root / "03-export" / "anonymized_dataset.jsonl",
json.dumps(valid_dataset_item(), ensure_ascii=False, sort_keys=True) + "\n",
)
metrics = {
name: {
@ -236,6 +266,33 @@ class Phase3ArtifactCheckerTests(unittest.TestCase):
self.assertTrue(any("sha256 mismatch" in error for error in report.errors), report.errors)
def test_approved_manifest_rejects_malformed_dataset_jsonl(self) -> None:
root = self.make_root()
dataset_path = root / "03-export" / "anonymized_dataset.jsonl"
write_text(dataset_path, "{}\n")
manifest_path = root / "03-export" / "export_manifest.json"
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
manifest["files"][0]["sha256"] = sha256(dataset_path)
manifest_path.write_text(json.dumps(manifest), encoding="utf-8")
report = checker.validate(root, max_scan_rows=100)
self.assertTrue(any("dataset item missing keys" in error for error in report.errors), report.errors)
def test_dry_run_manifest_rejects_malformed_dataset_jsonl(self) -> None:
root = self.make_root()
dataset_path = root / "03-export" / "anonymized_dataset.jsonl"
write_text(dataset_path, "{}\n")
manifest_path = root / "03-export" / "export_manifest.json"
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
manifest["export_status"] = "technical_dry_run"
manifest["files"][0]["sha256"] = sha256(dataset_path)
manifest_path.write_text(json.dumps(manifest), encoding="utf-8")
report = checker.validate(root, max_scan_rows=100)
self.assertTrue(any("dataset item missing keys" in error for error in report.errors), report.errors)
if __name__ == "__main__":
unittest.main()