Skip to content

Commit abfcd13

Browse files
Tighten Langfuse truncation-marker assertion
Address review feedback on PR #186: the input_is_raw_string_with_marker check matched a bare "[truncated" substring, which could false-positive on arbitrary content. Tighten it to a regex matching the full marker shape, matching the observer's _TRUNCATION_MARKER_TEMPLATE and consistent with the OTel marker_pattern approach.
1 parent 22c6596 commit abfcd13

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/conformance/test_observability.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3862,8 +3862,8 @@ def _assert_langfuse_generation_fields(
38623862
)
38633863
if exp.get("input_is_raw_string_with_marker") is True:
38643864
# Over-cap input falls through to the raw truncated string + §5.5.5 marker.
3865-
assert isinstance(match.input, str) and "[truncated" in match.input, (
3866-
f"{exp_name!r}: expected a raw truncated string with marker; got {match.input!r}"
3865+
assert isinstance(match.input, str) and re.search(r"\[truncated, \d+ bytes total\]", match.input), (
3866+
f"{exp_name!r}: expected a raw truncated string with the marker; got {match.input!r}"
38673867
)
38683868

38693869

0 commit comments

Comments
 (0)