Feat v0.8.2 capability negotiation (#69)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-frontend (push) Has been skipped
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-go-pg (push) Successful in 2m47s
CI/CD / test-sqlite (push) Successful in 2m52s
CI/CD / build-and-deploy (push) Successful in 30s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #69.
This commit is contained in:
2026-04-03 09:14:00 +00:00
committed by xcaliber
parent 435f972ded
commit 00ef970163
16 changed files with 593 additions and 96 deletions

View File

@@ -411,7 +411,7 @@ func TestUpgrade_BundledSkipExistingOnRestart(t *testing.T) {
})
// First install
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil)
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
pkg, _ := stores.Packages.Get(ctx, "restart-pkg")
if pkg == nil {
@@ -427,7 +427,7 @@ func TestUpgrade_BundledSkipExistingOnRestart(t *testing.T) {
})
// Second install — should skip because package exists
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil)
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
pkg, _ = stores.Packages.Get(ctx, "restart-pkg")
if pkg.Version != "1.0.0" {
@@ -438,7 +438,7 @@ func TestUpgrade_BundledSkipExistingOnRestart(t *testing.T) {
}
}
func TestUpgrade_PackageDormantOnUnmetRequires(t *testing.T) {
func TestUpgrade_PackageSkippedOnUnmetRequiredCaps(t *testing.T) {
stores := newTestStores(t)
ctx := context.Background()
@@ -447,25 +447,22 @@ func TestUpgrade_PackageDormantOnUnmetRequires(t *testing.T) {
// Package requires a capability that doesn't exist
buildTestPkg(t, bundledDir, map[string]any{
"id": "future-pkg",
"title": "Future",
"type": "extension",
"version": "1.0.0",
"hooks": []string{"on_install"},
"requires": []string{"kernel>=99.0.0"},
"id": "future-pkg",
"title": "Future",
"type": "extension",
"version": "1.0.0",
"hooks": []string{"on_install"},
"capabilities": map[string]any{
"required": []string{"pgvector"},
},
})
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil)
// No capabilities detected → pgvector is unavailable
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
pkg, _ := stores.Packages.Get(ctx, "future-pkg")
if pkg == nil {
t.Fatal("package should still be registered")
}
if pkg.Status != "dormant" {
t.Errorf("status = %q, want %q", pkg.Status, "dormant")
}
if pkg.Enabled {
t.Error("dormant package should not be enabled")
if pkg != nil {
t.Error("package with unmet required capabilities should not be registered")
}
}