Repository navigation
feat: a plan says what it will lock, on paper as well as in memory - #41
Closed
AlexeyShalaev wants to merge 1 commit into
Closed
AlexeyShalaev wants to merge 1 commit into
AlexeyShalaev wants to merge 1 commit into
Conversation
Every operation carried its capabilities -- the heaviest lock it takes and on what, and whether it can run inside a transaction block -- as a property, so the plan a file held had lost the one thing a DBA reads before agreeing to a window. capabilities and is_destructive are now computed fields: serialized on the way out, ignored on the way in, so the round trip holds and a saved plan is reviewable for its locks without the CLI. plan --locks prints the same for a person, one operation per line and the lock beneath it, with the operations that cannot run inside a transaction block marked: they are the ones a crash leaves half-done. There is deliberately no --sql. The DDL is built at execution time from decisions only made then -- a concurrent detach falling back to the blocking form, rows moved out of a DEFAULT partition, an orphan marker cleared -- and a rendering without them would be read as a transcript in exactly the cases a review exists to catch. The plan is the contract: what, why, how big, and what it locks.
This was referenced Sep 1, 2026
Member
Author
|
Folded into #43, one PR for the whole epic; this branch stays for history. |
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.
The answer to "
plan --sql" from the status comment, after measuring what it would cost.What is here. Every operation carried
capabilities— the heaviest lock it takes and on what, and whether it can run inside a transaction block — as a property, so the plan a file held had lost the one thing a DBA reads before agreeing to a window.capabilitiesandis_destructiveare nowcomputed_fields: serialized on the way out, ignored on the way in, so the round trip holds (tested) and a saved plan is reviewable for its locks without the CLI.plan --locksprints the same for a person, with the operations that cannot run inside a transaction block marked — they are the ones a crash leaves half-done.The subclass overrides keep working under a base-class
computed_field: pydantic resolves the getter on the instance at dump time, which I verified before relying on it.What is deliberately not here:
--sql. The DDL is built inside the repository at execution time, interleaved with decisions that are only made then — whetherDETACH CONCURRENTLYfalls back to the blocking form because a DEFAULT sibling exists, how rows a DEFAULT partition holds for a new window get moved, which orphan marker gets cleared, thelock_timeoutand retry loop around a drop. A faithful renderer would mean a render/execute split across the two most safety-critical modules in the project (creator.py,remover.py, ~1400 lines) and would still not be able to pre-render the runtime branches. A "representative" renderer that omitted them would be read as a transcript in exactly the cases a review exists to catch. So the plan stays the contract — what, why, how big, what it locks — and the docs say why.Stacked on the metrics PR.