style: apply prettier across the tree

One-shot prettier pass so the new format:check gate starts from a clean
baseline. Formatting only — no behaviour change. Generator-owned and
vendored artifacts stay untouched via .prettierignore.
This commit is contained in:
Marc-André Bombeck committed 2026-06-19 22:20:31 +02:00
1 parent b3fea2ef59
commit 1f4ba5939d
1000 files changed
+12130 -8385

No files matched your search

@@ -31,7 +31,7 @@ describe("isDashboardSnapshotEnabled", () => {
expect(isDashboardSnapshotEnabled()).toBe(true);
});
it("turns OFF only for the exact string \"false\"", () => {
it('turns OFF only for the exact string "false"', () => {
process.env.NEXT_PUBLIC_DASHBOARD_SNAPSHOT = "false";
expect(isDashboardSnapshotEnabled()).toBe(false);
});
+24 -12
View File
@@ -116,7 +116,9 @@ const fakePrisma = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any;
function baseUser(overrides: Partial<SnapshotUserInput> = {}): SnapshotUserInput {
function baseUser(
overrides: Partial<SnapshotUserInput> = {},
): SnapshotUserInput {
return {
id: "user-1",
username: "tester",
@@ -341,11 +343,7 @@ describe("buildDashboardSnapshot — per-type thick-phase gate", () => {
expect(snap.extras).not.toBeNull();
});
it.each([
["WEIGHT"],
["BLOOD_PRESSURE_SYS"],
["BLOOD_PRESSURE_DIA"],
])(
it.each([["WEIGHT"], ["BLOOD_PRESSURE_SYS"], ["BLOOD_PRESSURE_DIA"]])(
"an uncovered %s (rows without buckets) keeps the phase cold",
async (uncoveredType) => {
const coverage = new Map([
@@ -879,10 +877,18 @@ describe("module gating maps — every toggleable-domain widget is mapped (v1.18
});
describe("buildDashboardSnapshot — module gating (v1.18.0)", () => {
const widget = (snap: { layout: { widgets: { id: string; visible: boolean; tileVisible?: boolean }[] } }, id: string) =>
snap.layout.widgets.find((w) => w.id === id);
const cat = (snap: { layoutCatalogue: { id: string; visible: boolean }[] }, id: string) =>
snap.layoutCatalogue.find((w) => w.id === id);
const widget = (
snap: {
layout: {
widgets: { id: string; visible: boolean; tileVisible?: boolean }[];
};
},
id: string,
) => snap.layout.widgets.find((w) => w.id === id);
const cat = (
snap: { layoutCatalogue: { id: string; visible: boolean }[] },
id: string,
) => snap.layoutCatalogue.find((w) => w.id === id);
beforeEach(() => {
// A warm, data-rich account so every toggleable surface would
@@ -939,7 +945,9 @@ describe("buildDashboardSnapshot — module gating (v1.18.0)", () => {
expect(snap.tiles.summaries.SLEEP_DURATION).toBeDefined();
expect(snap.tiles.summaries.BLOOD_GLUCOSE).toBeDefined();
expect(snap.tiles.mood.entries.length).toBeGreaterThan(0);
expect(Object.keys(snap.extras!.glucoseByContext).length).toBeGreaterThan(0);
expect(Object.keys(snap.extras!.glucoseByContext).length).toBeGreaterThan(
0,
);
});
it("mood disabled: tile hidden + mood block emptied", async () => {
@@ -1000,7 +1008,11 @@ describe("buildDashboardSnapshot — module gating (v1.18.0)", () => {
fakePrisma,
baseUser({
insightsCachedText: JSON.stringify({
dailyBriefing: { headline: "x", body: "y", generatedAt: new Date().toISOString() },
dailyBriefing: {
headline: "x",
body: "y",
generatedAt: new Date().toISOString(),
},
}),
insightsCachedAt: new Date(),
}),
+5 -2
View File
@@ -79,7 +79,9 @@ export async function buildMedsTodayBlock(
const { start: todayStart, end: todayEnd } = getUserTodayBounds(now, userTz);
// The projector + tally read use an exclusive upper bound (`lt`),
// matching the summary route's window convention.
const todayEndExclusive = new Date(todayStart.getTime() + 24 * 60 * 60 * 1000);
const todayEndExclusive = new Date(
todayStart.getTime() + 24 * 60 * 60 * 1000,
);
// Projection FIRST so the tally read below sees the freshly minted
// pending rows. Idempotent — `skipDuplicates` + the
@@ -170,7 +172,8 @@ export async function buildMedsTodayBlock(
}
const eraStartByMedId = new Map<string, Date>();
for (const f of eraFloors) {
if (f._max.validUntil) eraStartByMedId.set(f.medicationId, f._max.validUntil);
if (f._max.validUntil)
eraStartByMedId.set(f.medicationId, f._max.validUntil);
}
// Earliest display-due across active medications. An open overdue
+7 -19
View File
@@ -34,10 +34,7 @@
* AI provider is configured anywhere, so clients can stop waiting.
* The builder NEVER POSTs `/api/insights/generate`.
*/
import type {
PrismaClient,
MeasurementType,
} from "@/generated/prisma/client";
import type { PrismaClient, MeasurementType } from "@/generated/prisma/client";
import { computeSummariesSlice } from "@/lib/analytics/summaries-slice";
import { getUnitForType } from "@/lib/validations/measurement";
import {
@@ -414,10 +411,8 @@ function enrichLastSeen(
raw: Record<string, { lastSeenAt: string } | null>,
nowMs: number,
): Record<string, { lastSeenAt: string; daysAgo: number } | null> {
const out: Record<
string,
{ lastSeenAt: string; daysAgo: number } | null
> = {};
const out: Record<string, { lastSeenAt: string; daysAgo: number } | null> =
{};
for (const [type, slot] of Object.entries(raw)) {
if (slot === null) {
out[type] = null;
@@ -597,9 +592,7 @@ async function buildExtras(
const ctxRows = glucoseRows.filter((r) => r.glucoseContext === ctx);
if (ctxRows.length === 0) continue;
glucoseByContext[ctx] = summarize(
ctxRows.map(
(r): DataPoint => ({ date: r.measuredAt, value: r.value }),
),
ctxRows.map((r): DataPoint => ({ date: r.measuredAt, value: r.value })),
);
}
}
@@ -630,9 +623,7 @@ async function buildExtras(
}
/** Parse + validate the cached `dailyBriefing` block; null when unusable. */
function parseCachedBriefing(
cachedText: string | null,
): DailyBriefing | null {
function parseCachedBriefing(cachedText: string | null): DailyBriefing | null {
if (!cachedText) return null;
try {
const parsed = JSON.parse(cachedText) as Record<string, unknown>;
@@ -681,8 +672,7 @@ async function liftBriefing(
const cachedAt = user.insightsCachedAt;
const updatedAt = cachedAt?.toISOString() ?? null;
const stale =
!cachedAt || Date.now() - cachedAt.getTime() >= BRIEFING_TTL_MS;
const stale = !cachedAt || Date.now() - cachedAt.getTime() >= BRIEFING_TTL_MS;
const cachedBriefing = parseCachedBriefing(user.insightsCachedText);
if (!stale && cachedBriefing) {
@@ -727,9 +717,7 @@ function buildMetricStates(
lastSeenByType: Record<string, { lastSeenAt: string } | null>,
): Record<string, DashboardMetricState> {
const out: Record<string, DashboardMetricState> = {};
for (const [type, metricKindRaw] of Object.entries(
METRIC_KIND_RAW_BY_TYPE,
)) {
for (const [type, metricKindRaw] of Object.entries(METRIC_KIND_RAW_BY_TYPE)) {
if (!metricKindRaw) continue;
const summary = summaries[type];
const lastSeen = lastSeenByType[type];
+14 -13
View File
@@ -50,16 +50,17 @@ export const WIDGET_MODULE_BY_ID: Partial<Record<string, ModuleKey>> = {
* gates also drop it) before the snapshot leaves the server. Core vital
* types are absent here and always pass through.
*/
export const SUMMARY_TYPE_MODULE: Partial<Record<MeasurementType, ModuleKey>> = {
SLEEP_DURATION: "sleep",
BLOOD_GLUCOSE: "glucose",
// v1.18.0 B1 — recovery-domain HealthKit metrics. The recovery page +
// its tiles are the recovery module's surface; when it is off these
// device-native signals must drop from the dashboard snapshot too.
CARDIO_RECOVERY: "recovery",
SIX_MINUTE_WALK_DISTANCE: "recovery",
STAIR_ASCENT_SPEED: "recovery",
STAIR_DESCENT_SPEED: "recovery",
// Per-night breathing-disturbance index is a sleep-page signal.
BREATHING_DISTURBANCES: "sleep",
};
export const SUMMARY_TYPE_MODULE: Partial<Record<MeasurementType, ModuleKey>> =
{
SLEEP_DURATION: "sleep",
BLOOD_GLUCOSE: "glucose",
// v1.18.0 B1 — recovery-domain HealthKit metrics. The recovery page +
// its tiles are the recovery module's surface; when it is off these
// device-native signals must drop from the dashboard snapshot too.
CARDIO_RECOVERY: "recovery",
SIX_MINUTE_WALK_DISTANCE: "recovery",
STAIR_ASCENT_SPEED: "recovery",
STAIR_DESCENT_SPEED: "recovery",
// Per-night breathing-disturbance index is a sleep-page signal.
BREATHING_DISTURBANCES: "sleep",
};