Skip to content

Collapse the unrelated methods when focusing on a state error, listed on hover - #171

Open
CatarinaGamboa wants to merge 2 commits into
mainfrom
feat/focus-collapse
Open

CatarinaGamboa wants to merge 2 commits into
mainfrom
feat/focus-collapse

Conversation

@CatarinaGamboa

@CatarinaGamboa CatarinaGamboa commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #170.

Why

Focus mode dimmed the methods unrelated to a state error but kept their text, so the layout did not move (#158). On a large machine the dimmed label stacks still took the space. In the UDP chat client the state the error is about, closed, was below the fold.

What

In focus mode:

  • Collapse. The dimmed methods of each label become a count: receive + +9 more, or 2 methods. Overloads count once. A single dimmed method keeps its name and conditions.
  • List on hover. Hovering a count lists its methods, with their conditions, next to the label. A click keeps the list open until the next click, a pan or a zoom. The diagram is not laid out again, so the list appears at once. The list opens above the label when there is more room there.
  • Constructors. The constructors of each state are merged into one arrow, e.g. 4 constructors.
  • Layout. The diagram is laid out again. A tall diagram is shrunk to fit the panel, but never below 60%.
  • Bright. Only the failed method stays bright.
  • States. No state is removed.

Show all is unchanged.

An earlier version of this PR also drew a dashed "way to an expected state": a shortest path along the diagram's transitions. It was dropped. The path ignores the transitions' conditions and the code, and for a state that no call leaves (closed) it could only suggest creating a new object. The ways to fix now come from the verifier's hints only (#172).

Error categories (liquid-java/liquidjava#418) are not used to choose what to show. #170 explains why.

Screenshots

Real verifier output (0.0.36) in headless VS Code.

UDP chat client (E_OSS_A1_22): receive after an if that may close the socket. In the screenshots, the three from = "closed(this) && connected(old(this))" preconditions are removed from the DatagramSocket spec. With them, verifier 0.0.36 sends no state context or hints for this error, and the view can only say "Invalid method call at line 28". That is a verifier issue, separate from this PR.

Before After

On hover: +12 more next to bound, and 2 methods next to tilingExplicit with their conditions.

UDP ImageWriteParam

ImageWriteParam: setTiling from startTiling.

Before After
Show all (unchanged)

The collapsed "Ways to fix" section in the screenshots comes from the stacked PR.

Tests

  • npm run test:unit: 118 passed. New tests cover collapsing, the list on hover, pinning it with a click and closing it on a click, pan or zoom, opening it upward, merging constructors and the entry transitions from Draw entry transitions on the state machine #169, the fit to the panel, and Show all being unchanged.
  • tsc -p tsconfig.test.json and npm run lint: clean.
  • npm test (VS Code): 9 + 1 passing, and server mvn test: 35 passing, both run on the stacked branch, which includes this one.

Rebased on #169. In focus mode, entry transitions are dimmed and merged per state, the same way constructors are.

🤖 Generated with Claude Code

…k the ways to fix it

Focus mode dimmed the methods unrelated to a state error but kept their
text, so the layout did not move. On a large machine like DatagramSocket
the dimmed label stacks still took the space, and the state the error is
about was below the fold.

Focus mode now collapses the dimmed methods of each label into a count
named in its tooltip ("+9 more", "2 methods"), merges the constructors
of each state, and lays the diagram out again. A tall focused diagram is
shrunk to fit the panel, but never below 60%. Show all is unchanged.

Only the failed method and the ways to fix the error stay bright: a
shortest path along the diagram's transitions from each state that
rejects the call to a state that accepts it, drawn dashed in the colour
of the expected states. When no transition leads there, the constructors
of the expected states are the way, as the verifier's hint says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CatarinaGamboa CatarinaGamboa changed the title Collapse the unrelated methods when focusing on a state error and mark the ways to fix it Collapse the unrelated methods when focusing on a state error, expandable on click Oct 27, 2026
The shortest way along the diagram ignored the transitions' conditions and the
code, and fell back to "create a new object" for a dead-end state. Only the
failed method stays bright now; the verifier's hints are the ways to fix.

Hovering "+N more" or "N methods" lists the methods, with their conditions,
next to the label, and a click keeps the list until the next click, a pan, or a
zoom. The diagram is not laid out again, so the list shows at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CatarinaGamboa CatarinaGamboa changed the title Collapse the unrelated methods when focusing on a state error, expandable on click Collapse the unrelated methods when focusing on a state error, listed on hover Oct 27, 2026
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