Enhance Planning Context with Progression Gap Snapshot and Start/Target Analysis
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Successful in 1m13s

- Introduced `build_progression_gap_snapshot` function to create a compact roadmap context for gap exercises, integrating start situation, target state, and stage specifications.
- Updated `build_gap_fill_goal_text` to include roadmap snapshot details, enhancing the context for AI-generated exercises.
- Enhanced `ProgressionPathSuggestRequest` and related components to support new structured inputs for start/target analysis, improving user experience and AI suggestions.
- Incremented application version to 0.8.212 to reflect these changes.
This commit is contained in:
Lars committed 2026-06-09 16:22:16 +02:00
1 parent fad1058d54
commit f2650dac57
11 files changed
+505 -25

No files matched your search

@@ -1,5 +1,6 @@
"""Tests Planungs-KI Phase D — planning_context für suggestExerciseAi."""
from planning_exercise_form_context import (
build_progression_gap_snapshot,
build_progression_path_gap_planning_context,
planning_context_prompt_variables,
sanitize_planning_context_for_ai,
@@ -44,3 +45,36 @@ def test_build_progression_path_gap_context():
def test_sanitize_truncates_long_strings():
ctx = sanitize_planning_context_for_ai({"goal_query": "x" * 900})
assert len(ctx["goal_query"]) <= 800
def test_build_progression_gap_snapshot_includes_start_target_and_stage():
snap = build_progression_gap_snapshot(
goal_analysis={
"primary_topic": "Kumite Beinarbeit",
"start_assumption": "gleichförmige Steppbewegung",
"target_state": "explosiver Angriff mit Ausweichen",
"success_criteria": ["nachvollziehbarer Übergang"],
},
resolved_structured={"roadmap_notes": "Kindergruppe"},
stage_spec={
"learning_goal": "variable Rhythmen",
"load_profile": ["timing", "distanz"],
"success_criteria": ["Reaktion unter Druck"],
"anti_patterns": ["statisches Stehen"],
},
semantic_brief={"must_phrases": ["Beinarbeit"], "development_arc": ["grundlage", "anwendung"]},
)
assert snap["start_situation"] == "gleichförmige Steppbewegung"
assert snap["stage_learning_goal"] == "variable Rhythmen"
assert "timing" in snap["stage_load_profile"]
assert snap["roadmap_notes"] == "Kindergruppe"
def test_gap_planning_context_carries_snapshot_fields():
ctx = build_progression_path_gap_planning_context(
goal_query="Kumite Beinarbeit",
goal_analysis={"start_assumption": "Start", "target_state": "Ziel"},
stage_spec={"learning_goal": "Stufenziel", "load_profile": ["koordination"]},
)
assert ctx["start_situation"] == "Start"
assert ctx["stage_learning_goal"] == "Stufenziel"
@@ -91,3 +91,25 @@ def test_build_gap_fill_goal_text_includes_topic():
assert "Mae Geri" in text or "mae geri" in text.lower()
assert "anwendung" in text
assert "Kihon" in text
def test_build_gap_fill_goal_text_includes_roadmap_snapshot():
brief = build_semantic_brief("Kumite Beinarbeit")
text = build_gap_fill_goal_text(
goal_query="Kumite Beinarbeit",
brief=brief,
spec={"phase": "vertiefung", "title_hint": "variable Rhythmen"},
step_a={"title": "Schritt A"},
step_b={"title": "Schritt B"},
roadmap_snapshot={
"start_situation": "gleichförmige Steppbewegung",
"target_state": "explosiver Angriff",
"stage_learning_goal": "variable Rhythmen und multidirektionale Kontrolle",
"stage_load_profile": ["timing", "distanz"],
"skill_hints": ["Beinarbeit"],
},
)
assert "gleichförmige Steppbewegung" in text
assert "explosiver Angriff" in text
assert "variable Rhythmen" in text
assert "timing" in text
@@ -16,6 +16,7 @@ from planning_progression_roadmap import (
resolve_roadmap_structured_input,
resolve_step_exercise_kind_filter,
run_progression_roadmap_pipeline,
run_start_target_resolve_only,
stage_spec_exercise_kind_filter,
stage_spec_retrieval_query,
normalize_major_steps_for_override,
@@ -173,6 +174,15 @@ def test_resolve_structured_regex_fallback_without_llm():
assert "dynamischen" in (resolved.target_state or "")
def test_run_start_target_resolve_only_no_major_steps():
ctx = run_start_target_resolve_only(KUMITE_GOAL, include_llm_start_target=False)
assert ctx.pipeline_phase == "start_target_only"
assert ctx.roadmap is None
assert ctx.goal_analysis is not None
assert "Steppbewegung" in ctx.goal_analysis.start_assumption
assert ctx.resolved_structured is not None
def test_resolve_structured_merges_user_and_llm_notes():
brief = build_semantic_brief("Kumite Beinarbeit")
structured = RoadmapStructuredInput(roadmap_notes="Kindergruppe 10–12")