Adds Invoke.Handler conformance case - #216
Merged
Merged
Conversation
Publishes Statifier.Testing.HandlerCase (ADR-0065), a reusable
conformance case any Statifier.Invoke.Handler implementation runs
against itself alongside its own `use ExUnit.Case`:
- start/2, cancel/2, and forward/3 are checked deterministic and
observably effect-free; cancel of an unknown invoke_id must be a
no-op, never a raise.
- perform/2 is checked idempotent on invoke_id against an
implementor-declared observation point (observed_effects/1); a
handler that performs with no observation point declared flunks
naming the override to write, never passes silently.
- The library-half pins run with case-internal probe handlers under
the implementor's own type string: {:error, _} from start/2
surfaces as error.execution in a minimal driving chart, and
handler exceptions propagate un-rescued.
Every check is also a public function for suites that want them one
at a time; fixtures (invoke, ctx, event) are overridable. Documents
the case in docs/extending.md and adds a changelog fragment - a
published testing module is public API.
Refs: st-718j
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
Statifier.Invoke.Handlercontract (ADR-0051 decision 4,docs/extending.md) binds downstream implementations only as prose: planning callbacks must be pure,perform/2must be idempotent oninvoke_id, cancel of an unknown invocation must not raise,{:error, _}fromstart/2becomeserror.execution, and exceptions are never rescued by the library. st-718j asks for a mechanical pin any handler implementation can run against itself, so every host handler gets contract coverage from day one and the contract stays pinned by tests rather than docs alone.What
Statifier.Testing.HandlerCase(new, ADR-0065):used alongside the host's ownuse ExUnit.Casewithhandler:andtype:options, it generates seven conformance tests. Every check is also a public assertion function for suites that want them individually; fixtures (conformance_invoke/0,conformance_ctx/0,conformance_event/0) are overridable.observed_effects/1); a handler that routes work toperform/2with none declared flunks naming the override to write (fail-not-skip, ADR-0053), never passes silently.docs/extending.md; ADR-0065 records the shape decisions (split-useover a second CaseTemplate, probe pins, observation-point discipline).changelog.d/st-718j.md- a published testing module is public API.Notes
caller_context); ADR-0065 records caller-context-aware conformance assertions as a follow-up once that lands, not a rider here.testblocks in the test file, so the two chart-driven library pins were sabotage-verified againstStatifier.Session.Effects.plan_invoke/3and the mutations are documented in a comment above theusesite.mix qualitygreen (2,497 tests, 96.3% coverage) andmix quality --profile mergegreen including the ADR judge. Skips were not-applicable only (gettext).Closes: st-718j