Implement Stage Learning Goal Features in Planning Exercise
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 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m13s

- Added `semantic_brief_for_stage` function to enhance semantic briefs with stage learning goals for improved roadmap matching.
- Introduced `exercise_passes_stage_learning_goal_gate` to validate exercises against stage learning goals, enhancing relevance checks.
- Updated path retrieval and scoring logic to incorporate stage learning goals, allowing for more nuanced exercise selection.
- Enhanced UI to indicate weak matches with stage learning goals, improving user feedback on exercise relevance.
- Incremented application version to reflect these updates.
This commit is contained in:
Lars committed 2026-06-10 16:39:17 +02:00
1 parent 48d51c07c5
commit 18547613ea
8 files changed
+339 -44

No files matched your search

@@ -0,0 +1,96 @@
"""Tests Roadmap-Stufen-Match — Gate gegen themenfremde Übungen."""
from planning_exercise_semantics import (
exercise_passes_stage_learning_goal_gate,
pick_best_path_hit,
semantic_brief_for_stage,
build_semantic_brief,
)
def test_stage_gate_accepts_learning_goal_in_title():
assert exercise_passes_stage_learning_goal_gate(
learning_goal="variable Rhythmen und Hüftmobilität für Mae Geri",
title="Mae Geri — variable Rhythmen",
summary="",
semantic_score=0.1,
)
def test_stage_gate_rejects_unrelated_kumite():
assert not exercise_passes_stage_learning_goal_gate(
learning_goal="variable Rhythmen und Hüftmobilität für Mae Geri",
title="Kumite Grundstellungen",
summary="Partnerarbeit Distanz",
semantic_score=0.05,
)
def test_semantic_brief_for_stage_adds_learning_goal():
brief = build_semantic_brief("Mae Geri Perfektion")
stage = semantic_brief_for_stage(
brief,
learning_goal="Hüftmobilität und Kammerhaltung",
phase="grundlage",
)
assert "hüftmobilität und kammerhaltung" in stage.must_phrases[0]
def test_pick_best_path_hit_roadmap_stage_no_weak_fallback():
brief = build_semantic_brief("Mae Geri Perfektion")
stage_brief = semantic_brief_for_stage(
brief,
learning_goal="Hüftmobilität für Mae Geri",
phase="grundlage",
)
hits = [
{
"id": 1,
"title": "Kumite Stellungen",
"summary": "Partner Distanz",
"score": 0.92,
"semantic_score": 0.08,
},
{
"id": 2,
"title": "Kraft-Ausdauer Zirkel",
"summary": "allgemeine Fitness",
"score": 0.88,
"semantic_score": 0.02,
},
]
chosen = pick_best_path_hit(
hits,
set(),
semantic_brief=stage_brief,
stage_learning_goal="Hüftmobilität für Mae Geri",
roadmap_stage_match=True,
)
assert chosen is None
def test_pick_best_path_hit_roadmap_stage_picks_relevant():
brief = build_semantic_brief("Mae Geri Perfektion")
stage_brief = semantic_brief_for_stage(
brief,
learning_goal="Hüftmobilität für Mae Geri",
phase="grundlage",
)
hits = [
{"id": 1, "title": "Kumite", "score": 0.9, "semantic_score": 0.1},
{
"id": 2,
"title": "Mae Geri Hüftmobilität",
"summary": "Kammerhaltung und Hüfte",
"score": 0.7,
"semantic_score": 0.55,
},
]
chosen = pick_best_path_hit(
hits,
set(),
semantic_brief=stage_brief,
stage_learning_goal="Hüftmobilität für Mae Geri",
roadmap_stage_match=True,
)
assert chosen is not None
assert int(chosen["id"]) == 2