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
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:
@@ -88,7 +88,7 @@ func TestBundledInstall_FreshDB(t *testing.T) {
|
||||
"route": "/s/test-b",
|
||||
})
|
||||
|
||||
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil)
|
||||
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
|
||||
|
||||
// Both packages should be installed and enabled
|
||||
for _, id := range []string{"test-surface-a", "test-surface-b"} {
|
||||
@@ -127,7 +127,7 @@ func TestBundledInstall_SkipsExisting(t *testing.T) {
|
||||
"type": "surface",
|
||||
})
|
||||
|
||||
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil)
|
||||
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
|
||||
|
||||
// Package should retain original title (not overwritten)
|
||||
pkg, err := stores.Packages.Get(ctx, "pre-existing")
|
||||
@@ -145,7 +145,7 @@ func TestBundledInstall_MissingDir(t *testing.T) {
|
||||
stores := newTestStores(t)
|
||||
|
||||
// Should not panic or error — just log and return
|
||||
InstallBundledPackages("/nonexistent/path", "", "", stores, nil)
|
||||
InstallBundledPackages("/nonexistent/path", "", "", stores, nil, nil)
|
||||
}
|
||||
|
||||
// TestBundledInstall_EmptyDir verifies no-op when directory exists but is empty.
|
||||
@@ -155,12 +155,12 @@ func TestBundledInstall_EmptyDir(t *testing.T) {
|
||||
bundledDir := t.TempDir()
|
||||
|
||||
// Should not panic or error
|
||||
InstallBundledPackages(bundledDir, "", "", stores, nil)
|
||||
InstallBundledPackages(bundledDir, "", "", stores, nil, nil)
|
||||
}
|
||||
|
||||
// TestBundledInstall_DormantPackage verifies that bundled packages with
|
||||
// unmet requires are marked dormant.
|
||||
func TestBundledInstall_DormantPackage(t *testing.T) {
|
||||
// TestBundledInstall_SkippedOnUnmetRequiredCaps verifies that bundled
|
||||
// packages with unmet capabilities.required are skipped (not registered).
|
||||
func TestBundledInstall_SkippedOnUnmetRequiredCaps(t *testing.T) {
|
||||
stores := newTestStores(t)
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -168,24 +168,21 @@ func TestBundledInstall_DormantPackage(t *testing.T) {
|
||||
packagesDir := t.TempDir()
|
||||
|
||||
buildTestPkg(t, bundledDir, map[string]any{
|
||||
"id": "dormant-pkg",
|
||||
"title": "Dormant Package",
|
||||
"type": "extension",
|
||||
"hooks": []string{"on_install"},
|
||||
"requires": []string{"chat"},
|
||||
"id": "needs-pgvector",
|
||||
"title": "Needs pgvector",
|
||||
"type": "extension",
|
||||
"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, err := stores.Packages.Get(ctx, "dormant-pkg")
|
||||
if err != nil || pkg == nil {
|
||||
t.Fatal("dormant package not found after install")
|
||||
}
|
||||
if pkg.Status != "dormant" {
|
||||
t.Errorf("status = %q, want %q", pkg.Status, "dormant")
|
||||
}
|
||||
if pkg.Enabled {
|
||||
t.Error("dormant package should not be enabled")
|
||||
pkg, _ := stores.Packages.Get(ctx, "needs-pgvector")
|
||||
if pkg != nil {
|
||||
t.Error("package with unmet required capabilities should not be registered")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +206,7 @@ func TestBundledInstall_Allowlist(t *testing.T) {
|
||||
})
|
||||
|
||||
// Only allow alpha and gamma
|
||||
InstallBundledPackages(bundledDir, packagesDir, "pkg-alpha,pkg-gamma", stores, nil)
|
||||
InstallBundledPackages(bundledDir, packagesDir, "pkg-alpha,pkg-gamma", stores, nil, nil)
|
||||
|
||||
// Alpha and gamma should be installed
|
||||
for _, id := range []string{"pkg-alpha", "pkg-gamma"} {
|
||||
|
||||
Reference in New Issue
Block a user