Enhance Gap Fill and Rematch Logic in Progression Path
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 47s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 39s
Test Suite / playwright-tests (push) Successful in 1m22s
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 47s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 39s
Test Suite / playwright-tests (push) Successful in 1m22s
- Introduced `_step_neighbors_at_index` to safely retrieve neighboring steps without causing IndexErrors, improving robustness in gap fill specifications. - Updated `collect_gap_fill_specs` to utilize the new neighbor retrieval function, ensuring safe access to adjacent steps during gap fill processing. - Enhanced rematch logic in `_run_roadmap_rematch_loop` to incorporate `max_rematch_rounds`, allowing for controlled iterations during roadmap rematching. - Improved handling of unfilled roadmap slots in `collect_rematch_slot_indices`, ensuring accurate identification of gaps in the progression path. - Added tests to validate the new gap fill handling and rematch logic, ensuring reliability in path suggestion features.
This commit is contained in:
1 parent
de939481ba
commit
df93da9a03
6 files changed
+217
-53
No files matched your search
@@ -214,3 +214,55 @@ def test_build_gap_fill_offer_exposes_context_preview():
|
||||
)
|
||||
assert offer["context_preview"]["start_situation"] == "Steppbewegung"
|
||||
assert "variable Rhythmen" in offer["goal_for_ai"]
|
||||
|
||||
|
||||
def test_collect_gap_fill_specs_off_topic_last_step_no_crash():
|
||||
"""Rand-Slot: off_topic am letzten Schritt darf keinen IndexError auslösen (500)."""
|
||||
brief = build_semantic_brief("Mawashi Geri Kumite")
|
||||
steps = [
|
||||
{"exercise_id": 1, "title": "Stand", "roadmap_major_step_index": 0},
|
||||
{"exercise_id": 2, "title": "Yoko Geri", "roadmap_major_step_index": 1},
|
||||
]
|
||||
specs = collect_gap_fill_specs(
|
||||
steps=steps,
|
||||
unfilled_gaps=[],
|
||||
off_topic_steps=[
|
||||
{
|
||||
"step_index": 1,
|
||||
"roadmap_major_step_index": 1,
|
||||
"title": "Yoko Geri",
|
||||
"expected_phase": "anwendung",
|
||||
}
|
||||
],
|
||||
llm_specs=[],
|
||||
brief=brief,
|
||||
goal_query="Mawashi Geri Kumite",
|
||||
)
|
||||
assert len(specs) == 1
|
||||
assert specs[0]["source"] == "off_topic"
|
||||
assert "Stand" in specs[0]["sketch"]
|
||||
|
||||
|
||||
def test_collect_gap_fill_specs_off_topic_first_step_uses_safe_neighbors():
|
||||
brief = build_semantic_brief("Mawashi Geri")
|
||||
steps = [
|
||||
{"exercise_id": 1, "title": "Yoko Geri", "roadmap_major_step_index": 0},
|
||||
{"exercise_id": 2, "title": "Mawashi", "roadmap_major_step_index": 1},
|
||||
]
|
||||
specs = collect_gap_fill_specs(
|
||||
steps=steps,
|
||||
unfilled_gaps=[],
|
||||
off_topic_steps=[
|
||||
{
|
||||
"step_index": 0,
|
||||
"roadmap_major_step_index": 0,
|
||||
"title": "Yoko Geri",
|
||||
}
|
||||
],
|
||||
llm_specs=[],
|
||||
brief=brief,
|
||||
goal_query="Mawashi Geri",
|
||||
)
|
||||
assert len(specs) == 1
|
||||
assert "Mawashi" in specs[0]["sketch"]
|
||||
assert "vorherigem Schritt" in specs[0]["sketch"]
|
||||
@@ -68,6 +68,19 @@ def test_collect_rematch_slot_indices_from_optimization_hints():
|
||||
assert indices == {0}
|
||||
|
||||
|
||||
def test_collect_rematch_slot_indices_from_roadmap_unfilled():
|
||||
specs = _stage_specs()
|
||||
indices, reasons = collect_rematch_slot_indices(
|
||||
stripped_off_topic=[],
|
||||
off_topic_steps=[],
|
||||
optimization_hints=[],
|
||||
stage_specs=specs,
|
||||
roadmap_unfilled=[(1, specs[1])],
|
||||
)
|
||||
assert indices == {1}
|
||||
assert "Roadmap-Stufe" in reasons[1]
|
||||
|
||||
|
||||
def test_rematch_roadmap_slots_replaces_only_target_slot():
|
||||
specs = _stage_specs()
|
||||
ctx = ProgressionRoadmapContext(
|
||||
|
||||
Reference in new issue
Block a user