Fix checker crashes silently passing validation as valid#11
Open
RPRKLR wants to merge 1 commit into
Open
Conversation
The two catch blocks in checkBehaviorReport() assumed every caught
error was a custom {path, error} object (as thrown by
Behavior.createStructureInfo / checkStatemachine). A real JS exception
(e.g. a TypeError from a bug in the checker) has no .error property, so:
- checking.js:189 pushed `error.error` == undefined onto
report.fatal_errors. checkBehavior() then returns fatal_errors[0]
== undefined, which callers read as "no error" -> a behavior that
actually failed the check could be saved or started as if valid.
- checking.js:199 called `error.path.replace(...)` unconditionally.
On a real exception .path is undefined, so this threw a second
TypeError inside the catch handler, masking the original error.
Both handlers now resolve a non-empty message
(error.error -> error.message -> String(error)), so a checker crash
always produces a real fatal error instead of undefined. The
container-navigation logic is guarded by `if (error.path != undefined)`
so it only runs for the custom {path, error} objects that carry a path.
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.
The two catch blocks in checkBehaviorReport() assumed every caught
error was a custom {path, error} object (as thrown by
Behavior.createStructureInfo / checkStatemachine). A real JS exception
(e.g. a TypeError from a bug in the checker) has no .error property, so:
Both handlers now resolve a non-empty message
(error.error -> error.message -> String(error)), so a checker crash
always produces a real fatal error instead of undefined. The
container-navigation logic is guarded by
if (error.path != undefined)so it only runs for the custom {path, error} objects that carry a path.