Repository navigation
Draw a StateRefinement without from as an entry transition - #15
Merged
Merged
Conversation
The verifier uses the first StateRefinement of a method whose from matches, so one without from only goes from the states that the earlier ones do not cover. Beside StateRefinements with from it is also how an object in an unknown state enters the protocol, now in entryTransitions. Closes #14 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CatarinaGamboa
added a commit
to liquid-java/vscode-liquidjava
that referenced
this pull request
Oct 27, 2026
Brings [liquidjava-fsm#15](liquid-java/liquidjava-fsm#15) to the extension, released as liquidjava-fsm 0.2.2. The verifier uses the first `@StateRefinement` of a method whose `from` matches. A `@StateRefinement` without `from` beside ones with `from` is how an object whose state is unknown (a field, a parameter or a getter's result) enters the protocol. The parser now reports these as `entryTransitions`, and the diagram draws them as arrows from the initial node, labelled with the method and, when conditions are shown, its postcondition. - `server/pom.xml`: liquidjava-fsm 0.2.1 → 0.2.2 - `StateMachineDTO`: passes `entryTransitions` to the client - `diagram.ts`: draws `[*] --> to : method` for each entry transition, dimmed in focus mode like the constructor arrows - `fsm.ts`: an entry transition postcondition enables Expand Conditions The fsm PR's `EntryTransition` spec, with `new Edit().undo()` as the state error. `canUndo` (`return`) → `endDone` and `reset` → `start` now come out of the initial node: | Show all | Focus on error | Conditions collapsed | |---|---|---| | <img src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/169/entry-all.png" width="300"> | <img src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/169/entry-focus.png" width="300"> | <img src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/169/entry-collapsed.png" width="300"> | ## Tests - client: `vitest run` 110 passed, typecheck clean - server: `mvn test` 35 passed, against liquidjava-fsm 0.2.2 from Maven Central - checked in headless VS Code with the fixture above 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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 #14
What changes
The verifier tries a method's
@StateRefinements in declaration order and uses the first one whosefrommatches (AuxStateHandler.changeState). A@StateRefinementwithoutfromhasfrom = true, so:from=alternatives of the same method do not cover. A state counts as covered when an earlierfromnames it without a condition.from=alternatives, it also becomes aStateMachineEntryTransition(to, label, toCondition)in the newStateMachine.entryTransitionslist: how an object whose state is unknown (a field, a parameter, a getter result) enters the protocol. Clients can draw it as[*] --> to: label.@StateRefinementwith no alternatives keeps its edges from every state and gets no entry transition (it really applies in every known state, seeToOnlyTransition).For the UndoManager
canUndo()in the issue, the fourcanUndo [return] → endDoneedges are gone; instead there is one entry transition[*] → endDone: canUndo [return], plus the self-loops from thefrom=alternatives.Compatibility
StateMachinegets a new componententryTransitions. The existing 4- and 5-argument constructors are kept and default it to an empty list. The MCP'sget_state_machineand the VS Code extension will need a follow-up to render the new list.Tests
EntryTransition.javafixture: thecanUndospec from the issue, plus areset()whose from-less alternative still goes from the uncovered states.testToOnlyTransitionHasNoEntryTransition: a from-less refinement alone adds no entry transition.mvn test: 27 tests, 0 failures.🤖 Generated with Claude Code