Skip to content

Compares exported positions and drives the diff cases - #25

Merged
johnnyt merged 1 commit into
mainfrom
srb-1kv-diff-cases-position-parity
Oct 24, 2026
Merged

johnnyt merged 1 commit into
mainfrom
srb-1kv-diff-cases-position-parity

Conversation

@johnnyt

@johnnyt johnnyt commented Oct 24, 2026

Copy link
Copy Markdown
Member

Bead: srb-1kv

What changes

The conformance runner (under test/conformance/, none of it ships) now completes the statifier suite:

  • The diff pair is driven, not compared. A host object's to_source, expect_diff, mapping and expect_compatible_at are accepted (UNCOMPARED_HOST_KEYS in Conformance::Drive) and compared by nothing, so a diff case is driven like any host case and agrees on its configurations and its sends. This follows the reference's harness at v2.16.0, whose moduledoc in lib/mix/statifier/corpus/host_case.ex says "this runner compares none of them". Any other unknown host key is still refused by name.
  • expect_position is compared. Once a step's configuration agrees, Conformance::PositionExpectation.at_step renders the state's position from Statifier.export_position as the reference's PositionExpectation.render/1 renders its export (lib/mix/statifier/corpus/position_expectation.ex at v2.16.0) and compares it as a JSON value:
    • configuration, entered_states, states_to_invoke: sorted id arrays;
    • history_values: each history id to its sorted recorded ids;
    • active_invocations: {state, index} per live invocation, sorted by state then index, the invoke id left out;
    • running: as exported;
    • datamodel: the position's tagged texts decoded, without _event, _ioprocessors and _sessionid, and without _name unless the <scxml> element carries a name attribute (the reference's drop_unset_name/2); the undefined value as null; a date, datetime or duration (or a list or map holding one) fails the step naming the variable.
    • A differing member is named with both values as JSON, "nothing" for an absent one, in the reference's wording.
  • A document with an unnamed state fails a case that states a position before the case is driven (the reference's named/1, counting every state but the root).
  • Step data. A step of a case stating a position sends its event's data, as the reference's harness does for every case it runs through run/2; before this, only a case with a host object did. No corpus case exercises the hostless form today; a test pins it.
  • The ratchet records the new passes (the ten diff cases and the four position cases): the statifier claim now holds every case of its suite, and the registry check passes over the whole run.
  • conformance/README.md says what the runner does with the diff pair and with expect_position, and drops the stale sentence that called the accepts keys unhonoured; README.md's claim table and its "not claimed yet" list follow the registry.

No lib/ change and no changelog fragment (a runner-only change, per changelog.d/README.md).

Evidence

  • Full gate (mise exec -- bundle exec rake) green on the committed tree: rubocop clean over 199 files; corpus:check agrees at v2.16.0; registry: 309 entries pass today, statifier: 0 of 36 cases not yet claimed; 622 runs, 0 failures; line coverage 99.81%, branch 96.46%.
  • New tests: test/conformance/position_expectation_test.rb (the rendering, the invocation shape, the _name rule, the date/datetime/duration refusal, the member-by-member reason, hostless step data, the unnamed-state refusal, the diff pair driven and uncompared). statifier_suite_test.rb now requires every case of the suite to pass and a case with one flipped position member to fail naming it.
  • Sabotage: each new test carries its mutation in a comment above it; every mutation of this change's own lines turned its named test red on an assertion, and each file was restored byte-equal before the next.

The conformance runner refused the statifier suite's ten diff cases by
naming their host keys, and refused the four cases that state an
exported position. The reference's harness drives a diff case like any
host case and compares none of to_source, expect_diff, mapping and
expect_compatible_at, so the runner now accepts the four keys and
compares nothing of them.

A step's expect_position is now compared, once its configuration
agrees, with the state's position exported and rendered as the
reference renders it: the id sets and history lists sorted, each live
invocation as its state and index, the running flag, and the datamodel
without _event, _ioprocessors and _sessionid, and without _name unless
the scxml element carries a name attribute, each value in its JSON
form. A date, datetime or duration value fails the step naming the
variable, and a case stating a position on a document with a state
that has no id fails before it is driven. A case stating a position
sends its steps' event data, as the reference's harness does.

Every statifier case passes, and the ratchet records the fourteen new
passes: the registry holds 309 entries, 36 of them statifier's.

Refs: srb-1kv
@johnnyt
johnnyt merged commit 5eef611 into main Oct 24, 2026
4 checks passed
@johnnyt
johnnyt deleted the srb-1kv-diff-cases-position-parity branch October 24, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant