fix(deployment): bulk-deploy up-to-date pre-filter uses batch hash/status reads and the operation's shared flatten session; completion log reports pre-filter cost (review 2026-10-21 04/P1)

This commit is contained in:
Joseph Doherty
2026-10-22 06:46:03 -04:00
parent df67fabe68
commit 32e63eaa96
11 changed files with 247 additions and 78 deletions
@@ -125,6 +125,17 @@ public interface IDeploymentManagerRepository
/// <returns>The current deployment record, or null if no deployment exists.</returns>
Task<DeploymentRecord?> GetCurrentDeploymentStatusAsync(int instanceId, CancellationToken cancellationToken = default);
/// <summary>
/// Batch form of <see cref="GetCurrentDeploymentStatusAsync"/>: the CURRENT (most recent by
/// <c>DeployedAt</c>, then highest <c>Id</c>) deployment record of each instance in
/// <paramref name="instanceIds"/>, in ONE untracked query. Used by the bulk-deploy
/// up-to-date pre-filter, which reads but never writes these records.
/// </summary>
/// <param name="instanceIds">Instances to look up; duplicates are harmless.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>Instance id → current record, omitting instances with no record.</returns>
Task<IReadOnlyDictionary<int, DeploymentRecord>> GetCurrentDeploymentStatusesAsync(
IReadOnlyCollection<int> instanceIds, CancellationToken cancellationToken = default);
/// <summary>
/// Gets a deployment record by deployment ID.
/// </summary>
/// <param name="deploymentId">The deployment ID.</param>