Add pinned CPU engine dependencies, retained interrupted-response history, provider admission, offline evaluation and isolated browser tooling. Record Phase 2 acceptance and Phase 3/4 preparation, bounded paid-test accounting and interruption incident findings. Human interruption acceptance, paired OpenAI evaluation and rollback remain pending.
38 lines
2.0 KiB
Python
38 lines
2.0 KiB
Python
"""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', local_s2s_retain_interrupted_answers=True)
|
|
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)
|