Enhance Roadmap Step Handling and Off-Topic Logic
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 52s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 41s
Test Suite / playwright-tests (push) Successful in 1m51s
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 52s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 41s
Test Suite / playwright-tests (push) Successful in 1m51s
- Improved off-topic step handling by incorporating roadmap major step indices for better indexing and detection. - Refactored `collect_gap_fill_specs` to streamline the insertion logic for off-topic steps, ensuring correct placement based on major step indices. - Introduced `_normalize_roadmap_steps_coverage` function to standardize roadmap steps coverage, enhancing the handling of missing slots. - Added `prune_stripped_after_rematch` function to clean up stripped off-topic steps after rematching, improving the overall rematching process. - Updated tests to validate new rematching and off-topic handling features, ensuring robustness against edge cases. - Incremented application version to reflect these updates.
This commit is contained in:
1 parent
1d94c2ebf1
commit
713a344d17
7 files changed
+269
-53
No files matched your search
@@ -95,8 +95,9 @@ def test_rematch_roadmap_slots_replaces_only_target_slot():
|
||||
|
||||
def _fake_match(cur, *, stage_spec, used, **kwargs):
|
||||
assert stage_spec.major_step_index == 1
|
||||
assert 20 not in used
|
||||
assert 20 in used
|
||||
assert 10 in used
|
||||
assert 30 in used
|
||||
return (
|
||||
{
|
||||
"exercise_id": 21,
|
||||
@@ -131,3 +132,41 @@ def test_rematch_roadmap_slots_replaces_only_target_slot():
|
||||
assert log[0]["replaced_exercise_id"] == 20
|
||||
assert log[0]["new_exercise_id"] == 21
|
||||
assert not unfilled
|
||||
|
||||
|
||||
def test_rematch_excludes_replaced_exercise_from_used():
|
||||
specs = _stage_specs()
|
||||
ctx = ProgressionRoadmapContext(
|
||||
goal_query="Mawashi Geri",
|
||||
max_steps=3,
|
||||
stage_specs=specs,
|
||||
)
|
||||
steps = [
|
||||
{"exercise_id": 10, "title": "OK", "roadmap_major_step_index": 0},
|
||||
{"exercise_id": 99, "title": "Mae Geri", "roadmap_major_step_index": 1},
|
||||
]
|
||||
seen_used = []
|
||||
|
||||
def _fake_match(cur, *, used, stage_spec, **kwargs):
|
||||
seen_used.append(set(used))
|
||||
return (
|
||||
{"exercise_id": 42, "title": "Neu", "roadmap_major_step_index": stage_spec.major_step_index},
|
||||
None,
|
||||
)
|
||||
|
||||
rematch_roadmap_slots(
|
||||
None,
|
||||
tenant=None,
|
||||
body=None,
|
||||
goal_query="Mawashi",
|
||||
max_steps=3,
|
||||
semantic_brief=None,
|
||||
path_target_profile=None,
|
||||
path_intent="",
|
||||
roadmap_ctx=ctx,
|
||||
steps=steps,
|
||||
slot_indices={1},
|
||||
rematch_reasons={1: "technique_scope"},
|
||||
match_slot_fn=_fake_match,
|
||||
)
|
||||
assert 99 in seen_used[0]
|
||||
Reference in new issue
Block a user