Skip to content

fix(parser): re-emit bar/fill file references instead of corrupting them - #25

Merged
BenHuddart merged 1 commit into
mainfrom
claude/distracted-shaw-34eca6
Aug 6, 2026
Merged

BenHuddart merged 1 commit into
mainfrom
claude/distracted-shaw-34eca6

Conversation

@BenHuddart

Copy link
Copy Markdown
Owner

Summary

  • Add test coverage for the two recognizer-only FileSeries variants (series_type "bar" and "fill"), produced by parser/recognizer.py when a .gle file's bar/fill dataset references an external data file that can't be resolved. These had zero test coverage since the G1.1 typed-series refactor.
  • Writing the round-trip (fixed-point) tests surfaced a real bug: the writer had no dispatch for these two variants in Figure._write_axes_content, so on re-save:
    • "fill" raised KeyError: 'y_col' (it carries y1_col/y2_col, not y_col) — any recovered figure with a broken fill reference crashed on savefig.
    • "bar" silently fell through to the generic errorbar path, dropping the bar command and degrading a bar chart into a plain colored dataset.
  • Fixed by adding GLEWriter.add_bar_from_file and GLEWriter.add_fill_from_file, which re-emit the original data/bar/fill GLE shape verbatim (consistent with how the existing "line"/"errorbar" variants already behave — GLE still fails to compile due to the missing file, but that's an honest, expected failure rather than gleplot corrupting the model).

Test plan

  • New tests test_broken_bar_becomes_file_series_with_error and test_broken_fill_becomes_file_series_with_error in tests/parser/test_recognizer.py: construct a fixture, delete the backing .dat, assert the exact recognized FileSeries field set, and verify a two-cycle parse/save fixed-point round trip.
  • Full suite: pytest tests/ → 2085 passed, 2 skipped.
  • black --check clean on changed files.

🤖 Generated with Claude Code

Adding test coverage for the recognizer-only FileSeries 'bar'/'fill'
variants (produced when a bar/fill dataset's data file can't be
resolved) surfaced that the writer had no dispatch for them: 'bar'
silently degraded into a plain colored dataset, dropping the bar
entirely, and 'fill' raised a KeyError (it has y1_col/y2_col, not
y_col) on any re-save. Add add_bar_from_file/add_fill_from_file to
re-emit the original data/bar/fill shape verbatim, matching how the
line/errorbar variants already behave.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@BenHuddart
BenHuddart merged commit f6984b3 into main Aug 6, 2026
4 checks passed
@BenHuddart
BenHuddart deleted the claude/distracted-shaw-34eca6 branch August 6, 2026 05:42
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.

1 participant