Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,22 @@ with a reference host's cases.

The cases under `conformance/cases/diff/` are in this world too, and they
prove the two questions a host asks before it moves an execution from one
chart to an edited one; nothing in them moves anything. Each pairs the
`hold_queue` chart with an edit of it: the host object carries the edited
chart as `to_source` and `expect_diff`, the class and reasons
chart to an edited one; nothing in them moves anything. Each pairs a
`hold_queue` or a `loan` chart with an edit of it: the host object carries
the edited chart as `to_source` and `expect_diff`, the class and reasons
`Statifier.Chart.diff/3` answers (ADR-0072 decisions 1 and 2), with the
`mapping` it is given where a case gives one. The emitter runs these cases
as it runs any host case; the class and the reasons, order included, are
compared by this repository's test suite
(`test/corpus/diff_cases_test.exs`), because nothing in `lib/` calls either
function (ADR-0072 decision 6). There is one pair per class: the same bytes
(identical), an added `<data>` key (compatible), and `awaiting_pickup`
function (ADR-0072 decision 6). Four `hold_queue` pairs are one per class:
the same bytes (identical), an added `<data>` key (compatible), and `awaiting_pickup`
renamed to `ready_for_pickup` with a mapping (mapped) and without one
(breaking). A case may also carry `expect_compatible_at`, what
`Statifier.Position.compatible_at?/3` answers (ADR-0072 decision 4) at the
position its steps leave the chart in: `Statifier.Position.export/1` holds
atoms, sets and tuples, so the case states no position, and every such
case's steps put `p-1`'s hold in `awaiting_pickup` with its pickup timer
hold case's steps put `p-1`'s hold in `awaiting_pickup` with its pickup timer
handed to the host. The predicate answers true when only `idle` is edited (a
breaking pair harmless at this position), false when a transition of
`awaiting_pickup` itself gains content (a compatible pair with no reasons),
Expand All @@ -153,6 +153,18 @@ state, and false for the rename with or without a mapping.
`schema/case.json` gives each reason as an object: `reason`, then the
members that reason carries.

Three more pairs take the loan while it waits for its copy to come back: a
`loan` chart whose execution starts in `awaiting_return` with its due-date
timer handed to the host, and whose `check_in` state routes the returned
copy after the wait. Each edit gives `check_in` a damaged outcome (a new
`damaged` key, a new `in_repair` final state and the transition to it),
and each is one class: with `awaiting_return` kept by id the pair is
compatible and the predicate answers true; with it renamed to
`awaiting_check_in` and a mapping given the pair is mapped and the
predicate answers false, since it takes no mapping; with it kept by id but
gathered with `overdue` under a new compound state the pair is breaking
and the predicate answers false.

The authored cases that came before the library world keep their own
domain: the four under `cases/send/` and the one under
`cases/system_variables/` are fixtures for the behaviour they pin, not
Expand Down
43 changes: 43 additions & 0 deletions conformance/cases/diff/loan_waiting_across_a_damaged_arm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"description": "A loan waits in awaiting_return with its due-date timer handed to the host while the loan chart is edited: the check-in step that routes after the wait gains a damaged outcome, a condition on a new damaged key sending the copy to a new in_repair final state ahead of the returned arm. awaiting_return is unchanged, id and content alike: the damaged outcome is the only edit. The diff reports the three additions and no breaking reason, so the pair is compatible; awaiting_return's transitions and onexit are byte-identical in both charts, so at this position the predicate answers true.",
"initial_configuration": [
"awaiting_return"
],
"steps": [],
"host": {
"send_types": [
"library:timer",
"library:route"
],
"expect_sends": [
{
"type": "library:timer",
"target": "loan",
"event": {
"name": "loan.due"
},
"delay_ms": 1814400000,
"send_id": "due"
}
],
"expect_diff": {
"class": "compatible",
"reasons": [
{
"reason": "state_added",
"state": "in_repair"
},
{
"reason": "transition_added",
"state": "check_in",
"t_index": 3
},
{
"reason": "data_added",
"data_id": "damaged"
}
]
},
"expect_compatible_at": true
}
}
33 changes: 33 additions & 0 deletions conformance/cases/diff/loan_waiting_across_a_damaged_arm.scxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" datamodel="predicator" initial="awaiting_return">
<datamodel>
<data id="copy_id" expr="'c-1'"/>
</datamodel>

<state id="awaiting_return">
<onentry>
<send type="library:timer" target="loan" event="loan.due" id="due" delay="21d"/>
</onentry>
<onexit>
<cancel sendid="due"/>
</onexit>
<transition event="copy.returned" target="check_in"/>
<transition event="loan.due" target="overdue"/>
</state>

<state id="overdue">
<transition event="copy.returned" target="check_in"/>
</state>

<state id="check_in">
<transition target="returned"/>
</state>

<final id="returned">
<onentry>
<send type="library:route" target="hold_queue" event="copy.available">
<param name="copy_id" expr="copy_id"/>
</send>
</onentry>
</final>
</scxml>
37 changes: 37 additions & 0 deletions conformance/cases/diff/loan_waiting_across_a_damaged_arm.to.scxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" datamodel="predicator" initial="awaiting_return">
<datamodel>
<data id="copy_id" expr="'c-1'"/>
<data id="damaged" expr="false"/>
</datamodel>

<state id="awaiting_return">
<onentry>
<send type="library:timer" target="loan" event="loan.due" id="due" delay="21d"/>
</onentry>
<onexit>
<cancel sendid="due"/>
</onexit>
<transition event="copy.returned" target="check_in"/>
<transition event="loan.due" target="overdue"/>
</state>

<state id="overdue">
<transition event="copy.returned" target="check_in"/>
</state>

<state id="check_in">
<transition cond="damaged" target="in_repair"/>
<transition target="returned"/>
</state>

<final id="returned">
<onentry>
<send type="library:route" target="hold_queue" event="copy.available">
<param name="copy_id" expr="copy_id"/>
</send>
</onentry>
</final>

<final id="in_repair"/>
</scxml>
51 changes: 51 additions & 0 deletions conformance/cases/diff/loan_waiting_across_a_mapped_rename.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"description": "The same edit with the waiting state's id changed as well: awaiting_return becomes awaiting_check_in, diffed with a mapping from the old id to the new. The mapping resolves the renamed state and its transitions match through it, so the pair is mapped, naming the one mapped state before the three additions the damaged outcome makes. A loan waits in awaiting_return with its due-date timer handed to the host, and at that position the predicate answers false: it takes no mapping, and awaiting_return does not resolve in the new chart.",
"initial_configuration": [
"awaiting_return"
],
"steps": [],
"host": {
"send_types": [
"library:timer",
"library:route"
],
"expect_sends": [
{
"type": "library:timer",
"target": "loan",
"event": {
"name": "loan.due"
},
"delay_ms": 1814400000,
"send_id": "due"
}
],
"mapping": {
"awaiting_return": "awaiting_check_in"
},
"expect_diff": {
"class": "mapped",
"reasons": [
{
"reason": "state_mapped",
"state": "awaiting_return",
"to_state": "awaiting_check_in"
},
{
"reason": "state_added",
"state": "in_repair"
},
{
"reason": "transition_added",
"state": "check_in",
"t_index": 3
},
{
"reason": "data_added",
"data_id": "damaged"
}
]
},
"expect_compatible_at": false
}
}
33 changes: 33 additions & 0 deletions conformance/cases/diff/loan_waiting_across_a_mapped_rename.scxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" datamodel="predicator" initial="awaiting_return">
<datamodel>
<data id="copy_id" expr="'c-1'"/>
</datamodel>

