fix(audit): keep refusals and job telemetry out of audit_logs

A *.validation-failed row was written on every malformed request, the
caller's own included, and the PR detection enqueue wrote one per batch.
Neither is a security event and nothing reads them. auditLog now files a
refused attempt only when a delegate made it, for the owner's activity
feed; otherwise it rides the wide event as meta.rejected_attempt. The PR
detection enqueue moves to annotate().
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 06:49:03 +02:00
1 parent ca937ba87a
commit 4979805d11
6 files changed
+96 -41

No files matched your search

+3 -7
View File
@@ -893,13 +893,9 @@ async function postBatch(request: NextRequest): Promise<Response> {
const silent = workouts.length > PR_DETECTION_SILENT_THRESHOLD;
try {
await enqueuePrDetection(user.id, { silent });
await auditLog("personal_records.detection_enqueued", {
userId: user.id,
details: {
source: "workout.batch",
batchSize: workouts.length,
silent,
},
// Telemetry, not an audit event: it rides the wide event.
annotate({
meta: { pr_detection_enqueued: true, pr_detection_silent: silent },
});
} catch (err) {
annotate({