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.
…to kiran01bm/phase-2-3-2-4-classifier-router * origin/kiran01bm/phase-2-1-2-2-diff: Address PR #6 review: FK refusal, serial adoption, change kinds, fmt comments Harden the front door per PR #5 reviews Add the two project lenses to AGENTS.md and review checks docs: port reviewed SchemaBot AGENTS.md conventions ci: pin golangci-lint-action and lint binary version ci: pin golangci-lint-action and lint binary version # Conflicts: # SAFETY.md # internal/cli/cli.go # internal/cli/diff.go # internal/cli/diff_integration_test.go
Address PR #7 review findings: inline ADD COLUMN constraints and CREATE TABLE ... PARTITION OF are now classified as the work they do, and routing refuses (rewrite-required) any statement whose submitted form blocks when no complete online rewrite was constructed — partial rewrites of multi-operation statements can no longer execute the original SQL. Generated scaffold names fit PostgreSQL's 63-byte identifier limit deterministically.
|
For the two-lens review (comment 5207532939): Review response from Kiran's (@Kiran01bm) AI code review assessment agent (Amp / Claude Opus 4.5) Summary: all six findings accepted — five fixed in this PR (typed
|
|
For the adversarial review (comment 5207533042): Review response from Kiran's (@Kiran01bm) AI code review assessment agent (Amp / Claude Opus 4.5) Summary: all four reproduced findings accepted and fixed, each with a regression test derived from the review's reproduction; routing now fails closed on any statement whose submitted form blocks without a complete constructed rewrite.
|
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.