Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

impl: prefer agent name over agent id in URI handler#585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fioan89 merged 4 commits intomainfromimpl-use-agent-name-over-agent-id
Oct 1, 2025
Merged
Changes from1 commit
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
PrevPrevious commit
NextNext commit
chore: update and fix UTs
Test cases related to agent matching have to be updatednow that agent name is preferred over agent id.
  • Loading branch information
@fioan89
fioan89 committedOct 1, 2025
commitec68c5010f6e5eff32f6ee5789c5edde4568ed6e
43 changes: 32 additions & 11 deletionssrc/test/kotlin/com/coder/gateway/util/LinkHandlerTest.kt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,15 +55,24 @@ internal class LinkHandlerTest {
val tests =
listOf(
Pair(mapOf("agent" to "agent_name"), "9a920eee-47fb-4571-9501-e4b3120c12f2"),
Pair(mapOf("agent_id" to "9a920eee-47fb-4571-9501-e4b3120c12f2"), "9a920eee-47fb-4571-9501-e4b3120c12f2"),
Pair(
mapOf("agent_id" to "9a920eee-47fb-4571-9501-e4b3120c12f2"),
"9a920eee-47fb-4571-9501-e4b3120c12f2"
),
Pair(mapOf("agent" to "agent_name_2"), "fb3daea4-da6b-424d-84c7-36b90574cfef"),
Pair(mapOf("agent_id" to "fb3daea4-da6b-424d-84c7-36b90574cfef"), "fb3daea4-da6b-424d-84c7-36b90574cfef"),
Pair(
mapOf("agent_id" to "fb3daea4-da6b-424d-84c7-36b90574cfef"),
"fb3daea4-da6b-424d-84c7-36b90574cfef"
),
Pair(mapOf("agent" to "agent_name_3"), "b0e4c54d-9ba9-4413-8512-11ca1e826a24"),
Pair(mapOf("agent_id" to "b0e4c54d-9ba9-4413-8512-11ca1e826a24"), "b0e4c54d-9ba9-4413-8512-11ca1e826a24"),
// Prefer agent_id.
Pair(
mapOf("agent_id" to "b0e4c54d-9ba9-4413-8512-11ca1e826a24"),
"b0e4c54d-9ba9-4413-8512-11ca1e826a24"
),
// Prefer agent name.
Pair(
mapOf(
"agent" to "agent_name",
"agent" to "agent_name_3",
"agent_id" to "b0e4c54d-9ba9-4413-8512-11ca1e826a24",
),
"b0e4c54d-9ba9-4413-8512-11ca1e826a24",
Expand All@@ -89,15 +98,19 @@ internal class LinkHandlerTest {
Triple(mapOf("agent" to "ws.agent_name"), IllegalArgumentException::class, "agent named"),
Triple(mapOf("agent" to "agent_name_4"), IllegalArgumentException::class, "agent named"),
Triple(mapOf("agent_id" to "not-a-uuid"), IllegalArgumentException::class, "agent with ID"),
Triple(mapOf("agent_id" to "ceaa7bcf-1612-45d7-b484-2e0da9349168"), IllegalArgumentException::class, "agent with ID"),
// Will ignore agent if agent_id is set even if agent matches.
Triple(
mapOf("agent_id" to "ceaa7bcf-1612-45d7-b484-2e0da9349168"),
IllegalArgumentException::class,
"agent with ID"
),
// Will ignore agent_id if agent is set even if agent_id matches.
Triple(
mapOf(
"agent" to "agent_name",
"agent" to "unknown_agent_name",
"agent_id" to "ceaa7bcf-1612-45d7-b484-2e0da9349168",
),
IllegalArgumentException::class,
"agentwith ID",
"The workspace \"ws\" does not have anagentnamed \"unknown_agent_name\"",
),
)

Expand DownExpand Up@@ -142,7 +155,11 @@ internal class LinkHandlerTest {
Triple(mapOf("agent" to "ws"), IllegalArgumentException::class, "agent named"),
Triple(mapOf("agent" to "ws.agent_name_3"), IllegalArgumentException::class, "agent named"),
Triple(mapOf("agent" to "agent_name_4"), IllegalArgumentException::class, "agent named"),
Triple(mapOf("agent_id" to "ceaa7bcf-1612-45d7-b484-2e0da9349168"), IllegalArgumentException::class, "agent with ID"),
Triple(
mapOf("agent_id" to "ceaa7bcf-1612-45d7-b484-2e0da9349168"),
IllegalArgumentException::class,
"agent with ID"
),
)

tests.forEach {
Expand All@@ -166,7 +183,11 @@ internal class LinkHandlerTest {
Triple(mapOf("agent" to null), IllegalArgumentException::class, "has no agents"),
Triple(mapOf("agent_id" to null), IllegalArgumentException::class, "has no agents"),
Triple(mapOf("agent" to "agent_name"), IllegalArgumentException::class, "has no agents"),
Triple(mapOf("agent_id" to "9a920eee-47fb-4571-9501-e4b3120c12f2"), IllegalArgumentException::class, "has no agents"),
Triple(
mapOf("agent_id" to "9a920eee-47fb-4571-9501-e4b3120c12f2"),
IllegalArgumentException::class,
"has no agents"
),
)

tests.forEach {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp