Hide managed connectors until fully configured

A managed (Model B) connector like Crisp needs both the Probo-held key
and a resource ID (the plugin ID) to connect, but the driver catalog
gated visibility on the key alone. A deployment that set the key without
the plugin ID (reachable through raw JSON config; the bootstrap env path
already requires both) would show Crisp as connectable and then fail
every attempt with an internal error.

Add a RequiresManagedResourceID flag to the registration and a
Registry.ManagedConnectorReady check that requires both before a managed
provider enters the catalog, so a half-configured provider stays hidden
instead of dead-ending at connect.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-07-11 17:55:33 +02:00
parent a531b3242f
commit 557028e327
5 changed files with 74 additions and 4 deletions

View File

@@ -266,6 +266,35 @@ func TestCrispIsManagedAPIKey(t *testing.T) {
assert.True(t, reg.ManagedAPIKey)
assert.False(t, reg.SupportsAPIKey)
assert.True(t, reg.APIKeyBasicAuthUserPass)
assert.True(t, reg.RequiresManagedResourceID, "crisp needs the plugin ID before it can connect")
}
// TestRegistry_ManagedConnectorReady pins that a provider requiring a resource
// ID (Crisp's plugin ID) is reported ready, and thus surfaced in the catalog,
// only once BOTH the managed key and the resource ID are configured.
func TestRegistry_ManagedConnectorReady(t *testing.T) {
t.Parallel()
t.Run("crisp needs both key and resource id", func(t *testing.T) {
t.Parallel()
r := provider.NewBuiltinRegistry()
assert.False(t, r.ManagedConnectorReady(coredata.ConnectorProviderCrisp), "unconfigured")
r.SetManagedAPIKey(coredata.ConnectorProviderCrisp, "identifier:secret")
assert.False(t, r.ManagedConnectorReady(coredata.ConnectorProviderCrisp), "key set but plugin id missing")
r.SetManagedResourceID(coredata.ConnectorProviderCrisp, "plugin-id")
assert.True(t, r.ManagedConnectorReady(coredata.ConnectorProviderCrisp), "key and plugin id set")
})
t.Run("non-managed provider is never ready", func(t *testing.T) {
t.Parallel()
r := provider.NewBuiltinRegistry()
r.SetManagedAPIKey(coredata.ConnectorProviderTally, "some-key")
assert.False(t, r.ManagedConnectorReady(coredata.ConnectorProviderTally))
})
}
// TestRegistry_RejectsManagedPlusCustomerCredential pins that a