Sealed ballot: race-safe close, close sweep, endpoint tests, backup reader and auth findings in the doc

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Heimdall 2026-11-09 20:30:35 +00:00
commit 96da1b7a8c
7 changed files with 310 additions and 9 deletions

View file

@ -122,6 +122,7 @@ builder.Services.AddScoped<BifrostIdentityService>();
builder.Services.AddScoped<GitHubWebhookService>();
builder.Services.AddScoped<MotionGovernanceService>();
builder.Services.AddScoped<SealedBallotService>();
builder.Services.AddHostedService<SealedBallotCloser>();
builder.Services.AddScoped<MotionEveSurfaceService>();
builder.Services.AddScoped<PatronageService>();
builder.Services.AddScoped<StripeWebhookService>();
@ -547,16 +548,17 @@ eveGovernance.MapGet("/surface", async (
var sealedMotions = app.MapGroup("/api/sealed-motions")
.RequireAuthorization(ActiveMemberRequirement.PolicyName);
static async Task<IResult> SealedCall(Func<Task<object>> call)
async Task<IResult> SealedCall(Func<Task<object>> call)
{
try
{
return Results.Ok(await call());
return Results.Text(JsonSerializer.Serialize(await call(), appJsonSerializerOptions), "application/json");
}
catch (SealedBallotException error)
{
return Results.Json(
new { error = error.Message },
return Results.Text(
JsonSerializer.Serialize(new { error = error.Message }, appJsonSerializerOptions),
"application/json",
statusCode: error.Failure switch
{
SealedBallotFailure.Forbidden => StatusCodes.Status403Forbidden,