fix-rollbar (7996/465146160601): skip malformed args in PlannerStateVars_fromArgs#617
Open
astashovai wants to merge 1 commit into
Open
fix-rollbar (7996/465146160601): skip malformed args in PlannerStateVars_fromArgs#617astashovai wants to merge 1 commit into
astashovai wants to merge 1 commit into
Conversation
…ars_fromArgs When a Liftoscript function argument doesn't contain a colon separator (e.g. user mid-typing), the value portion is undefined. The existing guard only reported the error when an onError callback was provided, but the autocomplete code path calls without one, so execution fell through to .match() on undefined. Now we always continue past malformed arguments.
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.
Summary
PlannerStateVars_fromArgswhen a function argument string doesn't contain a:separatorvalue.split(":")produces a single-element array, leavingfnArgValStrasundefined, which then crashes on.match(/(lb|kg)/)onErrorwas provided, but the autocomplete code path inliftoscriptCodemirror.tscalls without itcontinuepast malformed arguments regardless of whetheronErroris setPlannerStateVars_fromArgscovering the edge casesRollbar
https://app.rollbar.com/a/astashov/fix/item/liftosaur/7996/occurrence/465146160601
Decision
Fixed — this is a real bug in our code that crashes the CodeMirror autocomplete while users are mid-typing function arguments in the Liftoscript editor.
Root Cause
PlannerStateVars_fromArgssplits each argument string on:to get[key, value]. When the user is still typing and the argument doesn't yet contain a:,fnArgValStrisundefined. The guard at line 14 only calledonError(and didn'tcontinue) when anonErrorcallback was provided. The autocomplete path calls withoutonError, so execution fell through tofnArgValStr.match(...)which threw.Test plan
PlannerStateVars_fromArgswith missing colon, empty string, and mixed valid/invalid args