Skip to content

Commit 609c6db

Browse files
Name states explicitly in the state error summary
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 08b0dc8 commit 609c6db

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎client/src/webview/views/fsm/fsm.spec.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe('state machine view', () => {
120120
renderStateMachineView(document.body, errorMachine, diagram, 'TB', false, true);
121121

122122
const summary = document.querySelector('.diagram-error-text')!;
123-
expect(summary.textContent).toBe('socket.receive() is rejected when socket is closed \u00B7 allowed when bound');
123+
expect(summary.textContent).toBe('socket.receive() is rejected when socket is in state closed \u00B7 allowed in state bound');
124124
expect(Array.from(summary.querySelectorAll('code'), node => node.textContent)).toEqual(['socket.receive()', 'socket', 'closed', 'bound']);
125125
expect(button('diagram-focus-btn').textContent?.trim()).toBe('Show all');
126126

@@ -137,19 +137,19 @@ describe('state machine view', () => {
137137
},
138138
}), diagram, 'TB', false, true);
139139

140-
expect(document.querySelector('.diagram-error-text')?.textContent).toBe('root.getFirstChild() is rejected when root is childrenAllowed');
140+
expect(document.querySelector('.diagram-error-text')?.textContent).toBe('root.getFirstChild() is rejected when root is in state childrenAllowed');
141141
});
142142

143143
it.each([
144144
[
145145
'the state of the receiver is unknown',
146146
{ possibleStates: ['unbound', 'bound', 'connected', 'closed'] },
147-
'socket.receive() is rejected: the state of socket is unknown here \u00B7 allowed when unbound or bound or connected',
147+
'socket.receive() is rejected: the state of socket is unknown here \u00B7 allowed in state unbound or bound or connected',
148148
],
149149
[
150150
'every possible state accepts the call',
151151
{ possibleStates: ['bound'] },
152-
'socket.receive() is rejected here \u00B7 allowed when bound',
152+
'socket.receive() is rejected here \u00B7 allowed in state bound',
153153
],
154154
])('summarizes the error when %s', (_, errorContext, summary) => {
155155
renderStateMachineView(document.body, machine({

‎client/src/webview/views/fsm/fsm.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ function renderStateErrorSummary(focus: StateErrorFocus, focusOnError: boolean):
6565
if (focus.unknownState) {
6666
summary = `${rejected}: the state of ${receiver} is unknown here`;
6767
} else if (focus.invalidStates.length > 0) {
68-
summary = `${rejected} when ${receiver} is ${renderStates(focus.invalidStates)}`;
68+
summary = `${rejected} when ${receiver} is in state ${renderStates(focus.invalidStates)}`;
6969
} else {
7070
summary = `${rejected} here`;
7171
}
72-
if (allowedStates.length > 0) summary += ` \u00B7 allowed when ${renderStates(allowedStates)}`;
72+
if (allowedStates.length > 0) summary += ` \u00B7 allowed in state ${renderStates(allowedStates)}`;
7373
return /*html*/`
7474
<div class="diagram-error-summary">
7575
<p class="diagram-error-text">${summary}</p>

0 commit comments

Comments
 (0)