Repository navigation
fix(client): show Lean error messages in typewriter mode - #580
Open
fushanbobfan wants to merge 1 commit into
Open
fushanbobfan wants to merge 1 commit into
fushanbobfan wants to merge 1 commit into
Conversation
Error.tsx turned messages into text with TaggedText_stripTags, which drops the content of MsgEmbed tags. Lean sends most message text inside expr embeds, so errors such as "Invalid rewrite argument ..." became empty and were not rendered. Read the text out of expr, goal, widget and trace embeds instead.
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.
What was wrong
Since #492, a failing tactic in typewriter mode shows "Failed command: rw [x]" but no error message, so the player does not see why it failed. This is the
should show error message when using invalid tactic calltest incypress/e2e/game-features.cy.ts, which has failed on Linux and macOS onmainsince #492 (it passed on the run before it, 2026-09-16).The diagnostic does reach the client: it is in the step's
diags.Error.tsxturns the message into text withTaggedText_stripTags, which only keeps the text under a tag and drops theMsgEmbeditself. Lean sends most of a message's text insideexprembeds, e.g.so the string comes out empty and
Errorrenders nothing.What this changes
Adds
messageToStringinclient/src/components/editor/messages/Error.tsx, which reads the text out ofexpr,goal,widget(itsalt) andtrace(itsmsg) embeds, and uses it in place ofTaggedText_stripTags. The "unsolved goals" handling is unchanged. The player now sees e.g.How it was tested
Cypress on Windows (Electron, dev server via
npm start). Running the editor on Windows needs the change from #567, so I tested this onmainplus #567:game-features.cy.ts:should show error message when using invalid tactic callfails without this change and passes with it (18 of 20 passing after). In the run without the change,should not change language of hints to selected language if translation is not availablealso failed once; it passed in every later run.01-basic-interface.cy.ts: 6/6 passing.should show goal and hint in editor mode("Current Goal") andshould show unsolved goals only in editor mode. Both look for editor-mode infoview content, which Refactor: eliminate old infoview implementations #492 lists as still to do, so I left them alone.npm run build:clientsucceeds;tscreports no errors inError.tsx.