<state id="awaiting_return">
<onentry>
<send type="library:timer" target="loan" event="loan.due" id="due" delay="21d"/>
</onentry>
<onexit>
<cancel sendid="due"/>
</onexit>
<transition event="copy.returned" target="check_in"/>
<transition event="loan.due" target="overdue"/>
</state>

<state id="overdue">
<transition event="copy.returned" target="check_in"/>
</state>

<state id="check_in">
<transition target="returned"/>
</state>

<final id="returned">
<onentry>
<send type="library:route" target="hold_queue" event="copy.available">
<param name="copy_id" expr="copy_id"/>
</send>
</onentry>
</final>
</scxml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" datamodel="predicator" initial="awaiting_check_in">
<datamodel>
<data id="copy_id" expr="'c-1'"/>
<data id="damaged" expr="false"/>
</datamodel>

<state id="awaiting_check_in">
<onentry>
<send type="library:timer" target="loan" event="loan.due" id="due" delay="21d"/>
</onentry>
<onexit>
<cancel sendid="due"/>
</onexit>
<transition event="copy.returned" target="check_in"/>
<transition event="loan.due" target="overdue"/>
</state>

<state id="overdue">
<transition event="copy.returned" target="check_in"/>
</state>

<state id="check_in">
<transition cond="damaged" target="in_repair"/>
<transition target="returned"/>
</state>

<final id="returned">
<onentry>
<send type="library:route" target="hold_queue" event="copy.available">
<param name="copy_id" expr="copy_id"/>
</send>
</onentry>
</final>

<final id="in_repair"/>
</scxml>
61 changes: 61 additions & 0 deletions conformance/cases/diff/loan_waiting_across_a_regrouping.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"description": "The same damaged outcome with the waiting state kept by id but moved: the edit gathers awaiting_return and overdue under a new compound state checked_out. Each of the two can be active and now has another parent, so the pair is breaking, the two parent changes reported before the added checked_out and the three additions the damaged outcome makes. A loan waits in awaiting_return with its due-date timer handed to the host, and at that position the predicate answers false: the active state's parent differs, and awaiting_return without checked_out is not a legal configuration of the new chart.",
"initial_configuration": [
"awaiting_return"
],
"steps": [],
"host": {
"send_types": [
"library:timer",
"library:route"
],
"expect_sends": [
{
"type": "library:timer",
"target": "loan",
"event": {
"name": "loan.due"
},
"delay_ms": 1814400000,
"send_id": "due"
}
],
"expect_diff": {
"class": "breaking",
"reasons": [
{
"reason": "state_changed",
"state": "awaiting_return",
"fields": [
"parent"
]
},
{
"reason": "state_changed",
"state": "overdue",
"fields": [
"parent"
]
},
{
"reason": "state_added",
"state": "checked_out"
},
{
"reason": "state_added",
"state": "in_repair"
},
{
"reason": "transition_added",
"state": "check_in",
"t_index": 3
},
{
"reason": "data_added",
"data_id": "damaged"
}
]
},
"expect_compatible_at": false
}
}
33 changes: 33 additions & 0 deletions conformance/cases/diff/loan_waiting_across_a_regrouping.scxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" datamodel="predicator" initial="awaiting_return">
<datamodel>
<data id="copy_id" expr="'c-1'"/>
</datamodel>

<state id="awaiting_return">
<onentry>
<send type="library:timer" target="loan" event="loan.due" id="due" delay="21d"/>
</onentry>
<onexit>
<cancel sendid="due"/>
</onexit>
<transition event="copy.returned" target="check_in"/>
<transition event="loan.due" target="overdue"/>
</state>

<state id="overdue">
<transition event="copy.returned" target="check_in"/>
</state>

<state id="check_in">
<transition target="returned"/>
</state>

<final id="returned">
<onentry>
<send type="library:route" target="hold_queue" event="copy.available">
<param name="copy_id" expr="copy_id"/>
</send>
</onentry>
</final>
</scxml>
Loading
Loading