Axis 06 · Temporal: Does B follow A within a deadline?

A promise with a deadline. A confirmed order ships within a minute. The question is not whether it ships, but whether it ships in time, however the time between calls is spent.

The service shipped 90 seconds after confirming. The promise says 60. With nobody watching a clock, the order sat "in progress" for good.

Temporal<FulfilmentEvent>.AfterUntil(
	e => e is FulfilmentEvent.Confirmed,
	(_, next) => next is FulfilmentEvent.Shipped,
	TimeSpan.FromSeconds(60),
	isInterrupt: e => e is FulfilmentEvent.Cancelled)
		
  1. a cancelled order is excused

Or in the fluent form: After<Confirmed>().Then<Shipped>().Within(60s).

It chooses the delays itself: none, and just before and just after the deadline, so a deadline is both met and missed within a few tries. The clock is virtual, so a 60-second deadline costs milliseconds. It fails as vacuous if no run ever went past the deadline, since then the rule could never have failed.

Temporal failed.

Rule broken confirmed-ships-within-a-minute Noticed at +60s What happened No matching event within 00:01:00 after Confirmed Events recorded +0s Confirmed +90s Shipped Calls made wait 1s, Confirm

Law What must follow something within a deadline does, however the time between calls is spent. Consequence A deadline is missed under timing the tests never tried, so a stuck state is reported as in progress for good.

Smallest case found, after 5 shrinks. To run this case again: .Seed("0i1vmP3ChLc5")

How to read this:

  • Noticed at is when, after the first event, the deadline passed with nothing.
  • Events recorded shows the confirmation at +0s and the shipment at +90s: too late.
  • Calls made shows the delay the test chose before confirming.

You would have to pick a delay yourself, and you would pick one that works. The bug lives at the delay you did not try.

In docs-builder, a build that overruns half an hour is a rule: otherwise the editor's panel can say "building" forever.


Previous: 05 Absence · Next: 07 Liveness · All nine axes