fix(deployment): pending-updates tick uses a slim instance projection, hash-only flatten, one untracked mismatch snapshot read and a per-tick secret lookup memo (review 2026-10-21 04/P2)
This commit is contained in:
@@ -39,6 +39,13 @@ public sealed class SiteSecretsCollector(ISecretStore store)
|
||||
/// </summary>
|
||||
/// <param name="connections">The site's data-connection artifacts to scan.</param>
|
||||
/// <param name="ct">A token to cancel the operation.</param>
|
||||
/// <param name="lookupCache">
|
||||
/// Optional per-sweep memo of store lookups, keyed by secret name (a <see langword="null"/>
|
||||
/// value records "absent"). A multi-site caller passes ONE dictionary for the whole sweep so
|
||||
/// a secret referenced by N sites is read from the store once, not N times. Only successful
|
||||
/// lookups are recorded; a store read failure is never cached. Not thread-safe — the
|
||||
/// callers build their per-site commands serially.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The resolved rows (mapped field-for-field from <see cref="StoredSecret"/>) and the
|
||||
/// references that were absent or tombstoned in the store. A store read failure is
|
||||
@@ -48,7 +55,8 @@ public sealed class SiteSecretsCollector(ISecretStore store)
|
||||
/// secret never touches the store at all.
|
||||
/// </returns>
|
||||
public async Task<SiteSecretsCollection> CollectAsync(
|
||||
IEnumerable<DataConnectionArtifact> connections, CancellationToken ct)
|
||||
IEnumerable<DataConnectionArtifact> connections, CancellationToken ct,
|
||||
IDictionary<string, StoredSecret?>? lookupCache = null)
|
||||
{
|
||||
var secrets = new List<SecretArtifact>();
|
||||
var missing = new List<SecretReference>();
|
||||
@@ -58,7 +66,12 @@ public sealed class SiteSecretsCollector(ISecretStore store)
|
||||
StoredSecret? row;
|
||||
try
|
||||
{
|
||||
row = await store.GetAsync(new SecretName(reference.Name), ct);
|
||||
if (lookupCache is null || !lookupCache.TryGetValue(reference.Name, out row))
|
||||
{
|
||||
row = await store.GetAsync(new SecretName(reference.Name), ct);
|
||||
if (lookupCache is not null)
|
||||
lookupCache[reference.Name] = row;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!ct.IsCancellationRequested)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user