Skip to content

Commit 3a744d1

Browse files
committed
Repair SQL regression source compilation and RF3 caller lifetimes
1 parent 9f3acf5 commit 3a744d1

11 files changed

Lines changed: 66 additions & 18 deletions

File tree

‎ai-database-sql.plan.md‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ no reliable cheaper-tier correctness/routing evidence is available in this run.
2626
| TASK-AISQL-011; exact baseline finding and Accepted ADR-036 contract | SQL worker; OrleansNode.cs, NEW Server/Features/ClusterRouting/OrleansRpcFailure.cs and UnitTests/Features/ClusterRouting/OrleansRpcFailureTests.cs only; root owns trusted gateway/auth caller joins and docs | 011,009 | Native-exception regression sources, narrow initial-RPC classification, no retry/suppression/domain recoding; root reviews then exact-SHA build/unit/RF3 catch-up proof |
2727
| TASK-AISQL-012A; Accepted ADR-054 integration repair | models worker; Client/Features/BlobStorage/BlobClient.cs and NEW UnitTests/Features/BlobStorage/BlobSdkArgumentTests.cs only; root owns Send access join | 012,006,009 | Tests-first public null guards, source-compatible feature extension methods, same transport/IDs; root review + exact build/RF3 |
2828
| TASK-AISQL-012B; Accepted ADR-054 integration repair | gates worker; QueryCandidateReader.cs only | 008,009 | Remove depth4 nesting without new allocations/semantic changes; existing25 real-store regression cases + exact build |
29+
| TASK-AISQL-015; exact UnitTests compiler diagnostics | models worker; RelationalLinkageTests.cs, RelationalTestData.cs and RelationalRowTests.cs only | 002–004,009 | Correct actual ordered TUnit collection comparison and cache CompositeFormat without altering exact raw decimal fixtures or assertions; exact-SHA compiler/units join |
30+
| TASK-AISQL-016; exact UnitTests compiler diagnostics | SQL worker; OrleansRpcFailureTests.cs, SqlOperationBudgetTests.cs and SqlOperationCompilerTests.cs only | 005,007,011,009 | Await native CancelAsync before cancellation assertions and remove imports proven redundant by actual compiler; same errors and test coverage, no suppression |
31+
| TASK-AISQL-014; exact RF3 compiler diagnostics | gates worker; SqlRf3AdmissionTests.cs only, root owns static scenario member | 004,007,009 | Isolate existing per-node using/await-using ownership in VerifyNodeAsync outside fixture try/finally/loop analysis; start caller deadline after separately bounded fixture readiness; preserve all3 real-node assertions, same-ID control progress and schema/linkage contracts; no suppression/test weakening |
2932

3033
No worker may expand scope, change contracts/policy, install tools/dependencies,
3134
stash, weaken diagnostics/assertions, test locally or commit/push. Escalate any
@@ -107,7 +110,7 @@ build/format/governance/unit/scalar/recovery and analyzer jobs passed. Required
107110
runtime failures remain:
108111

