Skip to content

Run a specification against its own slice only - #1060

Merged
einari merged 13 commits into
mainfrom
fix/specifications-run-only-their-own-slice
Oct 25, 2026
Merged

einari merged 13 commits into
mainfrom
fix/specifications-run-only-their-own-slice

Conversation

@einari

@einari einari commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

A specification now runs against the slice that declares it, and nothing else, so it states only what its slice owns.

Added

  • then invokes <Command> states a command the slice's reaction invokes, with the values it passes indented beneath, as ESM v34. A specification that states at least one invocation compares every recorded invocation in count and order, or as a set under then events in any order.
  • PLAY0815 reports a malformed then invokes line, and PLAY0816 reports a then invokes for a command no reaction of the specification's own slice invokes.
  • A specification run's new Invocations property lists the invocations its reactions made, accepted or refused, as SemanticRecordedInvocation values.

Changed

  • Only the specification's own slice runs: its reactions, captures and outbound publications. Other slices' reactions, captures and publications no longer run, so their facts never reach then, read-model or query assertions. A command another slice owns is still decided when the slice's reaction invokes it, so refusals and on refused branches behave as declared, but its events are not kept. State that hand-over with then invokes. See decision 0115.
  • PLAY0285 follows only the reactions, invocations and publications of the specification's own slice, so a specification that states another slice's event is refused at compile time.
  • Upgrade: a specification that stated another slice's events now fails. Move a published event to the outbound Translate slice's specification (when append <PrivateEvent>), and replace an invoked command's events with then invokes <Command>.
  • The Acme Commerce sample specifies each slice on its own, with new specifications in the slices that own the moved facts.
  • The canonical reactions, Acme admissions, protected command reads and described command handlers corpora are restated under the new rule.

Fixed

  • A command specification no longer passes while stating an event another slice publishes, such as SetProductPrice stating ProductPriceChanged.

einari added 13 commits October 25, 2026 09:52
A specification states what its slice owns, so only that slice's behavior runs:
its own reactions, captures and outbound publications. A command another slice
owns is still decided for its outcome, so refusal branches work, but its facts
are not adopted. The compile-time outcome check follows the same rule, so a
specification that states another slice's event is refused as unreachable.
Each specification now states only what its own slice does: published events
move to the translation's specification, invoked commands' facts leave the
automation's specification, and the pinned bytes, revisions and outcomes are
regenerated.
The Release build's StyleCop rule SA1515 refused a comment directly
after a collection entry.
A specification's then section can state 'then invokes <Command>' with the
values the invocation passes, in both compilers. The statement prints,
walks, indexes as a command reference and appears in MCP declaration
details. PLAY0815 refuses a malformed line and PLAY0816 an invocation no
reaction of the specification's own slice can make (decision 0115).
A specification that states an invocation binds its command and the
stated non-generated property values, selects language and semantic
version 34 and serializes thenInvocations only when present, so every
earlier model keeps its version, bytes and revision. Readers below v34
refuse the member, and a stated invocation counts as a success outcome.
Move the slice-isolation properties and methods into the positions the
StyleCop ordering rules expect; no behavior changes.
A specification run records every invocation its slice's reactions make,
with the values sent and whether the command accepted it, and exposes them
as SemanticSpecificationRun.Invocations. When a specification states
'then invokes', the invocations must match in count and order (as a
multiset under 'then events in any order'), comparing only stated values.
Monaco and the VS Code grammar read 'then invokes <Command>' as a step,
Monaco completes it and keeps PLAY0815 on its marker, and the event model
board names stated invocations in the specification header.
Every specification now states only what its own slice does (decision
0115). Automations state the command they hand over to with then invokes,
facts of other slices' reactions and publications move to those slices,
and the commands those automations invoke gain their own accepted-path
specifications. The sample now selects ESM v34.
@einari einari added minor New features, non-breaking additions ai-corpus: tracked Language change; the AI corpus update is tracked in a linked Cratis/AI issue or PR labels Oct 25, 2026
@cratis-direct

cratis-direct Bot commented Oct 25, 2026

Copy link
Copy Markdown

Corpus impact: Cratis/AI#926

@einari

einari commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Corpus impact: Cratis/AI#926

Verification (local):

  • dotnet build Screenplay.slnx Debug and Release: 0 errors, Release 0 warnings.
  • dotnet test Screenplay.slnx -c Debug: every assembly green (Screenplay 13,814, Mcp 3,400 + 3 skipped, CanonicalVectors 706, ...). Tool specs run through .github/scripts/run-specifications.sh (235 passed); VSTest's "Catastrophic failure" on Tool predates this branch.
  • TypeScript Compiler / EventModels / Monaco: build, lint, test green (7,873 / 322 / 1,222).
  • screenplay test Samples/AcmeCommerce: 188 discovered, 186 passed, 0 failed, 2 unsupported (same two as on main).

Follow-ups: Stage and Studio pick this up after release; Studio's Acme sample spec SettingAPriceIsPublished is fixed here at the source.

@einari
einari merged commit 647b620 into main Oct 25, 2026
28 of 31 checks passed
@einari
einari deleted the fix/specifications-run-only-their-own-slice branch October 25, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-corpus: tracked Language change; the AI corpus update is tracked in a linked Cratis/AI issue or PR minor New features, non-breaking additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant