refactor(provcache): inject TimeProvider and IGuidProvider for determinism - DET-005

Refactored 8 files across StellaOps.Provcache, StellaOps.Provcache.Postgres, and StellaOps.Provcache.Valkey:

Core Provcache library:
- EvidenceChunker: Added IGuidProvider for ChunkId generation in ChunkAsync/ChunkStreamAsync
- LazyFetchOrchestrator: Added IGuidProvider for ChunkId generation when storing fetched chunks
- MinimalProofExporter: Added IGuidProvider for ChunkId generation in ImportAsync
- FeedEpochAdvancedEvent: Added optional eventId/timestamp parameters to static Create()
- SignerRevokedEvent: Added optional eventId/timestamp parameters to static Create()

Postgres implementation:
- PostgresProvcacheRepository: Added TimeProvider and IGuidProvider for IncrementHitCountAsync,
  GetStatisticsAsync, LogRevocationAsync, and MapToEntity
- PostgresEvidenceChunkRepository: Added TimeProvider and IGuidProvider for GetManifestAsync and MapToEntity

Valkey implementation:
- ValkeyProvcacheStore: Added TimeProvider for TTL calculations in GetAsync, SetAsync, SetManyAsync

All constructors use optional parameters with defaults to system implementations for backward compatibility.
Added StellaOps.Determinism.Abstractions project references where needed.
This commit is contained in:
StellaOps Bot
2026-01-04 15:02:09 +02:00
parent 3098e84de4
commit 99cb2bcb0f
10 changed files with 86 additions and 26 deletions

View File

@@ -80,6 +80,17 @@ public sealed record FeedEpochAdvancedEvent
/// <summary>
/// Creates a new FeedEpochAdvancedEvent.
/// </summary>
/// <param name="feedId">The feed identifier.</param>
/// <param name="previousEpoch">The previous epoch identifier.</param>
/// <param name="newEpoch">The new epoch identifier.</param>
/// <param name="effectiveAt">When the new epoch became effective.</param>
/// <param name="advisoriesAdded">Number of advisories added (for metrics).</param>
/// <param name="advisoriesModified">Number of advisories modified (for metrics).</param>
/// <param name="advisoriesWithdrawn">Number of advisories withdrawn (for metrics).</param>
/// <param name="tenantId">Tenant ID if multi-tenant.</param>
/// <param name="correlationId">Correlation ID for tracing.</param>
/// <param name="eventId">Optional event ID (defaults to new GUID).</param>
/// <param name="timestamp">Optional timestamp (defaults to current UTC time).</param>
public static FeedEpochAdvancedEvent Create(
string feedId,
string previousEpoch,
@@ -89,12 +100,14 @@ public sealed record FeedEpochAdvancedEvent
int? advisoriesModified = null,
int? advisoriesWithdrawn = null,
string? tenantId = null,
string? correlationId = null)
string? correlationId = null,
Guid? eventId = null,
DateTimeOffset? timestamp = null)
{
return new FeedEpochAdvancedEvent
{
EventId = Guid.NewGuid(),
Timestamp = DateTimeOffset.UtcNow,
EventId = eventId ?? Guid.NewGuid(),
Timestamp = timestamp ?? DateTimeOffset.UtcNow,
FeedId = feedId,
PreviousEpoch = previousEpoch,
NewEpoch = newEpoch,