feat(runtime): implement single-article consolidation runtime and modularize codebase

This commit is contained in:
2026-08-24 00:14:07 -03:00
parent e1e0be1353
commit 23de7d8fe7
176 changed files with 266754 additions and 10179 deletions
@@ -0,0 +1,30 @@
"""Unit tests for Langfuse tracer and offline queue covering OBS-001 to OBS-011."""
from pathlib import Path
from src.runtime.core.config import load_runtime_config
from src.runtime.observability.langfuse_tracer import LangfuseRuntimeTracer
from src.runtime.storage.sqlite_store import SQLiteStore
def test_tracer_offline_queues_to_sqlite(tmp_path: Path):
db_file = tmp_path / "obs.db"
store = SQLiteStore(db_file)
cfg = load_runtime_config("runtime_config.local.json")
tracer = LangfuseRuntimeTracer(cfg, store)
# Without keys configured, record_trace must safely queue to SQLite pending_telemetry
success = tracer.record_trace(
trace_id="tr_001",
fingerprint="a" * 64,
source_url="https://example.com",
status="completed_text",
spans_data={"validation": {"status": "SUCCESS"}},
generations=[],
metrics={"cost_usd": 0.001},
)
assert success is False # Queued offline
unflushed = store.get_unflushed_telemetry()
assert len(unflushed) == 1
assert unflushed[0]["fingerprint"] == "a" * 64