G0~G8 성과·동맹 측정 OS 작업 일괄 고정

8월 7일까지 워킹트리에만 남아 있던 미커밋 작업을 커밋한다. 여러 사본
폴더(worktree·clone)에 흩어져 있던 중간 스냅샷을 정리하기 전에 원본을
git 이력으로 고정하는 것이 목적이다.

- contracts/routes/services: measurement, outcome_trajectory, rupture_repair,
  deliberate_practice, calibration_transfer, supervision_research,
  multimodal_alliance, continuous_improvement 계열 신규 모듈과 테스트
- infra/db/init: 07~16 마이그레이션(측정 기반~calibration transfer 실행)
- apps/web: 세션 리뷰 카드·관리 화면·E2E 스펙 추가
- docs/ops: G0~G8 라이브 통합·배포·롤백 증거 문서와 evidence JSON/PNG
- scripts: smoke·ledger·릴리스 에이전트·NAS 프리뷰 운영 스크립트

engine.public 로그 .bak과 apps/web/test-results 산출물은 커밋에서 제외했다.
This commit is contained in:
Yun Chan 2026-08-08 01:30:53 +09:00
parent 93dd8f82d7
commit 16e791e044
390 changed files with 243188 additions and 499 deletions

View file

@ -166,7 +166,11 @@ class ProviderRegistryTest(unittest.IsolatedAsyncioTestCase):
json.dumps(
{
"type": "turn.completed",
"usage": {"input_tokens": 12, "output_tokens": 3},
"usage": {
"input_tokens": 12,
"cached_input_tokens": 2,
"output_tokens": 3,
},
}
),
]
@ -196,13 +200,14 @@ class ProviderRegistryTest(unittest.IsolatedAsyncioTestCase):
self.assertEqual(result.text, "OK")
self.assertEqual(result.tokens_in, 12)
self.assertEqual(result.tokens_out, 3)
self.assertEqual(result.cost_usd, 0.0000705)
args = runner.await_args.args[0]
self.assertIn("gpt-5.6-terra", args)
self.assertIn('model_reasoning_effort="medium"', args)
self.assertEqual(args[-1], "-")
self.assertIn("[시스템 지침]", runner.await_args.kwargs["input_text"])
async def test_agy_generation_passes_prompt_immediately_after_print_flag(self):
async def test_agy_generation_uses_stream_json_usage_and_reference_cost(self):
capabilities = provider_registry.EngineCapabilitiesResponse(
provider="agy_cli",
available=True,
@ -225,7 +230,35 @@ class ProviderRegistryTest(unittest.IsolatedAsyncioTestCase):
reasoning_effort="high",
messages=[EngineMessage(role="user", content="hello")],
)
runner = AsyncMock(return_value=("OK\n", ""))
process = _FakeAgyProcess(
[
{
"event": "step_update",
"step_update": {
"step_type": "agent_response",
"state": "DONE",
"text_delta": "OK",
},
},
{
"event": "result",
"result": {
"status": "SUCCESS",
"response": "OK",
"usage": {
"input_tokens": 12,
"cache_read_tokens": 2,
"output_tokens": 2,
},
},
},
]
)
captured: list[tuple] = []
async def fake_create_subprocess_exec(*args, **kwargs):
captured.append(args)
return process
with (
patch.object(provider_registry, "_binary", return_value="agy"),
@ -234,7 +267,11 @@ class ProviderRegistryTest(unittest.IsolatedAsyncioTestCase):
"discover_capabilities",
AsyncMock(return_value=capabilities),
),
patch.object(provider_registry, "_run_process", runner),
patch.object(
provider_registry.asyncio,
"create_subprocess_exec",
fake_create_subprocess_exec,
),
):
result = await provider_registry.generate_with_provider(
request,
@ -243,11 +280,14 @@ class ProviderRegistryTest(unittest.IsolatedAsyncioTestCase):
)
self.assertEqual(result.text, "OK")
args = runner.await_args.args[0]
self.assertEqual(result.tokens_in, 12)
self.assertEqual(result.tokens_out, 2)
self.assertEqual(result.cost_usd, 0.0000303)
args = captured[0]
print_index = args.index("--print")
self.assertEqual(print_index, len(args) - 2)
self.assertIn("[시스템 지침]", args[-1])
self.assertNotIn("input_text", runner.await_args.kwargs)
self.assertEqual(args[args.index("--output-format") + 1], "stream-json")
async def test_agy_stream_forwards_live_deltas_without_repeating_final_response(self):
capabilities = provider_registry.EngineCapabilitiesResponse(
@ -296,7 +336,11 @@ class ProviderRegistryTest(unittest.IsolatedAsyncioTestCase):
"result": {
"status": "SUCCESS",
"response": "안녕",
"usage": {"input_tokens": 12, "output_tokens": 2},
"usage": {
"input_tokens": 12,
"cache_read_tokens": 2,
"output_tokens": 2,
},
},
},
]
@ -334,6 +378,7 @@ class ProviderRegistryTest(unittest.IsolatedAsyncioTestCase):
self.assertEqual(events[-1].result.text, "안녕")
self.assertEqual(events[-1].result.tokens_in, 12)
self.assertEqual(events[-1].result.tokens_out, 2)
self.assertEqual(events[-1].result.cost_usd, 0.0000303)
args = captured[0]
self.assertIn("--output-format", args)
self.assertEqual(args[args.index("--output-format") + 1], "stream-json")