Skip to content

sqlint-extensions - #30

Merged
JaimeStill merged 7 commits into
mainfrom
sqlint-extensions
Nov 24, 2026
Merged

JaimeStill merged 7 commits into
mainfrom
sqlint-extensions

Conversation

@JaimeStill

Copy link
Copy Markdown
Contributor

v1.data.extensions · task 2/5 · sqlint-extensions

Summary

  • sqlint gains a top-level extensions key. The native forms of each listed module join the
    engine's deny list for standard-tier files.
  • An extension module exports [export.native_forms]. If it has no forms, it declares an empty
    table beside a new [export] reason. A listed module with neither is refused.
  • postgres and sqlint now require sqlate v0.8.0. postgres's changelog cuts v0.9.0, which SHIP
    tags. sqlint's changes stay under Unreleased.
  • The guide's sqlint section documents the key, the export, the refusals, the findings, and two
    review conventions: the native: header names the extension, and the list stays in step with
    migrate.Options.Extensions.

Core changes

  1. Config.Extensions and Export.Reason: Load validates the list, refusing an empty
    entry, a repeated one, a value that isn't a list of strings, and extensions without
    engine. Why: the configuration validates where it loads. Export.NativeForms is nil when the
    table is absent and empty when it is declared {}.
    Extensions []string // Config
    Reason     string   `toml:"reason"` // Export
  2. Extension lookup in Lint: each entry is found the way engine is: a module path
    through the Resolver, otherwise a tree directory. A lookup failure, a refusal, or a bad
    expression is a finding against sqlint.toml, and the rest of the tree is still linted. Why:
    it reuses the engine's lookup and failure form, now one shared producer helper.
  3. The extension finding names its module:
    "<=>" (cosine_distance, from vec) in a standard-tier file; …. Why: a form name shared by the
    engine and an extension stays unambiguous. Engine findings are byte-for-byte unchanged.
  4. The upgrade: postgres and sqlint require sqlate v0.8.0, and both build, test, and lint with
    GOWORK=off.

Verify

mise run check: ✓ all three modules build, vet, test and lint with 0 issues; sqlint: ok

  1. cd postgres && GOWORK=off go list -m github.com/standards-lab/sqlate && GOWORK=off go test ./...
    → v0.8.0, ok. The same in sqlint/.
  2. Build sqlint/cmd/sqlint and run it over a tree that has an engine, an extension directory
    vec exporting cosine_distance = '<=>', and extensions = ["vec"]. A standard-tier
    <=> gives "<=>" (cosine_distance, from vec) in a standard-tier file; …. The same operator
    in a native-tier file, a literal, a comment, or a role with native_forms = false gives
    nothing.
  3. In the same tree, list formless (no table) and unexplained ({} with no reason) → each
    gives sqlint.toml: extensions: <entry> exports neither native forms nor a reason. List
    nowhere → extensions: nowhere: …. The other findings still appear.
  4. Set extensions = ["vec", ""], or drop engine → Load prints one sqlint.toml: refusal
    line each.

Decided without you

  1. Refusal and finding texts: extensions: <entry>: <error>,
    extensions: <entry> exports neither native forms nor a reason,
    extensions: <entry>: native_forms.<name>: <error>, and extensions[N]: empty /
    "x" is listed twice. Each names the entry because a module's lookup error doesn't.
  2. A module whose forms all fail to compile still counts as accepted, since it does export forms.
    It gets one bad-expression finding per form and no refusal.
  3. Nil versus empty NativeForms carries absent versus declared-empty, instead of a separate
    field.
  4. The engine and extension lookups share one producer helper (standards review).
  5. sqlint's changelog no longer says the API is unchanged (standards review).
  6. The package doc's native-forms bullet in sqlint/doc.go mentions extensions.
  7. Dropped decision "plan: sqlint's extensions key; … or is refused. No sqlint check against
    Options.Extensions.": the guide states it.
  8. Dropped decision "extension-stage: Releases v0.8.0 alone. …": this task carries it out.
  9. Dropped decision "sqlint-extensions: entries are module paths or tree directories; Load
    refuses extensions without engine": the guide states it.
  10. Dropped decision "sqlint-extensions: the native: header stays free text …": the guide states
    the convention.
  11. Pending edit added: the coordinator's postgres-extensions.md "sqlint" section moves from
    forms = [] to an empty table plus reason, with entries as module paths or directories.

Redirects and escalations

none

Merge danger: one-way for the postgres/v0.9.0 tag, which accepting authorizes: postgres's
ExtensionCatalog methods and pgtest.MigratedWith become public, requiring sqlate v0.8.0.
sqlint's key merges unreleased and stays two-way · blast radius: sqlate only; sqlint's outside
consumers are unaffected until a sqlint release · sqlate: merge waits on CI

Needs you: none

- postgres/go.mod and sqlint/go.mod require github.com/standards-lab/sqlate v0.8.0
  (on the Go proxy); each builds and tests with GOWORK=off, and postgres's
  integration-tagged code vets with GOWORK=off.
- postgres/CHANGELOG.md: the Unreleased additions move under a v0.9.0 section dated
  2026-11-24, with a Changed entry and a "Requires" line for v0.8.0 in the form of
  earlier releases; [Unreleased] stays empty and compares from postgres/v0.9.0.
- sqlint/CHANGELOG.md: the v0.8.0 requirement recorded under Unreleased as a
  non-breaking Changed entry, since the linter's API and findings do not change.
- No tag is created; tagging happens at ship.
sqlint.toml accepts a top-level extensions list, read into
Config.Extensions. Load refuses, one line each: a value that is not a
list of strings, an empty entry, an entry listed twice, and any
extensions while engine is unset.

[export] accepts reason, a string, into Export.Reason, beside forms or
an empty native_forms table. Export.NativeForms carries the three
states slice 3 reads: nil when no native_forms table is declared, an
empty non-nil map when it is declared empty, entries otherwise. The
same Export type serves readExport, so an extension module's file
decodes the same way when Lint reads it.

The guide documents the extensions key, its refusals, and an extension
module's export.
Lint finds each extensions entry through the engine's lookup: a module
path (dotted first segment) through the Resolver, anything else as a
directory of the tree. It accepts a module whose export names at least
one native form, or an empty native_forms table beside a non-empty
reason; it refuses a missing table and an empty one without a reason.
Load already validated the list, so Lint validates only resolution and
the module's export.

Findings against sqlint.toml, the rest of the tree still linted:
- extensions: <entry>: <error>, for an entry that does not resolve or
  has no sqlint.toml (the entry is named even when the error names it,
  since a module root's error reads ". declares no sqlint.toml");
- extensions: <entry> exports neither native forms nor a reason;
- extensions: <entry>: native_forms.<name>: <error>, the module's other
  forms still applied.

Accepted forms join the engine's deny list and are matched through the
same path, so tier, role switches, overrides and stripping are shared.
A finding from an extension's form reads "(<name>, from <entry>)"; the
engine's message is unchanged, and a name the engine and an extension
both export is reported once for each.

The guide, the package doc, and the changelog's Unreleased section
describe the lookup, the findings, the message, the native: header
convention, and review keeping extensions in step with
migrate.Options.Extensions.
@JaimeStill
JaimeStill merged commit f623daa into main Nov 24, 2026
1 check passed
@JaimeStill
JaimeStill deleted the sqlint-extensions branch November 24, 2026 23:15
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