Skip to content

Adds Statifier.report_send_failed for a send a host could not deliver - #23

Merged
johnnyt merged 1 commit into
mainfrom
srb-1xq-report-send-failed
Oct 24, 2026
Merged

johnnyt merged 1 commit into
mainfrom
srb-1xq-report-send-failed

Conversation

@johnnyt

@johnnyt johnnyt commented Oct 24, 2026

Copy link
Copy Markdown
Member

Bead: srb-1xq

What

Statifier.report_send_failed(machine, state, send, **options) lets a host tell a chart that a send it was handed could not be delivered. The chart takes error.communication on its internal queue, as the reference's Statifier.Session.failed_send/3 writes it (statifier-ex at v2.16.0, lib/statifier/session.ex): the event's origin is the send's content, its sendid is the send's id whether or not the author named it, and it carries no data. The chart then runs to a stable configuration and takes its external queue, as Statifier.step does. The result has the shape of the driver's other calls (ok?, value, error), its value a Statifier::Driver::Moved.

  • Once the chart has stopped the report is refused with :not_running; while a macrostep's round budget has halted it, with :halted. Nothing is written in either case, as the reference's session drops a report to a sender halted :done, :cancelled or :budget_exhausted.
  • The options are reason: (the host's own account; not read, and the chart is not handed it, as the reference does not read failure), processors: and clock:. An unknown option, a state that is not an execution of machine, or processors naming other types raise ArgumentError; a machine, state or send of the wrong kind raises TypeError.
  • A synchronous failure: a processor's deliver may answer Statifier::Driver::DeliveryFailure.new(reason:), and the same event is raised within the call that handed the send, at its place, as the reference raises the failure its processor plans in deliver/3 (the Basic HTTP processor's no-target clause in lib/statifier/send/basic_http.ex). That failure counts against the call's round budget with the undelayed sends to #_internal, so a chart that sends again on every failure halts.

The conformance runner (Conformance::Host#report and Conformance::Calls in the test tree) reports a send whose expected item carries "outcome": "fail" once the driver call that handed it returns, before the configuration is read, as the reference's harness does in pump/3 of lib/mix/statifier/corpus/host_case.ex; a report refused because the chart has stopped or halted is dropped. The ratchet records statifier/send/registered_send_failed, so the statifier claim follows its entries.

Tests

  • FailuresTest (driver): the event's fields for an author-named and a generated send id; the drain after the report; the stopped and halted refusals; the argument checks; a DeliveryFailure raising the event within the call; the round budget bounding a chart that resends on every failure.
  • HostTest (runner): a send marked failed is reported before the configuration is read, an unmarked one is not, and a report to a stopped chart is dropped.
  • StatifierSuiteTest: the failed-send case is no longer among the cases left.

Every new test that asserts behaviour carries its sabotage note; each mutation was applied, turned its test red on an assertion, and was restored byte-equal.

Gate

The full gate (mise exec -- bundle exec rake) ran green on the committed tree: rubocop clean, the corpus check, the registry check (every entry passes), and the test suite with 0 failures under the coverage minimum. The commit was made with no change between that run and the commit.

Provenance

The method's name follows statifier-ts's reportSendFailed in snake case (decided by the conductor under a standing consent, 2026-10-23). These engineering choices were taken in the bead and are open to the review:

  • The method takes the compiled chart, as the bead's acceptance states, though Statifier.step and Statifier.advance take only the state; the chart is checked against the state's own machine (equal by value, so a fresh compile of the same source is accepted). Dropping the parameter before 0.1.0 is a one-line change.
  • The keywords are taken as **options and checked against a defaults table, as Statifier.start takes its options; the unknown-option check is shared with start's through one helper in Statifier::Driver::Checks.
  • :halted is a new refusal for a report to a budget-halted chart, where the reference drops it silently: a refusal tells the host the miss is its own to record.
  • The synchronous failure is an answered value, Statifier::Driver::DeliveryFailure, following statifier-ts's DeliveryFailure; an exception raised by deliver still propagates unchanged.
  • The hand-off to a processor moved from Statifier::Driver::Routing into a new internal module, Statifier::Driver::Delivery, beside the failed-send write; Routing.communication_error takes the sendid as a keyword so both paths build the event in one place.
  • The bead's acceptance says the event is "queued for the next step"; the report follows the reference, whose failed_send/3 delivers the event and runs the chart to quiescence within the call.

A send an invoked child handed is reported against the session the state is for; routing a report to a child session is not part of this change.

A host whose processor cannot deliver a send it was handed now tells
the chart, which takes error.communication with the send's id, as the
reference's Statifier.Session.failed_send/3 writes it: the event's
origin is the send's content and its sendid is the send's id whether
or not the author named it. The report runs the chart to a stable
configuration and then takes its external queue, as a step does. It
is refused with :not_running once the chart has stopped and with
:halted while a round budget has halted it, where the reference's
session drops the report.

A processor that knows of the failure while it is handed the send
answers Statifier::Driver::DeliveryFailure from deliver, and the same
event is raised within that call, at the send's place, as the
reference raises the failure its processor plans in deliver/3. Such a
failure counts against the call's round budget, so a chart that sends
again on every failure halts.

The conformance runner reports a send whose expected item asks for
it once the call that handed it returns, before the configuration is
read, and the ratchet records statifier/send/registered_send_failed.

Refs: srb-1xq
@johnnyt
johnnyt merged commit 5718bde into main Oct 24, 2026
4 checks passed
@johnnyt
johnnyt deleted the srb-1xq-report-send-failed branch October 24, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant