Phase 2.3-2.4: classifier and router seam - #7
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.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Review requested by Armand and performed by his agent — same two lenses used across this stack (#4, #5, #6, #3): pg-sprite as an OSS-first, best-in-class Postgres DDL tool, and pg-sprite as a clean integration target for an orchestrator. Reviewed at head This is the PR the rest of the engine hangs off, and the decomposition is right: OSS lens
Integration lens
Verified solidThe refusal wall holds under pressure: I swept twenty statement shapes an operator might plausibly submit, and every genuinely non-online operation the engine doesn't model — This review was generated by Claude Code (claude-fable-5). |
|
🤖 Adversarial correctness review requested by Armand and performed by his agent — separate from the two-lens pass. Method: attack the classifier and the router, then verify every candidate finding against a real PostgreSQL at head Findings, most severe first1. Against a real server, That is the exact operation 2. The first is the 3. Generated constraint and index names collide with the table itself once PostgreSQL truncates them to 63 bytes. Short of that limit the failure is a collision between siblings rather than with the table: two 4. The route itself is defensible — it is brief and scans nothing — so this is milder than the others. But Probed and heldAttacks that failed, and one that changed my mind. Reproduction testsFindings 1 and 2 —
|
aparajon
left a comment
There was a problem hiding this comment.
🤖 Approving on Armand's behalf. My two-lens review and adversarial correctness pass are posted above — the findings there are for follow-up, not fix-before-merge blockers.
This approval was submitted by Claude Code (claude-fable-5) at Armand's direction.
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.