Repository navigation
feat: the closed check, on the protocol - #56
Merged
Merged
Conversation
is_partition_closed(name, *, settle_seconds=0, boundaries=None) is a method of PartitionMetadataProvider in both mirrors. It was always the export pipeline's question: the archiving guide is written around it, and PartitionToolkit.from_engine takes a boundary_codec for that one call. But only the Postgres provider declared it, and the toolkit hands its provider back under the protocol's type, so under a type checker kit.metadata.is_partition_closed did not exist and a caller narrowed with isinstance first -- which is what the toolkit was built to make unnecessary. A provider of your own now has to answer it, the way the Postgres one does: True once the upper bound plus the settle buffer has passed on the database's clock, False rather than an exception when the bound cannot be read. A test holds every protocol method to the Postgres implementation's signature, in both mirrors, so the next method to land on the implementation alone is caught there.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
is_partition_closed(partition_name, *, settle_seconds=0, boundaries=None)joinsPartitionMetadataProviderin both mirrors.Why
PartitionToolkit.from_enginealways builds aPostgresMetadataProviderand hands it back askit.metadata: PartitionMetadataProvider. The closed check lived on the implementation only, so under a type checkerkit.metadata.is_partition_closed(...)did not exist and a consumer narrowed withisinstance(kit.metadata, PostgresMetadataProvider)first, which is what the toolkit was built to make unnecessary. The toolkit takes aboundary_codecfor that one call and the archiving guide has a section for it; the protocol just never listed it.What
tests/unit/test_protocols.py: every protocol method has the implementation's signature, and every public method of the implementation is on the protocol unless listed as Postgres-only (evaluate_sql_predicate,get_partition_boundaries,get_partition_column). Metadata and repository, both mirrors.boundaries=config.time_boundarieslike every other page.A provider of your own now has to implement the method: a stub without it no longer satisfies the protocol under a type checker. At runtime nothing changes until the method is called.
Checks
ruff, mypy (the package plus the new test module), 2792 unit tests. A consumer probe calling the method through
PartitionToolkit.from_engine(...).metadatatype-checks in both mirrors without narrowing.