Refine Technique Path Scope Logic and Enhance Test Coverage
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 44s
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 1m24s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 44s
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 1m24s
- Updated the `exercise_passes_technique_path_scope` function to clarify the requirements for technique inclusion, ensuring that the primary technique must appear in the exercise text. - Enhanced the logic to allow for relaxed matching based on parts of the primary topic, improving flexibility in exercise validation. - Added new tests to validate the rejection of off-topic exercises, specifically addressing cases where only stage goals mention the primary technique. - Improved the selection logic in `pick_best_path_hit` to ensure proper handling of roadmap stage matches.
This commit is contained in:
1 parent
713a344d17
commit
f63b09fc9c
2 files changed
+71
-8
No files matched your search
@@ -207,7 +207,10 @@ def exercise_passes_technique_path_scope(
|
||||
relaxed: bool = False,
|
||||
) -> bool:
|
||||
"""
|
||||
Technik-Pfad: keine Geschwister-Technik; Haupttechnik im Übungstext oder Stufen-Lernziel.
|
||||
Technik-Pfad: keine Geschwister-Technik; Haupttechnik muss im Übungstext vorkommen.
|
||||
|
||||
Das Stufen-Lernziel allein reicht nicht — sonst würden themenfremde Übungen (z. B. Kumite)
|
||||
nur wegen „Mawashi Geri“ im Lernziel durch das Gate rutschen.
|
||||
"""
|
||||
primary = _normalize_phrase(primary_topic)
|
||||
if not primary:
|
||||
@@ -218,11 +221,14 @@ def exercise_passes_technique_path_scope(
|
||||
if excludes and _blob_matches_stage_excludes(blob, excludes):
|
||||
return False
|
||||
|
||||
in_exercise = _phrase_in_blob(primary, blob)
|
||||
in_stage = _phrase_in_blob(primary, _blob_from_fields("", "", learning_goal, []))
|
||||
if in_exercise or in_stage:
|
||||
if _phrase_in_blob(primary, blob):
|
||||
return True
|
||||
return relaxed
|
||||
|
||||
if relaxed:
|
||||
parts = [p for p in primary.split() if len(p) >= 4]
|
||||
if parts and any(_phrase_in_blob(part, blob) for part in parts):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _detect_development_arc(q_lower: str) -> List[str]:
|
||||
@@ -1245,15 +1251,16 @@ def pick_best_path_hit(
|
||||
return best
|
||||
|
||||
chosen = _scan(strict=True)
|
||||
if chosen:
|
||||
return chosen
|
||||
chosen = _scan(strict=False)
|
||||
if chosen:
|
||||
return chosen
|
||||
|
||||
if roadmap_stage_match:
|
||||
return None
|
||||
|
||||
chosen = _scan(strict=False)
|
||||
if chosen:
|
||||
return chosen
|
||||
|
||||
# Notfall (nur retrieval-first / Brücken): bester verbleibender Treffer
|
||||
fallback: Optional[Dict[str, Any]] = None
|
||||
fallback_key: Tuple[float, float] = (-1.0, -1.0)
|
||||
|
||||
Reference in new issue
Block a user