Refactor Roadmap Step Annotation and Slot Assignment Logic
Deploy Development / deploy (push) Successful in 49s
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 33s
Test Suite / playwright-tests (push) Successful in 1m12s

- Updated `_annotate_roadmap_step` to change the condition for setting `slot_status` based on `roadmap_match_source`, improving clarity in slot assignment handling.
- Removed the `_try_reconcile_slot_assignment` function to streamline the slot assignment process, as its logic is now integrated into the main flow.
- Enhanced `_match_roadmap_slot` to conditionally preserve slot assignments based on exercise ID, ensuring better handling of existing assignments.
- Improved the handling of semantic scores in `rank_visible_library_hits` to prioritize the best semantic fit, enhancing exercise retrieval accuracy.
- Added tests to validate the new logic for title equivalence and semantic scoring, ensuring robustness in exercise selection processes.
This commit is contained in:
Lars committed 2026-06-11 12:45:53 +02:00
1 parent ca2adbd55e
commit b2fbf6b4af
5 files changed
+91 -129

No files matched your search

@@ -354,18 +354,57 @@ def test_title_equivalent_to_stage_goal():
assert not exercise_title_equivalent_to_stage_goal("Kumite", "Hüftmobilität für Mae Geri")
def test_stage_fit_passes_for_title_equivalent_despite_missing_path_technique():
def test_stage_fit_passes_for_title_equivalent_with_sufficient_semantic_score():
stage_goal = "Koordination Absprung ohne Kick"
assert exercise_passes_stage_fit(
learning_goal=stage_goal,
title=stage_goal,
summary="",
summary="Absprung und Landung koordinieren",
goal="",
path_primary_topic="mawashi geri",
path_technique_excludes=["kumite"],
stage_semantic_score=0.42,
)
def test_pick_best_prefers_semantic_fit_over_coincidental_title():
stage_goal = "Hüftmobilität für Mawashi Geri"
stage_brief = build_stage_match_brief(learning_goal=stage_goal)
hits = [
{
"id": 1,
"title": "Hüftmobilität für Mawashi Geri",
"summary": "allgemeine Aufwärmung",
"goal": "",
"score": 0.9,
"semantic_score": 0.12,
"stage_semantic_score": 0.12,
"stage_rank_semantic": 0.35,
},
{
"id": 2,
"title": "Mawashi Hüftmobilität und Adduktoren",
"summary": "Dehnung Hüfte für Rundtritt",
"goal": "Mawashi Geri Hüftbeweglichkeit",
"score": 0.72,
"semantic_score": 0.58,
"stage_semantic_score": 0.58,
"stage_rank_semantic": 0.62,
},
]
chosen = pick_best_path_hit(
hits,
set(),
stage_learning_goal=stage_goal,
roadmap_stage_match=True,
stage_match_brief=stage_brief,
path_primary_topic="mawashi geri",
path_technique_excludes=technique_sibling_excludes("mawashi geri"),
)
assert chosen is not None
assert int(chosen["id"]) == 2
def test_pick_roadmap_relaxed_with_path_primary_when_strict_fails():
"""Bestehende Graph-Übungen: relaxed Gate auch bei gesetztem path_primary_topic."""
stage_goal = "Hüftmobilität für Mawashi Geri"