fix: Pass snapshot_id as keyword argument to RemoveStatisticsUpdate #2694
+38
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2558
Rationale for this change
When removing snapshots with statistics,
RemoveStatisticsUpdatewas being instantiated with a positional argument, which, as suggested by @vndv, "violates Pydantic's BaseModel requirement that all fields be passed as keyword arguments". Shout out to @vndv for catching this 🚀This caused a
TypeError: BaseModel.__init__() takes 1 positional argument but 2 were givenwhen callingtable.maintenance.expire_snapshots().older_than(...).commit().Are these changes tested?
Yes, and a new test was added.
Existing tests only tested the
RemoveStatisticsUpdatedirectly, but didnt test the code path throughRemoveSnapshotsUpdatethat triggers the bug.Added
test_update_remove_snapshots_with_statisticstotest_expire_snapshots.pyto extend coverage for the condition.Are there any user-facing changes?
No.