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

- 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:
Lars committed 2026-06-11 10:40:25 +02:00
1 parent 1d94c2ebf1
commit 713a344d17
7 files changed
+269 -53

No files matched your search

+30
View File
@@ -137,6 +137,8 @@ def rematch_roadmap_slots(
for m, s in steps_by_major.items()
if s.get("exercise_id") is not None
}
if old and old.get("exercise_id") is not None:
used.add(int(old["exercise_id"]))
planned_ids, anchor_id, anchor_variant_id = _context_before_major(
steps_by_major, int(major_idx)
)
@@ -196,7 +198,35 @@ def rematch_roadmap_slots(
return ordered, rematch_log, new_unfilled
def prune_stripped_after_rematch(
stripped_off_topic: Sequence[Mapping[str, Any]],
rematch_log: Sequence[Mapping[str, Any]],
) -> List[Dict[str, Any]]:
"""Entfernt aus stripped_off_topic Slots, die per Rematch ersetzt wurden."""
replaced: Set[int] = set()
for entry in rematch_log or []:
if not isinstance(entry, dict):
continue
if str(entry.get("action") or "") != "replaced":
continue
midx = entry.get("roadmap_major_step_index")
if midx is not None:
replaced.add(int(midx))
if not replaced:
return list(stripped_off_topic or [])
out: List[Dict[str, Any]] = []
for item in stripped_off_topic or []:
if not isinstance(item, dict):
continue
midx = item.get("roadmap_major_step_index")
if midx is not None and int(midx) in replaced:
continue
out.append(dict(item))
return out
__all__ = [
"collect_rematch_slot_indices",
"prune_stripped_after_rematch",
"rematch_roadmap_slots",
]