| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 1 | 1 | 0% |
| Commands | 0 | 0 | 2 | 0% |
| Section tags | 1 | 0 | 2 | 33% |
What each file covers
Sections
0 shared · 1 only in A · 1 only in B- − ClickHouse Conventions
- + Testing Conventions
Commands
0 shared · 0 only in A · 2 only in B- + npm run lint:openapi
- + pnpm start:worker
Section tags
1 shared · 0 only in A · 2 only in B- + test
- + testing-strategy
- code-style
Line diff
novuhq/novu · .cursor/rules/clickhouse.mdc
@@ −1 @@
1---
2description: Rules for working with ClickHouse analytics and trace logging
3globs:
4 - "**/analytic-logs/**"
5 - "**/clickhouse-migrations/**"
6alwaysApply: false
7---
8
9### ClickHouse Conventions
10
11**Service layer**
12- Use `ClickHouseService` for single queries/inserts and `ClickHouseBatchService` for high-throughput writes.
13- Both are registered as custom providers (`clickHouseService`, `clickHouseBatchService`) in each app's `shared.module.ts`.
14- Never instantiate ClickHouse clients directly — always inject the providers.
15
16**Repositories**
17- All ClickHouse repositories extend `LogRepository` in `libs/application-generic/src/services/analytic-logs/`.
18- Each repository has a corresponding schema file defining the table columns and types.
19- Always include `_environmentId` and `_organizationId` in queries for tenant isolation (same pattern as MongoDB DAL).
20
21**Migrations**
22- ClickHouse migrations are numbered `.sql` files in `apps/api/migrations/clickhouse-migrations/`.
23- Run locally with `cd apps/api && pnpm run clickhouse:migrate:local`.
24- New migrations must be additive — never alter or drop columns that existing queries depend on. Use temp tables and exchange patterns for schema refactors (see migration 4/5 for the established pattern).
25
26**Feature flags**
27- Gate new ClickHouse-dependent behavior behind a feature flag (see `packages/shared/src/types/feature-flags.ts` for existing flags like `IS_CLICKHOUSE_BATCHING_ENABLED`).
28
novuhq/novu · .cursor/rules/testing.mdc
@@ +1 @@
1---
2description: Rules for writing and running tests
3globs:
4 - "**/*.spec.ts"
5 - "**/*.test.ts"
6 - "**/e2e/**"
7alwaysApply: false
8---
9
10### Testing Conventions
11
12**General**
13- Match the test style and tooling already used in the same app (Mocha for API/worker, Playwright for dashboard).
14- Shared test utilities and setup helpers live in `libs/testing` — use them instead of rolling custom harnesses.
15- Never mock MongoDB models directly; use the test harness in `libs/testing` which manages real database state.
16
17**API (`apps/api`)**
18- Unit tests: `cd apps/api && pnpm test` (Mocha + ts-node, matches `src/**/*.spec.ts`)
19- Lint: `cd apps/api && pnpm check`
20- OpenAPI validation: `npm run lint:openapi` (requires API running)
21- E2E tests: see `.cursor/skills/run-api-e2e-tests/SKILL.md`
22- Bootstrap a NestJS testing module for integration-style unit tests rather than mocking the entire DI container.
23
24**Dashboard (`apps/dashboard`)**
25- E2E tests: `cd apps/dashboard && pnpm test:e2e` (Playwright — start dashboard first)
26- Lint: `cd apps/dashboard && pnpm check`
27- Tests live in `apps/dashboard/tests/` (or `e2e/`).
28
29**Worker (`apps/worker`)**
30- Unit tests: `cd apps/worker && pnpm test` (Mocha + ts-node, matches `src/**/**/*.spec.ts`)
31- Lint: `cd apps/worker && pnpm check`
32- The worker must be running (`pnpm start:worker`) when testing end-to-end notification flows.
33
@@ −1 +1 @@
11 ---
2−description: Rules for working with ClickHouse analytics and trace logging
2+description: Rules for writing and running tests
33 globs:
4− - "**/analytic-logs/**"
5− - "**/clickhouse-migrations/**"
4+ - "**/*.spec.ts"
5+ - "**/*.test.ts"
6+ - "**/e2e/**"
67 alwaysApply: false
78 ---
89
9−### ClickHouse Conventions
10+### Testing Conventions
1011
11−**Service layer**
12−- Use `ClickHouseService` for single queries/inserts and `ClickHouseBatchService` for high-throughput writes.
13−- Both are registered as custom providers (`clickHouseService`, `clickHouseBatchService`) in each app's `shared.module.ts`.
14−- Never instantiate ClickHouse clients directly — always inject the providers.
12+**General**
13+- Match the test style and tooling already used in the same app (Mocha for API/worker, Playwright for dashboard).
14+- Shared test utilities and setup helpers live in `libs/testing` — use them instead of rolling custom harnesses.
15+- Never mock MongoDB models directly; use the test harness in `libs/testing` which manages real database state.
1516
16−**Repositories**
17−- All ClickHouse repositories extend `LogRepository` in `libs/application-generic/src/services/analytic-logs/`.
18−- Each repository has a corresponding schema file defining the table columns and types.
19−- Always include `_environmentId` and `_organizationId` in queries for tenant isolation (same pattern as MongoDB DAL).
17+**API (`apps/api`)**
18+- Unit tests: `cd apps/api && pnpm test` (Mocha + ts-node, matches `src/**/*.spec.ts`)
19+- Lint: `cd apps/api && pnpm check`
20+- OpenAPI validation: `npm run lint:openapi` (requires API running)
21+- E2E tests: see `.cursor/skills/run-api-e2e-tests/SKILL.md`
22+- Bootstrap a NestJS testing module for integration-style unit tests rather than mocking the entire DI container.
2023
21−**Migrations**
22−- ClickHouse migrations are numbered `.sql` files in `apps/api/migrations/clickhouse-migrations/`.
23−- Run locally with `cd apps/api && pnpm run clickhouse:migrate:local`.
24−- New migrations must be additive — never alter or drop columns that existing queries depend on. Use temp tables and exchange patterns for schema refactors (see migration 4/5 for the established pattern).
24+**Dashboard (`apps/dashboard`)**
25+- E2E tests: `cd apps/dashboard && pnpm test:e2e` (Playwright — start dashboard first)
26+- Lint: `cd apps/dashboard && pnpm check`
27+- Tests live in `apps/dashboard/tests/` (or `e2e/`).
2528
26−**Feature flags**
27−- Gate new ClickHouse-dependent behavior behind a feature flag (see `packages/shared/src/types/feature-flags.ts` for existing flags like `IS_CLICKHOUSE_BATCHING_ENABLED`).
29+**Worker (`apps/worker`)**
30+- Unit tests: `cd apps/worker && pnpm test` (Mocha + ts-node, matches `src/**/**/*.spec.ts`)
31+- Lint: `cd apps/worker && pnpm check`
32+- The worker must be running (`pnpm start:worker`) when testing end-to-end notification flows.
2833
