Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,23 @@ data class AgentRuntimeProperties(
// starting with the `gh` wrapper degrading to a no-op.
val githubAppBearerSecret: String = "github-app",
val githubAppBearerSecretKey: String = "token-bearer",
)
) {
init {
require(defaultMcpProfile in VALID_MCP_PROFILES) {
"agent-runtime.default-mcp-profile must be one of " +
VALID_MCP_PROFILES.joinToString(", ") +
"; got '$defaultMcpProfile'"
}
}

companion object {
val VALID_MCP_PROFILES: Set<String> =
setOf(
"minimal",
"frontend",
"cluster",
"code-intel",
"full-diagnostic",
)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.jorisjonkers.personalstack.assistant.config

import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatThrownBy
import org.junit.jupiter.api.Test
import org.springframework.boot.context.properties.bind.Binder
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource
Expand Down Expand Up @@ -73,6 +74,32 @@ class AgentRuntimePropertiesBindingTest {
assertThat(props.nodeSelector).containsKey("personal-stacknode")
}

@Test
fun `default mcp profile accepts every declared runner profile`() {
AgentRuntimeProperties.VALID_MCP_PROFILES.forEach { profile ->
val props =
bind(
base +
mapOf("agent-runtime.default-mcp-profile" to profile),
)

assertThat(props.defaultMcpProfile).isEqualTo(profile)
}
}

@Test
fun `default mcp profile rejects unknown values`() {
assertThatThrownBy {
bind(
base +
mapOf("agent-runtime.default-mcp-profile" to "frontned"),
)
}.rootCause()
.isInstanceOf(IllegalArgumentException::class.java)
.hasMessageContaining("agent-runtime.default-mcp-profile")
.hasMessageContaining("frontned")
}

private fun bind(properties: Map<String, String>): AgentRuntimeProperties {
val source = MapConfigurationPropertySource(properties)
return Binder(source)
Expand Down
Loading