Skip to content

Conversation

@disconcision
Copy link
Member

Fixes #2099

The exercise module export was using Zipper.show() which tried to serialize refractors.autos containing Id.Map.t(unit). The Id.Map.pp function output debug-style text that was not valid OCaml syntax, resulting in blank fields like ids = ; in the exported .ml file.

Changes:

  • Add Refractors.for_serialization to reset non-persistable fields (autos, sample_cursor) before serialization, keeping only manuals
  • Update Id.Map.pp to output valid OCaml for empty maps, fail explicitly for non-empty maps with a helpful error message
  • Use for_serialization in Exercise.editor_pp before calling Zipper.show()

This aligns with the existing design where only manuals is persisted (see state location docs in Refractors.re).

Fixes #2099

The exercise module export was using Zipper.show() which tried to serialize
refractors.autos containing Id.Map.t(unit). The Id.Map.pp function output
debug-style text that was not valid OCaml syntax, resulting in blank fields
like `ids = ;` in the exported .ml file.

Changes:
- Add Refractors.for_serialization to reset non-persistable fields (autos,
  sample_cursor) before serialization, keeping only manuals
- Update Id.Map.pp to output valid OCaml for empty maps, fail explicitly
  for non-empty maps with a helpful error message
- Use for_serialization in Exercise.editor_pp before calling Zipper.show()

This aligns with the existing design where only manuals is persisted (see
state location docs in Refractors.re).

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.39%. Comparing base (b90744a) to head (abe9c7b).

Files with missing lines Patch % Lines
src/util/Id.re 0.00% 2 Missing ⚠️
src/haz3lcore/zipper/Refractors.re 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2103      +/-   ##
==========================================
+ Coverage   50.37%   50.39%   +0.01%     
==========================================
  Files         230      230              
  Lines       25368    25368              
==========================================
+ Hits        12780    12783       +3     
+ Misses      12588    12585       -3     
Files with missing lines Coverage Δ
src/haz3lcore/zipper/Refractors.re 47.82% <0.00%> (-2.18%) ⬇️
src/util/Id.re 32.65% <0.00%> (+0.65%) ⬆️

... and 16 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Refractors create syntax errors in exercise modules

1 participant