Skip to content

Commit dcbde67

Browse files
iancooperclaude
andcommitted
fix(spec-0030): resolve solution-wide CS8604/CS8601/CS8618 from string?-widened operators
D8 widened nine core value-type implicit operators from `operator string(T)` to the null-safe `operator string?(T) => t?.Value` (commit cb3e4ef, matching the ChannelName precedent). Because src/Directory.Build.props sets TreatWarningsAsErrors, every call site feeding one of these conversions into a non-nullable string broke at compile time. The earlier fixes (6262cc1, 7f451cd) only covered Paramore.Brighter and ServiceActivator; a full-solution build across all TFMs surfaced 326 more sites across ~28 src assemblies plus the dependent test projects. Fix (mechanical, behaviour-preserving): use `.Value` at each call site where the value type is non-nullable, and `?.Value ?? <existing fallback>` where the source is itself nullable (e.g. MessageHeader.ReplyTo, Publication.Topic). A few sites that were already guarded non-null by an upstream IsNullOrEmpty-throw use `Topic!.Value`, matching the established repo convention. Tenant (Transformers.JustSaying) is reverted to the non-nullable `operator string`: it is a readonly record struct, so its receiver can never be null and `tenant?.Value` was both unnecessary and invalid (CS0023). Test-only fixes (fallout from the Phase 2 contract retyping, surfaced once src compiled): `Assert.Equal(n, x.Version)` -> `.Version.Value` across the BoxProvisioning migration tests, and the MySQL fake VersionCapturingMigrationRunner MigrateAsync override retyped to the value-type IAmABoxMigrationRunner signature. Full solution now builds clean across netstandard2.0;net8.0;net9.0;net10.0 (and net462/net472 where applicable). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9bdc82f commit dcbde67

79 files changed

Lines changed: 331 additions & 331 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Paramore.Brighter.BoxProvisioning.MsSql/MsSqlBoxMigrationRunner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ await InsertHistoryRowAsync(
430430
await ExecuteUpScriptAsync(connection, transaction!, migration, cancellationToken);
431431
await InsertHistoryRowAsync(
432432
connection, transaction!, effectiveSchema, tableName,
433-
migration.Version, migration.Description, cancellationToken);
433+
migration.Version, migration.Description.Value, cancellationToken);
434434
}
435435
}
436436

@@ -450,14 +450,14 @@ protected override async Task RunNormalPathAsync(
450450
await ExecuteUpScriptAsync(connection, transaction!, migration, cancellationToken);
451451
await InsertHistoryRowAsync(
452452
connection, transaction!, effectiveSchema, tableName,
453-
migration.Version, migration.Description, cancellationToken);
453+
migration.Version, migration.Description.Value, cancellationToken);
454454
}
455455
}
456456

457457
private static Task ExecuteUpScriptAsync(
458458
SqlConnection connection, SqlTransaction transaction,
459459
IAmABoxMigration migration, CancellationToken cancellationToken)
460-
=> ExecuteDdlAsync(connection, transaction, migration.UpScript, cancellationToken);
460+
=> ExecuteDdlAsync(connection, transaction, migration.UpScript.Value, cancellationToken);
461461

462462
private static async Task ExecuteDdlAsync(
463463
SqlConnection connection, SqlTransaction transaction,

src/Paramore.Brighter.BoxProvisioning.MySql/MySqlBoxMigrationRunner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ await InsertHistoryRowAsync(
210210
await ExecuteUpScriptAsync(connection, migration, cancellationToken);
211211
await InsertHistoryRowAsync(
212212
connection, effectiveSchema, tableName,
213-
migration.Version, migration.Description, cancellationToken);
213+
migration.Version, migration.Description.Value, cancellationToken);
214214
}
215215
}
216216

@@ -229,14 +229,14 @@ protected override async Task RunNormalPathAsync(
229229
await ExecuteUpScriptAsync(connection, migration, cancellationToken);
230230
await InsertHistoryRowAsync(
231231
connection, effectiveSchema, tableName,
232-
migration.Version, migration.Description, cancellationToken);
232+
migration.Version, migration.Description.Value, cancellationToken);
233233
}
234234
}
235235

236236
private static Task ExecuteUpScriptAsync(
237237
MySqlConnection connection, IAmABoxMigration migration,
238238
CancellationToken cancellationToken)
239-
=> ExecuteDdlAsync(connection, migration.UpScript, cancellationToken);
239+
=> ExecuteDdlAsync(connection, migration.UpScript.Value, cancellationToken);
240240

241241
private static async Task ExecuteDdlAsync(
242242
MySqlConnection connection, string ddl,

src/Paramore.Brighter.BoxProvisioning.PostgreSql/PostgreSqlBoxMigrationRunner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ await InsertHistoryRowAsync(
462462
await ExecuteUpScriptAsync(connection, transaction!, migration, cancellationToken);
463463
await InsertHistoryRowAsync(
464464
connection, transaction!, effectiveSchema, tableName,
465-
migration.Version, migration.Description, cancellationToken);
465+
migration.Version, migration.Description.Value, cancellationToken);
466466
}
467467
}
468468

@@ -482,14 +482,14 @@ protected override async Task RunNormalPathAsync(
482482
await ExecuteUpScriptAsync(connection, transaction!, migration, cancellationToken);
483483
await InsertHistoryRowAsync(
484484
connection, transaction!, effectiveSchema, tableName,
485-
migration.Version, migration.Description, cancellationToken);
485+
migration.Version, migration.Description.Value, cancellationToken);
486486
}
487487
}
488488

489489
private static Task ExecuteUpScriptAsync(
490490
NpgsqlConnection connection, NpgsqlTransaction transaction,
491491
IAmABoxMigration migration, CancellationToken cancellationToken)
492-
=> ExecuteDdlAsync(connection, transaction, migration.UpScript, cancellationToken);
492+
=> ExecuteDdlAsync(connection, transaction, migration.UpScript.Value, cancellationToken);
493493

494494
private static async Task ExecuteDdlAsync(
495495
NpgsqlConnection connection, NpgsqlTransaction transaction,

src/Paramore.Brighter.BoxProvisioning.Sqlite/SqliteBoxMigrationRunner.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,23 +282,23 @@ private static async Task ApplyOrSkipAsync(
282282
// Per ADR §6: if IdempotencyCheckSql is non-null, evaluate it under the lock-bearing
283283
// transaction. A non-zero scalar means the migration's effect is already present —
284284
// skip UpScript but still record history so MAX(V) advances.
285-
if (!string.IsNullOrEmpty(migration.IdempotencyCheckSql))
285+
if (!string.IsNullOrEmpty(migration.IdempotencyCheckSql?.Value))
286286
{
287287
var alreadyApplied = await ScalarIsPositiveAsync(
288288
connection, transaction, migration.IdempotencyCheckSql!, cancellationToken);
289289
if (!alreadyApplied)
290290
{
291-
await ExecuteUpScriptAsync(connection, transaction, migration.UpScript, cancellationToken);
291+
await ExecuteUpScriptAsync(connection, transaction, migration.UpScript.Value, cancellationToken);
292292
}
293293
}
294294
else
295295
{
296-
await ExecuteUpScriptAsync(connection, transaction, migration.UpScript, cancellationToken);
296+
await ExecuteUpScriptAsync(connection, transaction, migration.UpScript.Value, cancellationToken);
297297
}
298298

299299
await InsertHistoryRowAsync(
300300
connection, transaction, tableName,
301-
migration.Version, migration.Description, cancellationToken);
301+
migration.Version, migration.Description.Value, cancellationToken);
302302
}
303303

