Skip to content

Show one state machine diagram per state set - #163

Merged
CatarinaGamboa merged 2 commits into
mainfrom
feat/115-multiple-state-machines
Oct 26, 2026
Merged

CatarinaGamboa merged 2 commits into
mainfrom
feat/115-multiple-state-machines

Conversation

@CatarinaGamboa

@CatarinaGamboa CatarinaGamboa commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #115. Uses liquidjava-fsm 0.2.1 (liquid-java/liquidjava-fsm#13).

Why

A class with several @StateSets, like ImageWriteParam with its tiling and compression states, was drawn as one diagram of the first state set. Every compression method ended up on the tiling diagram, and a compression error was marked on a tiling state: setCompressionQuality() in startCompression showed startTiling as rejected.

What

  • Server: liquidjava/fsm and StateRefinementErrorDTO now return one StateMachineDTO per state set (stateMachines, with a stateSet index), using StateMachineParser.parseAll from fsm 0.2.1.
    • The error context goes only on the diagrams whose transitions include the called method, and each one uses its own state set's part of the verifier's states.
    • A state is marked rejected only if no accepted state includes it, so a call that is rejected because of another state set doesn't blame this one. With one state set this gives the same marks as before.
  • View: the diagrams are stacked, each titled with its states. The diagram with the error comes first, and Focus on error dims the others. The summary combines the state sets the call involves. Copy Mermaid Source copies every diagram.
  • A class with one state set looks exactly as before.
  • The walkthrough mentions the per-state-set diagrams.

Arrows between state sets are left for later. A method that needs a state of the other state set keeps it as a condition, e.g. [compressionSet(this)].

Screenshots

Expert ImageWriteParam spec, in headless VS Code.

Tiling error: the tiling diagram comes first.

Tiling error

Focus on error: the compression diagram below it is dimmed.

Compression diagram dimmed

Compression error, before and after: before, it was drawn on the tiling diagram with startTiling marked rejected. Now it is on the compression diagram.

Before After
Before After

Show all:

Show all

Tests

Rebased on main after #165. The screenshots are from the build after #161.

🤖 Generated with Claude Code

CatarinaGamboa added a commit that referenced this pull request Oct 26, 2026
@CatarinaGamboa
CatarinaGamboa force-pushed the feat/115-multiple-state-machines branch from 7e17de0 to 6ae57ef Compare October 26, 2026 11:33
CatarinaGamboa added a commit that referenced this pull request Oct 26, 2026
CatarinaGamboa and others added 2 commits October 26, 2026 14:47
A class with several @stateset annotations, such as ImageWriteParam,
now has one diagram per state set. liquidjava/fsm returns the list from
liquidjava-fsm's parseAll, and a state refinement error carries
stateMachines instead of stateMachine.

The verifier names each state by its name in every state set, so the
error context of each diagram uses that state set's names. A state is
marked invalid only if no accepted state has it, so that a call like
write(), which needs a state in each state set, does not blame the
state set that is already right. The error is only put on the diagrams
of the state sets whose transitions have the called method.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The State Machine view stacks the diagram of each state set of a class,
such as the tiling and compression states of ImageWriteParam, under the
class name, each labelled with its states. A class with one state set
looks as before.

A state error is drawn on the diagrams of the state sets it involves,
which come first, and focusing on it dims the other diagrams. The
summary lists the rejected states of every state set and the allowed
states each one needs. Copy Mermaid Source copies every diagram.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CatarinaGamboa
CatarinaGamboa force-pushed the feat/115-multiple-state-machines branch from 6ae57ef to 902f4e8 Compare October 26, 2026 15:00
@CatarinaGamboa
CatarinaGamboa marked this pull request as ready for review October 26, 2026 15:02
@CatarinaGamboa
CatarinaGamboa merged commit 083e4db into main Oct 26, 2026
3 checks passed
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.

Show one state machine diagram per @StateSet

1 participant