Implement Learning Goal Candidate Retrieval and Roadmap Fallback Logic
Deploy Development / deploy (push) Successful in 43s
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 34s
Test Suite / playwright-tests (push) Successful in 1m22s
Deploy Development / deploy (push) Successful in 43s
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 34s
Test Suite / playwright-tests (push) Successful in 1m22s
- Added `_safe_tsquery_fragment` to sanitize learning goal input for SQL queries, improving query safety. - Introduced `_fetch_learning_goal_library_candidate_ids` to retrieve exercise IDs matching learning goals, enhancing exercise relevance in roadmap suggestions. - Enhanced `_match_roadmap_slot` to utilize learning goal candidates, improving the accuracy of supplemental exercise selection. - Implemented `_pick_roadmap_rank_fallback` to provide a fallback mechanism for selecting the best exercise when strict matching fails, ensuring better exercise retrieval. - Updated tests to validate the new learning goal retrieval and fallback logic, ensuring robustness in exercise selection processes.
This commit is contained in:
1 parent
b2fbf6b4af
commit
6d130a7e09
5 files changed
+227
-5
No files matched your search
@@ -367,6 +367,39 @@ def test_stage_fit_passes_for_title_equivalent_with_sufficient_semantic_score():
|
||||
)
|
||||
|
||||
|
||||
def test_roadmap_rank_fallback_picks_best_stage_semantic():
|
||||
from planning_exercise_semantics import _pick_roadmap_rank_fallback
|
||||
|
||||
stage_goal = "Hüftmobilität für Mawashi Geri"
|
||||
hits = [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Hüftmobilität für Mawashi Geri",
|
||||
"summary": "Aufwärmen",
|
||||
"goal": "",
|
||||
"score": 0.9,
|
||||
"stage_rank_semantic": 0.32,
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Mawashi Hüftdehnung",
|
||||
"summary": "Adduktoren und Hüfte",
|
||||
"goal": "Mobilität für Mawashi Geri",
|
||||
"score": 0.7,
|
||||
"stage_rank_semantic": 0.58,
|
||||
},
|
||||
]
|
||||
chosen = _pick_roadmap_rank_fallback(
|
||||
hits,
|
||||
set(),
|
||||
stage_learning_goal=stage_goal,
|
||||
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_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)
|
||||
|
||||
Reference in new issue
Block a user