OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
comments: drop the V1 framing from the rpc headers
Carl-Gerhard Lindesvärdf3046cd4f3f6
diff --git a/packages/core/src/modules/assistant/assistant.rpc.ts b/packages/core/src/modules/assistant/assistant.rpc.tsindex bd5eb78b7..ba4eb222d 100644--- a/packages/core/src/modules/assistant/assistant.rpc.ts+++ b/packages/core/src/modules/assistant/assistant.rpc.ts@@ -1,4 +1,3 @@-//// Every procedure is on its V1 twin's builder. `protectedProcedure` runs// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as// V1 does — `models` takes no input and needs no object-id check of its own, sodiff --git a/packages/core/src/modules/assistant/src/app.ts b/packages/core/src/modules/assistant/src/app.tsindex e623d660d..4ae7d2149 100644--- a/packages/core/src/modules/assistant/src/app.ts+++ b/packages/core/src/modules/assistant/src/app.ts@@ -1,4 +1,3 @@-//// The app is BUILT from the `deps` `assistant.routes.ts` already holds, not// constructed at module scope (R15). Importing this file now opens nothing — no// provider client, no agent, no conversation store — and every tool handlerdiff --git a/packages/core/src/modules/assistant/src/report-runner.ts b/packages/core/src/modules/assistant/src/report-runner.tsindex 88f835583..cd1f031ee 100644--- a/packages/core/src/modules/assistant/src/report-runner.ts+++ b/packages/core/src/modules/assistant/src/report-runner.ts@@ -1,4 +1,3 @@-//// Explicitly defers unifying MCP's tool definitions with assistant's, so// `modules/mcp/src/tools/analytics/reports.ts` keeps its own copy of this// dispatch — reaching into another module's tool tree is not the fix.diff --git a/packages/core/src/modules/auth/auth.rpc.ts b/packages/core/src/modules/auth/auth.rpc.tsindex 601bcc7b3..52067589b 100644--- a/packages/core/src/modules/auth/auth.rpc.ts+++ b/packages/core/src/modules/auth/auth.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// V1's `rateLimitMiddleware` wrappers are mounted below through// `createRateLimitMiddleware` (rpc/base.ts) with V1's own limits, procedure fordiff --git a/packages/core/src/modules/chart/chart.rpc.ts b/packages/core/src/modules/chart/chart.rpc.tsindex 5b3215be5..7d27a4b37 100644--- a/packages/core/src/modules/chart/chart.rpc.ts+++ b/packages/core/src/modules/chart/chart.rpc.ts@@ -1,4 +1,3 @@-//// The seven member-only procedures are back on `protectedProcedure`, so// `enforceAccess` reads the top-level `projectId` before the input is parsed,// exactly as V1 does.diff --git a/packages/core/src/modules/client/client.rpc.ts b/packages/core/src/modules/client/client.rpc.tsindex fc0df364a..ad830285f 100644--- a/packages/core/src/modules/client/client.rpc.ts+++ b/packages/core/src/modules/client/client.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// `ctx.services.client` carries this module's factory.//diff --git a/packages/core/src/modules/cohort/cohort.constants.ts b/packages/core/src/modules/cohort/cohort.constants.tsindex cfec145a4..2dea732fd 100644--- a/packages/core/src/modules/cohort/cohort.constants.ts+++ b/packages/core/src/modules/cohort/cohort.constants.ts@@ -1,4 +1,3 @@-//// Isomorphic by the AGENTS.md rule: zod, another `*.constants.ts`, or nothing.// `zChartEventFilter` used to be a diverged local copy here (TODO(P7) in// M5-003) to dodge a TDZ from importing it through packages/validation's barreldiff --git a/packages/core/src/modules/cohort/cohort.jobs.ts b/packages/core/src/modules/cohort/cohort.jobs.tsindex c1d4947ac..4a0987ca2 100644--- a/packages/core/src/modules/cohort/cohort.jobs.ts+++ b/packages/core/src/modules/cohort/cohort.jobs.ts@@ -1,4 +1,3 @@-//// `cohortCompute` is this module's own queue — registry key `cohortCompute`// EXACTLY (ADR-005's acceptance note: no env rename, so// COHORTCOMPUTE_CONCURRENCY keeps working). `cohortRefresh` is a cron fragment,diff --git a/packages/core/src/modules/cohort/cohort.rpc.ts b/packages/core/src/modules/cohort/cohort.rpc.tsindex 84dff12aa..0109060a5 100644--- a/packages/core/src/modules/cohort/cohort.rpc.ts+++ b/packages/core/src/modules/cohort/cohort.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// The per-project access ladder itself is bound once, in auth.service.ts; every// procedure here reaches it through `ctx.services.auth`.diff --git a/packages/core/src/modules/conversation/conversation.rpc.ts b/packages/core/src/modules/conversation/conversation.rpc.tsindex e3fd64b32..9094a845b 100644--- a/packages/core/src/modules/conversation/conversation.rpc.ts+++ b/packages/core/src/modules/conversation/conversation.rpc.ts@@ -1,4 +1,3 @@-//// Every procedure is on its V1 twin's builder. `protectedProcedure` runs// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as// V1 does. `enforceAccess` reads the raw, pre-zod input and only a TOP-LEVELdiff --git a/packages/core/src/modules/dashboard/dashboard.rpc.ts b/packages/core/src/modules/dashboard/dashboard.rpc.tsindex 776c1c313..7c72dd3d2 100644--- a/packages/core/src/modules/dashboard/dashboard.rpc.ts+++ b/packages/core/src/modules/dashboard/dashboard.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// The dashboardId-keyed procedures are invisible to `enforceAccess`; their// in-handler `requireProjectAccess` through `ctx.services.auth` is the onlydiff --git a/packages/core/src/modules/dashboard/dashboard.service.ts b/packages/core/src/modules/dashboard/dashboard.service.tsindex 61ad85130..89f671a93 100644--- a/packages/core/src/modules/dashboard/dashboard.service.ts+++ b/packages/core/src/modules/dashboard/dashboard.service.ts@@ -1,4 +1,3 @@-//// Every function takes `ServiceDeps` and reaches Postgres as `deps.db`; the// `loadDb` / `loadIdService` lazy loaders are gone, so this module// value-imports neither `@openpanel/db` nor its own package barrel — the Prismadiff --git a/packages/core/src/modules/email/email.constants.ts b/packages/core/src/modules/email/email.constants.tsindex 86d65047b..33439aed5 100644--- a/packages/core/src/modules/email/email.constants.ts+++ b/packages/core/src/modules/email/email.constants.ts@@ -1,4 +1,3 @@-//// Keys must match the template `category` in @openpanel/email. Each entry's// label + description drive the account email-preferences toggles.export const emailCategories = {diff --git a/packages/core/src/modules/email/email.rpc.ts b/packages/core/src/modules/email/email.rpc.tsindex 83a62bd8f..d4dda152f 100644--- a/packages/core/src/modules/email/email.rpc.ts+++ b/packages/core/src/modules/email/email.rpc.ts@@ -1,4 +1,3 @@-//// Deliberately R + C only (no `email.service.ts`): the three procedures' bodies// are three small `db.emailUnsubscribe` calls, inlined here the same way// conversation.rpc.ts inlines its organization lookup. Sending/templates stay@@ -6,11 +5,10 @@// already wraps that package for the one thing this module doesn't need —// sending.//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// This module has no queue/cron of its own, so there is no// `ctx.services.email`, same as `user`/`reference`.diff --git a/packages/core/src/modules/event/event.rpc.ts b/packages/core/src/modules/event/event.rpc.tsindex 1afa06617..9535c29de 100644--- a/packages/core/src/modules/event/event.rpc.ts+++ b/packages/core/src/modules/event/event.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// `bots` was V1's only `publicProcedure` here (anonymous callers were let in// when a share-overview row existed); ADR-011 makes it protected.diff --git a/packages/core/src/modules/group/group.constants.ts b/packages/core/src/modules/group/group.constants.tsindex 1d17dbfa9..35590004f 100644--- a/packages/core/src/modules/group/group.constants.ts+++ b/packages/core/src/modules/group/group.constants.ts@@ -1,4 +1,3 @@-//// Isomorphic by the AGENTS.md rule: zod and nothing else.import { z } from 'zod';diff --git a/packages/core/src/modules/group/group.rpc.ts b/packages/core/src/modules/group/group.rpc.tsindex fc7e67e78..88d8b155e 100644--- a/packages/core/src/modules/group/group.rpc.ts+++ b/packages/core/src/modules/group/group.rpc.ts@@ -1,4 +1,3 @@-//// Every procedure is on its V1 twin's builder. `protectedProcedure` runs// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as// V1 does. Every procedure below carries a top-level `projectId`, sodiff --git a/packages/core/src/modules/gsc/gsc.jobs.ts b/packages/core/src/modules/gsc/gsc.jobs.tsindex 0664405fc..f1e7c6f1a 100644--- a/packages/core/src/modules/gsc/gsc.jobs.ts+++ b/packages/core/src/modules/gsc/gsc.jobs.ts@@ -1,4 +1,3 @@-//// `gscProjectSync` / `gscProjectBackfill` are this module's own queue (`gsc` in// the registry — ADR-005's registry key). `gscSync` is a cron fragment, spread// into the ONE `cron` queue by jobs.registry.ts. Scheduler id and cadence arediff --git a/packages/core/src/modules/gsc/gsc.rpc.ts b/packages/core/src/modules/gsc/gsc.rpc.tsindex 59510a880..645787648 100644--- a/packages/core/src/modules/gsc/gsc.rpc.ts+++ b/packages/core/src/modules/gsc/gsc.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// The per-project access ladder itself is bound once, in auth.service.ts; every// procedure here reaches it through `ctx.services.auth`.diff --git a/packages/core/src/modules/import/import.constants.ts b/packages/core/src/modules/import/import.constants.tsindex 765f33ae5..8d185eb9d 100644--- a/packages/core/src/modules/import/import.constants.ts+++ b/packages/core/src/modules/import/import.constants.ts@@ -1,4 +1,3 @@-//// Isomorphic by the AGENTS.md rule: zod and nothing else.import { z } from 'zod';diff --git a/packages/core/src/modules/import/import.jobs.ts b/packages/core/src/modules/import/import.jobs.tsindex 6ca2926e1..cd725b5ad 100644--- a/packages/core/src/modules/import/import.jobs.ts+++ b/packages/core/src/modules/import/import.jobs.ts@@ -1,4 +1,3 @@-//// `import` is this module's own queue AND its only job — the registry key, the// Redis name and the BullMQ job name are all `import` (legacyCompat.import// already discriminates on `{type: 'import', payload}`, jobs/compat.ts). Unlikediff --git a/packages/core/src/modules/import/import.rpc.ts b/packages/core/src/modules/import/import.rpc.tsindex d04aecd9b..524e9f2a9 100644--- a/packages/core/src/modules/import/import.rpc.ts+++ b/packages/core/src/modules/import/import.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// V1's router has no compute-heavy or ClickHouse-touching logic to delegate (it// is Prisma CRUD + a BullMQ enqueue, unlike gsc/cohort), sodiff --git a/packages/core/src/modules/import/import.service.ts b/packages/core/src/modules/import/import.service.tsindex 1cf66ce72..b081ffd26 100644--- a/packages/core/src/modules/import/import.service.ts+++ b/packages/core/src/modules/import/import.service.ts@@ -1,4 +1,3 @@-//// Db/ch access is LAZY (`load*` below), not a static top-level import — see// gsc.service.ts's header for the full reasoning (jobs.registry.ts and// services.ts pull this module into the eager barrel chain nearly every corediff --git a/packages/core/src/modules/insight/insight.jobs.ts b/packages/core/src/modules/insight/insight.jobs.tsindex 1b05cab7b..915a601d1 100644--- a/packages/core/src/modules/insight/insight.jobs.ts+++ b/packages/core/src/modules/insight/insight.jobs.ts@@ -1,4 +1,3 @@-//// `insightsProject` is this module's own queue (`insights` in the registry —// ADR-005's registry key). `insightsDaily` / `insightCleanup` / `weeklyDigest`// are cron fragments, spread into the ONE `cron` queue by jobs.registry.ts.diff --git a/packages/core/src/modules/insight/insight.rpc.ts b/packages/core/src/modules/insight/insight.rpc.tsindex 1e55d652e..2a2ee3a8b 100644--- a/packages/core/src/modules/insight/insight.rpc.ts+++ b/packages/core/src/modules/insight/insight.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// The permission ladder itself is bound once, in auth.service.ts; every// procedure here reaches it through `ctx.services.auth`.diff --git a/packages/core/src/modules/integration/integration.constants.ts b/packages/core/src/modules/integration/integration.constants.tsindex 8d35cb6f0..90623be49 100644--- a/packages/core/src/modules/integration/integration.constants.ts+++ b/packages/core/src/modules/integration/integration.constants.ts@@ -1,4 +1,3 @@-//// `zSlackAuthResponse` does NOT move here even though it is zod-only and would// pass `constants-stay-isomorphic`: it is Slack's OAuth token-exchange wire// contract, not integration config a form validates against — nothing indiff --git a/packages/core/src/modules/integration/integration.rpc.ts b/packages/core/src/modules/integration/integration.rpc.tsindex fac16664e..156c51a81 100644--- a/packages/core/src/modules/integration/integration.rpc.ts+++ b/packages/core/src/modules/integration/integration.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// Every access assertion (including the data-dependent "authorize against the// EXISTING row" rule) lives in integration.service.ts, not here — see thatdiff --git a/packages/core/src/modules/misc/misc.jobs.ts b/packages/core/src/modules/misc/misc.jobs.tsindex f6f7e3490..e7e51b3fa 100644--- a/packages/core/src/modules/misc/misc.jobs.ts+++ b/packages/core/src/modules/misc/misc.jobs.ts@@ -1,4 +1,3 @@-//// `ping` is this module's fragment of the ONE `cron` queue's jobs: declared// here and spread into jobs.registry.ts, same shape as organization.jobs.ts's// `delete`. Its `cron` is explicitly `null` (ADR-021's on-demand state, notdiff --git a/packages/core/src/modules/notification/notification.constants.ts b/packages/core/src/modules/notification/notification.constants.tsindex 669eda3f2..526e5f092 100644--- a/packages/core/src/modules/notification/notification.constants.ts+++ b/packages/core/src/modules/notification/notification.constants.ts@@ -1,4 +1,3 @@-//// `zChartEvent`/`zChartEventFilter` are chart/report vocabulary that has not// moved to core yet (ADR-008's "report" module is a later wave), so per// `constants-stay-isomorphic` (zod, another `*.constants.ts`, or type-only —diff --git a/packages/core/src/modules/notification/notification.jobs.ts b/packages/core/src/modules/notification/notification.jobs.tsindex a2fff0e04..212f0560d 100644--- a/packages/core/src/modules/notification/notification.jobs.ts+++ b/packages/core/src/modules/notification/notification.jobs.ts@@ -1,4 +1,3 @@-//// `sendNotification` is this module's own queue (`notification` in the registry// — ADR-005's registry key). legacyCompat.notification already discriminates on// this exact job name (jobs/compat.ts), so this pins the two in agreement. Nodiff --git a/packages/core/src/modules/notification/notification.rpc.ts b/packages/core/src/modules/notification/notification.rpc.tsindex b1c16ec72..07d03b2bf 100644--- a/packages/core/src/modules/notification/notification.rpc.ts+++ b/packages/core/src/modules/notification/notification.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// `list`/`rules` have no access check here either — same gap V1's router has// (ported verbatim, not fixed; see notification.service.ts's header for whydiff --git a/packages/core/src/modules/onboarding/onboarding.constants.ts b/packages/core/src/modules/onboarding/onboarding.constants.tsindex 12e8af9d5..61409a5e4 100644--- a/packages/core/src/modules/onboarding/onboarding.constants.ts+++ b/packages/core/src/modules/onboarding/onboarding.constants.ts@@ -1,4 +1,3 @@-//// Isomorphic by the AGENTS.md rule: zod and nothing else.import { z } from 'zod';diff --git a/packages/core/src/modules/onboarding/onboarding.jobs.ts b/packages/core/src/modules/onboarding/onboarding.jobs.tsindex db72d986b..e7a375138 100644--- a/packages/core/src/modules/onboarding/onboarding.jobs.ts+++ b/packages/core/src/modules/onboarding/onboarding.jobs.ts@@ -1,4 +1,3 @@-//// `onboarding` is this module's fragment of the ONE `cron` queue's jobs, spread// into jobs.registry.ts. Scheduler id and cadence are V1's, unchanged// (apps/worker/src/boot-cron.ts) — same shape as organization.jobs.ts.diff --git a/packages/core/src/modules/onboarding/onboarding.rpc.ts b/packages/core/src/modules/onboarding/onboarding.rpc.tsindex 39117b259..999ca01a3 100644--- a/packages/core/src/modules/onboarding/onboarding.rpc.ts+++ b/packages/core/src/modules/onboarding/onboarding.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// `project`'s input can carry an existing `organizationId`, which// `enforceAccess` gates on membership (not admin — joining an org you alreadydiff --git a/packages/core/src/modules/organization/organization.rpc.ts b/packages/core/src/modules/organization/organization.rpc.tsindex 614086f21..4d49d9b57 100644--- a/packages/core/src/modules/organization/organization.rpc.ts+++ b/packages/core/src/modules/organization/organization.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// The organization-admin ladder itself is bound once, in auth.service.ts; every// procedure here reaches it through `ctx.services.auth`.diff --git a/packages/core/src/modules/organization/src/wind-down.test.ts b/packages/core/src/modules/organization/src/wind-down.test.tsindex 50a256ac7..de60024ce 100644--- a/packages/core/src/modules/organization/src/wind-down.test.ts+++ b/packages/core/src/modules/organization/src/wind-down.test.ts@@ -1,4 +1,3 @@-//// Prisma, the event counts, the last-event lookup, the highlight builder and// the email transport are injected stubs — these assert the job's decisions// (who enters, which step fires, what gets written), not any real persistence.diff --git a/packages/core/src/modules/overview/overview.rpc.ts b/packages/core/src/modules/overview/overview.rpc.tsindex e358e487f..c9d4eb956 100644--- a/packages/core/src/modules/overview/overview.rpc.ts+++ b/packages/core/src/modules/overview/overview.rpc.ts@@ -1,4 +1,3 @@-//// `overviewProcedure` is V1's own builder — `publicProcedure` plus one// middleware that resolves share-or-membership off the raw// `projectId`/`shareId`, BEFORE the input parser. `runFilterCommand` is adiff --git a/packages/core/src/modules/profile/profile.rpc.ts b/packages/core/src/modules/profile/profile.rpc.tsindex 7107918df..c767953fb 100644--- a/packages/core/src/modules/profile/profile.rpc.ts+++ b/packages/core/src/modules/profile/profile.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.import { z } from 'zod';import { createTRPCRouter, protectedProcedure } from '../../rpc/base';diff --git a/packages/core/src/modules/project/project.rpc.ts b/packages/core/src/modules/project/project.rpc.tsindex 0b56feb05..36a6b3883 100644--- a/packages/core/src/modules/project/project.rpc.ts+++ b/packages/core/src/modules/project/project.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// `ctx.services.project` carries this module's factory.//diff --git a/packages/core/src/modules/realtime/realtime.rpc.ts b/packages/core/src/modules/realtime/realtime.rpc.tsindex 340c3976d..0ee922e12 100644--- a/packages/core/src/modules/realtime/realtime.rpc.ts+++ b/packages/core/src/modules/realtime/realtime.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// Each procedure also calls `requireProjectAccess({ level: 'read' })`// explicitly; `enforceAccess` already does the same off the `projectId` input,diff --git a/packages/core/src/modules/reference/reference.rpc.ts b/packages/core/src/modules/reference/reference.rpc.tsindex 928c9f197..e010952e8 100644--- a/packages/core/src/modules/reference/reference.rpc.ts+++ b/packages/core/src/modules/reference/reference.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// The handler bodies reach the module through `ctx.services.reference`, so the// requestId minted at the edge reaches the Postgres call.diff --git a/packages/core/src/modules/reference/reference.service.ts b/packages/core/src/modules/reference/reference.service.tsindex e4e9940e6..cbc533a62 100644--- a/packages/core/src/modules/reference/reference.service.ts+++ b/packages/core/src/modules/reference/reference.service.ts@@ -1,4 +1,3 @@-//// Every function takes `ServiceDeps` and reaches Postgres as `deps.db`. The// `loadDb` / `loadDateService` / `loadOrganizationService` lazy loaders are// gone: nothing here value-imports `@openpanel/db` or this package's own barreldiff --git a/packages/core/src/modules/report/report.constants.ts b/packages/core/src/modules/report/report.constants.tsindex 10a41c0a1..bd17fbe49 100644--- a/packages/core/src/modules/report/report.constants.ts+++ b/packages/core/src/modules/report/report.constants.ts@@ -1,4 +1,3 @@-//// `getDefaultIntervalByDates` is REWRITTEN from date-fns// (differenceInDays/isSameDay) to plain Date math per the module map. Every// process that constructs these Dates runs under TZ=UTC (ADR-012: "this ADRdiff --git a/packages/core/src/modules/report/report.rpc.ts b/packages/core/src/modules/report/report.rpc.tsindex 484c85a51..376110d2a 100644--- a/packages/core/src/modules/report/report.rpc.ts+++ b/packages/core/src/modules/report/report.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// Most of this router's inputs carry a reportId or a dashboardId rather than a// projectId, so `enforceAccess` is blind to them and the in-handlerdiff --git a/packages/core/src/modules/report/report.service.ts b/packages/core/src/modules/report/report.service.tsindex 1dfd89601..07967dfe1 100644--- a/packages/core/src/modules/report/report.service.ts+++ b/packages/core/src/modules/report/report.service.ts@@ -1,4 +1,3 @@-//// Every function takes `ServiceDeps` and reaches Postgres as `deps.db`;// `loadDb` and the `@openpanel/core` self-barrel import are gone — the Prisma// row types below are `import type`, erased at runtime.diff --git a/packages/core/src/modules/salt/salt.jobs.ts b/packages/core/src/modules/salt/salt.jobs.tsindex 7a95e665c..c97c0e510 100644--- a/packages/core/src/modules/salt/salt.jobs.ts+++ b/packages/core/src/modules/salt/salt.jobs.ts@@ -1,4 +1,3 @@-//// `salt` is this module's fragment of the ONE `cron` queue's jobs, spread into// jobs.registry.ts. Its schedule is now derived straight from `cron` below — id// and cadence are V1's, unchanged (apps/worker/src/boot-cron.ts).diff --git a/packages/core/src/modules/salt/salt.service.ts b/packages/core/src/modules/salt/salt.service.tsindex 559103d08..026600297 100644--- a/packages/core/src/modules/salt/salt.service.ts+++ b/packages/core/src/modules/salt/salt.service.ts@@ -1,4 +1,3 @@-//// Reaches Postgres as `deps.db`, no `@openpanel/db` import left. `main.ts`// passes its own `deps` to `createInitialSalts` at boot; `salt.jobs.ts`'s// handler passes its `JobCtx` (a `ServiceDeps` by construction) todiff --git a/packages/core/src/modules/session/session.rpc.ts b/packages/core/src/modules/session/session.rpc.tsindex 2b78ff92e..2ff23853b 100644--- a/packages/core/src/modules/session/session.rpc.ts+++ b/packages/core/src/modules/session/session.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// V1's file also exported `encodeCursor` / `decodeCursor`; nothing imports them// and `shared/pagination.ts` already has the generic pair, so they were notdiff --git a/packages/core/src/modules/session/src/session-end.ts b/packages/core/src/modules/session/src/session-end.tsindex 6640a8ac8..8498cdf33 100644--- a/packages/core/src/modules/session/src/session-end.ts+++ b/packages/core/src/modules/session/src/session-end.ts@@ -1,4 +1,3 @@-//// Everything that touches Redis, ClickHouse, a buffer or a queue is INJECTED// (`SessionEndDeps`): M10-006 moved the binding into `session.jobs.ts`, where// the job's `ctx` supplies every client, so the requestId that opened thediff --git a/packages/core/src/modules/share/share.rpc.ts b/packages/core/src/modules/share/share.rpc.tsindex 6cf90d62f..4480ca374 100644--- a/packages/core/src/modules/share/share.rpc.ts+++ b/packages/core/src/modules/share/share.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// The handler bodies reach the module through `ctx.services.share`, so the// requestId minted at the edge reaches the Postgres call.diff --git a/packages/core/src/modules/share/share.service.ts b/packages/core/src/modules/share/share.service.tsindex 1c00b0899..dc5af56a3 100644--- a/packages/core/src/modules/share/share.service.ts+++ b/packages/core/src/modules/share/share.service.ts@@ -1,4 +1,3 @@-//// Every function takes `ServiceDeps` and reaches Postgres as `deps.db`; the// `loadDb` / `loadAccessService` / `loadDashboardService` /// `loadReportsService` lazy loaders are gone, so this module value-importsdiff --git a/packages/core/src/modules/subscription/subscription.constants.ts b/packages/core/src/modules/subscription/subscription.constants.tsindex d76a8323e..35ce113d3 100644--- a/packages/core/src/modules/subscription/subscription.constants.ts+++ b/packages/core/src/modules/subscription/subscription.constants.ts@@ -1,4 +1,3 @@-//// Isomorphic by the AGENTS.md rule: zod and nothing else.import { z } from 'zod';diff --git a/packages/core/src/modules/subscription/subscription.rpc.ts b/packages/core/src/modules/subscription/subscription.rpc.tsindex afbae9308..b933d7a0a 100644--- a/packages/core/src/modules/subscription/subscription.rpc.ts+++ b/packages/core/src/modules/subscription/subscription.rpc.ts@@ -1,9 +1,7 @@-//-// Every procedure is on its V1 twin's builder. `protectedProcedure` runs-// `enforceUserIsAuthed` + `enforceAccess` BEFORE the input parser, exactly as-// V1 does. The explicit checks in the handlers below stay: `enforceAccess` only-// sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved from-// another id needs its own.+// `protectedProcedure` runs `enforceUserIsAuthed` + `enforceAccess` BEFORE the+// input parser. The explicit checks in the handlers below stay: `enforceAccess`+// only sees a TOP-LEVEL `projectId` / `organizationId`, so anything resolved+// from another id needs its own.//// `requireOrganizationAdmin` lives in subscription.service.ts, not here — see// that file's header. `ctx.services.subscription` carries this module's factorydiff --git a/packages/core/src/modules/subscription/subscription.service.ts b/packages/core/src/modules/subscription/subscription.service.tsindex 9cf3ea91e..a21f03506 100644--- a/packages/core/src/modules/subscription/subscription.service.ts+++ b/packages/core/src/modules/subscription/subscription.service.ts@@ -1,4 +1,3 @@-//// `requireOrganizationAdmin` travels with the business logic here rather than// living in subscription.rpc.ts the way project.rpc.ts's simple ladder checks// do: every mutating procedure in this module gates on it first, beforediff --git a/packages/core/src/modules/user/user.service.ts b/packages/core/src/modules/user/user.service.tsindex 0f149aaf5..7ba8b21c6 100644--- a/packages/core/src/modules/user/user.service.ts+++ b/packages/core/src/modules/user/user.service.ts@@ -1,4 +1,3 @@-//// Every function takes `ServiceDeps` and reaches Postgres as `deps.db`; the// `loadDb` lazy loader is gone. Every caller — including// `onboarding.service.ts` and `auth.service.ts` — passes the `deps` it holds.