관리자 감정 관측 기록과 조회 API 추가

This commit is contained in:
Yun Chan 2026-09-23 04:45:50 +09:00
parent d22cd9883d
commit acb0d26338
16 changed files with 1445 additions and 18 deletions

View file

@ -385,6 +385,43 @@ class OrchestratorMaskingGateTest(unittest.IsolatedAsyncioTestCase):
for key in ("messages", "prompt", "text"):
self.assertNotIn(key, audit_payloads[0])
async def test_private_affect_trace_is_absent_from_public_result_and_done_event(self) -> None:
ctx = _prepare_context()
engine = CaptureStreamEngine()
async def apply_private_trace(
context: orchestrator.TurnContext,
*,
audit_hook=None,
) -> None:
setattr(context, "client_affect_trace", {
"probabilities": [0.0, 0.0, 0.4, 0.6, 0.0],
})
with patch.object(orchestrator, "_apply_client_affect", apply_private_trace):
events = [
event
async for event in orchestrator.run_turn_stream(
ctx,
engine, # type: ignore[arg-type]
)
]
done = events[-1]
self.assertEqual(done.event, "done")
self.assertNotIn("client_affect_trace", done.data)
self.assertNotIn("probabilities", _json_blob(done.data))
generated = orchestrator.TurnResult(
turn_seq=ctx.state_after.turn_seq,
stage=ctx.state_after.stage.value,
effective_openness=ctx.state_after.effective_openness,
client_reply="Masked stream reply.",
safety_flagged=False,
state_after=ctx.state_after,
)
self.assertFalse(hasattr(generated, "client_affect_trace"))
async def test_run_turn_generate_sends_only_masked_korean_pii(self) -> None:
ctx = orchestrator.prepare_turn(
session_id="masking-session",