Skip to content

Release 1.20.0

Choose a tag to compare

@reid-spencer reid-spencer released this 06 Apr 18:49
· 19 commits to main since this release

What's New

New reply Statement

New language construct for query handlers to send results back
to the sender without needing to know the sender's identity.

on query GetOrder {
  reply result OrderResult
}
  • Syntax: reply result SomeResult (or any message ref)
  • Classified as an executable statement for handler completeness
  • Query completeness check now accepts reply as satisfying
    the query→result requirement
  • Full support: parser, AST, EBNF, BAST (subtype 15), prettify,
    resolution, validation, and diagrams

Extended require Statement

The require statement now accepts either a literal string
condition or a named invariant reference:

invariant BalanceNonNegative is "balance >= 0"
handler H is {
  on command Withdraw {
    require invariant BalanceNonNegative
    // ... or the original form:
    require "amount > 0"
  }
}
  • New InvariantRef type in AST
  • Invariants defined but not referenced by any require invariant
    statement produce a UsageWarning
  • BAST subtype 14 format updated (condition-kind byte added)

New auto-id Entity Option

entity Order is { ... } with { option auto-id }

Instructs the entity to automatically obtain a unique ULID at
instantiation time. The entity must still define an Id type so
it can be referenced in messages and state fields.

New Validation Checks

Entity checks:

  • Entity Id type scope verification (three-level):
    • Inside entity body: warns to move to containing context
    • In containing context: correct, no warning
    • At domain level or beyond: warns scope is too broad
    • Not defined at all: warns missing
  • Event-sourced entity command handlers must emit events
  • Entities without query handlers flagged

Saga checks:

  • Saga step do-statements must contain tell command to
    effect state changes

Handler checks:

  • Empty on other clauses flagged (silently discards messages)

Streamlet checks:

  • Flow/Split/Router handlers must send to their outlets
  • Source streamlets must have on init or on other to
    generate data

Type checks:

  • Command types with no fields (skips placeholder definitions)
  • Event types not produced by any handler
  • Query types without corresponding result types (and vice versa)

BAST Format

FORMAT_REVISION bumped to 6. RequireStatement wire format changed
(added condition-kind byte) and ReplyStatement is new subtype 15.
Old BAST files are incompatible with this revision.

Compatibility

  • New language features: reply statement, require invariant
    form, auto-id option — all additive
  • BAST: Breaking change (revision 5 → 6), old .bast files
    must be regenerated
  • All existing APIs remain unchanged