feat(db): pipeline_runs.profile + run_start-Trace-Profil persistieren (#235)#247
Merged
Conversation
…#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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_runshatte 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:shared/db_schema.py: Spalteprofile TEXT DEFAULT ''in derpipeline_runs-DDL.generative/db.pyinit_db:_add_column(conn, "pipeline_runs", "profile TEXT DEFAULT ''")— Migration für Bestands-DBs (SCHEMA_SQL deckt nur frische DBs ab).generative/db.pyinsert_run:profilein Spaltenliste/VALUES/Param-Dict,data.get("profile", "").generative/orchestrator.pymain():"profile": runtime_config.profileiminsert_run-Data-Dict.generative/agents/tracing.pytrace_run_start: Signatur umprofile: str = ""erweitert, ins Event-Dict geschrieben. Aufrufstelle in_run_extraction_stages(orchestrator.py) reichtgetattr(runtime_config, "profile", "")durch (defensiv, daruntime_configdort optional ist).generative/agents/base.pyre-exportierttrace_run_startunverändert (kein Edit nötig — gleiches Funktionsobjekt).generative/runtime_config.pynicht verändert (nurRuntimeConfig.profilegelesen).TDD
RED (vor dem Fix, auf master-Stand reproduziert):
test_pipeline_runs_has_profile_column—AssertionError: assert 'profile' in [...]test_insert_run_stores_profile—sqlite3.OperationalError: no such column: profiletest_insert_run_profile_defaults_to_empty_string— ditotest_trace_run_start_writes_profile—TypeError: 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