microsoft / microsoft/flint-chart

validate_chart silently accepts nonexistent chartProperties and options keys

Open
#68 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.2k
Forks
235
Avg merge
17h 45m
Merged PRs (30d)
11

Description

Summary

validate_chart silently accepts nonexistent chartProperties and options keys — it returns valid: true, warnings: []. Agents (and humans) get no signal that a knob does not exist, so they retry blindly.

Verified against flint-chart@0.3.0. Source refs at main (commit 95b2552).

Repro

{
  "chart_spec": {
    "chartType": "Line Chart",
    "encodings": { "x": { "field": "x" }, "y": { "field": "y" } },
    "chartProperties": { "lineWidth": 5, "pointSize": 12, "totallyFakeKnob": true }
  },
  "options": { "fontSize": 18, "bogusOption": "xyz" }
}

{ "valid": true, "warnings": [], "errors": [] }

None of lineWidth, pointSize, totallyFakeKnob, fontSize, bogusOption exist for a Line Chart, yet nothing is reported.

Root cause

packages/flint-js/src/core/normalize-properties.ts (normalizeChartProperties) validates discrete property values against the template's declared options, but never checks whether a chartProperties key exists in chartTemplate.properties. options keys are not validated at all. No unknown-key check exists in the pipeline.

Suggested fix

In normalizeChartProperties (and/or the validate path), diff the incoming keys against the template's known option keys (chartTemplate.properties.map(p => p.key) — the same model that drives the customization panel) and the recognized AssembleOptions names, and push a warning per unknown key:

unknown chartProperty "lineWidth" for Line Chart; available: [cornerRadius, ...]

Keep it a warning, not an error, for forward compatibility.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/flint-js/src/core/normalize-properties.ts at normalizeChartProperties, then trace the validate path and the chart template properties model. Run the supplied validate_chart reproduction and inspect how AssembleOptions names are represented. Done means unknown chartProperties and options produce individual warnings while recognized keys and forward-compatible inputs remain valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.