Skip to content

plan v1.data.extensions: goal record - #28

Merged
JaimeStill merged 1 commit into
mainfrom
plan-v1.data.extensions
Nov 24, 2026
Merged

JaimeStill merged 1 commit into
mainfrom
plan-v1.data.extensions

Conversation

@JaimeStill

Copy link
Copy Markdown
Contributor

plan · v1.data.extensions · round outcome

Context

v1.data.extensions was a coordinator-only goal (repos = []) with one task, strategy, to decide
how a Postgres extension is declared at the native tier: its install, migration, image pin, and the
packages allowed to use it. pgvector for capstone-athena is the first case (spike-ai-pipeline
evidence 10, standards-lab/context/data-intelligence.md). Seven plan rounds decided the strategy,
which turns the goal into reusable infrastructure in sqlate and go-database. This outcome writes
the strategy down, replaces strategy with five build tasks, sets the goal up with root sqlate,
and stages it.

The decided strategy

Image

  • One baseline image: postgres:19.0-alpine with each extension built from source. pgvector uses
    ARG PGVECTOR_VERSION, ADD …pgvector.git#v${PGVECTOR_VERSION}, and
    make with_llvm=no OPTFLAGS="".
  • sqlate's compose/postgres/Dockerfile is the canonical copy; consumers copy it. Only
    repositories that declare an extension switch to it.
  • currency.sh learns to read the ARG and compare it with pgvector's latest tag.
  • The image is the sole source of truth for an extension's version: no Go code declares one.

Extensions layer (sqlate/migrate, engine-neutral)

  • migrate.Options.Extensions holds one declaration per extension: its name, and optionally a
    removed state. It carries no version.
  • A stage runs before every set, under the migrator's lock, on its pinned connection.
    • Each declaration is a check plus an activation, each in its own transaction, applied in
      declared order.
    • sqlate/postgres supplies the standard pair. The check compares installed_version with the
      image's default_version in pg_available_extensions. The activation is
      CREATE EXTENSION IF NOT EXISTS x; ALTER EXTENSION x UPDATE.
  • There is no history table: every run reconciles against pg_extension.
  • Failures, each a typed error raised before any set runs:
    • the extension isn't available in the image;
    • the installed version is newer than the image's and the image ships no path back.
  • A mismatch makes Verify return an error that unwraps to ErrPending, so go-database's
    Start applies it.
  • Migrator.Extensions(ctx) reports each extension's state.
  • Removal: a declaration marked removed runs DROP EXTENSION IF EXISTS x RESTRICT after the sets.
    Deleting a declaration stops managing the extension and never drops it.
  • Reset leaves extensions installed.
  • Shipped library sets declare no extensions; only the application does.
  • pgtest.MigratedWith(t, env, prefix, opts, sets...) sits beside Migrated.

sqlint

  • A new key, extensions = [<module paths>], adds each listed extension's native forms to the
    engine's deny list.
  • An extension module must export forms whenever the extension adds any name a statement can use.
    Otherwise it declares forms = [] with a reason.
  • sqlint rejects a listed extension that has neither. Review keeps the sqlint list and
    Options.Extensions consistent.

Modules

  • sqlate/postgres/pgvector: its own module, holding the native forms plus a small Go package.
    The package has the extension name and a table mapping each metric (l2, cosine, ip) to its
    operator and operator class.
  • go-database/postgres/pgvector: uses pgvector-go's root module directly over database/sql
    text format.
    • It provides typed helpers over hand-written SQL, so pgvector-go stays out of domain packages.
    • It ships no SQL generation and no space registry; the capstone's chunks task owns that.
    • It depends on sqlate's pgvector package.
  • Importing an extension module is limited the way importing a provider is: the composition root,
    the migrations, and the packages the design docs declare.
  • Per-space HNSW partial indexes are application migrations.

go-database admin

  • admin.Status gains an extensions field, and Ready is false on a mismatch.
  • GET /schema in go-web-service is unchanged.

Edits

Every repository gets the plan-v1.data.extensions branch, one commit per kind of change, and a
pull request whose body is this outcome.

standards-lab (coordinator)

  1. Roadmap
    • Rewrite roadmap/v1.data.extensions.toml:
      • repos = ["sqlate", "go-database", "architecture"], root = "sqlate";
      • order = ["extension-stage", "sqlint-extensions", "pgvector-sql", "pgvector-go", "principles"];
      • context = ["standards-lab/context/postgres-extensions.md"];
      • one [tasks.*] table per task, each with a short summary. pgvector-go takes
        repos = ["go-database"], principles takes repos = ["architecture"], and the first
        three take repos = ["sqlate"].
      • The strategy task is removed.
    • roadmap/index.toml: move v1.data.extensions from planned to active.
  2. Notes
    • New context/postgres-extensions.md: the strategy above, with the facts it rests on (no
      downgrade scripts in pgvector, the privilege notes, the per-space index recipe).
    • context/data-intelligence.md: point evidence 10 at the new note.
    • context/migration-sets.md: add one line saying shipped sets declare no extensions, with a
      link to the note.
    • context/waves.md: the wave C line, saying v1.data.extensions is staged alongside C.
  3. Catalog
    • None now: the new sub-modules enter references.md as pending edits when they exist.

sqlate (root)

  1. Goal setup: create context/goals/v1.data.extensions.md.
    • Header: State idle, Task none.
    • Tasks: the five, all unchecked.
    • Decisions: one line each for the settled points a later task relies on (image as source of
      truth, Options carrier, ErrPending mapping, removal by RESTRICT after the sets, no shipped
      set declares an extension, the forms rule, the module paths, the Dockerfile ARG).
    • Pending edits:
      • coordinator references.md gains the new sub-modules, with pgvector and pgvector-go
        under upstream sources;
      • the coordinator note retires at the principles sync.

No next brief is written. The next start v1.data.extensions plans extension-stage.

Verification

  • lint-context && lint-references pass in standards-lab (its marathon check).
  • sqlate's check passes with the new goal record, which lint-context holds to the goal file's
    order.
  • marathon status lists v1.data.extensions as active and idle, with extension-stage next.
  • Each pull request publishes, runs marathon checks, and merges: standards-lab first, then
    sqlate.

The plan file is deleted once the edits are published.

@JaimeStill
JaimeStill merged commit de668cb into main Nov 24, 2026
1 check passed
@JaimeStill
JaimeStill deleted the plan-v1.data.extensions branch November 24, 2026 22:07
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