OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
ralph(M15-124): Per-module fixes: packages/core/src/modules/salt - R13 and the findings no rule covers
ralph56ee382d2b6a
diff --git a/packages/core/src/modules/salt/salt.service.ts b/packages/core/src/modules/salt/salt.service.tsindex 38f5cf2ba..fd7cbb03d 100644--- a/packages/core/src/modules/salt/salt.service.ts+++ b/packages/core/src/modules/salt/salt.service.ts@@ -1,7 +1,5 @@// Moved from packages/db/src/services/salt.service.ts +-// apps/worker/src/jobs/cron.salt.ts (M8-004). V1's boot (createInitialSalts)-// and cron dispatch (rotateSalt, exported there as `salt`) stay the LIVE call-// sites (DELEGATE PATTERN); packages/db keeps a re-export shim.+// apps/worker/src/jobs/cron.salt.ts (M8-004).//// M10-004: reaches Postgres as `deps.db`, no `@openpanel/db` import left.// `main.ts` passes its own `deps` to `createInitialSalts` at boot;@@ -34,9 +32,9 @@ export interface Salts {previous: string;}-/** Only Postgres — narrowed so `main.ts`'s `AppDeps` (which has no `queues`- * yet at the point it calls `createInitialSalts`) satisfies it with no- * cast. */+/** Only Postgres — narrowed so `main.ts`'s `AppDeps` (which never carries+ * `queues`; that field only exists on the per-request/per-job `Ctx`)+ * satisfies it with no cast. */type SaltDeps = Pick<ServiceDeps, 'db'>;function sleep(ms: number): Promise<void> {@@ -75,7 +73,10 @@ export async function createInitialSalts(// Uncached: boot has nothing worth reusing a stale answer for.await fetchSalts(deps);} catch (error) {- if (!(error instanceof Error && error.message === NO_SALT_FOUND_MESSAGE)) {+ const noSaltYet =+ error instanceof Error && error.message === NO_SALT_FOUND_MESSAGE;++ if (!noSaltYet) {if (retryCount >= MAX_RETRIES) {throw new Error(`Failed to create salts after ${MAX_RETRIES} attempts`);}