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

Store snapshot assertion index in snapshot file #569

Open
noahnu opened this issue Nov 3, 2021 · 5 comments
Open

Store snapshot assertion index in snapshot file #569

noahnu opened this issue Nov 3, 2021 · 5 comments
Labels
breaking change serializer Syrupy serializer question

Comments

@noahnu
Copy link
Collaborator

noahnu commented Nov 3, 2021

We had to wrap custom names in square brackets because our "does assertion name match name in file" logic is brittle. See: #563 and related PR.

@noahnu noahnu added serializer Syrupy serializer question breaking change labels Nov 3, 2021
@noahnu noahnu added this to the v2.0.0 milestone Nov 3, 2021
@iamogbz
Copy link
Collaborator

iamogbz commented May 8, 2022

Damn this was missed in the v2 release, could probably have merged both number and string indexes to use the same pattern e.g # name: TestClass.test_class_method_name[1]

@iamogbz
Copy link
Collaborator

iamogbz commented May 8, 2022

Maybe a larger change (since it's gonna be breaking) would be to split the index from the name in the snapshot header e.g.

# ---
# name: TestClass.test_class_method_name[parameterized1]
# index: 1

@iamogbz
Copy link
Collaborator

iamogbz commented Jul 4, 2023

Hey 👋🏾 trying to figure how this can work with the current state of things, would it require a new snapshot file version, how does it work with TaintedSnapshotError? Catching up on the code base, but comments would be appreciated.

Also don't see any more tasks queued in project/up next, so prioritising the oldest/easiest issues.

@noahnu
Copy link
Collaborator Author

noahnu commented Jul 5, 2023

I'll try find some time towards the end of this week to do some general project maintenance (comments + prioritized backlog).

Will give a longer answer when at my computer but in general yes, we'd need a new serializer version. A new serializer version will automatically leverage the tainted snapshot error to force snapshots to be considered "invalid" and require updates. This is necessary because adding additional metadata around a snapshot, e.g. index, does not actually cause a snapshot inequality/failed match. So as long as you change the version, you don't have to worry about the taint error (it's automatic).

If you're interested, I think the old issue around supporting extremely large snapshots would be a good one to pick up.

@iamogbz
Copy link
Collaborator

iamogbz commented Jul 20, 2023

I think this would need to be implemented with some backwards compatibility even if the version is incremented so that snapshot discovery can still be done on the old versions while issuing the warning. Except it's a straight up breaking change? Also thinking of picking this up now since the other todos are non blocking, thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change serializer Syrupy serializer question
Projects
None yet
Development

No branches or pull requests

2 participants