Skip to content

Remove coerce.js function pass-through hack; fatal errors on unknown marker symbols#11

Merged
gatopeich merged 3 commits intomasterfrom
copilot/remove-coerce-fix-review-markers
Mar 22, 2026
Merged

Remove coerce.js function pass-through hack; fatal errors on unknown marker symbols#11
gatopeich merged 3 commits intomasterfrom
copilot/remove-coerce-fix-review-markers

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 22, 2026

The codebase had a special-case in coerce.js allowing raw JS functions to bypass enumerated value validation (added for custom marker symbols), and all symbol lookup failures silently fell back to symbol 0 (circle) with no indication of the bad input.

Changes

  • src/lib/coerce.js: Remove the typeof v === 'function' bypass in enumerated coercion. Functions are now treated as invalid and fall back to the attribute default like any other unrecognized value.

  • src/components/drawing/index.js:

    • symbolNumber(v): throws Error('Unknown marker symbol: ...') instead of returning 0
    • singlePointStyle(...): throws on null lookupSymbol result instead of silently falling back to lookupSymbol(0)
    • applyBackoff(...): throws on unrecognized end-marker symbol; preserves b = 0 when endMarker is legitimately absent
  • src/traces/scattergl/convert.jsgetSymbolSdf(...): throws on null lookupSymbol result instead of crashing later with a cryptic Cannot read property 'path' of null

Before / after behavior:

// Before: silently rendered a circle (symbol 0)
marker: { symbol: 'typo-symbol' }

// After: throws immediately
// Error: Unknown marker symbol: typo-symbol

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…unknown marker symbols

Co-authored-by: gatopeich <7722268+gatopeich@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gatopeich/plotly.js/sessions/faf05e5d-fbbf-4670-97b3-f5ee6a9ec6a0
Copilot AI changed the title [WIP] Remove coerce.js fix and review code related to markers Remove coerce.js function pass-through hack; fatal errors on unknown marker symbols Mar 22, 2026
Copilot AI requested a review from gatopeich March 22, 2026 11:42
@gatopeich
Copy link
Copy Markdown
Owner

@copilot OO encapsulation: The Error should be thrown from inside lookupSymbol

Copy link
Copy Markdown
Author

Copilot AI commented Mar 22, 2026

@copilot OO encapsulation: The Error should be thrown from inside lookupSymbol

Done in b9a942c. lookupSymbol now throws Error('Unknown marker symbol: ...') directly for every unrecognised input, and the null-check boilerplate has been removed from all call sites.

@gatopeich gatopeich marked this pull request as ready for review March 22, 2026 22:19
@gatopeich gatopeich merged commit c74c81d into master Mar 22, 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

Development

Successfully merging this pull request may close these issues.

2 participants