feat: scheduler web+worker merge + audit Batch 1 (68 endpoints annotated)

Scheduler:
- Merge scheduler-worker into scheduler-web with Worker:Embedded flag
- Default embedded=true (compose), false available for K8s split
- Upgrade to resources-heavy, comment out scheduler-worker container

Audit Batch 1 (first real audit emission):
- Create AuditedRouteGroupExtensions convention helper
- EvidenceLocker: 7 endpoints (store/snapshot/verify/hold/export/verdict)
- Integrations: 6 endpoints (CRUD + test + discover)
- Scanner: 55 endpoints across 25 files
- Sprint 005 FILTER-001/002/003 marked DONE

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-09 11:08:40 +03:00
parent 7c7525f353
commit 7f65e224ae
8 changed files with 112 additions and 82 deletions

View File

@@ -41,6 +41,8 @@ using StellaOps.Scheduler.Worker.Options;
using StellaOps.Scheduler.Plugin;
using StellaOps.Scheduler.Plugin.Scan;
using StellaOps.Scheduler.Plugin.Doctor;
using StellaOps.Scheduler.Queue;
using StellaOps.Scheduler.Worker.DependencyInjection;
using System.Linq;
var builder = WebApplication.CreateBuilder(args);
@@ -161,11 +163,32 @@ builder.Services.AddScoped<IGraphJobService, GraphJobService>();
builder.Services.AddImpactIndex();
builder.Services.AddResolverJobServices();
// Exception lifecycle workers (SCHED-WORKER-25-101/25-102)
var workerOptions = builder.Configuration.GetSection("Scheduler:Worker").Get<SchedulerWorkerOptions>() ?? new SchedulerWorkerOptions();
workerOptions.Validate();
builder.Services.AddSingleton(workerOptions);
builder.Services.AddSingleton<SchedulerWorkerMetrics>();
// Embedded worker mode: when Scheduler:Worker:Embedded is true (default),
// all 8 BackgroundServices (6 heavy workers + 2 exception workers) run in this
// process, eliminating the need for a separate scheduler-worker container.
// Set to false for K8s deployments that scale workers independently.
var embeddedWorker = builder.Configuration.GetValue("Scheduler:Worker:Embedded", true);
if (embeddedWorker)
{
// Register queue transport (Redis/NATS) required by worker background services
builder.Services.AddSchedulerQueues(builder.Configuration);
// Register all worker background services (Planner, Runner, PolicyRun,
// GraphBuild, GraphOverlay, PlannerQueueDispatcher) plus supporting services
// (Surface FS, crypto, HTTP clients for Scanner/Policy/Cartographer).
builder.Services.AddSchedulerWorker(builder.Configuration.GetSection("Scheduler:Worker"));
}
else
{
// Standalone web mode: only exception lifecycle workers run here.
var workerOptions = builder.Configuration.GetSection("Scheduler:Worker").Get<SchedulerWorkerOptions>() ?? new SchedulerWorkerOptions();
workerOptions.Validate();
builder.Services.AddSingleton(workerOptions);
builder.Services.AddSingleton<SchedulerWorkerMetrics>();
}
// Exception workers and bootstrap always run in the web process regardless of embedded mode
builder.Services.AddSingleton<IExceptionRepository, PostgresExceptionRepository>();
builder.Services.AddSingleton<IExceptionEventPublisher>(NullExceptionEventPublisher.Instance);
builder.Services.AddSingleton<IExpiringDigestService>(NullExpiringDigestService.Instance);