chore(deps): bump Spirit for quoted lint messages and render SQL fragments as code - #1207
Conversation
There was a problem hiding this comment.
Pull request overview
Updates SchemaBot’s Spirit dependency so lint messages quote type names/collations/allowed-value tokens with %q, allowing the existing quoted-token rendering pass (ui.CodeQuoteIdentifiers) to format them as inline code in GitHub PR comments without additional SchemaBot-side parsing logic.
Changes:
- Bump
github.com/block/spirittov0.16.1-0.20260828161121-d5c94537b5ff(root module +e2e/consumermodule) and refresh transitive deps. - Update preview fixtures + tests to match Spirit’s new double-quoted token shape (rendered as backticked inline code in Markdown surfaces).
- Regenerate
TEMPLATES.mdto reflect the updated rendering.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| TEMPLATES.md | Updates rendered examples so type tokens appear as inline code (backticked) in lint warnings. |
| pkg/webhook/templates/preview.go | Adjusts preview fixture lint/unsafe messages to Spirit’s new %q-quoted token style. |
| pkg/webhook/plan_test.go | Updates assertions to expect backticked TIMESTAMP/DATETIME after ui.CodeQuoteIdentifiers rewriting. |
| pkg/cmd/internal/templates/pull_test.go | Updates CLI pull-schema lint output expectations to include new quoted tokens (kept as quotes on CLI surfaces). |
| pkg/cmd/internal/templates/preview_pull.go | Updates CLI preview response fixture lint message to new quoted token style. |
| pkg/cmd/internal/templates/plan_unsafe_test.go | Updates unsafe-change rendering expectations for the new quoted token style. |
| go.mod | Bumps Spirit + several dependencies (e.g., testify, x/*). |
| go.sum | Updates sums to match the dependency bumps. |
| e2e/consumermodule/go.mod | Mirrors dependency bumps in the consumer module. |
| e2e/consumermodule/go.sum | Updates sums for the consumer module dependency bumps. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
8807cf5 to
941f136
Compare
941f136 to
b3bfdb0
Compare
…ine code
Lint messages quote whole SQL fragments ("DROP TABLE `t`") and multi-word
tokens ("int(11) unsigned", "created_at DESC"), but the code-quoting pass
only converted single quoted identifiers — the quotes rendered literally
while the fragment's embedded backticks became their own code span, mixing
the two markers in one message. Convert a quoted fragment led by a DDL
keyword and a quoted token carrying attribute words to inline code as well,
using the padded double-backtick span form when the content itself contains
backticks. Quoted prose is untouched.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Picks up the Spirit lint changes that quote every SQL token in message
prose the way identifiers are quoted — type names and collations, column
lists with number agreement (column "a" / columns ("a", "b")), and a
unified %q shape for every unsafe-operation message. Preview fixtures move
to the shapes Spirit now emits so TEMPLATES.md shows lint findings and
unsafe reasons fully rendered as inline code.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
b3bfdb0 to
3322a91
Compare
|
🤖 Review findings - created by Kiran's code review agent - for schemabot/pull/1207, 3322a91. Verdict: 8 findings — 1 blocking (an unnoticed refusal-routing change rides along with the Spirit bump), 4 non-blocking. Blocking
Non-blocking
General suggestions
The one thing that could have broken, verifiedSpirit's messages are the input to schemabot's own text parsing, so adding Verified correct
This review was generated by Claude Code (claude-opus-5). |
Spirit refuses every ALTER against a table without a primary key at classification time rather than failing mid-run at table setup. Pin both an add-column and a modify-column shape in the refusal contract so a future Spirit bump that moves this verdict is caught at the unit tier. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…le code spans
The quoted-token pattern now admits the comma and single quote that
parameterised and enumerated types carry, so "decimal(10,2)" and
"enum('active','archived')" render as one inline code span instead of
being corrupted. Code-span fences size to the longest backtick run in
the content plus one, so an identifier with a doubled embedded backtick
cannot close the span mid-content.
Drop the single-quote conversion pass: no registered linter emits
single-quoted tokens, and the pass was rewriting the quoted values
inside enum/set types. Fixture updates move the datetime lint preview
and the unsafe-reason test fixtures to the quoted shapes Spirit emits,
and correct the preview's linter name to type_pedantic.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
🤖 All eight findings addressed in new commits fcc9e97b and be2f9b63:
Verification: full This reply was generated by Claude Code (Claude Fable 5). |
Bumps Spirit to pick up the lint-message quoting convention, and teaches the PR-comment renderer the two quoted shapes it could not convert. Together they finish the job started in the first quoting pass: every SQL token in a lint or unsafe message now renders as inline code on GitHub.
column "a"vscolumns ("a", "b")), index/table names, and every unsafe-operation fragment through one unified shape.CodeQuoteIdentifiersconverts a quoted fragment led by a DDL keyword ("DROP COLUMNnickname") and a quoted token carrying attribute words ("int(11) unsigned","created_at DESC") to inline code, sizing the code-span fence past the longest backtick run in the content so identifiers with embedded backticks cannot close the span early. The quoted-token pattern admits the comma and single quote that parameterised and enumerated types carry ("decimal(10,2)","enum('active','archived')"each render as one code span), and quoted prose is untouched. The single-quote conversion pass is gone: no registered linter emits single-quoted tokens, and it corrupted the values inside enum/set types.Behavior changes in this bump (beyond message formatting):
ALTERagainst a table without a primary key at classification time (altering a table without a primary key is not supported) instead of failing mid-run at table setup. Plans for such tables route through the standard refused-statement handling; the refusal contract test pins both an add-column and a modify-column shape.type_pedanticlinter (default-on) now also checks collation consistency across tables, assuming utf8mb4 defaults, so plans can surface new advisory collation warnings on schemas with mixed collations.golang.org/x/{crypto,mod,net,sys,text,tools}andtestifyadvance to the versions Spirit now requires.Plan comment with lint warnings
Schema Change Plan — Staging
Database:
testapp| Type:MySQL| Schema Name:testappRequested by @jackjackbits at 2026-01-01 00:00:00 UTC · planned from
abcdef1💡 Lint Warnings: 2 advisory findings
users: Columncreated_atusesTIMESTAMPwhich overflows on 2038-01-19. Consider usingDATETIMEinstead.products: Indexidx_categoryon columncategoryis redundant - covered by indexidx_category_priceon columns (category,price)📋 Plan: 2 tables to create, 1 table to alter
Unsafe change rejected
Schema Change Plan — Staging
Database:
testapp| Type:MySQL| Schema Name:testappRequested by @jackjackbits at 2026-01-01 00:00:00 UTC · planned from
abcdef1📋 Plan: 1 table to alter
⛔ Apply rejected: 1 unsafe change detected
customers: Unsafe operation detected:DROP COLUMN `nickname`Destructive drop guidance:
Before allowing a destructive drop, first deploy application code that no longer reads from or writes to the dropped column.
🚨 To proceed with these destructive changes, re-run with
--allow-unsafe:This PR was written by Claude Code (Fable 5).