up the blokcing tasks
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Risk Bundle CI / risk-bundle-build (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Risk Bundle CI / risk-bundle-offline-kit (push) Has been cancelled
Risk Bundle CI / publish-checksums (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled

This commit is contained in:
StellaOps Bot
2025-12-11 02:32:18 +02:00
parent 92bc4d3a07
commit 49922dff5a
474 changed files with 76071 additions and 12411 deletions

View File

@@ -1,9 +1,10 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using StellaOps.Notify.Models;
using StellaOps.Notify.Storage.Mongo.Repositories;
using StellaOps.Notifier.Worker.Storage;
using StellaOps.Notifier.Worker.Options;
using System.Collections.Immutable;
namespace StellaOps.Notifier.Worker.Dispatch;
@@ -205,16 +206,17 @@ public sealed class DeliveryDispatchWorker : BackgroundService
// Update delivery status
var attempt = new NotifyDeliveryAttempt(
timestamp: DateTimeOffset.UtcNow,
status: result.Success ? NotifyDeliveryAttemptStatus.Success : NotifyDeliveryAttemptStatus.Failed,
status: result.Success ? NotifyDeliveryAttemptStatus.Succeeded : NotifyDeliveryAttemptStatus.Failed,
reason: result.ErrorMessage);
var updatedDelivery = delivery with
{
Status = result.Status,
StatusReason = result.ErrorMessage,
CompletedAt = result.Success ? DateTimeOffset.UtcNow : null,
Attempts = delivery.Attempts.Add(attempt)
};
var completedAt = result.Success || !result.IsRetryable ? DateTimeOffset.UtcNow : delivery.CompletedAt;
var updatedDelivery = CloneDelivery(
delivery,
result.Status,
result.ErrorMessage,
delivery.Attempts.Add(attempt),
completedAt);
await deliveryRepository.UpdateAsync(updatedDelivery, cancellationToken).ConfigureAwait(false);
@@ -250,12 +252,12 @@ public sealed class DeliveryDispatchWorker : BackgroundService
status: NotifyDeliveryAttemptStatus.Failed,
reason: errorMessage);
var updated = delivery with
{
Status = NotifyDeliveryStatus.Failed,
StatusReason = errorMessage,
Attempts = delivery.Attempts.Add(attempt)
};
var updated = CloneDelivery(
delivery,
NotifyDeliveryStatus.Failed,
errorMessage,
delivery.Attempts.Add(attempt),
delivery.CompletedAt ?? DateTimeOffset.UtcNow);
try
{
@@ -266,4 +268,28 @@ public sealed class DeliveryDispatchWorker : BackgroundService
_logger.LogError(ex, "Failed to update delivery {DeliveryId} status.", delivery.DeliveryId);
}
}
private static NotifyDelivery CloneDelivery(
NotifyDelivery source,
NotifyDeliveryStatus status,
string? statusReason,
ImmutableArray<NotifyDeliveryAttempt> attempts,
DateTimeOffset? completedAt)
{
return NotifyDelivery.Create(
source.DeliveryId,
source.TenantId,
source.RuleId,
source.ActionId,
source.EventId,
source.Kind,
status,
statusReason,
source.Rendered,
attempts,
source.Metadata,
source.CreatedAt,
source.SentAt,
completedAt);
}
}

View File

@@ -69,7 +69,7 @@ public sealed partial class SimpleTemplateRenderer : INotifyTemplateRenderer
["eventId"] = notifyEvent.EventId.ToString(),
["kind"] = notifyEvent.Kind,
["tenant"] = notifyEvent.Tenant,
["timestamp"] = notifyEvent.Timestamp.ToString("O"),
["timestamp"] = notifyEvent.Ts.ToString("O"),
["actor"] = notifyEvent.Actor,
["version"] = notifyEvent.Version,
};