109112
- [ ] RetainedReplicaCatchesUpThroughNativeSnapshotAndKeepsCommandOutcomes:
110-
[RF3 job111033735266](https://github.com/managedcode/KeyLoad/actions/runs/37065200835/job/111033735266),45/46 passing, no skips. RecoveryRequired after stopped replica; actual node1 logs show distributed-directory/placement connection rejection to node2. Inspect transport failure classification; do not broaden accepted retry errors to hide genuine recovery damage.
113+
[RF3 job111033735266](https://github.com/managedcode/KeyLoad/actions/runs/37065200835/job/111033735266),45/46 passing, no skips. RecoveryRequired after stopped replica; node1 logs also contain distributed-directory/placement connection rejection to node2, but the exact failed request dispatch phase and native exception class were not captured. The narrow native RPC repair is a contract correction, not proof of that failure's root cause; qualify the unchanged catch-up test and preserve genuine recovery damage.
111114
- [ ] AspireRunsIdenticalScenariosAgainstRealRf3AndExternalEngines:
112115
[comparison job111033735452](https://github.com/managedcode/KeyLoad/actions/runs/37065200835/job/111033735452), resource Waiting with no creation/health; lifecycle timed out. Concurrent comparison work is outside this scoped source commit.
113116
- [ ] AspireTimeseriesProfileEmitsOracleReportAndProtectsForeignSchema:
@@ -157,3 +160,19 @@ reached Server build after those repairs and stopped on one unnecessary import:
157160
settings into the dedicated fixture so SDK/MCP SQL rejection and direct-control
158161
progress can be deterministic. Concurrent occupied-lane saturation stays a
159162
separate qualifier; AC007 stays open until actual GitHub runtime evidence.
163+
164+
Candidate9f3acf5b9af39ad5d8f818039b22eb8ce1b0463e / [37069574976](https://github.com/managedcode/KeyLoad/actions/runs/37069574976) repeats the full gates after the IDE0005 repair. Outcome is pending; no runtime result is inferred from source review.
165+
166+
RF3 build job111045550869 reached IntegrationTests and exposed:
167+
168+
- [ ] CA1822 RelationalSqlRf3Scenario.Space: make the constant-only helper static; linked graph/vector semantics remain identical.
169+
- [ ] CA2000 SqlRf3AdmissionTests caller allocation: the committed loop already uses using/await-using, but analyzer reports both declarations within fixture try/finally. Extract an explicit per-node disposal scope into VerifyNodeAsync; retain unconditional disposal, all three node assertions and original control semantics. Start the caller deadline after the independent bounded fixture initialization so cold startup cannot consume it. Repeat exact-SHA build and real RF3 tests.
170+
171+
The same candidate Ubuntu job111045551116 exposed additional unit source failures before any units could execute:
172+
173+
- [ ] CS0103 RelationalLinkageTests.CollectionOrdering: bind the actual ordered TUnit comparison API; preserve sequence equality.
174+
- [ ] CA1863 RelationalTestData/RelationalRowTests string.Format: cache CompositeFormat preserving byte-for-byte numeric JSON fixture contents.
175+
- [ ] CA1849 OrleansRpcFailureTests/SqlOperationBudgetTests cancellation: await native CancelAsync before exercising the pre-cancelled boundary.
176+
- [ ] IDE0005 unused UnitTests imports in OrleansRpcFailureTests/SqlOperationCompilerTests: remove only compiler-identified redundant imports.
177+
178+
TASK-AISQL-014/015/016 are complete source artifacts, reviewed and joined by root. Per-node disposal extraction, static vector-space helper, actual TUnit namespace, cached invariant formatting, awaited cancellation and unused-import removals retain every contract/assertion. Exact-SHA build/tests remain pending.

‎docs/implementation/central-sql.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ Required baseline dispatched after planning:
4848
was cancelled before any job executed. The original37065200835 later completed
4949
failure: all three OS build/format/governance/unit/scalar/recovery jobs and analyzer
5050
rules passed; RF3 passed45/46 and comparisons2/4. The remaining snapshot/catch-up
51-
failure shows Orleans directory/placement connection rejection to a stopped node.
51+
failure returned a generic recovery error. Node logs also show Orleans directory/placement
52+
connection rejection to a stopped node; the request dispatch phase and exact exception
53+
were not retained, so a causal attribution remains unproven.
5254
Comparisons lifecycle remained Waiting, and two retained StreamAppend smoke cases
5355
failed with unsupported ReadEventAsync. The root plan tracks exact jobs and cases.
5456
Exact new-source qualification is pending; no test count or speed result is
@@ -91,3 +93,7 @@ initial native Orleans/timeout RPC faults map to read OwnershipLost or uncertain
9193
command UnknownWriteOutcome. Genuine domain RecoveryRequired and caller
9294
cancellation retain their contracts; no extra dispatch/retry is introduced.
9395
Independent join review is complete; the next exact-SHA CI is the authority.
96+
97+
Candidateaf9e0d16b / [37069241980](https://github.com/managedcode/KeyLoad/actions/runs/37069241980) stopped on one redundant namespace import before product tests. Candidate9f3acf5b9 / [37069574976](https://github.com/managedcode/KeyLoad/actions/runs/37069574976) removes it and repeats complete qualification; results remain pending.
98+
99+
Candidate9f3acf5b9 passed Server/ComparisonTests compilation and reached comparison tests, but IntegrationTests/UnitTests compilation failed on CA1822/CA2000, missing TUnit enum namespace, repeated-format caching, synchronous cancellation and redundant imports. Bounded source repairs preserve the existing assertions and are awaiting a fresh complete CI; RF3 and units did not execute in that candidate.

‎docs/implementation/status.json‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1925,12 +1925,26 @@
19251925
"run": 37068458582,
19261926
"conclusion": "failure",
19271927
"scope": "build_CA1062_blob_null_KLD0031_client_aggregate_KLD0033_query_nesting_no_product_runtime_execution"
1928+
},
1929+
{
1930+
"sha": "af9e0d16b6fdc781f7d4b9b54cd56fec152cfc56",
1931+
"run": 37069241980,
1932+
"conclusion": "failure",
1933+
"scope": "build_IDE0005_redundant_Server_import_no_product_runtime_execution"
1934+
},
1935+
{
1936+
"sha": "9f3acf5b9af39ad5d8f818039b22eb8ce1b0463e",
1937+
"run": 37069574976,
1938+
"conclusion": "in_progress",
1939+
"scope": "Server_ComparisonTests_build_pass_Unit_Integration_compile_failed_no_unit_RF3_execution_comparisons_pending"
19281940
}
19291941
],
19301942
"sourceRepairsAwaitingQualification": [
19311943
"feature_owned_typed_blob_extensions_shared_transport_null_guards",
19321944
"symmetric_native_equality_early_iterator_exits",
1933-
"initial_native_Orleans_RPC_read_ownership_write_unknown_outcome_mapping"
1945+
"initial_native_Orleans_RPC_read_ownership_write_unknown_outcome_mapping",
1946+
"per_node_RF3_caller_disposal_and_deadline_after_readiness",
1947+
"test_static_TUnit_namespace_cached_format_native_async_cancel_unused_import_repairs"
19341948
],
19351949
"evidence": [
19361950
"docs/Features/QueryExecution.md",

‎tests/KeyLoad.IntegrationTests/Features/QueryExecution/SqlRf3AdmissionTests.cs‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,31 @@ public async Task AcAisql007InsufficientDataBytesRejectSdkAndOfficialSqlBeforeId
2424
{
2525
var fixture = new ClusterFixture(new HttpAdmissionLimits
2626
{ MaxReservedBytes = DataBytes, HeavyReadReservedBytes = HeavyReadBytes });
27-
using var deadline = McpCallerDeadline.Create();
2827
try
2928
{
3029
await fixture.InitializeAsync();
30+
using var deadline = McpCallerDeadline.Create();
3131
var partition = new PartitionRef(TenantPrefix + Guid.NewGuid().ToString(McpCallerProtocol.GuidFormat),
3232
Database, Domain, Guid.NewGuid().ToString(McpCallerProtocol.GuidFormat));
3333
foreach (var node in new[] { McpCallerProtocol.Node1, McpCallerProtocol.Node2, McpCallerProtocol.Node3 })
3434
{
35-
using var http = McpCallerHttp.Create(fixture, node);
36-
var sdk = new KeyLoadClient(http, fixture.AdminKey);
37-
await using var mcp = await McpOfficialClient.ConnectAsync(fixture, node, fixture.AdminKey, deadline.Token);
38-
await VerifySdkRejectionAsync(http, sdk, fixture.AdminKey, partition, deadline.Token);
39-
await VerifyOfficialRejectionAsync(mcp, partition, deadline.Token);
40-
await VerifyHealthyAsync(sdk, deadline.Token);
35+
await VerifyNodeAsync(fixture, node, partition, deadline.Token);
4136
}
4237
}
4338
finally { await fixture.DisposeAsync(); }
4439
}
4540

41+
private static async Task VerifyNodeAsync(ClusterFixture fixture, string node, PartitionRef partition,
42+
CancellationToken cancellationToken)
43+
{
44+
using var http = McpCallerHttp.Create(fixture, node);
45+
var sdk = new KeyLoadClient(http, fixture.AdminKey);
46+
await using var mcp = await McpOfficialClient.ConnectAsync(fixture, node, fixture.AdminKey, cancellationToken);
47+
await VerifySdkRejectionAsync(http, sdk, fixture.AdminKey, partition, cancellationToken);
48+
await VerifyOfficialRejectionAsync(mcp, partition, cancellationToken);
49+
await VerifyHealthyAsync(sdk, cancellationToken);
50+
}
51+
4652
private static async Task VerifySdkRejectionAsync(HttpClient http, KeyLoadClient sdk, string administratorKey,
4753
PartitionRef partition, CancellationToken cancellationToken)
4854
{

‎tests/KeyLoad.IntegrationTests/Features/RelationalStorage/RelationalSqlRf3Scenario.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal sealed record RelationalSqlRf3Scenario(PartitionRef Partition, Resource
1010
internal EntityRef First => new(Partition, RelationalSqlRf3Tokens.Table, RelationalSqlRf3Tokens.FirstId);
1111
internal EntityRef Second => new(Partition, RelationalSqlRf3Tokens.Table, RelationalSqlRf3Tokens.SecondId);
1212
internal StreamRef Stream => new(Partition, RelationalSqlRf3Tokens.Streams, RelationalSqlRf3Tokens.StreamId);
13-
internal VectorSpace Space => new(RelationalSqlRf3Tokens.VectorSpace, RelationalSqlRf3Tokens.Dimension,
13+
private static VectorSpace Space => new(RelationalSqlRf3Tokens.VectorSpace, RelationalSqlRf3Tokens.Dimension,
1414
DistanceMetric.DotProduct, RelationalSqlRf3Tokens.VectorModel, RelationalSqlRf3Tokens.VectorVersion);
1515

1616
internal static async Task<RelationalSqlRf3Scenario> CreateAsync(KeyLoadClient administrator, CancellationToken cancellationToken)

‎tests/KeyLoad.UnitTests/Features/ClusterRouting/OrleansRpcFailureTests.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using KeyLoad.Server;
33
using KeyLoad.UnitTests.Features.TestInfrastructure;
44
using Microsoft.Extensions.Logging;
5-
using global::Orleans.Runtime;
65
using global::Orleans.Runtime.Messaging;
76

87
namespace KeyLoad.UnitTests.Features.ClusterRouting;
@@ -66,7 +65,7 @@ public async Task AcRoute009CancellationDomainRecoveryAndOtherFailuresRemainOuts
6665
public async Task AcRoute009CallerCancellationWinsOverANativeFailureAndProducesNoFailureLog(bool command)
6766
{
6867
using var cancellation = new CancellationTokenSource();
69-
cancellation.Cancel();
68+
await cancellation.CancelAsync();
7069
using var capture = new EventSourceLogCapture();
7170
using var factory = LoggerFactory.Create(builder => builder.AddEventSourceLogger());
7271
var logger = factory.CreateLogger(nameof(GrainFailureDiagnosticsTests));

‎tests/KeyLoad.UnitTests/Features/QueryExecution/SqlOperationBudgetTests.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ await SqlOperationTestData.Reject(request, ErrorCode.BudgetExceeded,
6060
public async Task AcAiSql007CancellationWinsBeforeMalformedInputOrPayloadAllocation()
6161
{
6262
using var cancellation = new CancellationTokenSource();
63-
cancellation.Cancel();
63+
await cancellation.CancelAsync();
6464
var request = SqlOperationTestData.Call(McpCatalogExpectations.QueryCapabilities) with { Sql = null! };
6565
var failure = Assert.ThrowsExactly<OperationCanceledException>(() =>
6666
SqlOperationTestData.Compile(request, cancellationToken: cancellation.Token));

‎tests/KeyLoad.UnitTests/Features/QueryExecution/SqlOperationCompilerTests.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Text.Json;
2-
using KeyLoad.Query;
32
using KeyLoad.Server;
43
using KeyLoad.UnitTests.Features.ClientApi;
54

‎tests/KeyLoad.UnitTests/Features/RelationalStorage/RelationalLinkageTests.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using KeyLoad.Query;
2+
using TUnit.Assertions.Enums;
23

34
namespace KeyLoad.UnitTests.Features.RelationalStorage;
45

‎tests/KeyLoad.UnitTests/Features/RelationalStorage/RelationalRowTests.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Globalization;
2+
using System.Text;
23
using System.Text.Json;
34

45
namespace KeyLoad.UnitTests.Features.RelationalStorage;
@@ -29,6 +30,7 @@ internal sealed class RelationalRowTests
2930
private const string DecimalMaximum = "79228162514264337593543950335";
3031
private const string DecimalMinimumQuantum = "0.0000000000000000000000000001";
3132
private const string ValidTrailingZeros = "1.25000000000000000000000000000";
33+
private static readonly CompositeFormat ParsedPropertyFormat = CompositeFormat.Parse(PropertyFormat);
3234

3335
[Test]
3436
public async Task AcAisql003ValidScalarLimitsUtcAndNullableAbsenceCommitWithoutCoercion()
@@ -113,8 +115,8 @@ public async Task AcAisql003ExactNumericBoundarySpellingsRemainAccepted(string i
113115
private static string Replace(string row, string column, string value)
114116
{
115117
using var document = JsonDocument.Parse(row);
116-
var before = string.Format(CultureInfo.InvariantCulture, PropertyFormat, column, document.RootElement.GetProperty(column).GetRawText());
117-
var after = string.Format(CultureInfo.InvariantCulture, PropertyFormat, column, value);
118+
var before = string.Format(CultureInfo.InvariantCulture, ParsedPropertyFormat, column, document.RootElement.GetProperty(column).GetRawText());
119+
var after = string.Format(CultureInfo.InvariantCulture, ParsedPropertyFormat, column, value);
118120
return row.Replace(before, after, StringComparison.Ordinal);
119121
}
120122
}

0 commit comments

Comments
 (0)