Feat v0.8.3 vector column type (#70)
Some checks failed
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Has been skipped
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / e2e-smoke (pull_request) Has been skipped
CI/CD / build-and-deploy (pull_request) Has been cancelled
CI/CD / test-sqlite (pull_request) Has been cancelled
CI/CD / test-go-pg (pull_request) Has been cancelled

Add vector(N) column type to db_tables manifests with three-tier
progressive enhancement: native pgvector on Postgres, JSONB fallback
without pgvector, TEXT fallback on SQLite. New db.query_similar()
Starlark builtin with dual-path dispatch.

- parseVectorDim validates 1..4096 dimensions
- mapColType gains hasPgvector parameter for tier selection
- HNSW index auto-created on pgvector backends
- starlarkToGoValue extended with list→JSON serialization
- cosineDistance helper for Go-side fallback computation
- ExtensionHandler gains SetCapabilities for install-time DDL
- Roadmap updated: v0.8.4 docs refresh + surface sizing fix

13 new tests (5 schema + 8 db module), all passing with -race.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 09:40:38 +00:00
parent 00ef970163
commit 4fed810dd5
16 changed files with 909 additions and 52 deletions

View File

@@ -17,13 +17,19 @@ import (
// ExtensionHandler serves extension management endpoints.
type ExtensionHandler struct {
stores store.Stores
stores store.Stores
capabilities map[string]bool
}
func NewExtensionHandler(stores store.Stores) *ExtensionHandler {
return &ExtensionHandler{stores: stores}
}
// SetCapabilities stores the detected environment capabilities map.
func (h *ExtensionHandler) SetCapabilities(caps map[string]bool) {
h.capabilities = caps
}
// validTiers is the set of accepted extension tier values.
var validTiers = map[string]bool{
models.ExtTierBrowser: true,
@@ -231,7 +237,7 @@ func (h *ExtensionHandler) AdminInstallExtension(c *gin.Context) {
SyncManifestPermissions(c, h.stores, pkg.ID, manifestMap)
if tables, ok := ParseDBTables(manifestMap); ok {
if err := CreateExtTables(c.Request.Context(), database.DB, database.IsPostgres(), h.stores, pkg.ID, tables); err != nil {
if err := CreateExtTables(c.Request.Context(), database.DB, database.IsPostgres(), h.stores, pkg.ID, tables, h.capabilities["pgvector"]); err != nil {
log.Printf("[ext-db] schema create failed for %s: %v", pkg.ID, err)
}
}