Skip to main content
Unknown means two things, depending on where you meet it: Bijection sends each task at most once and records one result. Unknown is final. To learn what happened, @bijectionhq/library-recovery submits a separate read-only operation declared as the command’s status.

Declare the receiver’s status

The receiver stores the receipt under the idempotency key egress derives from the send’s once. Its read-only status operation answers for that same key. Declare a cutoff when the receiver refuses commands that arrive after it.
Set the receiver’s clock skew with delivery: { skew }. The default is 60 seconds.

Submit the reconciled command

reconciled(target) is a target with the same args, value and codes. Its result follows the command. An Unknown or successful reply rejected by confirmReply(value, key, args) starts status reads for the exact attempt.
  • the original receipt (conclude answers a result) becomes the result;
  • A miss stays inconclusive by default. To conclude Failed from a miss, declare authoritativeAbsence(answer, key, args). The response must cover the original receiver and attempt in the journal that records the effect. The journal must give authoritative reads, retain evidence for the declared once.retains, and commit evidence with the effect or provide an equivalent guarantee. Reads also have to follow the cutoff plus skew, with the answer still inside retention.
  • otherwise it reads again (probes, default 3, every, default one minute). Only when every read stayed inconclusive is the result Unknown, and that is final too.
within (default 7 days) bounds the command, the wait past its cutoff and every read. It lowers to submit with once, due and then. The status revision travels with outstanding work. Change it when the receiver account, journal, or interpretation of evidence changes. An outstanding command whose revision differs stays uncertain and needs application review. Use reconciled(target, { answeredBy: route, resolutionUnder: label, onResolved }) when the receiver can call a verified route. Its handler passes the task, original receiver key, and result to reconciliation(target).answer. After Unknown settles, a conclusive answer records one result at reconciliation(target).resolutions(task) and triggers onResolved. The task’s original Fate stays final. For ordered delivery, call ordered from the predecessor’s then. After Unknown, it schedules the next send at the predecessor’s commit plus the receiver’s delivery.requestExpiry and delivery.skew. The purchase orders example holds a budget reservation while a release is uncertain and frees or consumes it from the reconciled result.

Converge a goal fact

reconciler({ table, label, due, correct }) from @bijectionhq/library-work drives a goal fact toward its desired state. Each current turn runs one bounded page of corrections, keeps the next cursor in the fact’s cursor field (t.maybe(t.string)) and re-arms. correct(ctx, fact, page) answers the next cursor, or null at the end of the pass. Submit each correction with once: page.once(instance), which is ["reconcile", goal, instance, generation], so a replayed turn never submits a correction twice. A reconciler is a controller.