diff --git a/scripts/v1341-audit-ledger-check.mjs b/scripts/v1341-audit-ledger-check.mjs index fd8bddf33..83e5724b5 100644 --- a/scripts/v1341-audit-ledger-check.mjs +++ b/scripts/v1341-audit-ledger-check.mjs @@ -25,7 +25,13 @@ const REQUIRED_FIELDS = [ "Confidence", "Unresolved", ]; -const ALLOWED_STATUS = new Set(["confirmed", "suspected", "blocked", "cleared", "refuted"]); +const ALLOWED_STATUS = new Set([ + "confirmed", + "suspected", + "blocked", + "cleared", + "refuted", +]); const ALLOWED_SEVERITY = new Set(["critical", "high", "medium", "low", "info"]); const ALLOWED_CONFIDENCE = new Set(["high", "medium", "low"]); const REQUIRED_SOURCES = ["research:", "correctness:", "live:", "performance:"]; @@ -41,7 +47,10 @@ const PRIVACY_PATTERNS = [ name: "email address", pattern: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/i, }, - { name: "authorization credential", pattern: /\bBearer\s+[A-Za-z0-9._~+/=-]+/i }, + { + name: "authorization credential", + pattern: /\bBearer\s+[A-Za-z0-9._~+/=-]+/i, + }, { name: "secret assignment", pattern: @@ -90,7 +99,8 @@ try { } for (const check of PRIVACY_PATTERNS) { - if (check.pattern.test(source)) errors.push(`privacy-dangerous ${check.name} detected`); + if (check.pattern.test(source)) + errors.push(`privacy-dangerous ${check.name} detected`); } const headingPattern = /^## (AUD-\d{3}) — (.+)$/gm; @@ -149,7 +159,8 @@ for (let index = 0; index < headings.length; index += 1) { errors.push(`${id}: ${status} findings must set Unresolved to no`); } if (sourceField) { - if (sourceRecords.has(sourceField)) errors.push(`${id}: duplicate Source record`); + if (sourceRecords.has(sourceField)) + errors.push(`${id}: duplicate Source record`); sourceRecords.add(sourceField); } @@ -164,7 +175,9 @@ for (let index = 0; index < records.length; index += 1) { } for (const prefix of REQUIRED_SOURCES) { - if (!records.some((record) => record.fields.get("Source")?.includes(prefix))) { + if ( + !records.some((record) => record.fields.get("Source")?.includes(prefix)) + ) { errors.push(`missing source family ${prefix}`); } } diff --git a/scripts/v1341-performance-baseline.mjs b/scripts/v1341-performance-baseline.mjs index 5ede28dad..700fbd85c 100644 --- a/scripts/v1341-performance-baseline.mjs +++ b/scripts/v1341-performance-baseline.mjs @@ -34,7 +34,9 @@ function fail(message) { } if (!fixtureMode) { - fail("refusing to run without --fixture; live and production probes are unsupported"); + fail( + "refusing to run without --fixture; live and production probes are unsupported", + ); } if (process.env.NODE_ENV === "production") { fail("refusing to run with NODE_ENV=production"); @@ -43,7 +45,9 @@ if (!outputPath) { fail("--output is required"); } if (args.some((arg) => /^(--url|--host|--database|--token|--live)/.test(arg))) { - fail("network, database, credential, and live-target arguments are unsupported"); + fail( + "network, database, credential, and live-target arguments are unsupported", + ); } const startedAt = performance.now(); @@ -63,7 +67,9 @@ function seededNumber(index, salt) { } function percentile(sorted, fraction) { - return sorted[Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1)]; + return sorted[ + Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1) + ]; } function formatMs(value) { @@ -94,7 +100,10 @@ function benchmark(name, operation) { } const elapsed = warm.map((sample) => sample.elapsedMs).sort((a, b) => a - b); const heaps = warm.map((sample) => sample.heapDeltaBytes); - const checksums = new Set([cold.result.checksum, ...warm.map((sample) => sample.result.checksum)]); + const checksums = new Set([ + cold.result.checksum, + ...warm.map((sample) => sample.result.checksum), + ]); if (checksums.size !== 1) { throw new Error(`${name} fixture produced a non-deterministic checksum`); } @@ -213,7 +222,8 @@ function healthScoreFixture() { domainCounts[row.domain] += 1; } let checksum = 0; - for (const row of dailyCanonical.values()) checksum = (checksum + row.value) >>> 0; + for (const row of dailyCanonical.values()) + checksum = (checksum + row.value) >>> 0; for (let domain = 0; domain < domainTotals.length; domain += 1) { const normalized = Math.round(domainTotals[domain] / domainCounts[domain]); checksum = (checksum * 31 + normalized) >>> 0; diff --git a/src/app/api/auth/passkey/register-options/route.ts b/src/app/api/auth/passkey/register-options/route.ts index ec7852eb2..a84bf7e8a 100644 --- a/src/app/api/auth/passkey/register-options/route.ts +++ b/src/app/api/auth/passkey/register-options/route.ts @@ -56,7 +56,7 @@ export const POST = apiHandler(async (request: NextRequest) => { if (parsed.data.method === "password") { proved = Boolean( user.passwordHash && - (await verifyPassword(user.passwordHash, parsed.data.password)), + (await verifyPassword(user.passwordHash, parsed.data.password)), ); } else if (parsed.data.method === "totp") { const result = await verifyMfaFactor(user, "totp", parsed.data.code); diff --git a/src/app/mcp/__tests__/route.test.ts b/src/app/mcp/__tests__/route.test.ts index d3659601d..7208acd96 100644 --- a/src/app/mcp/__tests__/route.test.ts +++ b/src/app/mcp/__tests__/route.test.ts @@ -53,8 +53,7 @@ vi.mock("@/lib/ai/coach/tools/inventory", () => ({ buildCoachDataInventory: vi.fn(), })); vi.mock("@/lib/mcp/server", async (importOriginal) => { - const actual = - await importOriginal(); + const actual = await importOriginal(); return { ...actual, createMcpServer: (...args: Parameters) => { diff --git a/src/lib/apple-health/ecg-csv.ts b/src/lib/apple-health/ecg-csv.ts index 155fdf915..76c6458a8 100644 --- a/src/lib/apple-health/ecg-csv.ts +++ b/src/lib/apple-health/ecg-csv.ts @@ -106,10 +106,7 @@ export async function parseAppleHealthEcgCsv(input: { } const [key, value] = pair; if (!inSamples) { - if ( - key.toLowerCase() === "lead" && - value.toLowerCase() === "voltage" - ) { + if (key.toLowerCase() === "lead" && value.toLowerCase() === "voltage") { inSamples = true; continue; } diff --git a/src/lib/medications/scheduling/__tests__/next-due.test.ts b/src/lib/medications/scheduling/__tests__/next-due.test.ts index 19dd77bf1..9ef1241fc 100644 --- a/src/lib/medications/scheduling/__tests__/next-due.test.ts +++ b/src/lib/medications/scheduling/__tests__/next-due.test.ts @@ -629,9 +629,7 @@ describe("Mounjaro rolling weekly — canonical overdue band after day change", now: d("2026-07-29T10:00:00.000Z"), userTz: BERLIN, lastIntakeAt: - status === "taken" - ? d("2026-07-28T06:10:00.000Z") - : lastTaken, + status === "taken" ? d("2026-07-28T06:10:00.000Z") : lastTaken, resolvedSlots: [ identifiedMark(missedOccurrence, { scheduleId: "mounjaro-weekly", diff --git a/tests/integration/bearer-scope-enforcement.test.ts b/tests/integration/bearer-scope-enforcement.test.ts index b7e840acb..cbf01602b 100644 --- a/tests/integration/bearer-scope-enforcement.test.ts +++ b/tests/integration/bearer-scope-enforcement.test.ts @@ -367,22 +367,22 @@ describe("B5b — MCP health reads require an explicit read grant", () => { ); it.each([ - [ - "expired", - { expiresAt: new Date("2020-01-01T00:00:00.000Z") }, - ], + ["expired", { expiresAt: new Date("2020-01-01T00:00:00.000Z") }], ["revoked", { revoked: true }], - ])("denies an explicit but %s health:read credential", async (_label, state) => { - const raw = await armExpiringToken( - ["health:read"], - `mcp-${_label}`, - state, - ); + ])( + "denies an explicit but %s health:read credential", + async (_label, state) => { + const raw = await armExpiringToken( + ["health:read"], + `mcp-${_label}`, + state, + ); - const res = await postMcp(raw, "tools/list"); + const res = await postMcp(raw, "tools/list"); - expect([401, 403]).toContain(res.status); - }); + expect([401, 403]).toContain(res.status); + }, + ); }); describe("B6 — a declared scope grants only what it names", () => { diff --git a/tests/integration/mcp-oauth-refresh-race.test.ts b/tests/integration/mcp-oauth-refresh-race.test.ts index ec2d44611..390ba7f8a 100644 --- a/tests/integration/mcp-oauth-refresh-race.test.ts +++ b/tests/integration/mcp-oauth-refresh-race.test.ts @@ -209,9 +209,9 @@ describe("MCP OAuth refresh rotation (real PostgreSQL)", () => { responses.map((response) => response.json() as Promise), ); const returnedSuccessors = bodies.filter( - (body): body is Required< - Pick - > => + ( + body, + ): body is Required> => typeof body.access_token === "string" && typeof body.refresh_token === "string", ); diff --git a/tests/integration/medication-reminder-cross-midnight.test.ts b/tests/integration/medication-reminder-cross-midnight.test.ts index a2b2e8593..c67dc2e85 100644 --- a/tests/integration/medication-reminder-cross-midnight.test.ts +++ b/tests/integration/medication-reminder-cross-midnight.test.ts @@ -18,8 +18,7 @@ vi.mock("@/lib/rollups/medication-compliance-rollups", () => ({ recomputeMedicationComplianceForEvent: vi.fn().mockResolvedValue(undefined), })); -const { dispatchNotification } = - await import("@/lib/notifications/dispatcher"); +const { dispatchNotification } = await import("@/lib/notifications/dispatcher"); const { handleReminderCheck } = await import("@/lib/jobs/reminder/medication-reminder-check"); diff --git a/tests/integration/medication-rolling-overdue-consumers.test.ts b/tests/integration/medication-rolling-overdue-consumers.test.ts index 8b32eec95..e505dce69 100644 --- a/tests/integration/medication-rolling-overdue-consumers.test.ts +++ b/tests/integration/medication-rolling-overdue-consumers.test.ts @@ -100,25 +100,21 @@ async function readConsumerOccurrence( const medication = raw as unknown as DueDerivationMedication; const listOccurrence = medication.nextDueAt ?? null; - const dashboard = await buildMedsTodayBlock( - prisma, - USER_ID, - USER_TZ, - NOW, - ); + const dashboard = await buildMedsTodayBlock(prisma, USER_ID, USER_TZ, NOW); // A prior-day rolling slot is outside today's clock window. The GLP-1 // card therefore displays the server's canonical nextDueAt verbatim. - const glp1Occurrence = resolveDisplayedSlotInstant({ - currentWindowStatus: { - status: null, - schedule: null, - window: null, - }, - nextDueAt: listOccurrence, - now: NOW, - timeZone: USER_TZ, - })?.toISOString() ?? null; + const glp1Occurrence = + resolveDisplayedSlotInstant({ + currentWindowStatus: { + status: null, + schedule: null, + window: null, + }, + nextDueAt: listOccurrence, + now: NOW, + timeZone: USER_TZ, + })?.toISOString() ?? null; const takeAll = deriveDueMedications([medication], { now: NOW, @@ -144,8 +140,10 @@ async function readConsumerOccurrence( )?.overdue ?? false, }, glp1Card: glp1Occurrence, - takeAllDue: takeAll.find((entry) => entry.id === medicationId) - ?.scheduledFor?.toISOString() ?? null, + takeAllDue: + takeAll + .find((entry) => entry.id === medicationId) + ?.scheduledFor?.toISOString() ?? null, }; } @@ -178,9 +176,7 @@ describe("rolling weekly overdue occurrence — shared consumers", () => { medicationId, scheduledFor: OVERDUE_OCCURRENCE, takenAt: - status === "taken" - ? new Date("2026-07-28T06:10:00.000Z") - : null, + status === "taken" ? new Date("2026-07-28T06:10:00.000Z") : null, skipped: status === "skipped", autoMissed: status === "autoMissed", source: "WEB",