Skip to content

Commit beb0248

Browse files
committed
Checkpoint all current runtime journal and quality changes
Commit the complete current working-tree scope on main at the owner's request. Validation: the last canonical Release solution snapshot failed with 59 CS0103 errors in Abstractions and no source drift during that build. The owned Diagnostics build/format passed, and 5/5 frozen coverage-threshold controls passed. Full product test and coverage gates remain open; this checkpoint is not acceptance or production qualification.
1 parent af034ba commit beb0248

11 files changed

Lines changed: 337 additions & 9 deletions

File tree

‎benchmarks/KeyLoad.BenchmarkScenarios/Features/BenchmarkComparisons/Benchmarks/EmbeddedBenchmarks.cs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void Setup()
4545
throw new InvalidOperationException(ActiveSetupMessage);
4646
}
4747

48-
var candidate = new EmbeddedBenchmarkResources();
48+
var candidate = new EmbeddedBenchmarkResources(EmbeddedBenchmarkRuntimeRegistration.Read());
4949
var initialized = false;
5050
try
5151
{
@@ -108,7 +108,7 @@ protected virtual void Dispose(bool disposing)
108108
private EmbeddedBenchmarkResources RequireResources()
109109
=> resources ?? throw new InvalidOperationException(EmbeddedBenchmarkResources.InactiveFixtureMessage);
110110

111-
private sealed class EmbeddedBenchmarkResources : IDisposable
111+
private sealed class EmbeddedBenchmarkResources(EmbeddedBenchmarkRuntimeOptions options) : IDisposable
112112
{
113113
internal const string InactiveFixtureMessage = "The benchmark fixture is not initialized.";
114114
private const string GuidFormat = "N";
@@ -123,8 +123,9 @@ internal DatabaseEngine Database
123123

124124
internal void Initialize(PartitionRef partition)
125125
{
126-
store = new(new(directory));
127-
database = new(store, new AuthorizationPolicy());
126+
store = new(new(directory), options.Storage, options.PointCache);
127+
database = new(store, new AuthorizationPolicy(), options.Database, options.DueWork, options.EventSource,
128+
options.Messaging);
128129
database.Bootstrap(new(PrincipalId, PrincipalScope,
129130
[new(Wildcard, Wildcard, Capability.All)], [Wildcard])
130131
{ ClusterAdministrator = true },

‎benchmarks/KeyLoad.BenchmarkScenarios/Features/BenchmarkComparisons/Benchmarks/ScaledStorageReadBenchmarks.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void Setup()
6666
throw new ArgumentOutOfRangeException(nameof(RecordCount), InvalidCountMessage);
6767
}
6868

69-
_fixture = new ScaledRawStorageFixture(RecordCount, PayloadBytes);
69+
_fixture = new ScaledRawStorageFixture(RecordCount, PayloadBytes, ScaledStorageExecutionRegistration.Read());
7070
}
7171

7272
/// <summary>Consumes one million checked sequential actual record identities.</summary>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Microsoft.Extensions.Configuration;
2+
using Microsoft.Extensions.Options;
3+
4+
namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
5+
6+
/// <summary>Binds standalone native fixtures before they acquire storage ownership.</summary>
7+
[ConfigurationBinding]
8+
internal static class BenchmarkScenarioOptionsRegistration
9+
{
10+
internal static IOptions<T> Read<T>(IConfiguration configuration, string section,
11+
Func<T, bool> validate, string message) where T : class, new()
12+
{
13+
var options = new OptionsManager<T>(new OptionsFactory<T>(
14+
[new ConfigureFromConfigurationOptions<T>(configuration.GetSection(section))], [],
15+
[new ValidateOptions<T>(Options.DefaultName, validate, message)]));
16+
_ = options.Value;
17+
return options;
18+
}
19+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using KeyLoad.Core;
2+
using KeyLoad.Storage.ZoneTree;
3+
using KeyLoad.Storage.ZoneTree.Features.ResourceExecution;
4+
using Microsoft.Extensions.Configuration;
5+
using Microsoft.Extensions.Options;
6+
7+
namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
8+
9+
/// <summary>Holds the validated native snapshots borrowed by an embedded benchmark owner.</summary>
10+
internal sealed record EmbeddedBenchmarkRuntimeOptions(IOptions<DatabaseLimits> Database,
11+
IOptions<DueWorkExecutionOptions> DueWork, IOptions<EventSourceExecutionOptions> EventSource,
12+
IOptions<MessagingExecutionOptions> Messaging, IOptions<ZoneTreeStorageExecutionOptions> Storage,
13+
IOptions<ZoneTreePointCacheExecutionOptions> PointCache);
14+
15+
/// <summary>Binds the actual generated runner's environment to native fixture policies.</summary>
16+
[ConfigurationBinding]
17+
internal static class EmbeddedBenchmarkRuntimeRegistration
18+
{
19+
internal static EmbeddedBenchmarkRuntimeOptions Read()
20+
{
21+
using var configuration = new ConfigurationBuilder().AddEnvironmentVariables().Build();
22+
return new(
23+
BenchmarkScenarioOptionsRegistration.Read<DatabaseLimits>(configuration, DatabaseLimits.SectionName,
24+
settings => settings.IsValid(), DatabaseLimits.ValidationMessage),
25+
BenchmarkScenarioOptionsRegistration.Read<DueWorkExecutionOptions>(configuration, DueWorkExecutionOptions.SectionName,
26+
settings => settings.IsValid(), DueWorkExecutionOptions.ValidationMessage),
27+
BenchmarkScenarioOptionsRegistration.Read<EventSourceExecutionOptions>(configuration, EventSourceExecutionOptions.SectionName,
28+
settings => settings.IsValid(), EventSourceExecutionOptions.ValidationMessage),
29+
BenchmarkScenarioOptionsRegistration.Read<MessagingExecutionOptions>(configuration, MessagingExecutionOptions.SectionName,
30+
settings => settings.IsValid(), MessagingExecutionOptions.ValidationMessage),
31+
BenchmarkScenarioOptionsRegistration.Read<ZoneTreeStorageExecutionOptions>(configuration, ZoneTreeStorageExecutionOptions.SectionName,
32+
settings => settings.IsValid(), ZoneTreeStorageExecutionOptions.ValidationMessage),
33+
BenchmarkScenarioOptionsRegistration.Read<ZoneTreePointCacheExecutionOptions>(configuration, ZoneTreePointCacheExecutionOptions.SectionName,
34+
settings => settings.IsValid(), ZoneTreePointCacheExecutionOptions.ValidationMessage));
35+
}
36+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using Microsoft.Extensions.Options;
2+
3+
namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
4+
5+
/// <summary>Bounds standalone scaled-fixture preparation and retained process memory.</summary>
6+
[ConfigurationOptions]
7+
public sealed class ScaledStorageExecutionOptions
8+
{
9+
/// <summary>The native benchmark execution section.</summary>
10+
public const string SectionName = "ScaledStorageExecution";
11+
/// <summary>Safe rejection before scaled-fixture admission.</summary>
12+
public const string ValidationMessage = "Scaled storage preparation, memory and mutable-segment budgets must be positive and consistent.";
13+
private const int DefaultPreparationMinutes = 20;
14+
private const long DefaultMaximumProcessBytes = 12_884_901_888;
15+
private const long DefaultRequiredHeadroomBytes = 2_147_483_648;
16+
private const long DefaultQualificationCapacityBytes = 15_032_385_536;
17+
private const int DefaultMutableSegmentRecords = 1000;
18+
private const int MaximumPreparationHours = 24;
19+
20+
/// <summary>The full preparation deadline including capacity admission and verification.</summary>
21+
public TimeSpan PreparationTimeout { get; set; } = TimeSpan.FromMinutes(DefaultPreparationMinutes);
22+
/// <summary>The observed process memory ceiling for native scaled fixtures.</summary>
23+
public long MaximumProcessBytes { get; set; } = DefaultMaximumProcessBytes;
24+
/// <summary>The available process memory reserved beyond measured retention.</summary>
25+
public long RequiredHeadroomBytes { get; set; } = DefaultRequiredHeadroomBytes;
26+
/// <summary>The available memory required for qualification-sized fixture admission.</summary>
27+
public long MinimumQualificationCapacityBytes { get; set; } = DefaultQualificationCapacityBytes;
28+
/// <summary>The minimum native mutable-segment capacity before corpus-based sizing.</summary>
29+
public int MinimumMutableSegmentRecords { get; set; } = DefaultMutableSegmentRecords;
30+
31+
/// <summary>Checks consistent, positive memory admission and a native timer-safe deadline.</summary>
32+
/// <returns>Whether native fixture ownership can begin.</returns>
33+
public bool IsValid() => PreparationTimeout > TimeSpan.Zero
34+
&& PreparationTimeout <= TimeSpan.FromHours(MaximumPreparationHours)
35+
&& MaximumProcessBytes > 0 && RequiredHeadroomBytes > 0
36+
&& MaximumProcessBytes <= long.MaxValue - RequiredHeadroomBytes
37+
&& MinimumQualificationCapacityBytes >= MaximumProcessBytes + RequiredHeadroomBytes
38+
&& MinimumMutableSegmentRecords > 0;
39+
40+
/// <summary>Rejects invalid standalone composition before storage allocation.</summary>
41+
public void Validate()
42+
{
43+
if (!IsValid())
44+
{ throw new OptionsValidationException(SectionName, typeof(ScaledStorageExecutionOptions), [ValidationMessage]); }
45+
}
46+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.Extensions.Configuration;
2+
using Microsoft.Extensions.Options;
3+
4+
namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
5+
6+
/// <summary>Binds scaled-fixture policy from the actual native generated runner's environment.</summary>
7+
[ConfigurationBinding]
8+
internal static class ScaledStorageExecutionRegistration
9+
{
10+
internal static IOptions<ScaledStorageExecutionOptions> Read()
11+
{
12+
using var configuration = new ConfigurationBuilder().AddEnvironmentVariables().Build();
13+
return BenchmarkScenarioOptionsRegistration.Read<ScaledStorageExecutionOptions>(configuration,
14+
ScaledStorageExecutionOptions.SectionName, settings => settings.IsValid(),
15+
ScaledStorageExecutionOptions.ValidationMessage);
16+
}
17+
}

‎benchmarks/KeyLoad.BenchmarkScenarios/KeyLoad.BenchmarkScenarios.csproj‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<ProjectReference Include="../../src/KeyLoad.Security/KeyLoad.Security.csproj" />
99
<ProjectReference Include="../../src/KeyLoad.Storage.ZoneTree/KeyLoad.Storage.ZoneTree.csproj" />
1010
<PackageReference Include="BenchmarkDotNet" />
11+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
12+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
1113
<InternalsVisibleTo Include="KeyLoad.UnitTests" />
1214
</ItemGroup>
1315
</Project>

‎docs/implementation/code-quality-repair-2026-10-06.json‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,14 @@
160160
"trx": "TestResults/quality-repair-frozen-threshold-20261006/KeyLoad.Analyzers.Tests_net10.0_arm64.trx",
161161
"fixtureDrift": 0,
162162
"limitation": "Frozen copied36-source contract with native synthetic coverage fixtures; no whole-current-catalog, functional coverage, complete source-cohort suite or current CRAP acceptance."
163-
}
163+
},
164+
"governance": {
165+
"status": "passed",
166+
"artifact": "governance-final2.log",
167+
"projects": 27,
168+
"modules": 4
169+
},
170+
"orderedReviewSourceDriftCheck": "Diagnostics eight authored hashes from the native review still match at final evidence join; frozen threshold fixture inputs remain identical to their captured copy."
164171
},
165172
"remainingFindings": [
166173
{
@@ -175,7 +182,7 @@
175182
"severity": "high",
176183
"status": "open; independently owned analyzer implementation in progress",
177184
"source": "scripts/Features/CodeQuality/site-analyzer-coverage.contract.json",
178-
"consequence": "Ten new analyzer files are not bound by the current catalog; Prepare correctly fails closed. Full threshold runtime verification remains blocked.",
185+
"consequence": "Ten new analyzer files are not bound by the current catalog; Prepare correctly fails closed. Five native frozen-fixture threshold controls pass, but complete current-catalog qualification remains blocked.",
179186
"artifact": "catalog-blocker.json"
180187
},
181188
{

‎src/KeyLoad.Core/Features/ClusterRouting/Execution/DatabaseEngine.RuntimeJournal.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using KeyLoad.Core.Features.ClusterRouting;
21
using Microsoft.Extensions.Options;
32
using KeyLoad.Storage;
43

‎src/KeyLoad.Orleans/Features/ClusterRouting/Lifecycle/RuntimeJournalAdmission.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace KeyLoad.Orleans;
22

33
/// <summary>Opens native journal work only after replicated identity and catalog verification.</summary>
4-
internal sealed class RuntimeJournalAdmission : IDisposable
4+
public sealed class RuntimeJournalAdmission : IDisposable
55
{
66
private readonly Lock lifecycle = new();
77
private readonly TaskCompletionSource ready = new(TaskCreationOptions.RunContinuationsAsynchronously);

0 commit comments

Comments
 (0)