feat(backend): deliver Phase 3 document and voice integration

Add authenticated upload, review, retry and knowledge-selection HTTP flows with bounded JSON processing and frozen OCR policy.

Preserve Gemini/OpenAI provider selection and fenced lifecycle semantics; retain FAQ preambles and uncertain vision candidates, and expose opt-in uncalibrated voice transport diagnostics.

Include frontend integration examples, aligned contracts and deterministic regressions. Validation: 1767 provider-free tests passed; all 404 PostgreSQL scenarios have passing evidence across the documented runs.
This commit is contained in:
11linear11
2026-10-09 17:43:52 -04:00
parent 9be47191d6
commit a73a496c54
67 changed files with 5988 additions and 234 deletions
+7 -6
View File
@@ -33,6 +33,8 @@ class Transport:
@pytest.fixture
def runner():
# Match API startup: framework imports precede voice/tool deadlines.
boundary.prepare_search_tools()
value = boundary.SearchToolRunner(running=2, waiting=2, timeout=2)
yield value
value.close()
@@ -711,7 +713,7 @@ def test_new_speech_during_normal_tail_cleanup_preserves_completion(runner, pers
@pytest.mark.parametrize("rows,status", [([row()], "ok"), ([], "no_evidence")])
def test_operator_harness_actual_fake_transport_tool_correlation(
settings, monkeypatch, runner, persisted, capsys, rows, status):
from pydantic import SecretStr
from app.modules.voice.configuration import VoiceSettings
from app import voice_smoke
from app.modules.voice import runtime as runtime_module
service = canonical_service(settings, monkeypatch, rows)
@@ -742,11 +744,10 @@ def test_operator_harness_actual_fake_transport_tool_correlation(
response_id=rid, item_id="a_" + rid, output_index=0, content_index=0, transcript="Provider-supplied fixture answer")))
await self.incoming.put(canonical_json(terminal(rid, output=output)))
transport = Scripted()
async def connection(config, limits):
return RealtimeAdapter(transport, settings=limits)
monkeypatch.setattr(voice_smoke, "create_adapter", connection)
config = SimpleNamespace(openai_api_key=SecretStr("fixture-not-a-key"),
openai_realtime_model="gpt-realtime-mini", openai_proxy=None)
async def connection(*args):
return transport
monkeypatch.setattr("app.infrastructure.voice_provider.connect_openai", connection)
config = VoiceSettings(_env_file=None, provider="openai", openai_realtime_api_key="fake-only")
assert asyncio.run(voice_smoke.run(service, runner, uuid4(), config, "q", 3, 4)) == 0
logs = [json.loads(line) for line in capsys.readouterr().out.splitlines()]
correlation = next(e for e in logs if e["type"] == "smoke_correlation")