fix(intake,dashboard): use Promise.allSettled around bulk-projection compliance recompute

The recompute helper swallows errors internally today, but the contract
is fragile — any future refactor that lets a throw escape would turn
the intake POST or dashboard summary GET into a 5xx for a strictly
best-effort hook. Wrap both call sites in `Promise.allSettled` so the
fail-soft contract is explicit at the call site, not buried in the
helper.

Closes specialist H1 from the v1.4.40 QA round.
This commit is contained in:
Marc-André Bombeck committed 2026-05-21 12:41:13 +02:00
1 parent 926ac36dea
commit 853792ca06
2 files changed
+12 -2

No files matched your search

+6 -1
View File
@@ -373,7 +373,12 @@ async function projectAndReadTodaysIntakes(
}),
);
}
await Promise.all(recomputeJobs);
// Defence in depth (specialist H1): the helper swallows internally
// today, but any future refactor that lets a throw escape would
// turn the dashboard summary into a 5xx. `allSettled` keeps the
// best-effort contract explicit at the call site so the request
// stays 200-OK regardless of helper behaviour.
await Promise.allSettled(recomputeJobs);
}
}
+6 -1
View File
@@ -183,7 +183,12 @@ export const GET = apiHandler(async (request: NextRequest) => {
}),
);
}
await Promise.all(recomputeJobs);
// Defence in depth (specialist H1): the helper swallows internally
// today, but any future refactor that lets a throw escape would
// turn the intake POST into a 5xx. `allSettled` keeps the
// best-effort contract explicit at the call site so the request
// stays 200-OK regardless of helper behaviour.
await Promise.allSettled(recomputeJobs);
}
const events = await prisma.medicationIntakeEvent.findMany({