Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add save file format compatibility test #2319

Open
xsebek opened this issue Feb 9, 2025 · 0 comments
Open

Add save file format compatibility test #2319

xsebek opened this issue Feb 9, 2025 · 0 comments
Labels
T-Testing Involves the testing suite - unit and integration tests, also benchmarks. Z-Developer Experience This issue seeks to make life easier for developers writing Scenarios or other Swarm code. Z-Feature A new feature to be added to the game.

Comments

@xsebek
Copy link
Member

xsebek commented Feb 9, 2025

Is your feature request related to a problem? Please describe.

The change in #2312 mistakenly broke scenario "save" (best score) compatibility.
Luckily, it was found (and soon fixed in #2318) promptly, but a change like this should not get past CI.

Describe the solution you'd like

We should test that the best scores that a player has already saved can be parsed in CI.

Additive changes can extend the file, but a new file must be added once we have any required fields.

In the case of #2312:

  • add one file format for the previous tuple-like version
  • add a new file with the named field version, as it is required in the alternative parser

Describe alternatives you've considered

Unit tests for individual types would be nice, but they would not cover my use case. I want to make code refactorings fearlessly and not worry that I will break compatibility.

Additional context

I thought a bit about how we would maintain the files, and I think it would work like this:

  • if a new (optional!) best metric is added, we could add it to the latest test file or be pedantic and add a whole new test file
  • if a change is significant and has required fields, we could add a version tag to the top of the format and parse the rest accordingly
  • if the amount of test files grows too large, we could delete the ones from unsupported versions - players could migrate by starting swarm with newer versions (this would require overwriting the files with the new format, which we do not automatically do)

This may seem like a lot of pointless work for one accidental change, which could be undone, but:

  1. this change is good ™ and blocking format improvements would be annoying
  2. we should be mindful of this if we want players to happily upgrade to the latest version and not be sad that they have to start over
  3. if the test is fast, developers will be happy
@xsebek xsebek added T-Testing Involves the testing suite - unit and integration tests, also benchmarks. Z-Developer Experience This issue seeks to make life easier for developers writing Scenarios or other Swarm code. Z-Feature A new feature to be added to the game. labels Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Testing Involves the testing suite - unit and integration tests, also benchmarks. Z-Developer Experience This issue seeks to make life easier for developers writing Scenarios or other Swarm code. Z-Feature A new feature to be added to the game.
Projects
None yet
Development

No branches or pull requests

1 participant