Skip to content

validate_chart silently accepts nonexistent chartProperties and options keys #68

Description

@soh-tetsu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions