Add pkg/suggest: advisory safer-form rewrites with typed caveats - #14
Add pkg/suggest: advisory safer-form rewrites with typed caveats#14Kiran01bm wants to merge 1 commit into
Conversation
Completes the P2.5 advisory surface (PLAT-38440): original -> recommended with typed reason and caveat metadata, offline and never executing. Refusals and rewrites stay lint findings; suggest reports only constructed rewrites, and an unmapped rewrite fails closed rather than shipping caveat-less advice.
|
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 (#8, #9, #13, #7): 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 The typed caveat vocabulary is the best idea in the P2.5 stack. Every other tool in this space that suggests OSS lens
Integration lens
Verified solid
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: check whether the caveat vocabulary is complete for the sequences it annotates, and whether Findings, most severe first1. The constraint-scaffold sequences have no residue caveat, and their most likely failure leaves a constraint on the live table that breaks the retry. The vocabulary carries two caveats for "what a failed sequence leaves behind" — So the advisory surface hands over a four-step sequence, the operator runs it, step 2 tells them their data has NULLs (which is genuinely useful), they fix the data, re-run the recommended sequence exactly as given — and it fails on step 1 with an error about a constraint they never asked for. The residue is invisible in the advice, and unlike an
2. Four findings, one suggestion. For the multi-operation ALTER and the 3. 4. A single caveat-mapping failure would discard the entire report. Probed and held
Reproduction testsFinding 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.
Summary
Adds the advisory
suggestsurface — the last piece of P2.5(PLAT-38440): map DDL that is risky as
written to the safer native form the engine would run instead, offline, never executing.
What
pkg/suggest: versioned report (format_version: 1) with oneSuggestionperconstructed rewrite —
original,operation, typedreason,recommendedsequence,and typed
caveats(non-transactional,separate-transactions,invalid-index-on-failure,detach-finalize-on-failure,validation-scan).pg-sprite suggest [file]CLI (stdin when omitted,--json): advisory only — alwaysexits zero on a valid script;
lintremains the gate.closed instead of emitting caveat-less advice, so a new planner rewrite cannot ship
un-annotated.
Why
The classifier already constructs safer sequences (
planner.Decision.SaferSQL), but theywere only visible inside
diff/migrate --dry-runoutput. The SchemaBot adapter's planverb and the standalone CLI front door both need the advisory contract as a standalone,
machine-readable surface: what would run instead, why, and under which caveats — because a
safer form is not a semantic equivalent (different transactionality, locking, and failure
modes).
References