Skip to content

Conversation

@fwdekker
Copy link
Owner

@fwdekker fwdekker commented Jan 26, 2025

Fixes issue #R37. Corrupted configs are automatically patched back into a valid state.

The issue was that the generator field was incorrectly not seen as transient, and therefore serialized to users' config files. However, a lambda cannot be (de)serialized! Therefore, when loading the config, an exception occurred.

Understanding how the serializer determines what to serialize was very tough. It's so tough, and so unclear (imo) that I decided to open an issue with JetBrains requesting that they either make it work as I expect it to, or better document how it works currently.

Until then, I have added a large number of tests that help verifying that serialization is successful. Previously, #551 introduced the "magical" mutate function to automatically mutate a State and see if this affects serialization. I have extended this idea with StateReflection, which is a general library for inspecting State classes generically (i.e. without knowing which state class it is) so that I can write automatically generated tests for serialization. Of course, those automated tests can also fail, so I also added a few manual tests that cover the most egregious cases.

Finally, this PR also

  • fixes a few rather outdated calls to lowercase giving the no-longer-required Locale parameter, and
  • moves various capitalisation helper functions to CapitalizationMode and better tests them.

@fwdekker fwdekker added bug Something isn't working documentation Improvements or additions to documentation labels Jan 26, 2025
@fwdekker fwdekker self-assigned this Jan 26, 2025
@codecov
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

Attention: Patch coverage is 88.63636% with 5 lines in your changes missing coverage. Please review.

Project coverage is 80.54%. Comparing base (f5f7400) to head (b2ec2a0).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #558      +/-   ##
==========================================
+ Coverage   80.37%   80.54%   +0.17%     
==========================================
  Files          51       51              
  Lines        2104     2128      +24     
  Branches      357      361       +4     
==========================================
+ Hits         1691     1714      +23     
- Misses        343      345       +2     
+ Partials       70       69       -1     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants