From 54113615128ffe50b735ddcbd2321ab0770ef5db Mon Sep 17 00:00:00 2001 From: yucheng Date: Fri, 25 Sep 2026 20:42:32 +0000 Subject: [PATCH] test(langfuse_otel): drop covers markers and a redundant docstring per review Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../test_langfuse_otel_identity.py | 8 -------- .../test_langfuse_otel_identity_chaos.py | 5 ----- .../test_langfuse_otel_identity_edges.py | 19 +------------------ .../test_langfuse_otel_identity_surfaces.py | 18 +----------------- .../integrations/arize/test_arize_utils.py | 2 -- 5 files changed, 2 insertions(+), 50 deletions(-) diff --git a/tests/integration/observability/test_langfuse_otel_identity.py b/tests/integration/observability/test_langfuse_otel_identity.py index cfa440f59f0..8ad5e5509e6 100644 --- a/tests/integration/observability/test_langfuse_otel_identity.py +++ b/tests/integration/observability/test_langfuse_otel_identity.py @@ -2,7 +2,6 @@ import uuid from pathlib import Path from typing import Final -import pytest from _langfuse_otel import ( _generation_span_attributes, _langfuse_proxy, @@ -15,7 +14,6 @@ from integration._support.client import Gateway, eventually from integration._support.wire import Reply, Request, wire_server -@pytest.mark.covers("other.observability.langfuse_otel.header_end_user_in_user_id_over_internal_user") def test_langfuse_otel_header_end_user_lands_in_user_id_not_session_id_for_a_key_owned_by_an_internal_user( gateway: Gateway, tmp_path: Path ) -> None: @@ -56,7 +54,6 @@ def test_langfuse_otel_header_end_user_lands_in_user_id_not_session_id_for_a_key }, attributes -@pytest.mark.covers("other.observability.langfuse_otel.header_end_user_in_user_id_service_key") def test_langfuse_otel_header_end_user_lands_in_user_id_for_a_service_account_key( gateway: Gateway, tmp_path: Path ) -> None: @@ -96,7 +93,6 @@ def test_langfuse_otel_header_end_user_lands_in_user_id_for_a_service_account_ke }, attributes -@pytest.mark.covers("other.observability.langfuse_otel.body_user_never_a_session") def test_langfuse_otel_body_user_is_never_a_session(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex upstream_bodies: Final[list[bytes]] = [] @@ -136,7 +132,6 @@ def test_langfuse_otel_body_user_is_never_a_session(gateway: Gateway, tmp_path: }, attributes -@pytest.mark.covers("other.observability.langfuse_otel.caller_trace_user_id_wins") def test_langfuse_otel_caller_trace_user_id_wins_over_the_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex upstream_bodies: Final[list[bytes]] = [] @@ -177,7 +172,6 @@ def test_langfuse_otel_caller_trace_user_id_wins_over_the_end_user(gateway: Gate }, attributes -@pytest.mark.covers("other.observability.langfuse_otel.caller_session_id_stays_session") def test_langfuse_otel_caller_session_id_stays_the_session_beside_the_end_user( gateway: Gateway, tmp_path: Path ) -> None: @@ -220,7 +214,6 @@ def test_langfuse_otel_caller_session_id_stays_the_session_beside_the_end_user( }, attributes -@pytest.mark.covers("other.observability.langfuse_otel.v2_header_end_user_in_user_id") def test_langfuse_otel_v2_header_end_user_lands_in_user_id(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex upstream_bodies: Final[list[bytes]] = [] @@ -259,7 +252,6 @@ def test_langfuse_otel_v2_header_end_user_lands_in_user_id(gateway: Gateway, tmp }, user_spans[0] -@pytest.mark.covers("other.observability.langfuse_otel.messages_caller_trace_user_id_under_litellm_metadata") def test_langfuse_otel_messages_caller_trace_user_id_under_litellm_metadata_wins_over_the_end_user( gateway: Gateway, tmp_path: Path ) -> None: diff --git a/tests/integration/observability/test_langfuse_otel_identity_chaos.py b/tests/integration/observability/test_langfuse_otel_identity_chaos.py index a5c6346292d..4a627ea7e73 100644 --- a/tests/integration/observability/test_langfuse_otel_identity_chaos.py +++ b/tests/integration/observability/test_langfuse_otel_identity_chaos.py @@ -8,7 +8,6 @@ from pathlib import Path from typing import Final import httpx -import pytest from _langfuse_otel import ( _dedupe_spans, _drained_spans, @@ -95,7 +94,6 @@ def _landed_counts(sink: Wire, batches: list[bytes], markers: tuple[str, ...]) - return {marker: len(_span_containing_marker(generations, marker)) for marker in markers} -@pytest.mark.covers("other.observability.langfuse_otel.burst_sink_outage") def test_langfuse_otel_sink_outage_mid_burst_never_duplicates(gateway: Gateway, tmp_path: Path) -> None: outage: Final = threading.Event() @@ -144,7 +142,6 @@ def test_langfuse_otel_sink_outage_mid_burst_never_duplicates(gateway: Gateway, assert missing <= window, (missing, window, counts) -@pytest.mark.covers("other.observability.langfuse_otel.burst_slow_sink") def test_langfuse_otel_slow_sink_never_duplicates_or_loses(gateway: Gateway, tmp_path: Path) -> None: def slow_sink(request: Request) -> Reply: time.sleep(1.5) @@ -179,7 +176,6 @@ def test_langfuse_otel_slow_sink_never_duplicates_or_loses(gateway: Gateway, tmp assert counts == {marker: 1 for marker in markers}, counts -@pytest.mark.covers("other.observability.langfuse_otel.worker_kill_mid_burst") def test_langfuse_otel_worker_kill_mid_burst_keeps_every_marker(gateway: Gateway, tmp_path: Path) -> None: with ( wire_server(lambda request: _upstream_reply_for(request, _marker_from_body(request))) as provider, @@ -234,7 +230,6 @@ def test_langfuse_otel_worker_kill_mid_burst_keeps_every_marker(gateway: Gateway assert counts == {marker: 1 for marker in accepted_markers}, (counts, failures) -@pytest.mark.covers("other.observability.langfuse_otel.proxy_restart_mid_burst") def test_langfuse_otel_proxy_restart_mid_burst_keeps_every_marker(gateway: Gateway, tmp_path: Path) -> None: with ( wire_server(lambda request: _upstream_reply_for(request, _marker_from_body(request))) as provider, diff --git a/tests/integration/observability/test_langfuse_otel_identity_edges.py b/tests/integration/observability/test_langfuse_otel_identity_edges.py index eba412a65e5..793a153dda6 100644 --- a/tests/integration/observability/test_langfuse_otel_identity_edges.py +++ b/tests/integration/observability/test_langfuse_otel_identity_edges.py @@ -4,15 +4,14 @@ from pathlib import Path from typing import Final import httpx -import pytest from _langfuse_otel import ( _drained_spans, _generation_marker_span_attributes, _generation_span_attributes, _langfuse_proxy, + _marker_from_body, _sink, _span_containing_marker, - _marker_from_body, _upstream_reply_for, ) from integration._support.client import Gateway, eventually @@ -55,7 +54,6 @@ def _subsequent_request_still_lands(candidate: Gateway, collector: Wire, batches assert _await_generation(collector, batches, next_marker) is not None -@pytest.mark.covers("other.observability.langfuse_otel.end_user_5kb_header") def test_langfuse_otel_five_kb_end_user_header_lands_in_user_id(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex end_user: Final = "e" * 5120 @@ -78,7 +76,6 @@ def test_langfuse_otel_five_kb_end_user_header_lands_in_user_id(gateway: Gateway assert _identity(attributes) == {"user.id": end_user, "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.empty_end_user_header") def test_langfuse_otel_empty_end_user_header_writes_no_identity(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -101,7 +98,6 @@ def test_langfuse_otel_empty_end_user_header_writes_no_identity(gateway: Gateway _subsequent_request_still_lands(candidate, collector, batches, model) -@pytest.mark.covers("other.observability.langfuse_otel.integer_body_user") def test_langfuse_otel_integer_body_user_does_not_crash(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -128,7 +124,6 @@ def test_langfuse_otel_integer_body_user_does_not_crash(gateway: Gateway, tmp_pa _subsequent_request_still_lands(candidate, collector, batches, model) -@pytest.mark.covers("other.observability.langfuse_otel.list_body_user") def test_langfuse_otel_list_body_user_does_not_crash(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -155,7 +150,6 @@ def test_langfuse_otel_list_body_user_does_not_crash(gateway: Gateway, tmp_path: _subsequent_request_still_lands(candidate, collector, batches, model) -@pytest.mark.covers("other.observability.langfuse_otel.integer_trace_user_id") def test_langfuse_otel_integer_trace_user_id_does_not_crash(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -174,7 +168,6 @@ def test_langfuse_otel_integer_trace_user_id_does_not_crash(gateway: Gateway, tm _subsequent_request_still_lands(candidate, collector, batches, model) -@pytest.mark.covers("other.observability.langfuse_otel.null_metadata") def test_langfuse_otel_null_metadata_still_maps_the_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -191,7 +184,6 @@ def test_langfuse_otel_null_metadata_still_maps_the_end_user(gateway: Gateway, t assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.duplicate_end_user_header") def test_langfuse_otel_duplicate_end_user_header_uses_the_first(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -239,7 +231,6 @@ def test_langfuse_otel_duplicate_end_user_header_uses_the_first(gateway: Gateway assert all(attributes.get("user.id") == f"first-{marker}" for attributes in spans), spans -@pytest.mark.covers("other.observability.langfuse_otel.unauthenticated_no_span") def test_langfuse_otel_bad_key_emits_no_generation_span(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -267,7 +258,6 @@ def test_langfuse_otel_bad_key_emits_no_generation_span(gateway: Gateway, tmp_pa assert offending == (), offending -@pytest.mark.covers("other.observability.langfuse_otel.upstream_failure_identity") def test_langfuse_otel_upstream_failure_never_invents_an_identity(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -295,9 +285,7 @@ def test_langfuse_otel_upstream_failure_never_invents_an_identity(gateway: Gatew assert offending == (), offending -@pytest.mark.covers("other.observability.langfuse_otel.sink_rejections_survived") def test_langfuse_otel_sink_rejections_do_not_drop_the_proxy(gateway: Gateway, tmp_path: Path) -> None: - marker: Final = uuid.uuid4().hex calls: Final[dict[str, int]] = {"count": 0} lock: Final = threading.Lock() @@ -336,7 +324,6 @@ def test_langfuse_otel_sink_rejections_do_not_drop_the_proxy(gateway: Gateway, t _subsequent_request_still_lands(candidate, collector, batches, model) -@pytest.mark.covers("other.observability.langfuse_otel.unknown_model") def test_langfuse_otel_unknown_model_error_reaches_the_caller(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -352,7 +339,6 @@ def test_langfuse_otel_unknown_model_error_reaches_the_caller(gateway: Gateway, _subsequent_request_still_lands(candidate, collector, batches, model) -@pytest.mark.covers("other.observability.langfuse_otel.session_id_empty_null_missing") def test_langfuse_otel_empty_and_null_session_id_stay_absent(gateway: Gateway, tmp_path: Path) -> None: markers: Final = tuple(uuid.uuid4().hex for _ in range(3)) with ( @@ -375,7 +361,6 @@ def test_langfuse_otel_empty_and_null_session_id_stay_absent(gateway: Gateway, t }, attributes -@pytest.mark.covers("other.observability.langfuse_otel.empty_trace_user_id") def test_langfuse_otel_empty_trace_user_id_falls_back_to_the_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -392,7 +377,6 @@ def test_langfuse_otel_empty_trace_user_id_falls_back_to_the_end_user(gateway: G assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.three_identical_requests") def test_langfuse_otel_three_identical_requests_each_land_the_end_user(gateway: Gateway, tmp_path: Path) -> None: markers: Final = tuple(uuid.uuid4().hex for _ in range(3)) with ( @@ -411,7 +395,6 @@ def test_langfuse_otel_three_identical_requests_each_land_the_end_user(gateway: assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.litellm_metadata_session_on_responses") def test_langfuse_otel_litellm_metadata_session_id_on_responses(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( diff --git a/tests/integration/observability/test_langfuse_otel_identity_surfaces.py b/tests/integration/observability/test_langfuse_otel_identity_surfaces.py index 6c51da46bb4..420906b0fa9 100644 --- a/tests/integration/observability/test_langfuse_otel_identity_surfaces.py +++ b/tests/integration/observability/test_langfuse_otel_identity_surfaces.py @@ -2,7 +2,6 @@ import uuid from pathlib import Path from typing import Final -import pytest from _langfuse_otel import ( _arize_generation_span_attributes, _generation_marker_span_attributes, @@ -16,7 +15,7 @@ from _langfuse_otel import ( from anthropic import Anthropic, AsyncAnthropic from integration._support.client import Gateway, eventually from integration._support.database import read_rows -from integration._support.wire import Reply, Request, Wire, wire_server +from integration._support.wire import Wire, wire_server from openai import AsyncOpenAI, OpenAI @@ -80,7 +79,6 @@ def _identity(attributes: dict[str, object]) -> dict[str, object]: return {key: attributes.get(key) for key in ("user.id", "session.id")} -@pytest.mark.covers("other.observability.langfuse_otel.customer_id_header_end_user_in_user_id") def test_langfuse_otel_customer_id_header_lands_in_user_id(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -102,7 +100,6 @@ def test_langfuse_otel_customer_id_header_lands_in_user_id(gateway: Gateway, tmp assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.langfuse_trace_user_id_header_wins") def test_langfuse_otel_langfuse_trace_user_id_header_wins_over_the_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -127,7 +124,6 @@ def test_langfuse_otel_langfuse_trace_user_id_header_wins_over_the_end_user(gate assert _identity(attributes) == {"user.id": f"caller-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.no_end_user_no_user_id") def test_langfuse_otel_no_end_user_never_exposes_the_internal_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -151,7 +147,6 @@ def test_langfuse_otel_no_end_user_never_exposes_the_internal_user(gateway: Gate assert _identity(attributes) == {"user.id": None, "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.team_key_end_user_with_team_attributes") def test_langfuse_otel_team_key_end_user_keeps_the_litellm_attributes(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -179,7 +174,6 @@ def test_langfuse_otel_team_key_end_user_keeps_the_litellm_attributes(gateway: G assert attributes.get("litellm.key_alias") == f"key-alias-{marker[:12]}", attributes -@pytest.mark.covers("other.observability.langfuse_otel.header_end_user_beats_body_user") def test_langfuse_otel_header_end_user_beats_the_body_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -214,7 +208,6 @@ def test_langfuse_otel_header_end_user_beats_the_body_user(gateway: Gateway, tmp assert attributes.get("user.id") == rows[0]["end_user"], (attributes, rows) -@pytest.mark.covers("other.observability.langfuse_otel.openai_sdk_streaming_end_user") def test_langfuse_otel_openai_sdk_streaming_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -244,7 +237,6 @@ def test_langfuse_otel_openai_sdk_streaming_end_user(gateway: Gateway, tmp_path: assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.openai_async_sdk_end_user") async def test_langfuse_otel_openai_async_sdk_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -268,7 +260,6 @@ async def test_langfuse_otel_openai_async_sdk_end_user(gateway: Gateway, tmp_pat assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.responses_api_end_user") def test_langfuse_otel_responses_api_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -290,7 +281,6 @@ def test_langfuse_otel_responses_api_end_user(gateway: Gateway, tmp_path: Path) assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.responses_api_async_streaming_end_user") async def test_langfuse_otel_responses_api_async_streaming_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -313,7 +303,6 @@ async def test_langfuse_otel_responses_api_async_streaming_end_user(gateway: Gat assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.anthropic_sdk_messages_end_user") def test_langfuse_otel_anthropic_sdk_messages_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -335,7 +324,6 @@ def test_langfuse_otel_anthropic_sdk_messages_end_user(gateway: Gateway, tmp_pat assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.anthropic_async_streaming_messages_end_user") async def test_langfuse_otel_anthropic_async_streaming_messages_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -358,7 +346,6 @@ async def test_langfuse_otel_anthropic_async_streaming_messages_end_user(gateway assert _identity(attributes) == {"user.id": f"end-user-{marker}", "session.id": None}, attributes -@pytest.mark.covers("other.observability.langfuse_otel.v2_caller_trace_user_id_wins") def test_langfuse_otel_v2_caller_trace_user_id_wins_over_the_end_user(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -394,7 +381,6 @@ def test_langfuse_otel_v2_caller_trace_user_id_wins_over_the_end_user(gateway: G ), user_spans -@pytest.mark.covers("other.observability.langfuse_otel.arize_phoenix_unchanged_header_end_user") def test_arize_phoenix_header_end_user_keeps_session_mapping(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -433,7 +419,6 @@ def test_arize_phoenix_header_end_user_keeps_session_mapping(gateway: Gateway, t assert attributes.get("litellm.trace_id") is not None, attributes -@pytest.mark.covers("other.observability.langfuse_otel.arize_phoenix_unchanged_caller_session") def test_arize_phoenix_caller_session_id_stays_session(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( @@ -477,7 +462,6 @@ def test_arize_phoenix_caller_session_id_stays_session(gateway: Gateway, tmp_pat assert attributes.get("litellm.trace_id") == f"sess-{marker}", attributes -@pytest.mark.covers("other.observability.langfuse_otel.dual_callbacks_arize_unchanged") def test_langfuse_otel_and_arize_phoenix_together_keep_each_mapping(gateway: Gateway, tmp_path: Path) -> None: marker: Final = uuid.uuid4().hex with ( diff --git a/tests/unit/integrations/arize/test_arize_utils.py b/tests/unit/integrations/arize/test_arize_utils.py index 8ce2f6a4202..5490e1503fb 100644 --- a/tests/unit/integrations/arize/test_arize_utils.py +++ b/tests/unit/integrations/arize/test_arize_utils.py @@ -1516,8 +1516,6 @@ def test_arize_mcp_emitter_is_inert_without_a_standard_logging_object(): def test_arize_session_and_user_attrs_still_emit_from_key_metadata_by_default(): - """The emit_session_and_user split is Langfuse-only: Arize keeps session.id - = end user and user.id = internal key owner when no body user exists.""" from unittest.mock import MagicMock span = MagicMock()