304304
private static async Task<bool> ScalarIsPositiveAsync(

src/Paramore.Brighter.Inbox.DynamoDB.V4/CommandItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public CommandItem(T command, string contextKey)
3636
var type = typeof(T).Name;
3737

3838
Time = $"{TimeStamp.Ticks}";
39-
CommandId = command.Id;
39+
CommandId = command.Id.Value;
4040
CommandType = typeof(T).Name;
4141
CommandBody = JsonSerializer.Serialize(command, JsonSerialisationOptions.Options);
4242
ContextKey = contextKey;

src/Paramore.Brighter.Inbox.DynamoDB.V4/DynamoDbInbox.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public async Task AddAsync<T>(T command, string contextKey, RequestContext? requ
143143
{
144144
var dbAttributes = new Dictionary<string, string>()
145145
{
146-
{"db.operation.parameter.command.id", command.Id}
146+
{"db.operation.parameter.command.id", command.Id.Value}
147147
};
148148
var span = Tracer?.CreateDbSpan(
149149
new BoxSpanInfo(DbSystem.Dynamodb, DYNAMO_DB_NAME, BoxDbOperation.Add, _configuration.TableName, dbAttributes: dbAttributes),

src/Paramore.Brighter.Inbox.DynamoDB/DynamoDbInbox.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public async Task AddAsync<T>(T command, string contextKey, RequestContext? requ
135135
{
136136
var dbAttributes = new Dictionary<string, string>()
137137
{
138-
{"db.operation.parameter.command.id", command.Id}
138+
{"db.operation.parameter.command.id", command.Id.Value}
139139
};
140140
var span = Tracer?.CreateDbSpan(
141141
new BoxSpanInfo(DbSystem.Dynamodb, DYNAMO_DB_NAME, BoxDbOperation.Add, _configuration.TableName, dbAttributes: dbAttributes),

src/Paramore.Brighter.Inbox.Firestore/FirestoreInbox.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void Add<T>(T command, string contextKey, RequestContext? requestContext,
7676
{
7777
var dbAttributes = new Dictionary<string, string>
7878
{
79-
["db.operation.parameter.command.id"] = command.Id,
79+
["db.operation.parameter.command.id"] = command.Id.Value,
8080
["db.operation.parameter.command.context_key"] = contextKey,
8181
};
8282

@@ -282,7 +282,7 @@ public async Task AddAsync<T>(T command, string contextKey, RequestContext? requ
282282
{
283283
var dbAttributes = new Dictionary<string, string>
284284
{
285-
["db.operation.parameter.command.id"] = command.Id,
285+
["db.operation.parameter.command.id"] = command.Id.Value,
286286
["db.operation.parameter.command.context_key"] = contextKey,
287287
};
288288

src/Paramore.Brighter.Inbox.MongoDb/MongoDbInbox.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task AddAsync<T>(T command, string contextKey, RequestContext? requ
5050
{
5151
var dbAttributes = new Dictionary<string, string>()
5252
{
53-
{"db.operation.parameter.command.id", command.Id}
53+
{"db.operation.parameter.command.id", command.Id.Value}
5454
};
5555
var span = Tracer?.CreateDbSpan(
5656
new BoxSpanInfo(DbSystem.Mongodb,
@@ -63,7 +63,7 @@ public async Task AddAsync<T>(T command, string contextKey, RequestContext? requ
6363

6464
try
6565
{
66-
var message = new InboxMessage(command, command.Id, contextKey, Configuration.TimeProvider.GetUtcNow(),
66+
var message = new InboxMessage(command, command.Id.Value, contextKey, Configuration.TimeProvider.GetUtcNow(),
6767
ExpireAfterSeconds);
6868
await Collection.InsertOneAsync(message, cancellationToken: cancellationToken)
6969
.ConfigureAwait(ContinueOnCapturedContext);
@@ -159,7 +159,7 @@ public void Add<T>(T command, string contextKey, RequestContext? requestContext,
159159
{
160160
var dbAttributes = new Dictionary<string, string>()
161161
{
162-
{"db.operation.parameter.command.id", command.Id}
162+
{"db.operation.parameter.command.id", command.Id.Value}
163163
};
164164
var span = Tracer?.CreateDbSpan(
165165
new BoxSpanInfo(DbSystem.Mongodb,
@@ -172,7 +172,7 @@ public void Add<T>(T command, string contextKey, RequestContext? requestContext,
172172

173173
try
174174
{
175-
var message = new InboxMessage(command, command.Id, contextKey, Configuration.TimeProvider.GetUtcNow(),
175+
var message = new InboxMessage(command, command.Id.Value, contextKey, Configuration.TimeProvider.GetUtcNow(),
176176
ExpireAfterSeconds);
177177
Collection.InsertOne(message);
178178
}

src/Paramore.Brighter.MessageScheduler.AWS.V4/AwsScheduler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,12 @@ private async Task<Target> CreateTargetAsync(string id, Message message, bool as
264264

265265
private ValueTask<string?> GetTopicAsync(Message message)
266266
{
267-
if (s_topic.TryGetValue(message.Header.Topic, out var topicArn))
267+
if (s_topic.TryGetValue(message.Header.Topic.Value, out var topicArn))
268268
{
269269
return new ValueTask<string?>(topicArn);
270270
}
271271

272-
return new ValueTask<string?>(GetTopicArnAsync(message.Header.Topic));
272+
return new ValueTask<string?>(GetTopicArnAsync(message.Header.Topic.Value));
273273

274274

275275
async Task<string?> GetTopicArnAsync(string topicName)
@@ -289,12 +289,12 @@ private async Task<Target> CreateTargetAsync(string id, Message message, bool as
289289

290290
private ValueTask<string?> GetQueueAsync(Message message)
291291
{
292-
if (s_queueUrl.TryGetValue(message.Header.Topic, out var queueUrl))
292+
if (s_queueUrl.TryGetValue(message.Header.Topic.Value, out var queueUrl))
293293
{
294294
return new ValueTask<string?>(queueUrl);
295295
}
296296

297-
return new ValueTask<string?>(GetQueueUrlAsync(message.Header.Topic));
297+
return new ValueTask<string?>(GetQueueUrlAsync(message.Header.Topic.Value));
298298

299299
async Task<string?> GetQueueUrlAsync(string queueName)
300300
{

0 commit comments

Comments
 (0)