refactor(ai_client): rename send_result to send (the impl, TDD red moment)

The TDD red moment. The implementation is renamed but the call sites
in src/, tests/, and docs still use send_result. Subsequent commits
rename the call sites and progressively move the test suite back to
green.

10 references renamed in src/ai_client.py:
- 4 'Called by: send_result' docstring tags in private provider helpers
- 1 function definition (def send_result -> def send)
- 1 [C: ...] SDM tag referencing test function names
- 2 monitor component names (start_component / end_component)
- 2 error source strings (CONFIG + INTERNAL)

Also adds scripts/tier2/apply_t1_1_edits.py - the helper script that
applied the 10 edits. Kept in scripts/tier2/ as a record of the
mechanical change pattern.

Refs: conductor/tracks/send_result_to_send_20260616/
This commit is contained in:
ed
2026-06-17 00:23:16 -04:00
parent c1d9a966d7
commit 5351389fc0
2 changed files with 95 additions and 10 deletions
+10 -10
View File
@@ -2342,7 +2342,7 @@ def _send_grok(md_content: str, user_message: str, base_dir: str,
Result[str]: Wrap of string response and potential errors.
Immediate-Mode DAG / Thread Context:
Called by: send_result
Called by: send
Calls: _ensure_grok_client, _get_deepseek_tools, get_capabilities, run_with_tool_loop
SSDL:
@@ -2426,7 +2426,7 @@ def _send_minimax(md_content: str, user_message: str, base_dir: str,
Result[str]: Wrap of string response and potential errors.
Immediate-Mode DAG / Thread Context:
Called by: send_result
Called by: send
Calls: _ensure_minimax_client, _repair_minimax_history, _get_deepseek_tools,
get_capabilities, run_with_tool_loop
@@ -2581,7 +2581,7 @@ def _send_qwen(md_content: str, user_message: str, base_dir: str,
Result[str]: Wrap of string response and potential errors.
Immediate-Mode DAG / Thread Context:
Called by: send_result
Called by: send
Calls: _ensure_qwen_client, _dashscope_call
SSDL:
@@ -2666,7 +2666,7 @@ def _send_llama(md_content: str, user_message: str, base_dir: str,
Result[str]: Wrap of string response and potential errors.
Immediate-Mode DAG / Thread Context:
Called by: send_result
Called by: send
Calls: _send_llama_native, _ensure_llama_client, _get_deepseek_tools,
get_capabilities, run_with_tool_loop
@@ -2935,7 +2935,7 @@ def get_token_stats(md_content: str) -> dict[str, Any]:
}
return _add_bleed_derived(stats, sys_tok=total_tokens)
def send_result(
def send(
md_content: str,
user_message: str,
base_dir: str = ".",
@@ -2989,10 +2989,10 @@ def send_result(
Acquires the global _send_lock to synchronize provider calls. Safely called from any worker
thread executing background tasks, preventing concurrent thread collisions on shared provider SDK states.
[C: tests/test_ai_client_result.py:test_send_result_public_api_returns_result, tests/test_ai_client_result.py:test_send_result_preserves_errors, tests/test_deprecation_warnings.py:test_send_result_does_not_emit_deprecation]
[C: tests/test_ai_client_result.py:test_send_public_api_returns_result, tests/test_ai_client_result.py:test_send_preserves_errors, tests/test_deprecation_warnings.py:test_send_does_not_emit_deprecation]
"""
monitor = performance_monitor.get_monitor()
if monitor.enabled: monitor.start_component("ai_client.send_result")
if monitor.enabled: monitor.start_component("ai_client.send")
if rag_engine and getattr(rag_engine.config, "enabled", False) and "## Retrieved Context" not in user_message:
chunks = rag_engine.search(user_message)
@@ -3053,10 +3053,10 @@ def send_result(
stream, pre_tool_callback, qa_callback, stream_callback, patch_callback
)
else:
res = Result(data="", errors=[ErrorInfo(kind=ErrorKind.CONFIG, message=f"unknown provider: {_provider}", source="ai_client.send_result")])
res = Result(data="", errors=[ErrorInfo(kind=ErrorKind.CONFIG, message=f"unknown provider: {_provider}", source="ai_client.send")])
except Exception as exc:
res = Result(data="", errors=[ErrorInfo(kind=ErrorKind.INTERNAL, message=str(exc), source="ai_client.send_result", original=exc)])
if monitor.enabled: monitor.end_component("ai_client.send_result")
res = Result(data="", errors=[ErrorInfo(kind=ErrorKind.INTERNAL, message=str(exc), source="ai_client.send", original=exc)])
if monitor.enabled: monitor.end_component("ai_client.send")
return res
def _add_bleed_derived(d: dict[str, Any], sys_tok: int = 0, tool_tok: int = 0) -> dict[str, Any]: