Files
OwnCord/Server/plugin/registry_upgrade_default_test.go
T
J3vb db0275a290 fix: batch of 29 correctness fixes across server and client (#1369)
* fix(ws): 2 defect(s) (OC-0013, OC-0140)

* fix(voice): 1 defect(s) (OC-0044)

* fix(ws): 1 defect(s) (OC-0024)

* fix(server): 1 defect(s) (OC-0027)

* fix(ws): 1 defect(s) (OC-0028)

* fix(server): 7 defect(s) (OC-0033, OC-0066, OC-0067, OC-0068, OC-0074, OC-0077, OC-0106)

* fix(ws): 1 defect(s) (OC-0051)

* fix(client): 1 defect(s) (OC-0053)

* fix(client): 1 defect(s) (OC-0055)

* fix(service): 1 defect(s) (OC-0069)

* fix(voice): 1 defect(s) (OC-0072)

* fix(service): 1 defect(s) (OC-0082)

* fix(client): 1 defect(s) (OC-0083)

* fix(plugin): 1 defect(s) (OC-0088)

* fix(plugin): 4 defect(s) (OC-0104, OC-0126, OC-0127, OC-0133)

* fix(admin): 1 defect(s) (OC-0110)

* fix(client): 1 defect(s) (OC-0114)

* fix(api): 1 defect(s) (OC-0139)

* fix(client): 1 defect(s) (OC-0149)

* test(server): adapt existing tests to updated OpenDM and IncrementMentionCounts signatures

* style(plugin): modernize loops and goroutine spawns in race test

* fix(ws): mirror the focus admission gate in the post-subscribe revalidation

* fix(service): detach DM post-commit side effects from the request ctx, fail delete closed, add empty-fan-out fallback

* fix(plugin): preserve enabled intent when upgrade reactivation hits a runtime-less build

* chore(skills): harden bughunt-fix workflow and fold review lessons into bughunt-run/db-change

* Add comprehensive documentation for task-observer skill

- Introduced environments.md to outline activation setup, compaction behavior, and handoff-doc mode.
- Created skill-authoring.md detailing taxonomy, licensing, confidentiality, and editing rules for skill creation.
- Added weekly-review.md for a structured review process of OPEN observations, including scheduled and in-session fallback modes.

* chore(go): pin toolchain go1.26.6 (stdlib CVE fixes flagged by govulncheck)
2026-08-14 10:05:40 +02:00

53 lines
1.6 KiB
Go

//go:build !wazero
package plugin
import (
"context"
"testing"
)
// On a default (non-wazero) build nothing can ever activate, so the
// reactivate-after-upgrade path must not let EnablePlugin's activation-failure
// rollback persistently flip an enabled plugin's store row to disabled: the
// admin's enabled intent has to survive the upgrade so a later restart under a
// wazero-tagged build brings the plugin back up, exactly as activateAll would
// have at startup.
func TestRegistry_InstallFromZip_RuntimeUnavailable_PreservesEnabledFlag(t *testing.T) {
r, store, dir := newRegistryWithDir(t)
ctx := context.Background()
writePluginDir(t, dir, "alpha", simpleManifest("alpha"))
if err := r.LoadAll(ctx); err != nil {
t.Fatalf("LoadAll: %v", err)
}
inst := r.List()[0]
if err := store.EnablePlugin(ctx, inst.ID); err != nil {
t.Fatalf("EnablePlugin (setup): %v", err)
}
r.mu.Lock()
inst.Enabled = true
r.mu.Unlock()
zipBytes := buildZip(t, map[string]string{
"plugin.json": simpleManifest("alpha"),
"alpha.wasm": "\x00asm\x01\x00\x00\x00",
})
if _, err := r.InstallFromZip(ctx, zipBytes); err != nil {
t.Fatalf("InstallFromZip: %v", err)
}
newInst := r.List()[0]
row, err := store.GetPlugin(ctx, newInst.ID)
if err != nil {
t.Fatalf("GetPlugin: %v", err)
}
if !row.Enabled {
t.Error("store row flipped to disabled by an upgrade on a runtime-less build — " +
"the enabled intent must survive until a wazero-tagged start can actually activate")
}
if !newInst.Enabled {
t.Error("in-memory instance must carry the preserved enabled flag so admin listings stay truthful")
}
}