Skip to content

fix-rollbar (7996/465146160601): skip malformed args in PlannerStateVars_fromArgs#617

Open
astashovai wants to merge 1 commit into
astashov:masterfrom
astashovai:fix/rollbar-465146160601
Open

fix-rollbar (7996/465146160601): skip malformed args in PlannerStateVars_fromArgs#617
astashovai wants to merge 1 commit into
astashov:masterfrom
astashovai:fix/rollbar-465146160601

Conversation

@astashovai

Copy link
Copy Markdown
Contributor

Summary

  • Fix TypeError crash in PlannerStateVars_fromArgs when a function argument string doesn't contain a : separator
  • The value.split(":") produces a single-element array, leaving fnArgValStr as undefined, which then crashes on .match(/(lb|kg)/)
  • The existing guard on line 14 only reported the error when onError was provided, but the autocomplete code path in liftoscriptCodemirror.ts calls without it
  • Now we continue past malformed arguments regardless of whether onError is set
  • Added unit tests for PlannerStateVars_fromArgs covering the edge cases

Rollbar

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_fromArgs splits each argument string on : to get [key, value]. When the user is still typing and the argument doesn't yet contain a :, fnArgValStr is undefined. The guard at line 14 only called onError (and didn't continue) when an onError callback was provided. The autocomplete path calls without onError, so execution fell through to fnArgValStr.match(...) which threw.

Test plan

  • Unit tests added and passing for PlannerStateVars_fromArgs with missing colon, empty string, and mixed valid/invalid args
  • All 830 existing unit tests pass
  • Build succeeds
  • Lint passes

…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.
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