Skip to content

feat(sql): cross-language ref-vs-column type check#35

Draft
gandarfh wants to merge 1 commit into
feat/sql-schema-completionfrom
feat/sql-type-check
Draft

feat(sql): cross-language ref-vs-column type check#35
gandarfh wants to merge 1 commit into
feat/sql-schema-completionfrom
feat/sql-type-check

Conversation

@gandarfh

Copy link
Copy Markdown
Member

Stacked on #34 (Phase 3). Phase 5 of Slice 5.

Adds a cross-language type check for the DB block: when a SQL column is compared
against a {{ref}} (WHERE col = {{req1.response.body.id}}), the LSP warns if the
column's type category and the ref's inferred shape type are genuinely
incompatible.

  • lib/sql_types.ml — type lattice (Number/String/Boolean/Json/Datetime/Unknown)
    normalising native SQL column types (PG/MySQL/SQLite) and inferred ref shapes.
    Leniency by design: Unknown always passes, Datetime<->String compatible.
  • lib/analyze.mlsql_ref_diagnostics: pairs each ref with a comparison-adjacent
    field column via the SQL CST, warns on incompatible categories.
    diagnostics gains ?shapes ?sql_tables_for ?doc.
  • bin/httui-lsp/httui_lsp.mlpublish_diagnostics feeds the schema_cache tables
    and doc text through.

Diagnostics already flow to the desktop, so the squiggle surfaces without any
frontend wiring.

Do not merge before #34.

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