Enhance Stage Specification Refinement and Rematch Logic
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m22s
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m22s
- Updated `max_rematch_rounds` in `ProgressionPathSuggestRequest` to allow for a maximum of 3 rounds, improving flexibility in rematch processes. - Introduced `_track_rejected` function to track rejected exercises by major step index, enhancing the rematch logic to account for previously rejected exercises. - Enhanced `_run_roadmap_rematch_loop` to utilize the new rejection tracking, ensuring better handling of off-topic steps during rematching. - Improved `detect_off_topic_steps` to incorporate refined scoring and reasoning for stage fit, enhancing the accuracy of off-topic detection. - Updated `refine_stage_spec_artifact` to merge stage exclusion phrases more effectively, improving the clarity of anti-pattern handling. - Bumped version to 0.8.228 to reflect the new features and improvements.
This commit is contained in:
1 parent
f36a747efa
commit
a49987408b
9 files changed
+269
-74
No files matched your search
@@ -1,5 +1,4 @@
|
||||
"""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,
|
||||
@@ -49,17 +48,14 @@ def test_refine_stage_spec_adds_rejected_title_and_criteria():
|
||||
"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 any("Mawashi" in a and "Tritt" 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
|
||||
assert not any("anderetechnikals" in a.replace(" ", "") for a in refined.anti_patterns)
|
||||
|
||||
|
||||
def test_apply_stage_spec_refinements_mutates_context():
|
||||
@@ -81,7 +77,6 @@ def test_apply_stage_spec_refinements_mutates_context():
|
||||
}
|
||||
],
|
||||
goal_query="Mawashi Geri",
|
||||
semantic_brief=build_semantic_brief("Mawashi Geri"),
|
||||
)
|
||||
assert len(log) == 1
|
||||
assert log[0]["action"] == "refined"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
"""Tests für Stufen-Ausschlüsse und Anti-Pattern-Sanitizer."""
|
||||
from planning_exercise_semantics import (
|
||||
exercise_passes_stage_fit,
|
||||
is_trainer_stage_anti_marker,
|
||||
merge_stage_exclude_phrases,
|
||||
parse_stage_goal_constraints,
|
||||
score_exercise_stage_fit,
|
||||
build_stage_match_brief,
|
||||
)
|
||||
|
||||
|
||||
def test_trainer_anti_marker_not_reparsed_as_negation():
|
||||
marker = 'keine Übung wie „One Leg Squat“'
|
||||
assert is_trainer_stage_anti_marker(marker)
|
||||
excludes = merge_stage_exclude_phrases(
|
||||
"Gleichgewichtstritt Mae-Geri",
|
||||
[marker, "kumite"],
|
||||
)
|
||||
assert "onelegsquat" not in "".join(excludes).replace(" ", "")
|
||||
assert "kumite" in excludes
|
||||
|
||||
|
||||
def test_parse_stage_goal_constraints_skips_trainer_markers_in_anti():
|
||||
marker = 'keine Übung wie „Erlernen des Mae Geri aus zusammengesetzten Einzelbewegungen“'
|
||||
result = parse_stage_goal_constraints(
|
||||
"Koordination ohne Kumite",
|
||||
[marker],
|
||||
)
|
||||
joined = " ".join(result.exclude_phrases)
|
||||
assert "keine uebung wie" not in joined
|
||||
assert "kumite" in joined
|
||||
|
||||
|
||||
def test_title_equivalent_passes_stage_fit_despite_low_semantic():
|
||||
goal = "Gleichgewichtstritt Mae-Geri"
|
||||
assert exercise_passes_stage_fit(
|
||||
learning_goal=goal,
|
||||
title="Gleichgewichtstritt Mae-Geri",
|
||||
summary="Balance und Treffpunkt variieren.",
|
||||
goal="Mae Geri aus Stand.",
|
||||
stage_semantic_score=0.05,
|
||||
)
|
||||
|
||||
|
||||
def test_stage_focus_scoring_rewards_learning_goal_tokens():
|
||||
goal = "Erlernen des Mae Geri aus zusammengesetzten Einzelbewegungen"
|
||||
brief = build_stage_match_brief(learning_goal=goal)
|
||||
score, reasons = score_exercise_stage_fit(
|
||||
title="Mae Geri aus Einzelteilen",
|
||||
summary="Zusammensetzung aus Schritt und Armschwingung.",
|
||||
goal="Einzelbewegungen verbinden.",
|
||||
stage_brief=brief,
|
||||
)
|
||||
assert score >= 0.25
|
||||
Reference in new issue
Block a user