Minor bug fix -- adds consistent application of .trim() in breakstrings.js - #1629
Draft
DoctorHaitch wants to merge 1 commit into
Draft
Minor bug fix -- adds consistent application of .trim() in breakstrings.js#1629DoctorHaitch wants to merge 1 commit into
DoctorHaitch wants to merge 1 commit into
Conversation
dqnykamp
requested changes
Aug 1, 2026
dqnykamp
left a comment
Member
There was a problem hiding this comment.
Great, can you add a regression test that fails without this change and passes with it?
For example, in boolean.test.ts, you could use this DoenetML
<boolean name="b">
<tupleList>
(1,0) (1,2)
</tupleList>
= <tupleList>(1,0) (1,2)</tupleList>
</boolean>
and assert that the value state variable of b is true.
DoctorHaitch
marked this pull request as draft
August 3, 2026 20:24
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
This PR fixes inconsistent whitespace handling when parsing tuple/list component strings in
breakstrings.js.Specifically,
.trim()was added to several component string parsing paths in:packages/doenetml-worker-javascript/src/components/commonsugar/breakstrings.jsThis brings the implementation into alignment across related parsing functions, ensuring component strings are treated consistently regardless of surrounding whitespace.
Motivation
Issue #1617 exposed cases where tuple/list parsing behavior differed depending on which helper function processed the input. Some code paths trimmed surrounding whitespace while others did not, leading to inconsistent parsing results and unexpected behavior.
By normalizing component strings with
.trim()throughout the relevant parsing logic, tuple/list handling becomes more predictable and consistent.Fixes #1617.
Changes
.trim()to several component string parsing operations inbreakstrings.jsImpact
This is a low-risk change that affects preprocessing of component strings prior to parsing.
Expected benefits include:
tupleListEquality Depends on Position of Closing</tupleList>Tag #1617Testing
Verified that tuple/list expressions containing leading and trailing whitespace are parsed consistently across the affected code paths and produce the same results as equivalent trimmed inputs.