Phase 1: optimistic front door with typed not-native-safe verdicts - #5
Conversation
…ute-and-introspect) The DDL-understanding trade-off is decided: classification parses via wasilibs/go-pgquery (Wasm libpg_query; cgo pg_query_go is the API-compatible escape hatch), shadow-table DDL and checkpoint fingerprints come from execute-and-introspect on an engine-owned scratch database (pg_sprite_scratch pre-provisioned, or CREATEDB to self-provision — verified in preflight), and refusals use both layers. Updates CO-7/ST-2/ST-6, the TCB dependency list, and the low-level design; supersedes the pg_query_go + AST-surgery assumption.
migrate gates statements through go-pgquery (ALTER TABLE only; index maintenance is pointed at CONCURRENTLY), size-guards the table via pg_table_size over the partition tree, attempts the change under SET LOCAL lock/statement budgets, and ends in a structured verdict — executed-natively, or refused with a typed reason and exit code 2. The verdict seam is what Phase 11 maps to ExecutionModeBlocked.
Closes the two behavioral coverage gaps from the Phase 1 coverage review: the status command's live-session output (pid/state/query fields against a held pg-sprite session) and the lock-budget refusal wording, which were previously untested paths.
…flag Establishes the observability posture early: stdout carries only command output, diagnostics go through log/slog to stderr, errors are logged once at the entry point, and credentials are never logged. sloglint/forbidigo enforce the mechanical half; --debug wires the previously unreachable pgx statement tracing in pkg/dbconn plus migrate lifecycle events.
Log text and human-facing prose are no longer a test surface (rule added to AGENTS.md, aligned with SchemaBot's observability guidance). The lock-vs-statement budget distinction was only visible in prose, so the verdict gains a typed machine-readable cause field, and status gains --json so its tests can assert structured session fields.
The action's default binary is built with an older Go than the module targets and cannot load the v2 config; SHA-pinning also satisfies the semgrep and zizmor unpinned-action checks.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Follow-up review requested by Armand and performed by his agent — same two lenses as the PR #4 passes: 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 First, credit where due: this PR directly delivers the integration ask from the previous pass — typed, machine-readable outcomes ( One fix-worthy safety findingSub-millisecond budgets fail open (LK-2). OSS lens
Integration lens
Verified solidThe proof-type pattern is excellent: 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 code, then verify every candidate finding by running it against a real PostgreSQL at head Findings, most severe first1. 2. 3. Common instant ALTER TABLE forms are refused with a factually wrong reason. Reproduced through the PR's own parser: 4. The size guard sees a fraction of the footprint it is guarding against. 5. Minor: The sub-millisecond → Probed and heldThings I attacked that survived: identifier handling end-to-end (quoted mixed-case names flow parser → preflight → attempt correctly; bind params + Reproduction testsEach finding's repro, runnable as-is from the repo root (findings 1, 2, and 4 need Docker for testcontainers; finding 3 needs no database). Finding 1 —
|
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.
…iran01bm/phase-1-front-door * origin/kiran01bm/ci-foundations: docs: port reviewed SchemaBot AGENTS.md conventions ci: pin golangci-lint-action and lint binary version Amp-Thread-ID: https://ampcode.com/threads/T-019fcb83-1db5-74dd-8aa5-b27a21407b7f Co-authored-by: Amp <amp@ampcode.com> # Conflicts: # .agents/checks/review.md # AGENTS.md
Every PR, design, and review is judged as (a) an OSS-first standalone Postgres online-DDL tool and (b) a clean SchemaBot engine integration; trading one off against the other needs an explicit decision.
Addresses the two-lens and adversarial review findings: - ST-7: the executor accepts only a ParseOne-constructed Statement whose target matches the preflight proof, so multi-statement SQL and cross-table smuggling are unrepresentable - size guard measures pg_total_relation_size (heap, indexes, TOAST) — the rewrite it fears rebuilds every index under the same lock - sub-millisecond budgets are rejected (they truncate to 0ms, which disables the PostgreSQL limit) - table-targeted RENAME / SET SCHEMA route through the front door instead of being refused as non-ALTER TABLE - status coalesces pg_stat_activity fields nulled for other roles - already-concurrent index forms no longer get circular safer-idiom advice; verdict reasons are flat kebab-case tokens; byte-size parsing rejects int64 overflow; CI builds with CGO_ENABLED=0
|
For the two-lens review: Review response from Kiran's (@Kiran01bm) AI code review assessment agent All eight items addressed in this PR — seven fixed in code, the fixture-margin item captured as test methodology.
|
|
For the Adversial review: Review response from Kiran's (@Kiran01bm) AI code review assessment agent All five findings fixed in this PR, each with a regression test derived from the review's reproduction; the "probed and held" confirmations need no action.
|
…to kiran01bm/phase-2-1-2-2-diff * origin/kiran01bm/phase-1-front-door: 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 Amp-Thread-ID: https://ampcode.com/threads/T-019fcb83-1db5-74dd-8aa5-b27a21407b7f Co-authored-by: Amp <amp@ampcode.com> # Conflicts: # SAFETY.md # internal/cli/migrate.go # pkg/statement/statement.go # pkg/statement/statement_test.go
…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
…er-router' into kiran01bm/oss-standup * origin/kiran01bm/phase-2-3-2-4-classifier-router: planner, router: fail closed on unconstructed safer rewrites 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 # docs/low-level-design.md # pkg/planner/planner.go
…ontract * origin/main: vision: describe the ecosystem by capability model, not named tools Address PR #2 review: gate releases, attest artifacts, OSS positioning planner, router: fail closed on unconstructed safer rewrites 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 ci: pin golangci-lint-action and lint binary version chore: list project leads in CODEOWNERS # Conflicts: # SAFETY.md # internal/cli/diff.go # internal/cli/dryrun.go
* origin/main: Address plan-contract review: converge both front doors vision: describe the ecosystem by capability model, not named tools Address PR #2 review: gate releases, attest artifacts, OSS positioning planner, router: fail closed on unconstructed safer rewrites 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 ci: pin golangci-lint-action and lint binary version chore: list project leads in CODEOWNERS Amp-Thread-ID: https://ampcode.com/threads/T-019fcb83-1db5-74dd-8aa5-b27a21407b7f Co-authored-by: Amp <amp@ampcode.com> # Conflicts: # SAFETY.md
Summary
Phase 1 — the optimistic front door. Stacked on
kiran01bm/ci-foundations.What
migrate --alterruns easyALTER TABLEchanges directly under strict lock/statement budgets (pkg/executorbounded optimistic attempt) and refuses everything else with a structured, machine-readable verdict (exit code 2):pkg/verdictwith typed reasons, safer-idiom pointers, and an optionalcausefield.pkg/preflighttable-size guard;statuscommand.wasilibs/go-pgquery, Wasm) + execute-and-introspect on a scratch schema — never AST transformation.log/slog,--debugstatement tracing; CLI tests assert typed outcomes, never wording.Why
A working, safe-by-refusal executing path end to end before any planning intelligence — the thin slice the later phases deepen.