nova funcionalidade: reconciliacao temporal
This commit is contained in:
@@ -177,3 +177,61 @@ async def test_revprec_does_not_use_state_or_history_as_authoritative_exact_mess
|
||||
}
|
||||
out = await TimPrematureActionRail().evaluate(text, ctx)
|
||||
assert out.allowed is False
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_revprec_allows_plain_invoice_explanation_without_llm():
|
||||
text = "[FaturasAgent] Analisando a sua fatura atual, a variação foi de R$ 46,99 com Tamboro Mensal de R$ 14,99."
|
||||
|
||||
class MustNotRunLLM:
|
||||
async def ainvoke(self, *args, **kwargs):
|
||||
raise AssertionError("explicação informacional não deve ser julgada como execução prematura")
|
||||
|
||||
out = await TimPrematureActionRail().evaluate(
|
||||
text,
|
||||
{"guardrail_llm": MustNotRunLLM(), "mcp_results": []},
|
||||
)
|
||||
assert out.allowed is True
|
||||
assert out.reason == "no_operational_completion_claim"
|
||||
assert out.metadata["mechanism"] == "deterministic_claim_scope"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_revprec_allows_composed_contestation_when_current_execution_structurally_proves_claims():
|
||||
text = (
|
||||
"Sua contestação do valor R$ 14,99 referente ao Tamboro Mensal foi registrada com sucesso. "
|
||||
"O protocolo aberto é 1234567890. Um novo boleto será emitido e você recebeu um SMS."
|
||||
)
|
||||
|
||||
class MustNotRunLLM:
|
||||
async def ainvoke(self, *args, **kwargs):
|
||||
raise AssertionError("evidência estrutural suficiente não deve ser re-julgada probabilisticamente")
|
||||
|
||||
ctx = {
|
||||
"guardrail_llm": MustNotRunLLM(),
|
||||
"mcp_results": [
|
||||
{
|
||||
"tool_name": "qualquer_tool_transacional",
|
||||
"ok": True,
|
||||
"result": {
|
||||
"status": "COMPLETED",
|
||||
"output": {
|
||||
"registrar": {
|
||||
"success": True,
|
||||
"contestation_registered": True,
|
||||
"contested_invoice_amount": "14.99",
|
||||
"sr": "1234567890",
|
||||
"sms_sent": True,
|
||||
"barcode": "34191.79001 01043.510047",
|
||||
"items": [
|
||||
{"itemName": "Tamboro Mensal", "message": "Contestação criada com sucesso"}
|
||||
],
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
out = await TimPrematureActionRail().evaluate(text, ctx)
|
||||
assert out.allowed is True
|
||||
assert out.reason == "current_execution_structurally_grounded"
|
||||
assert out.metadata["mechanism"] == "deterministic_structured_execution_evidence"
|
||||
|
||||
Reference in New Issue
Block a user