From d45d35ddfc12f150c63fdee49591df0ff000b9ba Mon Sep 17 00:00:00 2001 From: yuanhe Date: Thu, 1 Oct 2026 13:02:37 +0800 Subject: [PATCH] Give the model configuration observation fixture its placement rules Since #342, Store.CreateSession requires placement rules for an openai_hosted Session, and cmd/server supplies them through SetPlacement. The modelconfigurationpg observation fixture builds its own Store without them, so TestObservationExcludesOtherSourcesAndHistoricalSessions has failed on main (backend / check-core) since ffe6734e. The fixture now sets the same rules cmd/server builds: the built-in providers and an unset public URL. --- .../postgres/modelconfigurationpg/fixture_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/core/internal/persistence/postgres/modelconfigurationpg/fixture_test.go b/services/core/internal/persistence/postgres/modelconfigurationpg/fixture_test.go index a4fb2120..5b37c1dc 100644 --- a/services/core/internal/persistence/postgres/modelconfigurationpg/fixture_test.go +++ b/services/core/internal/persistence/postgres/modelconfigurationpg/fixture_test.go @@ -13,11 +13,13 @@ import ( "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/adminaudit" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/credentialcrypto" + "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/deployment/placement" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/identity" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/modelconfiguration" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/persistence/postgres/modelconfigurationpg" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/persistence/postgres/pgtest" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/persistence/postgres/pgunit" + "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/sandbox/providers" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/sessions" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/store" ) @@ -105,6 +107,12 @@ func newObserved(t *testing.T) observed { }, } sessions := store.NewWithCredentialCipher(f.pool, f.cipher) + // cmd/server gives the store its placement rules; hosted creation needs them. + rules, err := placement.NewRules(providers.Builtin(), "") + if err != nil { + t.Fatal(err) + } + sessions.SetPlacement(rules) tenant := uuid.NewString() session, err := sessions.CreateSession(t.Context(), tenant, input) if err != nil {