Skip to content

Python: Clean up state in snapshot.ts, NFC #4057

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

Merged
merged 1 commit into from
May 2, 2025

Conversation

hoodmane
Copy link
Contributor

@hoodmane hoodmane commented Apr 30, 2025

This reduces the number of global variables in snapshot.ts from 8 to 2. The two new global variables are LOADED_SNAPSHOT_META which contains information about a snapshot we loaded and CREATED_SNAPSHOT_META which contains information about a snapshot we are in the process of creating.

@hoodmane hoodmane requested review from a team as code owners April 30, 2025 19:18
@hoodmane hoodmane force-pushed the hoodmane/cleanup-snapshot-metadata branch 5 times, most recently from dbb05b0 to 0ae138c Compare April 30, 2025 20:30
@hoodmane hoodmane requested review from dom96 and danlapid April 30, 2025 20:41
@hoodmane hoodmane force-pushed the hoodmane/cleanup-snapshot-metadata branch 2 times, most recently from 5e1ad0e to f1d33cb Compare May 2, 2025 16:09
Copy link
Contributor

@dom96 dom96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine... though this is a lot of changes and the code is rather tough to follow. Do we have good test coverage for this?

As a general comment, I also wonder if it's possible to avoid globals completely for this code. Can we have a SnapshotState class that is instantiated at the start and holds all of this state? Not something that needs to be done as part of this PR, but perhaps something to consider for future refactorings.

@hoodmane
Copy link
Contributor Author

hoodmane commented May 2, 2025

We do have quite good test coverage for this.

@hoodmane hoodmane force-pushed the hoodmane/cleanup-snapshot-metadata branch from f1d33cb to 3c2c42e Compare May 2, 2025 17:51
@hoodmane hoodmane merged commit dd199a4 into main May 2, 2025
18 checks passed
@hoodmane hoodmane deleted the hoodmane/cleanup-snapshot-metadata branch May 2, 2025 18:31
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.

2 participants