Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -0,0 +1,23 @@
|
||||
// R-P1b regression fix: since the app-wide RLS cutover
|
||||
// (20260713190000_appwide_rls_cutover) NotificationDelivery is FORCE ROW LEVEL
|
||||
// SECURITY. The worker's default client is the RLS-scoped proxy from
|
||||
// @hivegrid/db, which only binds the tenant GUC when an async RLS context is
|
||||
// active. The maintenance sweeps deliberately fire notify() OUTSIDE their
|
||||
// withTenantRLS() read transactions (slow I/O), so without a bound context the
|
||||
// tenant-scoped insert fails the policy WITH CHECK and delivery silently stops
|
||||
// (the handlers only log e.g. "tasks.reminder.notify-failed").
|
||||
//
|
||||
// This wrapper binds the tenant context for exactly the notify() write —
|
||||
// the same pattern apps/worker/src/jobs/portal-lifecycle-bootstrap.ts uses for
|
||||
// its sweep. Every worker-side notify() call for a tenant-scoped delivery must
|
||||
// go through it (or run inside an equivalent bound context/transaction).
|
||||
import { runWithRlsContext } from "@hivegrid/db/rls-context.server";
|
||||
import { notify, type NotificationClient, type NotificationInput, type NotificationPreference } from "@hivegrid/foundation";
|
||||
|
||||
export async function notifyWithTenantRlsContext(
|
||||
input: NotificationInput,
|
||||
client: NotificationClient,
|
||||
preferences: readonly NotificationPreference[] = []
|
||||
): Promise<unknown> {
|
||||
return runWithRlsContext({ tenantId: input.tenantId }, () => notify(input, client, preferences));
|
||||
}
|
||||
Reference in new issue
Block a user