Files
rag-technical-docs-assistant/tests/support/local_s2s_pinned.py
amirhosein mazaheri 8d348f0ba1 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.
2026-10-15 12:28:17 +03:30

36 lines
1.4 KiB
Python

"""Execute hash-checked pinned methods without installing upstream ML dependencies."""
import ast
import hashlib
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1] / 'fixtures/local_s2s_upstream'
def tree(name):
manifest = json.loads((ROOT / 'manifest.json').read_text())
data = (ROOT / name).read_bytes()
assert hashlib.sha256(data).hexdigest() == manifest['files'][name]['sha256']
return ast.parse(data.decode())
def functions(name, selection, namespace):
definitions = []
for cls, method in selection:
nodes = tree(name).body
if cls:
nodes = next(n for n in nodes if isinstance(n, ast.ClassDef) and n.name == cls).body
node = next(n for n in nodes if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef)) and n.name == method)
node.decorator_list = []
definitions.append(node)
module = ast.Module(body=[ast.ImportFrom(module='__future__', names=[ast.alias(name='annotations')], level=0)] + definitions, type_ignores=[])
exec(compile(ast.fix_missing_locations(module), str(ROOT / name), 'exec'), namespace)
return namespace
def constant(name, identifier):
"""Read a literal from the hash-checked source, never a fixture override."""
node = next(n for n in tree(name).body if isinstance(n, ast.Assign)
and any(isinstance(t, ast.Name) and t.id == identifier for t in n.targets))
return ast.literal_eval(node.value)