Rejections

Every refusal in uftp: the 38 rejection reasons of UFTP §3.5 and the use cases, where each is defined, and refusal texts that are safe to log and send back.

On this page

The specification's reasons#

RejectionReason holds every reason UFTP 3.1 names, with the specification's text as its Display. They come from two places:

  • The 17 generic reasons of §3.5: Invalid Sender, Invalid Message, Unknown Recipient, Barred Sender, Duplicate Identifier, Already Submitted, ISP duration rejected, Time zone rejected, Invalid congestion point, Unknown reference ⟨field⟩, Reference Period mismatch, Reference message expired, Reference message revoked, ISPs out of bounds, ISP conflict, Period out of bounds and ExpirationDateTime out of bounds.
  • The 20 reasons the use cases of §3.6 to §3.10 name, such as Lacking Requested Disposition, Power discrepancy, Request mismatch, Price mismatch, Subordinate sequence and Flexibility procured.

Other(text) covers any other reasonable cause, which §3.5 allows.

reason.source() cites where a reason is defined, for example [UFTP §3.8.5, §3.9.3] for Price mismatch.

Which ones uftp decides#

The library applies every reason it can decide from the messages and the clock you pass. Some depend on your state: a revoked offer, a missing baseline, a CRO in closed mode, a lower revision than one already seen. Refuse those yourself:

return Err(opened.reject(Rejection::because(RejectionReason::ReferenceMessageRevoked,
    "FlexOffer 0303… was revoked at 13:00.")));

opened.reject attaches the message, so response(id, now) gives the Rejected answer.

The text#

Every refusal is one sentence. It says what is wrong, where (FlexRequest/ISP[2]/@MinPower), which rule ([UFTP §4.2.1], [XSD …]), and what is allowed:

FlexRequest/ISP[3]: ISP conflict: ISP 70 is addressed twice (ISPs 69–76 and ISP 70). [UFTP §4.2.1] each ISP in a period may only be addressed once

The sender controls much of the text inside a refusal, so received values and names are quoted with care:

  • line breaks, other control characters, bidirectional overrides and backticks are escaped;
  • each value is cut after 64 characters, or 128 bytes once escaped (an escaped bidirectional control takes eight);
  • no refusal is longer than 512 bytes.

A refusal can therefore be logged as one line and sent back as an HTTP body. A sender cannot forge a log line or inflate the answer.

The text of one refusal per kind and per reason is pinned by a snapshot test, so a change in wording shows up in review.