import pytest from duck_core.approvals.service import ApprovalService @pytest.mark.asyncio async def test_approval_service_allow_forever_is_exact_hash(tmp_path): service = ApprovalService(str(tmp_path / "duck.sqlite3")) await service.init() action = {"tool": "shell_exec_safe", "args": {"command": "pytest tests/smoke -v"}} approval = await service.create_pending("task_1", action) await service.allow_forever(approval.approval_id) assert await service.is_allowed_forever(action) is True assert await service.is_allowed_forever( {"tool": "shell_exec_safe", "args": {"command": "pytest -v"}} ) is False