Refactor Roadmap Step Annotation and Slot Assignment Logic
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m12s
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m12s
- Updated `_annotate_roadmap_step` to change the condition for setting `slot_status` based on `roadmap_match_source`, improving clarity in slot assignment handling. - Removed the `_try_reconcile_slot_assignment` function to streamline the slot assignment process, as its logic is now integrated into the main flow. - Enhanced `_match_roadmap_slot` to conditionally preserve slot assignments based on exercise ID, ensuring better handling of existing assignments. - Improved the handling of semantic scores in `rank_visible_library_hits` to prioritize the best semantic fit, enhancing exercise retrieval accuracy. - Added tests to validate the new logic for title equivalence and semantic scoring, ensuring robustness in exercise selection processes.
This commit is contained in:
1 parent
ca2adbd55e
commit
b2fbf6b4af
5 files changed
+91
-129
No files matched your search
@@ -431,8 +431,30 @@ def rank_visible_library_hits(
|
||||
step_phase=step_phase,
|
||||
)
|
||||
|
||||
rank_stage_sem = stage_semantic_score
|
||||
stage_lg = (stage_learning_goal or "").strip()
|
||||
if roadmap_stage_match and stage_lg:
|
||||
raw_brief = build_stage_match_brief(
|
||||
learning_goal=stage_lg,
|
||||
anti_patterns=pack.get("stage_anti_patterns"),
|
||||
phase=step_phase,
|
||||
)
|
||||
raw_sem, raw_reasons = score_exercise_stage_fit(
|
||||
title=title_s,
|
||||
summary=summary_s,
|
||||
goal=goal_s,
|
||||
variant_names=variants_by_ex.get(eid, []),
|
||||
stage_brief=raw_brief,
|
||||
step_phase=step_phase,
|
||||
)
|
||||
rank_stage_sem = max(stage_semantic_score, raw_sem)
|
||||
if raw_sem > stage_semantic_score and raw_reasons:
|
||||
for rr in raw_reasons:
|
||||
if rr not in stage_semantic_reasons:
|
||||
stage_semantic_reasons.append(rr)
|
||||
|
||||
effective_semantic = (
|
||||
stage_semantic_score
|
||||
rank_stage_sem
|
||||
if roadmap_stage_match and stage_match_brief
|
||||
else semantic_score
|
||||
)
|
||||
@@ -461,7 +483,7 @@ def rank_visible_library_hits(
|
||||
summary=summary_s,
|
||||
goal=goal_s,
|
||||
stage_brief=stage_match_brief,
|
||||
stage_semantic_score=stage_semantic_score,
|
||||
stage_semantic_score=rank_stage_sem,
|
||||
anti_patterns=pack.get("stage_anti_patterns"),
|
||||
step_phase=step_phase,
|
||||
path_primary_topic=pack.get("path_primary_topic"),
|
||||
@@ -528,6 +550,7 @@ def rank_visible_library_hits(
|
||||
"reasons": reasons,
|
||||
"semantic_score": round(semantic_score, 4),
|
||||
"stage_semantic_score": round(stage_semantic_score, 4),
|
||||
"stage_rank_semantic": round(rank_stage_sem, 4),
|
||||
"goal": goal_s,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user