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

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:
2026-04-03 08:59:11 +00:00
parent 44bf63e5fe
commit 301b7e0d02
2 changed files with 26 additions and 32 deletions

View File

@@ -158,9 +158,9 @@ func TestBundledInstall_EmptyDir(t *testing.T) {
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",
"id": "needs-pgvector",
"title": "Needs pgvector",
"type": "extension",
"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)
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")
}
}

View File

@@ -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()
@@ -452,20 +452,17 @@ func TestUpgrade_PackageDormantOnUnmetRequires(t *testing.T) {
"type": "extension",
"version": "1.0.0",
"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)
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")
}
}