diff --git a/backend/tests/test_optimization.py b/backend/tests/test_optimization.py index 21dca2d..8471aa8 100644 --- a/backend/tests/test_optimization.py +++ b/backend/tests/test_optimization.py @@ -169,6 +169,7 @@ def test_plan_navigation_finds_future_work_body_despite_nonempty_semantic_hits(s "page_type": "body", "text": noise.text, "rank": .03}]) assert any(hit["page"] == 14 and "t0" in hit["target_ids"] for hit in selected["evidence"]) assert all(hit["page_type"] == "body" for hit in selected["evidence"]) + assert navigator({**targets[0], "allowed_page_types": ["appendix"]}) == [] def test_heading_navigation_supplements_existing_hits_for_custom_labels(): diff --git a/backend/wisegrade/scoring.py b/backend/wisegrade/scoring.py index a128b78..af66298 100644 --- a/backend/wisegrade/scoring.py +++ b/backend/wisegrade/scoring.py @@ -97,6 +97,8 @@ def _body_navigator(db, *, course_version_id, project_id, category): return None def navigate(target): + if "body" not in target.get("allowed_page_types", ["body"]): + return [] label = normalize_heading(target.get("label") or "") if not label: return []