Skip to content

Commit 91c0a41

Browse files
committed
fix(claude-runner): Update Langfuse test assertions for privacy masking
The Langfuse initialization now includes a mask parameter for privacy-first message masking. Updated test assertions to check for the mask parameter and added @pytest.mark.asyncio decorators to async test functions. Changes: - test_observability.py: Updated test_init_successful to verify mask parameter is present and callable instead of exact parameter match - test_langfuse_model_metadata.py: Added @pytest.mark.asyncio decorators to async test functions This fixes test failures introduced by the privacy masking feature in commit 8eb65e1 (feat: Add privacy-first message masking to Langfuse observability).
1 parent 9e284fa commit 91c0a41

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

components/runners/claude-code-runner/tests/test_langfuse_model_metadata.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import sys
1414
import logging
1515
from pathlib import Path
16+
import pytest
1617

1718
# Add parent directory to path
1819
sys.path.insert(0, str(Path(__file__).parent.parent))
@@ -22,6 +23,7 @@
2223
logging.basicConfig(level=logging.INFO)
2324

2425

26+
@pytest.mark.asyncio
2527
async def test_model_metadata_tracking():
2628
"""Test that model metadata is properly tracked in Langfuse."""
2729

@@ -99,6 +101,7 @@ async def test_model_metadata_tracking():
99101
print("="*60)
100102

101103

104+
@pytest.mark.asyncio
102105
async def test_propagate_attributes_with_model():
103106
"""Test that propagate_attributes includes model in metadata."""
104107

components/runners/claude-code-runner/tests/test_observability.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,15 @@ async def test_init_successful(self, mock_langfuse_class, mock_propagate, manage
151151
assert manager.langfuse_client is not None
152152
assert manager._propagate_ctx is not None
153153

154-
mock_langfuse_class.assert_called_once_with(
155-
public_key="pk-lf-public",
156-
secret_key="sk-lf-secret",
157-
host="http://localhost:3000",
158-
)
154+
# Verify Langfuse was called with the expected parameters including mask function
155+
assert mock_langfuse_class.call_count == 1
156+
call_args = mock_langfuse_class.call_args
157+
assert call_args[1]["public_key"] == "pk-lf-public"
158+
assert call_args[1]["secret_key"] == "sk-lf-secret"
159+
assert call_args[1]["host"] == "http://localhost:3000"
160+
# Verify mask parameter is present and is callable
161+
assert "mask" in call_args[1]
162+
assert callable(call_args[1]["mask"])
159163

160164
# Verify propagate_attributes was called
161165
mock_propagate.assert_called_once()

0 commit comments

Comments
 (0)