docs: safer-sequences page (the improve path) + post-#50 clarifications - #51
docs: safer-sequences page (the improve path) + post-#50 clarifications#51Kiran01bm wants to merge 3 commits into
Conversation
The committed-prefix section showed the four-step SET NOT NULL sequence without saying what the original statement was or why it decomposes that way — a per-step table now covers purpose, lock profile, and budget class. "Needs-rewrite" in both design docs read as if the submitted SQL needed rewording; it means a PostgreSQL table rewrite (the copy-and-swap executor's job) — safer-sequence substitution stays on the native-safe path.
The improve path had no human-first explanation of why the substituted sequence is safer — the ADD CONSTRAINT UNIQUE two-step is worked through as the example (same end state, different locking, failure modes, transactionality, cost), plus what the engine adds over running the idiom by hand, the substitutions made today, and the typed caveats. Linked from the README's Improve paragraph and the docs index.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Adversarial correctness review, requested by @aparajon and performed by his agent. Reviewed at head Verdict: the page is the right page to write and almost all of it holds up under measurement — the Findings1. "Confining every exclusive lock to a brief, metadata-only catalog flip" is false for The failure is not "big table," it is nullability — the two PK runs differ in nothing else. What the operator gets: Bare timings for the same statement confirm the mechanism scales with the table, and The engine shares the belief. 2. The substitution table publishes The planner/executor/dry-run disagreement is pre-existing and not this PR's regression — worth its own issue, since 3. (precision) 4. (nit, engine not docs) Action items
Verified (tried to break, couldn't)The parts I most expected to be approximations are exact. The worked example's two-statement block is byte-identical to the This review was generated by Claude Code (claude-opus-5). |
|
🤖 Second pass, same head ( Lens 1 — OSS adoptionThis is the page that decides whether a skeptical DBA believes the project, and it is written at that level. The improve path is pg-sprite's actual differentiator — plenty of tools will diff a schema and emit DDL; the claim that the tool will substitute a safer sequence for the statement you wrote is the one that sounds too good to be true, and the one an evaluator will assume is marketing until shown otherwise. Publishing the mechanics, the exact SQL, and the locks is the right response to that skepticism. The page earns credibility in two specific places: the "Same end state, different path" table, which puts the submitted and substituted forms side by side per-property instead of asserting "safer"; and the paragraph that names the trade out loud — the safer sequence converts blocking risk into leftover-state risk, blocking paid by every query, leftover state paid by one operator with a documented recovery path. A page that only listed benefits would read worse. That paragraph is the single most persuasive thing in the PR. The highest-leverage addition: a short "verify this yourself" section. The page makes falsifiable claims about locks and durations, and its authority rests entirely on the reader taking them on faith. A DBA evaluating a tool that promises to run DDL on their production tables will want to reproduce them, and right now nothing tells them how. Three lines would close it: This is not a nice-to-have — it is how I found the finding in the comment above. A reader who runs the The gap an adopter feels next is the other half of the story: when the substitution does not happen. After "what does it do for me" the immediate question is "when won't it save me" — and the honest answer (needs-rewrite operations, refusals, the Small structural note: the table of contents on a 118-line page is more scaffolding than a reader needs, and the two tables plus the five-item caveat list already give it shape. Not worth changing on its own; worth not adding to. Lens 2 — the seam an orchestrator consumes"Automation branches on fields, never on prose" is exactly the right principle, and the substitution table is the one place this PR violates it. The page states the principle in the "What the engine adds" section — and then publishes, as prose, the authoritative list of substitutions the engine performs. That list is precisely what an integrator needs to reason about ("which of my statements will pg-sprite transform?"), and prose is the wrong medium for it: finding 2 is a row that is already wrong, and there is no mechanism that would have caught it. The The per-step table added to execution-model.md is the real seam contract in this PR, and it deserves a test. Statement → what it does → lock and duration → budget class is exactly the mapping an orchestrator needs in order to set timeouts and decide what a failure means, and it is the first place the For an orchestrator specifically, the committed-prefix framing is the part that matters most, and it improved here. An automated system that submits a statement and gets back "step 2 of 4 failed, steps 1 through 1 committed, their state remains" can decide whether to retry, roll forward, or escalate to a human — and the This review was generated by Claude Code (claude-opus-5). |
aparajon
left a comment
There was a problem hiding this comment.
🤖 Approving. Docs-only, and the substantive parts hold up under measurement — the SET NOT NULL per-step table is exactly true on a 2.9 GB table (1.370 ms for the catalog flip) and the worked UNIQUE example is byte-identical to real executed_sql.
Two accuracy items to land, per the comments above: ADD PRIMARY KEY should not be folded into the UNIQUE example (on a nullable column step 2 adds NOT NULL and scans under ACCESS EXCLUSIVE — I reproduced it failing the brief statement budget), and the DETACH PARTITION row is a substitution the executor deliberately refuses. Both are page fixes; the engine follow-ups behind them (planner nullability check, and the dry-run "0 refused" disagreement) are pre-existing and fine to file separately.
This review was generated by Claude Code (claude-opus-5).
Summary
Adds
docs/safer-sequences.md— a human-first explanation of the improve path: why the planner's substituted sequence is safer than the submitted form, worked through onADD CONSTRAINT … UNIQUE— and carries two small follow-up clarifications that missed the #50 merge.Why
The improve path is the product's headline move, but nothing explains why the substitution is safer — the README demos show it happening, the reference doc has the per-operation matrix, and the contracts carry the machine shape, yet a reader who asks "these two forms end in the same catalog state, so what did I gain?" has no page. The answer (blocking risk traded for leftover-state risk, exclusive locks confined to catalog flips) is the argument that wins an evaluator.
What
docs/safer-sequences.md: the workedADD CONSTRAINT … UNIQUEcomparison — one-statement vs two-step across locking, duplicate-failure behavior, transactionality, and cost; what the engine adds over running the idiom by hand (budgets per step, typed verdicts, visible substitution); the substitution families shipped today; the typed caveats and theUSING INDEXstructural limits.docs/README.mdindex: link the page.SET NOT NULLsequence (purpose, lock profile, budget class), and both design docs disambiguate needs-rewrite — a PostgreSQL table rewrite (copy-and-swap's job), not a rewording of the submitted SQL.Before / after