Fix dormant tests for capability negotiation
All checks were successful
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 / test-go-pg (pull_request) Successful in 2m42s
CI/CD / test-sqlite (pull_request) Successful in 3m2s
CI/CD / build-and-deploy (pull_request) Successful in 1m20s
All checks were successful
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 / test-go-pg (pull_request) Successful in 2m42s
CI/CD / test-sqlite (pull_request) Successful in 3m2s
CI/CD / build-and-deploy (pull_request) Successful in 1m20s
Update TestBundledInstall_DormantPackage and TestUpgrade_PackageDormantOnUnmetRequires to use the new capabilities.required manifest field and expect packages to be skipped (not registered) rather than marked dormant. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -158,9 +158,9 @@ func TestBundledInstall_EmptyDir(t *testing.T) {
|
|||||||
InstallBundledPackages(bundledDir, "", "", stores, nil, nil)
|
InstallBundledPackages(bundledDir, "", "", stores, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestBundledInstall_DormantPackage verifies that bundled packages with
|
// TestBundledInstall_SkippedOnUnmetRequiredCaps verifies that bundled
|
||||||
// unmet requires are marked dormant.
|
// packages with unmet capabilities.required are skipped (not registered).
|
||||||
func TestBundledInstall_DormantPackage(t *testing.T) {
|
func TestBundledInstall_SkippedOnUnmetRequiredCaps(t *testing.T) {
|
||||||
stores := newTestStores(t)
|
stores := newTestStores(t)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
@@ -168,24 +168,21 @@ func TestBundledInstall_DormantPackage(t *testing.T) {
|
|||||||
packagesDir := t.TempDir()
|
packagesDir := t.TempDir()
|
||||||
|
|
||||||
buildTestPkg(t, bundledDir, map[string]any{
|
buildTestPkg(t, bundledDir, map[string]any{
|
||||||
"id": "dormant-pkg",
|
"id": "needs-pgvector",
|
||||||
"title": "Dormant Package",
|
"title": "Needs pgvector",
|
||||||
"type": "extension",
|
"type": "extension",
|
||||||
"hooks": []string{"on_install"},
|
"hooks": []string{"on_install"},
|
||||||
"requires": []string{"chat"},
|
"capabilities": map[string]any{
|
||||||
|
"required": []string{"pgvector"},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// No capabilities detected → pgvector is unavailable
|
||||||
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
|
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
|
||||||
|
|
||||||
pkg, err := stores.Packages.Get(ctx, "dormant-pkg")
|
pkg, _ := stores.Packages.Get(ctx, "needs-pgvector")
|
||||||
if err != nil || pkg == nil {
|
if pkg != nil {
|
||||||
t.Fatal("dormant package not found after install")
|
t.Error("package with unmet required capabilities should not 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")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
stores := newTestStores(t)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
@@ -447,25 +447,22 @@ func TestUpgrade_PackageDormantOnUnmetRequires(t *testing.T) {
|
|||||||
|
|
||||||
// Package requires a capability that doesn't exist
|
// Package requires a capability that doesn't exist
|
||||||
buildTestPkg(t, bundledDir, map[string]any{
|
buildTestPkg(t, bundledDir, map[string]any{
|
||||||
"id": "future-pkg",
|
"id": "future-pkg",
|
||||||
"title": "Future",
|
"title": "Future",
|
||||||
"type": "extension",
|
"type": "extension",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"hooks": []string{"on_install"},
|
"hooks": []string{"on_install"},
|
||||||
"requires": []string{"kernel>=99.0.0"},
|
"capabilities": map[string]any{
|
||||||
|
"required": []string{"pgvector"},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// No capabilities detected → pgvector is unavailable
|
||||||
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
|
InstallBundledPackages(bundledDir, packagesDir, "*", stores, nil, nil)
|
||||||
|
|
||||||
pkg, _ := stores.Packages.Get(ctx, "future-pkg")
|
pkg, _ := stores.Packages.Get(ctx, "future-pkg")
|
||||||
if pkg == nil {
|
if pkg != nil {
|
||||||
t.Fatal("package should still be registered")
|
t.Error("package with unmet required capabilities should not 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")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user