commit b636bbabf77676f7ab45a562a2070024719c620a
parent d7eda42884114bf082e964dc07f95a851172a629
Author: triesap <tyson@radroots.org>
Date: Mon, 21 Sep 2026 14:06:39 +0000
core: seed representative guard faults
Diffstat:
2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/src/hyf_application/guard_seed.mojo b/src/hyf_application/guard_seed.mojo
@@ -0,0 +1,37 @@
+# Deliberately faulty guard implementations used to prove that critical tests
+# actually catch representative regressions.
+from std.collections import List
+
+
+def correct_eligibility(has_fail: Bool, has_unknown: Bool) -> String:
+ if has_fail:
+ return "ineligible"
+ if has_unknown:
+ return "conditional"
+ return "eligible"
+
+
+def seeded_unknown_to_pass(has_fail: Bool, has_unknown: Bool) -> String:
+ if has_fail:
+ return "ineligible"
+ return "eligible"
+
+
+def correct_compare(left: Int, right: Int) -> Int:
+ if left < right:
+ return -1
+ if left > right:
+ return 1
+ return 0
+
+
+def seeded_comparison_inversion(left: Int, right: Int) -> Int:
+ return correct_compare(right, left)
+
+
+def correct_revision_check(expected: String, current: String) -> Bool:
+ return expected == current
+
+
+def seeded_revision_check_bypass(expected: String, current: String) -> Bool:
+ return True
diff --git a/tests/test_journeys.mojo b/tests/test_journeys.mojo
@@ -211,3 +211,23 @@ def test_allocation_conservation_and_ordering_properties() raises:
assert_equal(ranked[0], "a")
assert_equal(ranked[1], "b")
assert_equal(ranked[2], "c")
+
+
+from hyf_application.guard_seed import (
+ correct_compare,
+ correct_eligibility,
+ correct_revision_check,
+ seeded_comparison_inversion,
+ seeded_revision_check_bypass,
+ seeded_unknown_to_pass,
+)
+
+
+def test_seeded_guard_faults_are_detected() raises:
+ # unknown must not become eligible
+ assert_true(seeded_unknown_to_pass(False, True) != correct_eligibility(False, True))
+ # comparison inversion must be observable
+ assert_true(seeded_comparison_inversion(1, 2) != correct_compare(1, 2))
+ # revision bypass must be observable
+ assert_true(seeded_revision_check_bypass("r1", "r2"))
+ assert_true(not correct_revision_check("r1", "r2"))