Repository navigation
fix: guard drawing points and unique ids - #109
Merged
Merged
Conversation
Reject non-finite or too-short drawing points before normalize, and reject duplicate indicator or drawing ids plus indicator ids that collide with main or a custom pane. Co-authored-by: Joe Blau <joeblau@users.noreply.github.com>
Merged
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.
Closes #95
Closes #96
Behavior
Checks run on
addDrawing,updateDrawing,moveDrawingPoint,addIndicator,addPane, constructor config, andupdateConfig. A rejected call throwschart-ts:and does not change the chart. Render is unchanged.minPointspoints, beforenormalizeruns.long-positionwith[]andsignpostwith aNaNindex throw instead of being stored and breaking every later frame.addIndicator/addDrawingthrowchart-ts: duplicate indicator "x"andchart-ts: duplicate drawing "x". An indicator id ofmain, or one that matches a custom pane, throwschart-ts: indicator id "…" collides with a pane. A pane id ofmainor of an existing indicator throws the same way.Tests
1911 tests passed. Coverage is 100% line, branch, and function.
bun run typecheck:tscpassed.Benchmarks
node bench/suite/run.mjs --samples=7 --sizes=100000, Node 24, median ms/op, back to back. These guards are not on the timed paths.Differences are run-to-run noise. Sorted
setDatamoved 0.6708 ms to 0.6778 ms (about 1%).