feat(voice): add isolated Local S2S v3 candidate and acceptance evidence

Extract the provider boundary while retaining OpenAI/Gemini contracts. Add
an opt-in isolated Local S2S adapter, pinned engine extension, bounded
component gateway and frozen effective configuration profiles.

Enforce request token limits, zero retries, local asset validation,
connection deadlines, disconnect ownership, bounded cleanup and signals.
Include regression coverage, pinned source fixtures, operator guidance,
asset fingerprints and guarded disposable PostgreSQL acceptance tooling.
Preserve immutable fixture bytes across Git line-ending conversion.

Validation recorded in the reports:
- 74 repair, 107 combined and 242 preservation checks passed.
- Fresh PostgreSQL local checks: 2 passed.
- Expanded PostgreSQL: 57 passed, 6 documented baseline failures.
- Compose configurations, staged whitespace and fixture hashes passed.

Phase 1 live listening and Phase 2 complete engine/SDK/POSIX, real component
audio and Persian browser acceptance remain pending. No operational switch,
paid call, model download or Phase 3 implementation is included.
This commit is contained in:
amirhosein mazaheri
2026-10-15 12:28:17 +03:30
parent 872e5f25cb
commit 8d348f0ba1
56 changed files with 8802 additions and 44 deletions
@@ -0,0 +1,37 @@
"""Real DB local profiles retain replay/owner/revocation authority."""
from uuid import UUID, uuid4
from sqlalchemy import text
import pytest
from tests.integration.test_phase2_postgres import seeded_env
from tests.unit.test_local_s2s_phase2 import local_config
def test_local_profile_replay_never_rewrites_frozen_components(seeded_env):
e = seeded_env
cid = UUID(e.lifecycle.create_conversation(e.user, uuid4())['id'])
request = uuid4()
config = local_config()
first = e.lifecycle.create_live_session(e.user, cid, request, provider='local_s2s',
model=config.selected_model, execution_profile=config.profile())
sid = UUID(first['session_id'])
changed = local_config(local_s2s_tts_voice='different')
replay = e.lifecycle.create_live_session(e.user, cid, request, provider='local_s2s',
model=changed.selected_model, execution_profile=changed.profile())
assert replay['session_id'] == first['session_id'] and replay['replayed']
info = e.lifecycle.validate_stream(e.user, sid, initial=True)
assert info['provider'] == 'local_s2s' and info['execution_profile'] == config.profile()
assert info['execution_profile'] != changed.profile()
with e.engine.begin() as conn:
row = conn.execute(text('SELECT execution_profile FROM live_sessions WHERE id=:id'), {'id': sid}).scalar_one()
assert row == config.profile()
def test_local_profile_revocation_still_blocks_stream(seeded_env):
e = seeded_env
cid = UUID(e.lifecycle.create_conversation(e.user, uuid4())['id'])
c = local_config()
reservation = e.lifecycle.create_live_session(e.user, cid, uuid4(), provider='local_s2s', model=c.selected_model, execution_profile=c.profile())
with e.engine.begin() as conn:
conn.execute(text('UPDATE organization_settings SET access_epoch=access_epoch+1 WHERE organization_id=:org'), {'org': e.org})
with pytest.raises(ValueError):
e.lifecycle.validate_stream(e.user, UUID(reservation['session_id']), initial=True)