Skip to content

Stop requiring an id key in chart files and name the y-axis label form - #110

Merged
rishsriv merged 1 commit into
mainfrom
chart-spec-optional-id
Sep 13, 2026
Merged

rishsriv merged 1 commit into
mainfrom
chart-spec-optional-id

Conversation

@rishsriv

Copy link
Copy Markdown
Member

Chart files no longer need an id key. The chart format reference now marks id as optional and says that the y-axis label is a yAxisLabel string. The quick-chart step in the skill now lists the required keys itself. A quick chart that leaves out id now meets the documented format. The plugin version is now 0.35.0.

Fixes #109.

The reference required a key that nothing reads

references/output/chart-spec.md listed id as required. scripts/term_chart.py, the script that prints the chart preview, never reads id. It also never reads a y-axis key. No other part of the plugin uses a saved chart file's id. Nothing failed when the key was missing, so quick-chart runs often left it out. In the behaviour suite, two of three runs of the quick-chart-of-a-trend case saved a file without id and failed the format check. The runs also wrote the y-axis label in two ways: as yAxisLabel in one run and as a yAxis object in two.

The fix makes id optional and names one y-axis form

  • The chart format reference now requires only title, type, xField, series and data. It marks id as optional and says that no tool reads it. It says to write the y-axis label as a yAxisLabel string, not as a yAxis object. The field list has matching entries.
  • The quick-chart step in skills/factiq/SKILL.md now names the required keys and yAxisLabel. The model sees them without having to open the reference.
  • The behaviour-suite grader spec-is-a-valid-chartspec no longer requires id.
  • Version is 0.35.0 in both .claude-plugin/plugin.json and .codex-plugin/plugin.json.

Before and after

The "Minimal valid spec" section of references/output/chart-spec.md:

Before:

Required: `id`, `title`, `type`, `xField` (object with `key`), `series`
(array), `data` (wide-format rows — one object per x value, one key per
series).

After:

Required: `title`, `type`, `xField` (object with `key`), `series`
(array), `data` (wide-format rows — one object per x value, one key per
series).

Optional: `id` (a short slug; no tool reads it) and `yAxisLabel` (a plain
string such as `"Percent"`). Write the y-axis label as `yAxisLabel`, not as a
`yAxis` object.

Quick-chart step in skills/factiq/SKILL.md:

Before:

Quick-chart mode: build a
ChartSpec from wide-format data (see `references/output/chart-spec.md`), save
it to JSON, run `term_chart.py render`, ...

After:

Quick-chart mode: build a
ChartSpec from wide-format data (see `references/output/chart-spec.md`;
required keys are `title`, `type`, `xField`, `series`, `data`, and a y-axis
label goes in `yAxisLabel`), save it to JSON, run `term_chart.py render`, ...

Grader evals/quick-chart-of-a-trend/graders/spec-is-a-valid-chartspec.md:

Before: It is one JSON object with the keys id, title, type, xField, seriesanddata.

After: It is one JSON object with the keys title, type, xField, seriesanddata.

Tests

tests/test_sql_docs.py has three new tests in ChartSpecRequiredKeysTests:

  • test_id_is_not_a_required_key: checks that neither the reference's required list nor the skill's list of required keys includes id.
  • test_y_axis_label_form_is_stated: checks that the reference names yAxisLabel and rejects a yAxis object.
  • test_renderer_accepts_a_spec_without_id: renders a spec that has no id with term_chart.py and checks that the render succeeds.

python -m pytest tests/ -q: 72 passed. The behaviour suite was not run again for this change.

🤖 Generated with Claude Code

The chart format reference listed `id` as required, but the chart
previewer never reads it, so quick charts were often saved without it.
The reference now marks `id` as optional and says the y-axis label is a
`yAxisLabel` string, not a `yAxis` object. The quick-chart step in the
skill names the required keys directly. The behaviour-suite grader no
longer requires `id`. Plugin version is now 0.35.0.

Fixes #109

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rishsriv
rishsriv merged commit b1ac106 into main Sep 13, 2026
1 check passed
@rishsriv
rishsriv deleted the chart-spec-optional-id branch September 13, 2026 02:13
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.

Quick-chart mode writes a ChartSpec without the required id key

1 participant