Wire up remaining TODO stubs: P3 test notifications, P2 drift notification trigger
- P3: test notification endpoint now instantiates real Slack/Email/Webhook notifiers - P2: drift processor triggers notification service when drift_score > 0 (non-fatal on failure)
This commit is contained in:
@@ -56,8 +56,21 @@ export async function registerProcessorRoutes(app: FastifyInstance) {
|
||||
);
|
||||
});
|
||||
|
||||
// TODO: Trigger notification if drift_score > threshold
|
||||
// TODO: Trigger remediation workflow if auto-remediate enabled
|
||||
// Trigger notification if drift score exceeds threshold
|
||||
if (report.drift_score > 0) {
|
||||
try {
|
||||
const { DriftNotificationService } = await import('../notifications/service.js');
|
||||
const notifService = new DriftNotificationService(pool);
|
||||
await notifService.notifyDrift(tenantId, {
|
||||
stackName: report.stack_name,
|
||||
driftScore: report.drift_score,
|
||||
totalResources: report.total_resources,
|
||||
driftedResources: report.drifted_resources?.length ?? 0,
|
||||
});
|
||||
} catch (err) {
|
||||
app.log.warn({ tenantId, error: (err as Error).message }, 'Notification dispatch failed (non-fatal)');
|
||||
}
|
||||
}
|
||||
|
||||
return reply.status(201).send({ status: 'accepted' });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user