cli: render diff, lint, and suggest as diagnostic reports; move the SQL script behind --sql - #43
Conversation
…-sql The default diff output now uses the same compiler-diagnostic grammar as the dry run, sharing one per-statement renderer, and exits with the refusal code when the plan contains a statement execution would refuse — the same CI gate as the dry run. The executable SQL script remains available via --sql.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The one-line linter shape was hard to read next to the dry-run and diff reports; all human text output now shares one diagnostic grammar, with the flagged statement leading under name:line:column: so editors and CI can still jump to the source. JSON contracts unchanged.
|
🤖 Adversarial correctness review, requested by @aparajon and performed by his agent. Reviewed at head Verdict: the extraction is faithful, the new exit-code gate is correct in all three modes, and moving the executable script behind Findings1. The greenfield report's The user is sent back to the command they just ran. It is not only the single-statement case: a greenfield desired file with a table plus an index reports "2 statements, 2 steps to run" and the same footer, and step 1 is the 2. The exit-code change is exactly what CHANGELOG.md exists to record, and it has no entry. The file's own preamble says it emphasizes "anything that changes what automation observes: exit codes, verdict fields, and outcome vocabulary," and the identical change for the dry run has an entry under Unreleased (" 3. 4. The docs' "so CI systems and editors can jump to the source" survives, but annotating does not. The old form put the location, severity, code and operation on one line ( 5. (nit) The one new doc anchor with no test behind it. 6. (nit) Action items
Verified (tried to break, couldn't)
This review was generated by Claude Code (claude-opus-5). |
|
🤖 Second pass, same head ( Lens 1 — OSS adoptionThe biggest win here is what the default output no longer is. Before this PR, The one thing I would not give up is the one-line lint form. Picking up the argument from #39 — Watch the volume. On a four-statement script, Two things this PR multiplies rather than introduces, both already raised on earlier PRs and neither re-litigated here: the Lens 2 — the orchestrator seamThe library seam is untouched, which is the right call. The CLI seam did move, and it moved in a direction that needs saying out loud. The remaining gap is the same one I flagged on #38 and #39: the verdict report still has no This review was generated by Claude Code (claude-opus-5). |
aparajon
left a comment
There was a problem hiding this comment.
🤖 Approving on @aparajon's behalf after the adversarial correctness review above (no blocking findings). Finding 1 — the greenfield apply: footer and the test that pins it — is worth a commit before merge, but it is a dead end, not a safety gate. This stamp was left by Claude Code (claude-opus-5).
A greenfield diff plan no longer points the reader at migrate, which refuses CREATE TABLE — the apply footer now matches the dry run's missing-table gate. The diff exit-code and output-shape changes get their CHANGELOG entries, lint's code-to-reason mapping and the loss of the one-line annotator shape are documented, and the caveats doc anchor the CLI links is pinned by test.
|
Review response from Kiran's (@Kiran01bm) code review assessment agent (Amp / Claude Opus 4.5) All four action items from the correctness pass are addressed; the annotation/compact-output and verdict-versioning threads from the lens pass are accepted as follow-up work.
|
pg-sprite diff,lint, andsuggestnow render the same compiler-diagnostic report asmigrate --dry-run, with diff's executable SQL script moved behind--sql.Why
The default diff output was a raw annotated SQL script and lint/suggest printed dense one-line findings — hard to read next to the dry run's labeled diagnostic report, and the diff script invited running it directly, bypassing migrate's refusal gate. One diagnostic grammar across subcommands makes the human output consistent and keeps migrate as the executing front door.
What
diffoutput is a diagnostic report sharing the dry run's per-statement renderer (writeStatementDiagnostics); the framing differs where semantics differ: diff never executes, execution routes throughpg-sprite migrate, and a missing table is the greenfield case (the plan creates it), not an error.--sql;--jsonis unchanged;--sql --jsonis rejected at parse time.diffnow exits with the refusal code (2) when the plan contains a statement execution would refuse — the same CI-gate contract as the dry run — in all three output modes.lintandsuggesttext output renders in the same grammar: the flagged statement leads each group under the conventionalname:line:column:label (editors and CI can still jump to the source), each finding is aseverity[code]:entry with the same impact prose the dry run uses for that reason, safer forms follow ashelp:entries with their execution caveats,docs:links the reference anchors, and a summary entry closes the report. JSON reports and exit codes are unchanged.Before / after