Skip to main content

Visualise a specification

This page draws the normative billing example, examples/billing/, from what the compiler makes of it. Nothing on it is typed by hand: cargo xtask site-data runs the real ess binary on a copy of the example, and task check fails when a committed recording differs from a fresh one.

The billing model, played​

The presentation below is written by ess-ui data from ess-ui-templates at the commit this site pins. Demo plays the model: every entity's lifecycle on one canvas, with instance tokens moving through their state machines while a run plays. Pick a run (the authored scenario, a synthesized scenario or a seeded run), then step, scrub or play it. Model is the reference: lifecycles, entities and relations, commands, events, views, and each declaration linked to its line in the example's source.

Every step it plays was executed at build time from the specification itself. The page only plays the recorded steps back.

The run it obliges​

The same specification synthesizes its conformance suite, and the suite runs against the built-in billing reference implementation:

ess / the billing example
ess specify validate --path examples/billing
billing v3 — 5 file(s), valid

ess specify compile --path examples/billing
billing v3 — 5 file(s), 26 declaration(s), compiled

ess verify conform synthesize --path examples/billing --out suite.json
note: the specification declares actors and serves no component, so enforcing a grant is the caller's, against the generated grant table, and no `<command>/grant/denied` scenario is owed
32 scenario(s) (0 authored), 0 refusal(s), written to suite.json

ess verify conform run --suite suite.json --target billing --report-format 2
Requires an empty logical modeled-instance/event/invocation namespace before each scenario setup; unrelated physical data need not be deleted.
Requires an empty logical modeled-instance/event/invocation namespace before each scenario setup; unrelated physical data need not be deleted.
billing v3 against billing-reference 0.85.0 — passed
  passed billing.email.SendEmail/outcome/failed
  passed billing.email.SendEmail/outcome/sent
  passed billing.invoice.CancelInvoice/outcome/cancelled
  passed billing.invoice.CancelInvoice/outcome/wrong-state
  passed billing.invoice.CreateInvoice/outcome/accepted
  passed billing.invoice.CreateInvoice/outcome/rejected
  passed billing.invoice.Invoice/invariant/after/billing.invoice.CancelInvoice/cancelled
  passed billing.invoice.Invoice/invariant/after/billing.invoice.CreateInvoice/accepted
  passed billing.invoice.Invoice/invariant/after/billing.invoice.IssueInvoice/issued
  passed billing.invoice.Invoice/invariant/after/billing.invoice.PayInvoice/settled
  passed billing.invoice.Invoice/state/Cancelled/refuses/billing.invoice.CancelInvoice
  passed billing.invoice.Invoice/state/Cancelled/refuses/billing.invoice.IssueInvoice
  passed billing.invoice.Invoice/state/Cancelled/refuses/billing.invoice.PayInvoice
  passed billing.invoice.Invoice/state/Draft/refuses/billing.invoice.PayInvoice
  passed billing.invoice.Invoice/state/Issued/refuses/billing.invoice.IssueInvoice
  passed billing.invoice.Invoice/state/Paid/refuses/billing.invoice.CancelInvoice
  passed billing.invoice.Invoice/state/Paid/refuses/billing.invoice.IssueInvoice
  passed billing.invoice.Invoice/state/Paid/refuses/billing.invoice.PayInvoice
  passed billing.invoice.Invoice/transition/cancel/by/billing.invoice.CancelInvoice/cancelled
  passed billing.invoice.Invoice/transition/issue/by/billing.invoice.IssueInvoice/issued
  passed billing.invoice.Invoice/transition/settle/by/billing.invoice.PayInvoice/settled
  passed billing.invoice.IssueInvoice/outcome/issued
  passed billing.invoice.IssueInvoice/outcome/wrong-state
  passed billing.invoice.Money/invariant/at/billing.invoice.InvoiceById/total
  passed billing.invoice.Money/invariant/at/billing.invoice.OutstandingInvoices/total
  passed billing.invoice.PayInvoice/outcome/rejected
  passed billing.invoice.PayInvoice/outcome/settled
  passed billing.invoice.PayInvoice/outcome/wrong-state
  passed notify-on-invoice-created/binding/delivery
  passed notify-on-invoice-created/binding/flow
  passed notify-on-invoice-created/binding/mapping
  passed notify-on-invoice-created/binding/on-failure
  32 scenarios: 32 passed, 0 failed, 0 error, 0 unsupported
ess built from this repository, recorded by `cargo xtask site-data` on a copy of examples/billing4/4 exit 0 · 3 ✓ · 0 ✕

Every scenario name in that suite comes from a declaration in the model: an outcome, a lifecycle transition, a state that refuses a command, an invariant, a binding. See Verify conformance for the commands and A specification and its contracts for the contracts generated from the same files.