chore: format sharing authority controls

Apply repository formatting to provider and import coverage.
This commit is contained in:
Marc-André Bombeck committed 2026-08-06 02:05:24 +02:00
1 parent a620a730b9
commit f5ca810643
4 files changed
+21 -18

No files matched your search

+15 -11
View File
@@ -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 },
+1 -4
View File
@@ -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<ProviderWorkAuthority>();
@@ -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 }) },
);
@@ -121,7 +121,10 @@ const resolveFromSharedRead: (request: NextRequest) => Promise<Response> =
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<Response> {