Skip to content

feat(lint): warn when SQL lint is unavailable for a dialect - #1350

Closed
kvlonge wants to merge 6 commits into
mainfrom
feat/lint-unavailable-warning
Closed

kvlonge wants to merge 6 commits into
mainfrom
feat/lint-unavailable-warning

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Why

SQLQuack's lint engine answers a known dialect it cannot parse yet with no diagnostics and an unavailable reason. If SQLBuild ignored that field, every file in such a project would look lint-clean. L007 reports our gap, not the user's SQL, so it must never fail a command.

Changes

  • The native lint response handler reads unavailable: the file gets one L007 warning at the body start with the engine's reason and a remediation saying the SQL was not linted. One per file, not per body.
  • A non-string unavailable is an invalid response and becomes the existing L003 fault.
  • sqb compile shows L007 as a warning-severity Rule diagnostic and sqb rules run lists it. counts_toward_exit owns the exemption: compile, rules run, and the plan/build rules gate ignore it for exit decisions.
  • Rule exceptions pass L007 through unsuppressed; the exception grammar rejected it as a rule code.
  • Responses without the key behave as before; the current engine never sends it.
  • Docs: L007 never changes an exit code.

Verification

  • sqlbuild-rules tests: an unavailable response with two bodies gives one non-fault L007; no key gives nothing; a null reason gives L003; only L007 is exempt from exit.
  • E2E: a cached finding is replayed as L007 and as SQLCLEAN043 through compile, rules run, plan and build. L007 exits 0 everywhere, the rule code 1. Without the gate change plan and build exit 1; before both fixes compile failed with an invalid-lifecycle error.
  • make check-ci, cargo test -p sqlbuild-rules --lib and the rules/plan e2e files pass locally.

DuckShop: not applicable; diagnostic reporting with no project shape, data value or lifecycle sequence.

A native lint response can report that the engine does not parse the project's
dialect yet. Each such file now gets one L007 warning carrying the engine's
reason, instead of looking lint-clean. A non-string reason is rejected as an
invalid response.
…le and rules run

compile and rules run kept only selected Rule codes, so an unavailable dialect
looked clean there. L007 now passes through as a warning-severity Rule
diagnostic in compile and is left out of rules run's failing-finding count.
counts_toward_exit owns the exemption.
The plan and build rules gate failed on any finding, so an L007-only project
could not plan. Rule exceptions also validate every finding's code as a rule
code and rejected L007 with an invalid-lifecycle error. The gate now counts only
findings that count toward exit, and L007 passes through rule exceptions
unsuppressed. An end-to-end test replays a cached finding as L007 and as a rule
code through compile, rules run, plan and build.
@kvlonge
kvlonge enabled auto-merge (squash) November 7, 2026 19:55

kvlonge commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Closing: every commit on this branch is already contained in #1374 (the combined parser train), which will land this change. The branch is kept; reopen if #1374 is dropped.

@kvlonge kvlonge closed this Nov 8, 2026
auto-merge was automatically disabled November 8, 2026 21:00

Pull request was closed

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.

1 participant