You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor conference ID handling across components and routers
- Removed conferenceId prop from SponsorActivityTimeline, SponsorDashboardMetrics, WorkshopsClientPage, VolunteerAdminPage, VolunteerForm, and WorkshopList components.
- Updated API calls in various routers (badge, proposal, sponsor, tickets, volunteer, workshop) to resolve conference ID using a new utility function `resolveConferenceId`.
- Simplified schemas by removing conferenceId requirements where applicable.
- Ensured consistent handling of conference ID resolution across the application.
- Proper query invalidation and optimistic updates
306
+
-**Conference Resolution:** Never accept `conferenceId` as client input. Use `resolveConferenceId()` from `/src/server/trpc.ts` to derive it server-side from the request's Host header via `getConferenceForCurrentDomain()`. This ensures multi-tenant isolation and prevents clients from accessing data across conferences.
306
307
-**Input Validation:** Zod schemas in `/src/server/schemas/` for type-safe input validation
307
308
-**Error Handling:** Consistent TRPCError usage with proper HTTP status codes and user-friendly messages
@@ -329,6 +330,19 @@ This applies to any component using `formatDistanceToNow`, `getDaysPending`, or
329
330
-**Qodo Review:**`pnpm qodo:review` - Review PR suggestions from Qodo Merge (auto-detects current branch PR, or pass PR number like `pnpm qodo:review 332`).
330
331
- Run sanity commands with `pnpm sanity {command}` (e.g., `pnpm sanity deploy`) - do not use `npx sanity` directly.
331
332
333
+
#### CLI (`cli/` — Rust)
334
+
335
+
The `cnctl` CLI lives in `cli/` as a standalone Cargo project. It uses mise for toolchain management.
336
+
337
+
-**Full Check:**`cd cli && mise run check` - Runs clippy, format check, and tests in parallel.
338
+
-**Clippy:**`cd cli && mise run clippy` - Runs clippy with pedantic lints, warnings as errors.
339
+
-**Format:**`cd cli && mise run fmt` - Formats code with rustfmt.
340
+
-**Format Check:**`cd cli && mise run fmt-check` - Checks formatting without modifying files.
341
+
-**Tests:**`cd cli && mise run test` - Runs all tests.
342
+
-**Tests (Verbose):**`cd cli && mise run test-verbose` - Runs tests with output.
343
+
-**Build:**`cd cli && mise run build` - Builds release binary.
344
+
-**Clean:**`cd cli && mise run clean` - Removes build artifacts.
This site is multi-tenant — each conference runs on its own subdomain. The server must determine which conference the request is for, and **this must always happen server-side**.
65
+
66
+
**Rule: Never accept `conferenceId` as client input in tRPC procedures.** Instead, use `resolveConferenceId()` from `/src/server/trpc.ts`, which derives the conference from the request's `Host` header via `getConferenceForCurrentDomain()`.
67
+
68
+
```typescript
69
+
// ✅ Correct — resolve server-side
70
+
import { resolveConferenceId } from'../trpc'
71
+
72
+
list: adminProcedure.query(async () => {
73
+
const conferenceId =awaitresolveConferenceId()
74
+
// use conferenceId for queries...
75
+
})
76
+
77
+
// ❌ Wrong — never accept conferenceId from client
78
+
list: adminProcedure
79
+
.input(z.object({ conferenceId: z.string() }))
80
+
.query(async ({ input }) => {
81
+
// DO NOT DO THIS — clients could access other conferences
82
+
})
83
+
```
84
+
85
+
**Why:** Accepting `conferenceId` from the client breaks multi-tenant isolation. A malicious or misconfigured client could pass a different conference's ID and access data it shouldn't. Server-side resolution guarantees each request only accesses data belonging to the conference identified by the domain.
86
+
87
+
**When you need the full conference object** (not just the ID), import and call `getConferenceForCurrentDomain()` directly.
0 commit comments