feat: Implement approvals workflow and notifications integration
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Added approvals orchestration with persistence and workflow scaffolding. - Integrated notifications insights and staged resume hooks. - Introduced approval coordinator and policy notification bridge with unit tests. - Added approval decision API with resume requeue and persisted plan snapshots. - Documented the Excitor consensus API beta and provided JSON sample payload. - Created analyzers to flag usage of deprecated merge service APIs. - Implemented logging for artifact uploads and approval decision service. - Added tests for PackRunApprovalDecisionService and related components.
This commit is contained in:
@@ -1811,11 +1811,11 @@ spec:
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandlePolicyActivateAsync_PendingSecondApprovalSetsExitCode()
|
||||
{
|
||||
var originalExit = Environment.ExitCode;
|
||||
|
||||
var backend = new StubBackendClient(new JobTriggerResult(true, "ok", null, null));
|
||||
public async Task HandlePolicyActivateAsync_PendingSecondApprovalSetsExitCode()
|
||||
{
|
||||
var originalExit = Environment.ExitCode;
|
||||
|
||||
var backend = new StubBackendClient(new JobTriggerResult(true, "ok", null, null));
|
||||
backend.ActivationResult = new PolicyActivationResult(
|
||||
"pending_second_approval",
|
||||
new PolicyActivationRevision(
|
||||
@@ -1852,15 +1852,65 @@ spec:
|
||||
finally
|
||||
{
|
||||
Environment.ExitCode = originalExit;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandlePolicyActivateAsync_MapsErrorCodes()
|
||||
{
|
||||
var originalExit = Environment.ExitCode;
|
||||
|
||||
var backend = new StubBackendClient(new JobTriggerResult(true, "ok", null, null))
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandlePolicyActivateAsync_ParsesScheduledTimestamp()
|
||||
{
|
||||
var originalExit = Environment.ExitCode;
|
||||
var backend = new StubBackendClient(new JobTriggerResult(true, "ok", null, null));
|
||||
backend.ActivationResult = new PolicyActivationResult(
|
||||
"scheduled",
|
||||
new PolicyActivationRevision(
|
||||
"P-8",
|
||||
5,
|
||||
"approved",
|
||||
false,
|
||||
DateTimeOffset.Parse("2025-12-01T00:30:00Z", CultureInfo.InvariantCulture),
|
||||
null,
|
||||
new ReadOnlyCollection<PolicyActivationApproval>(Array.Empty<PolicyActivationApproval>())));
|
||||
|
||||
var provider = BuildServiceProvider(backend);
|
||||
|
||||
try
|
||||
{
|
||||
const string scheduledValue = "2025-12-01T03:00:00+02:00";
|
||||
await CommandHandlers.HandlePolicyActivateAsync(
|
||||
provider,
|
||||
policyId: "P-8",
|
||||
version: 5,
|
||||
note: null,
|
||||
runNow: false,
|
||||
scheduledAt: scheduledValue,
|
||||
priority: null,
|
||||
rollback: false,
|
||||
incidentId: null,
|
||||
verbose: false,
|
||||
cancellationToken: CancellationToken.None);
|
||||
|
||||
Assert.Equal(0, Environment.ExitCode);
|
||||
Assert.NotNull(backend.LastPolicyActivation);
|
||||
var activation = backend.LastPolicyActivation!.Value;
|
||||
Assert.False(activation.Request.RunNow);
|
||||
var expected = DateTimeOffset.Parse(
|
||||
scheduledValue,
|
||||
CultureInfo.InvariantCulture,
|
||||
DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
|
||||
Assert.Equal(expected, activation.Request.ScheduledAt);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Environment.ExitCode = originalExit;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandlePolicyActivateAsync_MapsErrorCodes()
|
||||
{
|
||||
var originalExit = Environment.ExitCode;
|
||||
|
||||
var backend = new StubBackendClient(new JobTriggerResult(true, "ok", null, null))
|
||||
{
|
||||
ActivationException = new PolicyApiException("Revision not approved", HttpStatusCode.BadRequest, "ERR_POL_002")
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user