Refactor Planning Exercise Path Logic and Enhance Semantic Gating
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 41s
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
Test Suite / pytest-backend (pull_request) Successful in 38s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 13s
Test Suite / k6 /health Baseline (pull_request) Successful in 33s
Test Suite / playwright-tests (pull_request) Successful in 1m13s

- Replaced the manual path selection logic with a new `pick_best_path_hit` function to streamline the process of selecting the best exercise based on semantic scores and gating criteria.
- Updated the semantic gating logic to apply a soft penalty for off-topic exercises, improving the flexibility of exercise selection.
- Enhanced the handling of title, summary, and goal parameters in semantic checks to ensure more accurate relevance assessments.
- Incremented version to 0.8.189 and updated changelog to reflect these improvements in planning AI functionality.
This commit is contained in:
Lars committed 2026-05-23 12:50:55 +02:00
1 parent 5b73d1a1f5
commit 8d1dd59c3c
5 files changed
+143 -32

No files matched your search

@@ -14,10 +14,36 @@ def test_pick_best_path_hit_prefers_semantic_score():
assert chosen["id"] == 2
def test_pick_best_path_hit_skips_off_topic_when_gate():
brief = build_semantic_brief("Mae Geri")
hits = [{"id": 1, "title": "Kumite Grundstellung", "score": 0.9, "semantic_score": 0.05}]
assert _pick_best_path_hit(hits, set(), semantic_brief=brief) is None
def test_phrase_compact_match_maegeri():
from planning_exercise_semantics import _phrase_in_blob
assert _phrase_in_blob("mae geri", "Erlernen des Mae-Geri aus Einzelbewegungen")
assert _phrase_in_blob("mae geri", "Maegeri Kihon")
def test_pick_best_path_hit_fallback_title_only_in_summary():
from planning_exercise_semantics import pick_best_path_hit
brief = build_semantic_brief("Mae Geri Perfektion")
hits = [
{
"id": 1,
"title": "Kumite Stellungen",
"summary": "",
"score": 0.9,
"semantic_score": 0.02,
},
{
"id": 2,
"title": "Einzelbewegungen",
"summary": "Schrittweise Erlernen des Mae Geri",
"score": 0.5,
"semantic_score": 0.08,
},
]
chosen = pick_best_path_hit(hits, set(), semantic_brief=brief)
assert chosen is not None
assert int(chosen["id"]) == 2
def test_pick_best_path_hit_skips_used():