Enhance Progression Path Suggestion with Stage Specification Refinement
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m16s
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m16s
- Introduced `auto_refine_stage_spec` to `ProgressionPathSuggestRequest`, enabling optional refinement of stage specifications during the rematch process. - Updated `_run_roadmap_rematch_loop` to incorporate stage specification refinements, logging changes for better tracking of adjustments made during rematching. - Enhanced `suggest_progression_path` to include refine logs in the output, providing clearer insights into the refinement process. - Added utility functions for formatting refine log entries, improving the display of refinement actions in the frontend components. - Updated frontend components to display refine logs, enhancing user feedback on stage specification adjustments during progression analysis. - Bumped version to 0.8.227 to reflect the new features and improvements.
This commit is contained in:
1 parent
de9fdf3ac0
commit
f36a747efa
7 files changed
+417
-4
No files matched your search
@@ -0,0 +1,105 @@
|
||||
"""Tests Phase C — refine_stage_spec nach stage_mismatch."""
|
||||
from planning_exercise_semantics import build_semantic_brief
|
||||
from planning_path_refine_stage import (
|
||||
apply_stage_spec_refinements,
|
||||
collect_refine_stage_targets,
|
||||
refine_stage_spec_artifact,
|
||||
)
|
||||
from planning_progression_roadmap import ProgressionRoadmapContext, StageSpecArtifact
|
||||
|
||||
|
||||
def _spec(major=1, goal="Koordination Absprung ohne Tritttechnik"):
|
||||
return StageSpecArtifact(
|
||||
major_step_index=major,
|
||||
learning_goal=goal,
|
||||
load_profile=["koordination"],
|
||||
exercise_type="kihon_einzel",
|
||||
)
|
||||
|
||||
|
||||
def test_collect_refine_stage_targets_from_hint_and_off_topic():
|
||||
specs = [_spec(0, "A"), _spec(1, "B"), _spec(2, "C")]
|
||||
hints = [
|
||||
{
|
||||
"action": "refine_stage_spec",
|
||||
"roadmap_major_step_index": 1,
|
||||
"reason": "Passt nicht zum Stufen-Lernziel",
|
||||
}
|
||||
]
|
||||
off_topic = [
|
||||
{
|
||||
"issue": "stage_mismatch",
|
||||
"step_index": 2,
|
||||
"roadmap_major_step_index": 2,
|
||||
"title": "Kumite Drill",
|
||||
}
|
||||
]
|
||||
targets = collect_refine_stage_targets(
|
||||
optimization_hints=hints,
|
||||
off_topic_steps=off_topic,
|
||||
stage_specs=specs,
|
||||
)
|
||||
assert targets.keys() == {1, 2}
|
||||
|
||||
|
||||
def test_refine_stage_spec_adds_rejected_title_and_criteria():
|
||||
spec = _spec()
|
||||
finding = {
|
||||
"title": "Mawashi Trittpräzision",
|
||||
"roadmap_learning_goal": spec.learning_goal,
|
||||
"reasons": ["Semantik zu schwach für Stufen-Lernziel"],
|
||||
}
|
||||
brief = build_semantic_brief("Mawashi Geri Kumite")
|
||||
refined, changes = refine_stage_spec_artifact(
|
||||
spec,
|
||||
finding=finding,
|
||||
goal_query="Mawashi Geri ohne Kumite",
|
||||
semantic_brief=brief,
|
||||
)
|
||||
assert changes
|
||||
assert any("Mawashi Trittpräzision" in a for a in refined.anti_patterns)
|
||||
assert refined.success_criteria
|
||||
assert refined.anti_patterns != spec.anti_patterns or refined.success_criteria != spec.success_criteria
|
||||
|
||||
|
||||
def test_apply_stage_spec_refinements_mutates_context():
|
||||
specs = [_spec(0, "Stand"), _spec(1, "Sprungkoordination")]
|
||||
ctx = ProgressionRoadmapContext(
|
||||
goal_query="Mawashi Geri",
|
||||
max_steps=2,
|
||||
stage_specs=specs,
|
||||
)
|
||||
_, log = apply_stage_spec_refinements(
|
||||
ctx,
|
||||
optimization_hints=[],
|
||||
off_topic_steps=[
|
||||
{
|
||||
"issue": "stage_mismatch",
|
||||
"roadmap_major_step_index": 1,
|
||||
"title": "Yoko Geri",
|
||||
"roadmap_learning_goal": "Sprungkoordination",
|
||||
}
|
||||
],
|
||||
goal_query="Mawashi Geri",
|
||||
semantic_brief=build_semantic_brief("Mawashi Geri"),
|
||||
)
|
||||
assert len(log) == 1
|
||||
assert log[0]["action"] == "refined"
|
||||
assert ctx.stage_specs[1].anti_patterns
|
||||
assert any("Yoko Geri" in a for a in ctx.stage_specs[1].anti_patterns)
|
||||
|
||||
|
||||
def test_refine_no_op_when_no_finding_data():
|
||||
spec = StageSpecArtifact(
|
||||
major_step_index=1,
|
||||
learning_goal="",
|
||||
load_profile=[],
|
||||
exercise_type="kihon_einzel",
|
||||
)
|
||||
refined, changes = refine_stage_spec_artifact(
|
||||
spec,
|
||||
finding={"issue": "stage_mismatch"},
|
||||
goal_query="x",
|
||||
)
|
||||
assert changes == []
|
||||
assert refined is spec
|
||||
Reference in new issue
Block a user