engine: choice pseudostate resolution + validation (SPEC §5.5.1)#35
Merged
Conversation
Recognize choice nodes (a 'choice' branch list) as transient pseudostates, excluded from the active configuration. In run_transition, when a target resolves to a choice, run the triggering action, then resolve the branch chain in the source scope (first passing guard or the mandatory else; branch action runs; chained choices repeat) to a real target, then exit/enter as an external transition. Validate: exactly one else and last (collect_errors); branch targets resolve and the choice graph is acyclic (Machine build). Bundle the updated schema, bump to 0.0.2, add cases 23-25 to the harness, and add unit tests. Closes #34.
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.
Closes #34. Implements the choice pseudostate (spec: fruwehq/harel#30; cases: fruwehq/harel-conformance#8).
What
choicebranch list is a transient pseudostate (type=choice), never in the active configuration.run_transition): when a target resolves to a choice, the triggering action runs, then the branch chain is resolved in the source scope (first passing guard, or the mandatoryelse; branch action runs; chained choices repeat) to a real target, which is then entered as an ordinary external transition. Branch guards see esvs just assigned by the trigger — the dynamic behavior guarded lists can't do.else) branch, and it must be last (collect_errors→ load-time); branch targets resolve and the choice graph is acyclic (Machinebuild).main).Verify
tests/test_choice.py— dynamic branch, else, chained (parametrized), and four validation rejections (no else / else-not-last / cyclic / unresolved target). 129 unit tests, ruff + mypy clean.23-choice,24-choice-chain,25-choice-invalid(run locally against harel#30 + conformance#8; CI fetchesmainsince v0.0.2 isn't tagged yet).Note: this is 0.0.2 material (spec changed). Cut
v0.0.2on harel + harel-conformance when ready to snapshot.