hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

buyer_failure.mojo (937B)


      1 @fieldwise_init
      2 struct BuyerInferenceOutcome(Copyable, Movable):
      3     var status: String
      4     var resolved_lines: Int
      5     var unresolved_lines: Int
      6     var reason: String
      7 
      8 
      9 def buyer_inference_failure(reason: String) raises -> BuyerInferenceOutcome:
     10     if String(reason).strip().byte_length() == 0:
     11         raise Error("buyer inference failure requires a reason")
     12     return BuyerInferenceOutcome(
     13         status="failed",
     14         resolved_lines=0,
     15         unresolved_lines=1,
     16         reason=String(reason),
     17     )
     18 
     19 
     20 def buyer_inference_degraded(reason: String) raises -> BuyerInferenceOutcome:
     21     if String(reason).strip().byte_length() == 0:
     22         raise Error("buyer inference degradation requires a reason")
     23     return BuyerInferenceOutcome(
     24         status="degraded",
     25         resolved_lines=0,
     26         unresolved_lines=1,
     27         reason=String(reason),
     28     )
     29 
     30 
     31 def buyer_failure_means_unavailable_supply() -> Bool:
     32     return False