Skip to content

Phase 2.3-2.4: classifier and router seam - #7

Open
Kiran01bm wants to merge 3 commits into
kiran01bm/phase-2-1-2-2-difffrom
kiran01bm/phase-2-3-2-4-classifier-router
Open

Phase 2.3-2.4: classifier and router seam#7
Kiran01bm wants to merge 3 commits into
kiran01bm/phase-2-1-2-2-difffrom
kiran01bm/phase-2-3-2-4-classifier-router

Conversation

@Kiran01bm

Copy link
Copy Markdown
Collaborator

Summary

Phase 2.3–2.4 — the classifier and the router seam. Stacked on kiran01bm/phase-2-1-2-2-diff.

What

  • pkg/statement typed per-operation descriptors and advisory safer-SQL rewrites (CREATE INDEXCONCURRENTLY, ADD CONSTRAINTNOT VALID + VALIDATE, …).
  • pkg/planner: classifies each operation native / copy-and-swap / refuse with typed reasons; migrate --dry-run renders 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.

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
Kiran01bm marked this pull request as ready for review August 5, 2026 09:36
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant