Skip to content

feat(db): pipeline_runs.profile + run_start-Trace-Profil persistieren (#235)#247

Merged
TillQuandel merged 1 commit into
masterfrom
feat/235-profile-persist
Jul 13, 2026
Merged

feat(db): pipeline_runs.profile + run_start-Trace-Profil persistieren (#235)#247
TillQuandel merged 1 commit into
masterfrom
feat/235-profile-persist

Conversation

@TillQuandel

Copy link
Copy Markdown
Owner

Befund

Fund der Effizienz-Messreihe 2026-07-13: Das aktive Runtime-Profil (ATOMIC_AGENT_PROFILE, legacy/fast/balanced/quality) stand nur im Stdout-Log. pipeline_runs hatte keine Profil-Spalte, das Trace-run_start-Event nur das Agent->Modell-Mapping (model_config). Zwei Läufe mit unterschiedlichem Profil waren in DB/Trace nachträglich nicht unterscheidbar — relevant für die A/B-Messrunde 2, Kosten-Analysen im Dashboard und die Interpretation historischer Zeilen.

Fix

Additiv nach dem etablierten n_extracted-Muster (PR #220), 5 Stellen:

  1. shared/db_schema.py: Spalte profile TEXT DEFAULT '' in der pipeline_runs-DDL.
  2. generative/db.py init_db: _add_column(conn, "pipeline_runs", "profile TEXT DEFAULT ''") — Migration für Bestands-DBs (SCHEMA_SQL deckt nur frische DBs ab).
  3. generative/db.py insert_run: profile in Spaltenliste/VALUES/Param-Dict, data.get("profile", "").
  4. generative/orchestrator.py main(): "profile": runtime_config.profile im insert_run-Data-Dict.
  5. generative/agents/tracing.py trace_run_start: Signatur um profile: str = "" erweitert, ins Event-Dict geschrieben. Aufrufstelle in _run_extraction_stages (orchestrator.py) reicht getattr(runtime_config, "profile", "") durch (defensiv, da runtime_config dort optional ist).

generative/agents/base.py re-exportiert trace_run_start unverändert (kein Edit nötig — gleiches Funktionsobjekt). generative/runtime_config.py nicht verändert (nur RuntimeConfig.profile gelesen).

TDD

RED (vor dem Fix, auf master-Stand reproduziert):

  • test_pipeline_runs_has_profile_columnAssertionError: assert 'profile' in [...]
  • test_insert_run_stores_profilesqlite3.OperationalError: no such column: profile
  • test_insert_run_profile_defaults_to_empty_string — dito
  • test_trace_run_start_writes_profileTypeError: trace_run_start() got an unexpected keyword argument 'profile'

GREEN nach Fix: alle 4 neuen Tests grün (Roundtrip-Persistenz, PRAGMA-Spalten-Check, Default-Verhalten, Trace-Profil-Feld).

Suite

pytest generative lib/decision_engine/tests shared/tests -q: 5792 passed, 3 skipped, 4 deselected, 0 failed (inkl. der 4 neuen Tests).

ruff

ruff check . — All checks passed.
ruff format --check . — 261 files already formatted.

Closes #235

…#235)

Das aktive Runtime-Profil (legacy/fast/balanced/quality) stand bisher nur
im Stdout-Log — pipeline_runs hatte keine Profil-Spalte, das Trace
run_start-Event nur das Agent->Modell-Mapping. Zwei Läufe mit
unterschiedlichem Profil waren in DB/Trace nachträglich nicht
unterscheidbar (Voraussetzung für die A/B-Messrunde 2).

Additiv nach dem n_extracted-Muster (PR #220):
- shared/db_schema.py: Spalte profile TEXT DEFAULT '' in pipeline_runs
- generative/db.py: Migration via _add_column (Bestands-DBs) +
  insert_run schreibt profile (Default "")
- generative/orchestrator.py: runtime_config.profile ins insert_run-Dict,
  Profil an trace_run_start durchgereicht
- generative/agents/tracing.py: trace_run_start(model_config, profile="")

Neue Tests (RED vor dem Fix, GREEN danach): Roundtrip-Persistenz +
PRAGMA-Spalten-Check + Default-Verhalten in test_db.py,
run_start-Trace-Profil in test_per_agent_tracking.py.
@TillQuandel TillQuandel merged commit f5c1561 into master Jul 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nachvollziehbarkeit: Laufzeit-Profil (legacy/fast/balanced/quality) wird nicht persistiert — weder pipeline_runs noch Trace

2 participants