just wanna see what code rabbit does:)#12
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
WalkthroughThis update removes the language code mapping utilities and their exports from the shared lists module. It also adjusts import/export orders, cleans up unused imports and comments in several files, and modifies filter logic in a query builder. Additionally, minor refactoring and simplifications are made in database client and rate limiter logic, with a new badge added to the README. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API (simple-builder)
participant DB
Client->>API (simple-builder): Send request with filters
API (simple-builder)->>API (simple-builder): Process all filters (no allowedFilters check)
API (simple-builder)->>DB: Query with all filters
DB-->>API (simple-builder): Return results
API (simple-builder)-->>Client: Respond with data
Estimated code review effort3 (~40 minutes) Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
packages/rpc/src/routers/funnels.ts (1)
771-787: Conversion-rate aggregation should be weighted, not arithmetic mean
conversion_rate_sum += conversion_rate;followed by
conversion_rate_sum / conversion_rate_countcomputes the simple mean of per-referrer rates, giving equal weight to a referrer with 2 users and one with 2 000. A weighted average better reflects reality:- agg.conversion_rate_sum += conversion_rate; - agg.conversion_rate_count += 1; + // weight by cohort size + agg.conversion_rate_sum += conversion_rate * total_users; + agg.conversion_rate_count += total_users;and later
- conversion_rate: agg.conversion_rate_count > 0 ? Math.round((agg.conversion_rate_sum / agg.conversion_rate_count) * 100) / 100 : 0 + conversion_rate: agg.conversion_rate_count > 0 + ? Math.round((agg.conversion_rate_sum / agg.conversion_rate_count) * 100) / 100 + : 0
🧹 Nitpick comments (1)
packages/rpc/src/routers/funnels.ts (1)
14-15:conditionsschema is too permissive – preferz.unknown()or a typed union overz.any()
z.any()disables type-safety and leaksanydownstream, reducing the whole benefit of Zod.
If the values really can be anything, usez.unknown(); otherwise model the expected value types explicitly (e.g.z.string().or(z.number()).or(z.boolean()) …).- conditions: z.record(z.string(), z.any()).optional(), + // Narrower – accepts primitives only, adjust as needed + conditions: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()])).optional(),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
README.md(1 hunks)apps/api/src/query/simple-builder.ts(1 hunks)packages/db/src/clickhouse/client.ts(2 hunks)packages/rpc/src/routers/funnels.ts(2 hunks)packages/rpc/src/routers/goals.ts(1 hunks)packages/rpc/src/utils/rate-limit.ts(0 hunks)packages/shared/src/lists/index.ts(1 hunks)packages/shared/src/lists/languages.ts(0 hunks)
💤 Files with no reviewable changes (2)
- packages/rpc/src/utils/rate-limit.ts
- packages/shared/src/lists/languages.ts
🔇 Additional comments (5)
README.md (1)
13-13: Approve badge integration – functionality verifiedThe CodeRabbit badge in README.md (line 13) returns a valid SVG (HTTP 200) and displays as expected. No further changes are required.
• File: README.md (line 13)
• Badge URL: https://img.shields.io/coderabbit/prs/github/databuddy-analytics/Databuddy?utm_source=oss&utm_medium=github&utm_campaign=databuddy-analytics%2FDatabuddy&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviewspackages/shared/src/lists/index.ts (1)
1-4: Confirm removal of language exports is safeA repository-wide search found no imports or usages of the removed language utilities (
getLanguageName,validateLanguageCode,LANGUAGE_CODES), nor any direct imports from@databuddy/shared/listsrelated to languages. Removing the./languagesexport and reordering the exports inpackages/shared/src/lists/index.tswill not break existing functionality.packages/rpc/src/routers/goals.ts (1)
371-371: Good improvement using template literal.The change from string concatenation to template literal syntax is cleaner and more consistent with modern JavaScript practices.
packages/db/src/clickhouse/client.ts (2)
1-2: Good cleanup of unused imports.Removing unused logging-related imports improves code clarity and reduces bundle size.
108-117: Clean refactor of data transformation logic.The change from
Object.assignto direct property assignment is cleaner and more readable. The explicit type casting maintains type safety while the simplified accumulator type provides better flexibility.
| @@ -1,19 +1,17 @@ | |||
| import { z } from 'zod'; | |||
| import { z } from 'zod/v4'; | |||
There was a problem hiding this comment.
Potential build-break: sub-path import zod/v4 is non-standard
zod does not expose a stable sub-path named v4; the canonical entry-point is simply "zod". Unless you are publishing your own fork with that sub-path, this will resolve to module-not-found at runtime and during TypeScript emit.
-import { z } from 'zod/v4';
+import { z } from 'zod';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { z } from 'zod/v4'; | |
| -import { z } from 'zod/v4'; | |
| +import { z } from 'zod'; |
🤖 Prompt for AI Agents
In packages/rpc/src/routers/funnels.ts at line 1, the import statement uses a
non-standard sub-path 'zod/v4' which can cause module-not-found errors. Change
the import to use the canonical entry point by importing directly from 'zod'
instead of 'zod/v4' to ensure compatibility and prevent build failures.
Pull Request
Description
Please include a summary of the change and which issue is fixed. Also include relevant motivation and context.
Checklist
Summary by CodeRabbit
Documentation
Refactor
Chores