Skip to content

Commit e2d069c

Browse files
HandyS11claude
andcommitted
fix(review): address Copilot comments on PR #45
- DiscordWorkspaceGateway.DeleteMessageAsync forwards the cancellation token via RequestOptions.CancelToken instead of ignoring it. - Correct the stale DI comment: with no RustMaps API key the #info map renderer returns an empty payload (no message), not a placeholder. - RustMapsParityTests orders the fixture enumeration so the selected fixture is deterministic across filesystems. - MapParity CLI uses TryParse for numeric args and prints the usage line on invalid input instead of throwing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 93126ff commit e2d069c

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

src/RustPlusBot.Features.Workspace/Gateway/DiscordWorkspaceGateway.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ public async Task DeleteMessageAsync(ulong guildId,
153153

154154
try
155155
{
156-
await channel.DeleteMessageAsync(messageId).ConfigureAwait(false);
156+
await channel.DeleteMessageAsync(messageId, new RequestOptions
157+
{
158+
CancelToken = cancellationToken
159+
})
160+
.ConfigureAwait(false);
157161
}
158162
catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.NotFound)
159163
{

src/RustPlusBot.Features.Workspace/WorkspaceServiceCollectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public static IServiceCollection AddWorkspace(this IServiceCollection services)
4343
// the host must compose both AddWorkspace and AddConnections.
4444
services.AddScoped<IMessageRenderer, ServerInfoMessageRenderer>();
4545
// ServerInfoMapMessageRenderer takes IInfoMapReadModel as an OPTIONAL dependency: it only resolves
46-
// when Features.Map registered it (RustMaps API key present); otherwise the renderer shows the
47-
// "preparing" placeholder forever.
46+
// when Features.Map registered it (RustMaps API key present); otherwise the renderer returns an
47+
// empty payload and the reconciler never posts a map message.
4848
services.AddScoped<IMessageRenderer, ServerInfoMapMessageRenderer>();
4949
services.AddScoped<IMessageRenderer, MapControlMessageRenderer>();
5050

tests/RustPlusBot.Features.Map.Tests/RustMapsParityTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ public sealed class RustMapsParityTests
1717
[SkippableFact]
1818
public void Monument_world_coords_project_into_consistent_grid_cells()
1919
{
20+
// Order the enumeration so the selected fixture is deterministic across machines/filesystems.
2021
var fixture = Directory.Exists(FixtureDir)
21-
? Directory.EnumerateFiles(FixtureDir, "rustmaps-*.json").FirstOrDefault()
22+
? Directory.EnumerateFiles(FixtureDir, "rustmaps-*.json").Order(StringComparer.Ordinal).FirstOrDefault()
2223
: null;
2324
Skip.If(fixture is null, "No RustMaps fixture committed yet (run tools/RustPlusBot.MapParity).");
2425

tools/RustPlusBot.MapParity/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
using SixLabors.ImageSharp.PixelFormats;
99
using SixLabors.ImageSharp.Processing;
1010

11-
if (args.Length < 4)
11+
if (args.Length < 4
12+
|| !int.TryParse(args[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out var size)
13+
|| !int.TryParse(args[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var seed))
1214
{
1315
await Console.Error.WriteLineAsync("Usage: map-parity <worldSize> <seed> <apiKey> <outDir>").ConfigureAwait(false);
1416
return 1;
1517
}
1618

17-
var size = int.Parse(args[0], CultureInfo.InvariantCulture);
18-
var seed = int.Parse(args[1], CultureInfo.InvariantCulture);
1919
var apiKey = args[2];
2020
var outDir = Directory.CreateDirectory(args[3]).FullName;
2121

0 commit comments

Comments
 (0)