From f5ca81064357a7a381c8e709c88dc4fb2206d7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 6 Aug 2026 02:05:24 +0200 Subject: [PATCH] chore: format sharing authority controls Apply repository formatting to provider and import coverage. --- .../jobs/insight-status-generate-shared.ts | 26 +++++++++++-------- src/lib/sharing/provider-work-authority.ts | 5 +--- .../sharing-import-attribution.test.ts | 3 +-- .../sharing-provider-origin.test.ts | 5 +++- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/lib/jobs/insight-status-generate-shared.ts b/src/lib/jobs/insight-status-generate-shared.ts index fcf9d6669..2b31f6e4a 100644 --- a/src/lib/jobs/insight-status-generate-shared.ts +++ b/src/lib/jobs/insight-status-generate-shared.ts @@ -146,17 +146,21 @@ export async function enqueueStatusGeneration( return; } try { - await boss.send(INSIGHT_STATUS_GENERATE_QUEUE, { ...payload, authority }, { - singletonKey: `${payload.userId}:${payload.metric}`, - // De-dupe within a short window so a polling client doesn't enqueue - // a fresh job on every tick while a generation is already running. - singletonSeconds: 120, - // Transient provider / pool failures retry with backoff instead of - // leaving the card on "preparing" until the next nightly cron. - retryLimit: 3, - retryDelay: 60, - retryBackoff: true, - }); + await boss.send( + INSIGHT_STATUS_GENERATE_QUEUE, + { ...payload, authority }, + { + singletonKey: `${payload.userId}:${payload.metric}`, + // De-dupe within a short window so a polling client doesn't enqueue + // a fresh job on every tick while a generation is already running. + singletonSeconds: 120, + // Transient provider / pool failures retry with backoff instead of + // leaving the card on "preparing" until the next nightly cron. + retryLimit: 3, + retryDelay: 60, + retryBackoff: true, + }, + ); annotate({ action: { name: "insights.status.generate.enqueued" }, meta: { metric: payload.metric }, diff --git a/src/lib/sharing/provider-work-authority.ts b/src/lib/sharing/provider-work-authority.ts index c8584b9d5..4ab9a0438 100644 --- a/src/lib/sharing/provider-work-authority.ts +++ b/src/lib/sharing/provider-work-authority.ts @@ -18,10 +18,7 @@ export interface ProviderWorkAuthority { grantId: string | null; } -export type ProviderCredentialPolicy = - | "personal" - | "operator-default" - | "deny"; +export type ProviderCredentialPolicy = "personal" | "operator-default" | "deny"; const workerAuthority = new AsyncLocalStorage(); diff --git a/tests/integration/sharing-import-attribution.test.ts b/tests/integration/sharing-import-attribution.test.ts index 578014307..ae4190304 100644 --- a/tests/integration/sharing-import-attribution.test.ts +++ b/tests/integration/sharing-import-attribution.test.ts @@ -168,8 +168,7 @@ describe("shared intake import attribution", () => { const response = await getImportStatus( new NextRequest( `http://localhost/api/medications/${medication.id}/intake/import/${job.id}/status`, - { - }, + {}, ), { params: Promise.resolve({ id: medication.id, jobId: job.id }) }, ); diff --git a/tests/integration/sharing-provider-origin.test.ts b/tests/integration/sharing-provider-origin.test.ts index e3e78fef3..6f953c00c 100644 --- a/tests/integration/sharing-provider-origin.test.ts +++ b/tests/integration/sharing-provider-origin.test.ts @@ -121,7 +121,10 @@ const resolveFromSharedRead: (request: NextRequest) => Promise = apiHandler(async () => { const { user } = await requireRecordAuth("manage", "record"); const provider = await resolveProvider(user.id); - return NextResponse.json({ data: { provider: provider.type }, error: null }); + return NextResponse.json({ + data: { provider: provider.type }, + error: null, + }); }); function runMutation(): Promise {