Skip to content

State machine: green arrows where the called method is allowed, red crossed arrow from the actual state #206

Closed

Description

@CatarinaGamboa

Suggested by Jonathan for the study build. In focus mode the diagram marks the actual state (red cross) and the expected states (dotted), but every arrow of the called method is painted red, including the arrows from the states where the call is allowed. A1_01 today:

A1_01 focus today

setCompressionType is red on the self-loop of compressionTypeSet and on the arrow into it, which are exactly the places where calling it is right. And the red state compressionNotExplicit has no arrow for the call at all, because the spec has none, so nothing on the diagram says "this is the call that failed".

Change

Only facts from the spec and the verifier's error context, nothing derived from the graph (the diagram-derived "ways to fix" were dropped in #171 for ignoring guards and code).

  1. Green where the call is allowed. The transitions of the called method keep their guards and are coloured green (--lj-state-valid), arrow and label, instead of red. An unmet guard keeps its red text (lj-unmet-condition), so in A1_38 reset from open is a green arrow with mark(this) == marked in red.
  2. Red crossed arrow from the actual state. Each state of invalidStates (a possible state that rejects the call) gets a red self-loop labelled ✕ <method>: the attempted call, which the spec does not allow from there. When the actual state is unknown (possibleStates = all states, as in A1_09) there is no red arrow, only the green ones. When a transition of the called method already leaves an invalid state (a guard on another state set that is not met), that transition is drawn as the red crossed one instead of adding a loop.
  3. Legend gains the two arrows, each only when it is on the diagram: green arrow "Where <method> is allowed", red crossed arrow "The call, not allowed here". Existing items unchanged.
  4. Same colouring with Show all; dimming and collapsing unchanged; the summary line and Ways to fix unchanged.

Not in scope

Drawing a hint's path (#156), changing which states are dimmed or collapsed (#170), the Verification tab.

Check

Before/after screenshots of A1_01, A1_09 and A1_38 (the study's typestate tasks), light and dark. Unit tests in diagram-focus.spec.ts and fsm.spec.ts only where a test fails without the change.

Activity

  1. added
    enhancement
    study
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementstudy

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions