commit bcc682b4b53a315ad1b81bd35ce716a552b28506
parent 605430fb559707903304ba3081d2cb525341aff8
Author: triesap <tyson@radroots.org>
Date: Mon, 21 Sep 2026 13:54:48 +0000
core: compose applicable checks before ranking
Diffstat:
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/hyf_application/match_checks.mojo b/src/hyf_application/match_checks.mojo
@@ -135,3 +135,14 @@ def check_quantity(
"quantity", "pass", True, "partial_permitted"
)
return constraint_assessment("quantity", "fail", True, "quantity_insufficient")
+
+
+from hyf_core.domain.eligibility import compose_eligibility
+
+
+def compose_applicable_checks(checks: List[ConstraintAssessment]) -> String:
+ return compose_eligibility(checks)
+
+
+def scores_affect_feasibility() -> Bool:
+ return False
diff --git a/tests/test_application.mojo b/tests/test_application.mojo
@@ -489,3 +489,22 @@ def test_per_lot_quantity_feasibility() raises:
assert_equal(check_quantity(required, short, True, False).result, "fail")
assert_equal(check_quantity(required, short, True, True).result, "pass")
assert_equal(check_quantity(required, short, False, False).result, "unknown")
+
+
+from hyf_application.match_checks import (
+ compose_applicable_checks,
+ scores_affect_feasibility,
+)
+from hyf_core.domain.eligibility import ConstraintAssessment, constraint_assessment
+
+
+def test_compose_applicable_checks_before_ranking() raises:
+ var checks = List[ConstraintAssessment]()
+ checks.append(constraint_assessment("product", "pass", True, "product_match"))
+ checks.append(constraint_assessment("quantity", "fail", True, "quantity_insufficient"))
+ checks.append(constraint_assessment("window", "unknown", True, "window_mismatch"))
+ assert_equal(compose_applicable_checks(checks), "ineligible")
+ var only_unknown = List[ConstraintAssessment]()
+ only_unknown.append(constraint_assessment("quantity", "unknown", True, "stock_unknown"))
+ assert_equal(compose_applicable_checks(only_unknown), "conditional")
+ assert_true(not scores_affect_feasibility())