Unify auth middleware and remove X-User-ID trust, add project_members authorization, sandbox workspaces via resolver, and admin-only reconcile by run_id. Introduce goose migrations with startup schema gate, fail closed when DB unavailable outside explicit ALLOW_IN_MEMORY, bundle web/dist in app Dockerfile, and remove frontend pseudo-login fallback.
29 lines
606 B
Go
29 lines
606 B
Go
package bizdev
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"chat-agent-system/internal/config"
|
|
)
|
|
|
|
// MustNewService 测试辅助:允许内存降级,连接失败时不 fatal(除非显式需要 DB)。
|
|
func MustNewService(t testing.TB, cfg *config.Config) *Service {
|
|
t.Helper()
|
|
if cfg == nil {
|
|
cfg = &config.Config{DataDir: t.TempDir(), AgentBackend: "stub"}
|
|
}
|
|
if cfg.ContextDbHost != "" {
|
|
svc, err := NewService(cfg)
|
|
if err != nil {
|
|
t.Fatalf("NewService: %v", err)
|
|
}
|
|
return svc
|
|
}
|
|
cfg.AllowInMemory = true
|
|
svc, err := NewService(cfg)
|
|
if err != nil {
|
|
t.Fatalf("NewService: %v", err)
|
|
}
|
|
return svc
|
|
}
|