Skip to content

Commit 1cb1514

Browse files
author
Shreya Sangwa
committed
Fix doc references, stale comment, polling resilience and URI path join
1 parent 3cf3b45 commit 1cb1514

3 files changed

Lines changed: 25 additions & 7 deletions

File tree

tools/Azure.Mcp.Tools.ManagedCleanroom/docs/architecture.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Azure.Mcp.Tools.ManagedCleanroom/
3030
│ │ └── Collaborations/CollaborationsListOptions.cs
3131
│ └── Services/
3232
│ ├── IManagedCleanroomService.cs
33-
│ ├── ManagedCleanroomSerializerContext.cs
3433
│ └── ManagedCleanroomService.cs
3534
└── tests/
3635
└── Azure.Mcp.Tools.ManagedCleanroom.Tests/

tools/Azure.Mcp.Tools.ManagedCleanroom/src/Commands/ManagedCleanroomJsonContext.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
namespace Azure.Mcp.Tools.ManagedCleanroom.Commands;
88

9-
// Only JsonElement is registered here — no typed *CommandResult models — because
10-
// CollaborationClient is a protocol-method-only generated client that returns raw
11-
// Azure.Response with no typed deserialization. Commands pass the raw JsonElement
12-
// response directly to ResponseResult.Create without wrapping it in a result record.
9+
// Only JsonElement is registered here because the current Managed Cleanroom
10+
// commands pass through raw JSON payloads from HTTP/ARM responses directly to
11+
// ResponseResult.Create without wrapping them in typed result models.
1312
[JsonSerializable(typeof(JsonElement))]
1413
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
1514
internal partial class ManagedCleanroomJsonContext : JsonSerializerContext;

tools/Azure.Mcp.Tools.ManagedCleanroom/src/Services/ManagedCleanroomService.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,19 @@ await armClient.GetGenericResources()
154154

155155
await Task.Delay(ProvisioningPollInterval, cancellationToken).ConfigureAwait(false);
156156

157-
var getResponse = await resource.GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
157+
Response<GenericResource> getResponse;
158+
159+
try
160+
{
161+
getResponse = await resource.GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
162+
}
163+
catch (RequestFailedException ex) when (ex.Status == (int)HttpStatusCode.NotFound)
164+
{
165+
// ARM can briefly return 404 after the initial create starts but before the
166+
// resource has fully materialized. Keep polling until the timeout or a terminal state.
167+
continue;
168+
}
169+
158170
var propsBytes = getResponse.Value.Data.Properties?.ToArray() ?? [];
159171

160172
if (propsBytes.Length > 0)
@@ -187,7 +199,15 @@ private HttpClient CreateHttpClient(bool allowUntrustedCert)
187199
private static Uri BuildCollaborationsListUri(Uri endpointUri, bool? activeOnly)
188200
{
189201
// The current frontend route for listing collaborations is /gets.
190-
var builder = new UriBuilder(new Uri(endpointUri, CollaborationsListPath));
202+
var basePath = endpointUri.AbsolutePath.TrimEnd('/');
203+
var path = string.IsNullOrEmpty(basePath) || basePath == "/"
204+
? $"/{CollaborationsListPath}"
205+
: $"{basePath}/{CollaborationsListPath}";
206+
207+
var builder = new UriBuilder(endpointUri)
208+
{
209+
Path = path
210+
};
191211

192212
if (activeOnly.HasValue)
193213
{

0 commit comments

Comments
 (0)