Implement Peer Learning Goals and Stage Fit Enhancements
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m33s

- Introduced `_peer_stage_learning_goals` to retrieve learning goals from peer stages, enhancing the ability to filter exercises based on cross-slot collisions.
- Added `_filter_learning_goal_candidate_ids` to refine candidate selection by incorporating peer learning goals and stage fit criteria, improving exercise relevance in suggestions.
- Enhanced `pick_best_path_hit` and `_match_roadmap_slot` to utilize peer learning goals for better exercise selection and to prevent conflicts with titles from other stages.
- Updated `stage_refinement_criteria_from_learning_goal` to provide clearer criteria for stage refinement based on learning goals.
- Bumped version to 0.8.229 to reflect the new features and improvements.
This commit is contained in:
Lars committed 2026-06-12 07:40:26 +02:00
1 parent a49987408b
commit 8a4be795f4
5 files changed
+241 -43

No files matched your search

@@ -52,3 +52,70 @@ def test_stage_focus_scoring_rewards_learning_goal_tokens():
stage_brief=brief,
)
assert score >= 0.25
def test_rank_fallback_requires_relaxed_stage_fit():
goal_a = "Grundlegende Körperhaltung und erste Mae Geri Bewegung"
goal_b = "Präzise Trefferfläche und variable Distanzen"
hits = [
{
"id": 1,
"title": "Gleichgewichtstritt Mae-Geri",
"summary": "Balance",
"goal": "Mae Geri",
"stage_rank_semantic": 0.04,
"score": 0.5,
},
{
"id": 2,
"title": "Erlernen des Mae Geri aus zusammengesetzten Einzelbewegungen",
"summary": "Teile verbinden",
"goal": "Zusammensetzung",
"stage_rank_semantic": 0.03,
"score": 0.48,
},
]
from planning_exercise_semantics import pick_best_path_hit
brief_a = build_stage_match_brief(learning_goal=goal_a)
chosen = pick_best_path_hit(
hits,
set(),
stage_learning_goal=goal_a,
roadmap_stage_match=True,
stage_match_brief=brief_a,
peer_learning_goals=[goal_b],
)
assert chosen is None
def test_peer_stage_title_blocked_for_wrong_slot():
goal_a = "Grundlegende Körperhaltung und erste Mae Geri Bewegung"
goal_b = "Gleichgewichtstritt Mae-Geri"
from planning_exercise_semantics import exercise_title_matches_peer_stage_goal, pick_best_path_hit
assert exercise_title_matches_peer_stage_goal(
"Gleichgewichtstritt Mae-Geri",
current_learning_goal=goal_a,
peer_learning_goals=[goal_b],
)
hits = [
{
"id": 10,
"title": "Gleichgewichtstritt Mae-Geri",
"summary": "Balance auf einem Bein",
"goal": "Mae Geri aus Gleichgewicht",
"stage_rank_semantic": 0.35,
"score": 0.6,
}
]
brief_a = build_stage_match_brief(learning_goal=goal_a)
chosen = pick_best_path_hit(
hits,
set(),
stage_learning_goal=goal_a,
roadmap_stage_match=True,
stage_match_brief=brief_a,
peer_learning_goals=[goal_b],
)
assert chosen is None