Enhance Path QA and Stage Matching Logic
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m14s
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m14s
- Introduced multistage path quality assurance (QA) functionality to improve exercise relevance and feedback through structured tiers and optimization hints. - Updated stage specifications to include `start_state` and `target_state` for better contextualization in roadmap matching. - Enhanced semantic brief construction with technique sibling exclusions to refine exercise selection based on primary topics. - Improved path retrieval logic to incorporate new parameters for nuanced matching against learning goals. - Incremented application version to reflect these updates.
This commit is contained in:
1 parent
4ef3f00e6b
commit
a152218c45
13 files changed
+760
-6
No files matched your search
@@ -5,10 +5,12 @@ from planning_exercise_semantics import (
|
||||
enrich_brief_with_path_constraints,
|
||||
exercise_passes_stage_learning_goal_gate,
|
||||
exercise_passes_stage_fit,
|
||||
exercise_passes_technique_path_scope,
|
||||
pick_best_path_hit,
|
||||
resolve_path_anti_patterns,
|
||||
score_exercise_stage_fit,
|
||||
semantic_brief_for_stage,
|
||||
technique_sibling_excludes,
|
||||
)
|
||||
from planning_exercise_path_qa import strip_off_topic_steps_from_path
|
||||
|
||||
@@ -247,6 +249,47 @@ def test_pick_best_skips_kumite_for_mawashi_athletic_path():
|
||||
assert int(chosen["id"]) == 2
|
||||
|
||||
|
||||
def test_technique_scope_rejects_sibling_geri_for_mawashi_path():
|
||||
siblings = technique_sibling_excludes("mawashi geri")
|
||||
assert any("mae" in s for s in siblings)
|
||||
assert not exercise_passes_technique_path_scope(
|
||||
primary_topic="mawashi geri",
|
||||
title="Mae Geri Grundtechnik",
|
||||
summary="Front kick",
|
||||
goal="Präzision Mae Geri",
|
||||
learning_goal="Sprungvorbereitung für Mawashi Geri",
|
||||
sibling_excludes=siblings,
|
||||
)
|
||||
assert exercise_passes_technique_path_scope(
|
||||
primary_topic="mawashi geri",
|
||||
title="Sprungkraft Plyometrie",
|
||||
summary="Absprung",
|
||||
goal="Vorbereitung gesprungener Mawashi Geri",
|
||||
learning_goal="Sprungvorbereitung für Mawashi Geri",
|
||||
sibling_excludes=siblings,
|
||||
)
|
||||
|
||||
|
||||
def test_stage_fit_rejects_yoko_geri_on_mawashi_roadmap_stage():
|
||||
brief = build_semantic_brief("gesprungener Mawashi Geri Sprungphase")
|
||||
primary = brief.primary_topic or "mawashi geri"
|
||||
stage_goal = "Koordination Sprungphase Mawashi Geri"
|
||||
stage_brief = build_stage_match_brief(
|
||||
learning_goal=stage_goal,
|
||||
path_primary_topic=primary,
|
||||
path_technique_excludes=technique_sibling_excludes(primary),
|
||||
)
|
||||
assert not exercise_passes_stage_fit(
|
||||
learning_goal=stage_goal,
|
||||
title="Yoko Geri seitlicher Tritt",
|
||||
summary="Seitwärtskick",
|
||||
goal="Yoko Geri Technik",
|
||||
stage_brief=stage_brief,
|
||||
path_primary_topic=primary,
|
||||
path_technique_excludes=technique_sibling_excludes(primary),
|
||||
)
|
||||
|
||||
|
||||
def test_strip_off_topic_removes_partial_when_most_steps_bad():
|
||||
steps = [{"exercise_id": i, "title": f"E{i}"} for i in range(1, 8)]
|
||||
off_topic = [{"step_index": i, "issue": "path_exclude"} for i in range(5)]
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
"""Tests Stufen-Kontext (Start/Ziel-Verkettung) und mehrstufige QS."""
|
||||
from planning_path_qa_pipeline import derive_optimization_hints, run_multistage_path_qa
|
||||
from planning_progression_roadmap import MajorStep, StageSpecArtifact
|
||||
from planning_stage_context import (
|
||||
build_contextualized_stage_goal,
|
||||
derive_stage_specs_transition_states,
|
||||
)
|
||||
|
||||
|
||||
def test_derive_stage_transition_chain():
|
||||
majors = [
|
||||
MajorStep(index=0, phase="grundlage", learning_goal="Stand-Mawashi", consolidates=["m1"]),
|
||||
MajorStep(index=1, phase="vertiefung", learning_goal="Sprungvorbereitung", consolidates=["m2"]),
|
||||
MajorStep(index=2, phase="perfektion", learning_goal="Gesprungener Mawashi", consolidates=["m3"]),
|
||||
]
|
||||
specs = [
|
||||
StageSpecArtifact(major_step_index=0, learning_goal=majors[0].learning_goal),
|
||||
StageSpecArtifact(major_step_index=1, learning_goal=majors[1].learning_goal),
|
||||
StageSpecArtifact(major_step_index=2, learning_goal=majors[2].learning_goal),
|
||||
]
|
||||
out = derive_stage_specs_transition_states(
|
||||
specs,
|
||||
majors,
|
||||
path_start="Anfänger mit Grundstellung",
|
||||
path_target="Sauberer gesprungener Mawashi Geri",
|
||||
)
|
||||
assert out[0].start_state == "Anfänger mit Grundstellung"
|
||||
assert out[1].start_state == out[0].target_state
|
||||
assert out[2].target_state == "Sauberer gesprungener Mawashi Geri"
|
||||
|
||||
|
||||
def test_contextualized_stage_goal_includes_path_target():
|
||||
text = build_contextualized_stage_goal(
|
||||
learning_goal="Sprungkoordination",
|
||||
start_state="Stand-Mawashi sicher",
|
||||
target_state="Explosiver Absprung",
|
||||
path_target_state="Gesprungener Mawashi Geri",
|
||||
stage_index=1,
|
||||
stage_count=3,
|
||||
)
|
||||
assert "Sprungkoordination" in text
|
||||
assert "Gesamtziel" in text
|
||||
assert "Soll-Start" in text
|
||||
|
||||
|
||||
def test_multistage_qa_emits_optimization_hints():
|
||||
result = run_multistage_path_qa(
|
||||
off_topic_steps=[],
|
||||
stripped_off_topic=[
|
||||
{
|
||||
"step_index": 2,
|
||||
"issue": "technique_scope",
|
||||
"title": "Yoko Geri",
|
||||
"reasons": ["Passt nicht zur Haupttechnik"],
|
||||
}
|
||||
],
|
||||
gaps=[{"from_title": "A", "to_title": "B", "gap_score": 0.6, "is_large_gap": True}],
|
||||
llm_qa={"quality_score": 0.25, "recommendations": ["Athletisches Training ergänzen"]},
|
||||
llm_applied=True,
|
||||
)
|
||||
assert len(result["qa_tiers"]) == 3
|
||||
hints = result["optimization_hints"]
|
||||
assert any(h.get("action") == "rematch_slot" for h in hints)
|
||||
assert any(h.get("action") == "bridge_or_gap_fill" for h in hints)
|
||||
assert derive_optimization_hints(result["qa_tiers"])
|
||||
Reference in new issue
Block a user