Skip to content

pgvector-go: goal record - #32

Merged
JaimeStill merged 3 commits into
mainfrom
pgvector-go
Nov 25, 2026
Merged

JaimeStill merged 3 commits into
mainfrom
pgvector-go

Conversation

@JaimeStill

Copy link
Copy Markdown
Contributor

v1.data.extensions · task 4/5 · pgvector-go

Summary

  • admin reports extensions. admin.Status has an extensions list, and Ready is false
    whenever a declared extension doesn't match the database.
  • New module go-database/postgres/pgvector. It holds ParseMetric over sqlate's metric
    table. It wraps no pgvector-go type: its package doc shows applications using pgvector-go
    directly.
  • First live tests. go-database has a test-only compose PostgreSQL on 5438, using a copy of
    sqlate's pgvector image, and an integration tier run locally by mise run acceptance.
  • Upgrades. go-database is on sqlate v0.8.0, claude-plugins 0.24.0 and mise-action v5.3.0.
    Its currency.sh is now sqlate's script, so it also checks the image and the pgvector ARG.
  • sqlate gets a goal-record-only branch. This task touches only go-database, but the goal's
    record lives in sqlate, so sqlate's pgvector-go branch carries just that file.

Core changes

  1. admin's extension status. Readiness now covers extensions as well as sets: pending, not
    offered by the image, and no update path all clear Ready. The last two errors wrap
    ErrConflict and keep sqlate's error in the chain. Start logs
    extension pending; applying before it applies.

    type ExtensionStatus struct { Name string; Removed bool; Installed, Default string; Pending bool }
    // Status gains: Extensions []ExtensionStatus `json:"extensions"` (never nil)
  2. postgres/pgvector. The package imports only the standard library and sqlate's
    postgres/pgvector. pgvector-go, pgx and sqlate/postgres are required only by its tests.

    type Metric = sqlvector.Metric
    var ErrUnknownMetric = errors.New("unknown pgvector metric")
    func ParseMetric(name string) (Metric, error)
  3. Integration tier. It runs three live tests:

    • admin.Start installs vector at the image's default on a fresh database, and Status
      reports it installed and ready.
    • A vector column round-trips pgvector-go values and NULL through sql.Null[pgvector.Vector].
    • The test data is chosen so l2, cosine and inner product each pick a different nearest row.

    The check now vets, fixes and lints with -tags integration.

Verify

mise run check: ✓ go-database (., postgres, postgres/pgvector, tagged vet/fix/lint,
lint-context, lint-references); ✓ sqlate

In go-database:

  1. mise run currency → prints nothing, exit 0.
  2. mise run db:up, then
    docker compose exec -T postgres psql -U app -d app -Atc "select default_version from pg_available_extensions where name='vector'"
    → 0.8.7. Then mise run db:down.
  3. mise run acceptance → the stack comes up, all three live tests pass, the stack comes down,
    exit 0.
  4. GOFLAGS=-timeout=1ns mise run acceptance → exit 1, the compose log is printed, and the
    stack still comes down.
  5. Set ARG PGVECTOR_VERSION=0.8.6 by hand, run mise run currency → it reports
    pgvector/pgvector 0.8.6 -> 0.8.7 and exits 1. Revert the ARG.

Decided without you

  1. Dropped go-database's currency.sh comment on failing scans. The brief said to keep it,
    but it isn't one of the five permitted comment kinds. sqlate's header line ("A scan command
    that fails fails currency.") states the behavior, so the script stays byte-identical to
    sqlate's. This was the spec-reviewer's one gap.
  2. The check runs vet, fix and lint once, with -tags integration. These passes replaced the
    untagged ones instead of running alongside them. The tagged pass also covers every untagged
    file.
  3. admin's own ExtensionStatus type with JSON tags. sqlate's type has no tags, so its JSON
    keys would be capitalized.
  4. Status passes an I/O error from reading extensions through unwrapped, as it does an
    aborted operation. A removed extension that is still installed logs the same pending line.
  5. The admin live test uses pgtest.Create, not MigratedWith. MigratedWith would install
    vector before Start ran, so Start wouldn't be what installed it.
  6. The standards review made two tests fail when the metric list changes size. Before, they
    passed silently on an empty or shrunk list.
  7. Editor: Decisions dropped because the code or docs now state them:
    • "go-database's module … uses pgvector-go's root module …" (superseded);
    • removed-but-installed is pending (in sqlate's migrate docs);
    • go-database copies sqlate's Dockerfile and ARG check (built, and in the README);
    • three of this task's four new lines (ParseMetric, the readiness and ErrConflict rule,
      the integration tier).
  8. Pending edits added:
    • The sqlate-test-tier backlog goal now covers go-database too, since neither repository has
      a CI integration job.
    • A new backlog goal, sqlate-extension-match: admin's readiness re-derives sqlate's
      unexported classify rule.
    • The postgres-extensions.md items are merged, for principles to promote.

Redirects and escalations

  1. Plan round 1: Q1 revised. go-database wraps no pgvector-go type, and MetricNamed is named
    ParseMetric.

Merge danger: one-way door for both tags. Accepting authorizes these steps:

  1. Merge sqlate's record-only pgvector-go branch.
  2. Merge go-database's branch (merge waits on CI), confirm CI is green, and tag v0.13.0.
  3. A pgvector-go-fix branch swaps postgres/pgvector's replace for the v0.13.0 pin, merges
    on green CI, and then tags postgres/pgvector/v0.1.0.

Once pushed, Status.Extensions, its JSON, the readiness and ErrConflict rule, ParseMetric
and ErrUnknownMetric are public. Blast radius: go-database consumers, starting with
capstone-athena.

Needs you: none

@JaimeStill
JaimeStill merged commit 83dc2c4 into main Nov 25, 2026
1 check passed
@JaimeStill
JaimeStill deleted the pgvector-go branch November 25, 2026 01:03
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