Skip to content

Replace PlannedChange string slices with structured Violations field#689

Merged
morgo merged 1 commit into
mainfrom
structured-lint-violations
Apr 10, 2026
Merged

Replace PlannedChange string slices with structured Violations field#689
morgo merged 1 commit into
mainfrom
structured-lint-violations

Conversation

@aparajon
Copy link
Copy Markdown
Collaborator

@aparajon aparajon commented Apr 10, 2026

PlannedChange now carries a single Violations []Violation field instead of separate Errors/Warnings/Infos []string slices. Errors(), Warnings(), and Infos() are methods that filter by severity, returning []Violation. Consumers that need the formatted string can call v.String().

This is a breaking change for consumers that access the old string fields directly. The migration is straightforward:

  • change.Errorschange.Errors() (returns []Violation instead of []string)
  • change.Warningschange.Warnings()
  • change.Infoschange.Infos()
  • To get the old string format: v.String() on each violation

Closes #688

@aparajon aparajon force-pushed the structured-lint-violations branch from dd77d80 to 6894dc5 Compare April 10, 2026 18:02
@aparajon aparajon changed the title Add structured Violations field to PlannedChange Replace PlannedChange string slices with structured Violations field Apr 10, 2026
PlannedChange now carries a single Violations []Violation field instead
of separate Errors/Warnings/Infos []string slices. Errors(), Warnings(),
and Infos() are methods that filter by severity, returning []Violation.
Consumers that need the formatted string can call v.String() on each
violation.

This gives downstream consumers direct access to structured fields
(Message, Suggestion, Location, Severity) for richer formatting without
parsing the String() output.

Closes #688

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aparajon aparajon force-pushed the structured-lint-violations branch from 6894dc5 to e131e2c Compare April 10, 2026 18:09
@aparajon aparajon marked this pull request as ready for review April 10, 2026 18:21
Copy link
Copy Markdown
Collaborator

@morgo morgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morgo morgo merged commit 1310110 into main Apr 10, 2026
15 of 16 checks passed
aparajon added a commit to block/schemabot that referenced this pull request Apr 14, 2026
Consume block/spirit#689 which replaces PlannedChange string slices
(Errors/Warnings/Infos []string) with a structured Violations field.
Update the Spirit engine adapter to iterate over Violations directly,
extracting Linter name and Severity from the new typed fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aparajon added a commit to block/schemabot that referenced this pull request Apr 14, 2026
* Bump Spirit to v0.12.1 for structured lint violations

Consume block/spirit#689 which replaces PlannedChange string slices
(Errors/Warnings/Infos []string) with a structured Violations field.
Update the Spirit engine adapter to iterate over Violations directly,
extracting Linter name and Severity from the new typed fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Replace TIMESTAMP with DATETIME in test schemas

The updated Spirit version includes a new linter that flags TIMESTAMP
columns for 2038 overflow. Switch test DDL to DATETIME to avoid
spurious unsafe-change errors in tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address Copilot review: rename errors var, add lint mapping test

Rename `errors` to `errViolations` to avoid shadowing the stdlib
`errors` package. Add an integration test that triggers a known Spirit
linter (TIMESTAMP Y2038 overflow) and asserts the resulting
LintWarning fields (linter name, severity, message) are correctly
mapped from Spirit's structured Violation type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Rename LintWarning to LintViolation across codebase

Aligns naming with Spirit's structured Violation type. Since there are
no external consumers yet, this is a clean rename with no backwards
compatibility concerns. Updated proto, apitypes, engine, CLI, webhook,
and all test files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Structured lint violation output for downstream formatting

2 participants