Skip to content

Commit 3c6f8f3

Browse files
committed
chore: deprecate yaml mention extractor compatibility path
1 parent 1ce0e79 commit 3c6f8f3

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

src/issuelab/response_processor.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import os
1111
import re
1212
import subprocess
13+
import warnings
1314
from pathlib import Path
1415
from typing import Any, cast
1516

@@ -163,6 +164,15 @@ def _extract_sources_from_parsed_yaml(parsed: Any) -> list[str]:
163164

164165

165166
def extract_mentions_from_yaml(response_text: str) -> list[str]:
167+
"""Deprecated compatibility helper.
168+
169+
Main trigger pipeline now parses mentions from controlled markdown sections.
170+
"""
171+
warnings.warn(
172+
"extract_mentions_from_yaml is deprecated; use extract_controlled_mentions instead",
173+
DeprecationWarning,
174+
stacklevel=2,
175+
)
166176
yaml_text = extract_yaml_block(response_text)
167177
if not yaml_text:
168178
return []
@@ -357,7 +367,7 @@ def _normalize_agent_output(response_text: str, agent_name: str | None) -> tuple
357367
parsed_confidence = str(parsed.get("confidence", "")).lower()
358368
if parsed_confidence in {"high", "medium", "low"}:
359369
confidence = parsed_confidence
360-
parsed_mentions = extract_mentions_from_yaml(response_text)
370+
parsed_mentions = extract_controlled_mentions(response_text)
361371
parsed_sources = _extract_sources_from_parsed_yaml(parsed)
362372

363373
def _yaml_escape(value: str) -> str:

tests/test_response_processor.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
from unittest.mock import patch
44

5+
import pytest
6+
57

68
class TestExtractMentionsFromYaml:
7-
"""测试从 YAML 提取 mentions"""
9+
"""测试 YAML mentions 兼容层(已废弃)"""
810

911
def test_extract_mentions_list(self):
1012
from issuelab.response_processor import extract_mentions_from_yaml
@@ -20,7 +22,8 @@ def test_extract_mentions_list(self):
2022
- bob
2123
confidence: "high"
2224
```"""
23-
assert extract_mentions_from_yaml(text) == ["alice", "bob"]
25+
with pytest.warns(DeprecationWarning):
26+
assert extract_mentions_from_yaml(text) == ["alice", "bob"]
2427

2528
def test_extract_mentions_with_at_prefix(self):
2629
from issuelab.response_processor import extract_mentions_from_yaml
@@ -34,7 +37,8 @@ def test_extract_mentions_with_at_prefix(self):
3437
- "@delta"
3538
confidence: "medium"
3639
```"""
37-
assert extract_mentions_from_yaml(text) == ["charlie", "delta"]
40+
with pytest.warns(DeprecationWarning):
41+
assert extract_mentions_from_yaml(text) == ["charlie", "delta"]
3842

3943
def test_extract_mentions_invalid_items_filtered(self):
4044
from issuelab.response_processor import extract_mentions_from_yaml
@@ -49,12 +53,14 @@ def test_extract_mentions_invalid_items_filtered(self):
4953
- "ok_user"
5054
confidence: "low"
5155
```"""
52-
assert extract_mentions_from_yaml(text) == ["ok_user"]
56+
with pytest.warns(DeprecationWarning):
57+
assert extract_mentions_from_yaml(text) == ["ok_user"]
5358

5459
def test_no_yaml_mentions(self):
5560
from issuelab.response_processor import extract_mentions_from_yaml
5661

57-
assert extract_mentions_from_yaml("No mentions here") == []
62+
with pytest.warns(DeprecationWarning):
63+
assert extract_mentions_from_yaml("No mentions here") == []
5864

5965

6066
class TestResponseFormatConfig:

0 commit comments

Comments
 (0)