Phase 2.3-2.4: classifier and router seam - #7
Open
Kiran01bm wants to merge 3 commits into
Open
Conversation
Extend the parse boundary with ParseOps — one typed shape descriptor per operation (default constancy, generated/identity, NOT VALID, USING INDEX, CONCURRENTLY, renames) — plus two syntactic advisory rewriters: Concurrently and AddNotValid. These are the classifier's inputs; no semantics are derived from the AST.
pkg/planner maps each operation to a route with a typed reason, golden-tested against every row of the online-DDL reference. Risky literals get the safer native sequence (CONCURRENTLY, NOT VALID + VALIDATE, USING INDEX attach, the four-step SET NOT NULL pattern). Conservative by construction: unproven defaults are volatile, type changes without live column facts are rewrites, unknown operations are refused.
pkg/router is the policy layer between the classifier and the executors: every classified statement gets a backend (native / copy-and-swap) and a typed disposition; copy-and-swap routes come back unavailable until that executor exists, instead of pretending to run. diff and the new migrate --dry-run share the identical classify-and-route pipeline, with live column types feeding the classifier. Refs PLAT-38439.
Kiran01bm
marked this pull request as ready for review
August 5, 2026 09:36
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
Phase 2.3–2.4 — the classifier and the router seam. Stacked on
kiran01bm/phase-2-1-2-2-diff.What
pkg/statementtyped per-operation descriptors and advisory safer-SQL rewrites (CREATE INDEX→CONCURRENTLY,ADD CONSTRAINT→NOT VALID+VALIDATE, …).pkg/planner: classifies each operation native / copy-and-swap / refuse with typed reasons;migrate --dry-runrenders the classified plan.pkg/router: assigns classified statements to backends; copy-and-swap reports unavailable until that backend lands.Why
The classifier is PostgreSQL's missing
ALGORITHM=/LOCK=declaration — the safety decision in one pure, testable place — and the router is the single seam where migration policy will live, so Phase 3 executors plug in without touching the planner.