Skip to content

fix: guard drawing points and unique ids - #109

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/drawing-id-guards-0692
Nov 10, 2026
Merged

cursor[bot] merged 1 commit into
mainfrom
cursor/drawing-id-guards-0692

Conversation

@joeblau

@joeblau joeblau commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Closes #95
Closes #96

Behavior

Checks run on addDrawing, updateDrawing, moveDrawingPoint, addIndicator, addPane, constructor config, and updateConfig. A rejected call throws chart-ts: and does not change the chart. Render is unchanged.

Tests

1911 tests passed. Coverage is 100% line, branch, and function. bun run typecheck:tsc passed.

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.

Case Before After
100000 setData sorted 0.6708 0.6778
100000 setData shuffled 28.1175 26.9731
100000 DataStore single bar append 0.0005 0.0005
100000 chart appendData streaming 0.1800 0.2081
100000 stored 200 visible redraw 0.7610 0.6976
100000 stored 200 visible live 0.7523 0.7475
100000 stored 5000 visible redraw 8.7469 7.4383
100000 stored 5000 visible live 5.9929 8.3882

Differences are run-to-run noise. Sorted setData moved 0.6708 ms to 0.6778 ms (about 1%).

Open in Web Open in Cursor 

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>
@cursor
cursor Bot merged commit 9a91a3a into main Nov 10, 2026
8 checks passed
@cursor
cursor Bot deleted the cursor/drawing-id-guards-0692 branch November 10, 2026 19:56
@joeblau joeblau mentioned this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants