perf(site-runtime): instance reconcile sweep reads metadata only and fetches config_json just for the instances it repairs (review 2026-10-21 01/SR-P1)

Adds SiteStorageService.GetAllDeployedConfigMetadataAsync. The sweep decides
from the projection, then fetches single rows for its starts/restarts off-
thread and re-validates them (generation guard, revision match, pipeline/
running guards), releasing the per-revision claim of any repair that does
not act. Boot load unchanged.
This commit is contained in:
Joseph Doherty
2026-10-22 06:42:06 -04:00
parent c782744b07
commit 960c35060c
6 changed files with 415 additions and 42 deletions
@@ -147,6 +147,29 @@ public class SiteStorageServiceTests : IAsyncLifetime, IDisposable
Assert.Null(result);
}
/// <summary>
/// Review 2026-10-21 01/SR-P1: the all-rows metadata projection the instance sweep reads
/// carries the same identity as the full read, for every row, without the config blob.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetAllDeployedConfigMetadataAsync_MatchesTheFullReadForEveryRow()
{
await _storage.StoreDeployedConfigAsync(
"Pump1", "{\"test\":true}", "dep-001", "sha256:abc", isEnabled: true);
await _storage.StoreDeployedConfigAsync(
"Pump2", "{\"other\":1}", "dep-002", "sha256:def", isEnabled: false);
var metadata = (await _storage.GetAllDeployedConfigMetadataAsync())
.OrderBy(m => m.InstanceUniqueName).ToList();
var full = (await _storage.GetAllDeployedConfigsAsync())
.OrderBy(c => c.InstanceUniqueName).ToList();
Assert.Equal(
full.Select(c => (c.InstanceUniqueName, c.DeploymentId, c.RevisionHash, c.IsEnabled)),
metadata.Select(m => (m.InstanceUniqueName, m.DeploymentId, m.RevisionHash, m.IsEnabled)));
}
/// <summary>Verifies that a metadata read returns the same identity as reading all configs and picking the match.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]