mirror of
https://github.com/supabase/supabase.git
synced 2026-06-27 02:56:42 -04:00
7b5e976c9f
Sets up `.coderabbit.yaml` so our CodeRabbit configuration lives in the repo — version-controlled, visible to contributors, and reviewable — instead of split between the dashboard and nowhere. Three parts: 1. **Skills as code guidelines** — wires our `.claude/skills/` into reviews. 2. **Path instructions** — migrates the telemetry rules out of the CodeRabbit dashboard UI. 3. **Path filters** — skips machine-generated files so reviews focus on hand-written code. Supersedes #47327 (closed). ## 1. Skills as review guidelines CodeRabbit's code-guidelines feature reads guideline files and, by default, **directory-scopes** them — a file applies only to its own folder and below. Our skills live in `.claude/skills/` (no code), so they'd never reach `apps/studio`. The `applyTo` field on `filePatterns` decouples *where the guideline lives* from *which code it governs*, so we point CodeRabbit straight at the skills: | Skills | Apply to | | --- | --- | | `studio-best-practices`, `studio-ui-patterns`, `vercel-composition-patterns`, `studio-queries`, `studio-error-handling` | `apps/studio/**/*.{ts,tsx}` | | `studio-testing`, `studio-mock-api-tests` | `apps/studio/**/*.test.{ts,tsx}` | | `studio-e2e-tests` | `e2e/studio/**/*.spec.ts` | Skills stay the **single source of truth** — consumed directly, no duplicated/generated copy. ## 2. Path instructions (migrated from the dashboard) Moved the two existing telemetry path instructions into the file so they're version-controlled: - `packages/common/telemetry-constants.ts` — event-naming enforcement (`[object]_[verb]` snake_case, approved verb list, camelCase props, `useSendEventMutation` flag, JSDoc + union-type checks). - `apps/studio/components/**/*.tsx` — only suggest PostHog tracking for growth-relevant interactions, not passive/UI-only ones. ## 3. Path filters (skip generated files) Excludes machine-generated / vendored paths from review (mirrors `.prettierignore`): API types, generated DB types, route trees, design-system / icons / ui-library registries, generated icon components, and the lockfile. Keeps reviews focused on hand-written code and preserves OSS rate-limit budget on large codegen diffs. ## Notes - Cost is \$0 — CodeRabbit Pro (incl. code guidelines) is free for public repos. - `vitest` skill left out (generic framework reference, not our conventions). - The `telemetry-standards` skill is intentionally **not** also wired as a guideline — the migrated path instruction above is the curated version; wiring both would double up. ## To test - PR touching `apps/studio/**/*.tsx` → CodeRabbit cites Studio conventions - PR touching `e2e/studio/**/*.spec.ts` → cites E2E conventions - PR editing `telemetry-constants.ts` with a bad verb / non-camelCase prop → flagged - PR that regenerates e.g. `packages/api-types/types/**` → those files not reviewed - Confirm Studio guidelines don't bleed into unrelated areas (docs, www) ## Follow-ups (not here) - Extend `filePatterns` to other scopes: `dev-toolbar-review` → `packages/dev-tools/**` - Optionally skip bot PRs via `auto_review.ignore_title_keywords` - Move any remaining dashboard settings into this file as we find them <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added/updated automated review configuration to disable org-level inheritance and enable automatic issue enrichment. * Excluded generated/vendor artifacts (e.g., lockfiles, API/type outputs, generated docs/www, UI registry/icon sources) from review. * Added path-scoped review guidance for telemetry event naming/verification and tighter review focus for production UI event-tracking suggestions. * Extended internal coding guidelines to apply local skill docs across Studio source, unit/component tests, and Studio Playwright E2E specs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
72 lines
3.8 KiB
YAML
72 lines
3.8 KiB
YAML
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
|
|
|
|
# Don't inherit organization-level settings (they're tuned for other repos);
|
|
# this config is self-contained and unset values use CodeRabbit defaults.
|
|
inheritance: false
|
|
|
|
# Enrich linked issues with related code and potential solutions during review.
|
|
issue_enrichment:
|
|
auto_enrich:
|
|
enabled: true
|
|
|
|
reviews:
|
|
# Skip machine-generated / vendored files (mirrors .prettierignore). Keeps
|
|
# reviews focused on hand-written code and preserves rate-limit budget on
|
|
# large codegen diffs.
|
|
path_filters:
|
|
- '!pnpm-lock.yaml'
|
|
- '!packages/api-types/types/**' # generated API types (api.d.ts, platform.d.ts)
|
|
- '!supabase/functions/common/database-types.ts' # generated by `pnpm generate:types`
|
|
- '!**/routeTree.gen.ts' # TanStack Router generated
|
|
- '!**/__generated__/**'
|
|
- '!apps/docs/features/docs/generated/**'
|
|
- '!apps/www/.generated/**'
|
|
- '!apps/design-system/__registry__/**'
|
|
- '!apps/ui-library/__registry__/**'
|
|
- '!apps/ui-library/public/r/**' # registry output
|
|
- '!packages/icons/__registry__/**'
|
|
- '!packages/icons/src/icons/**' # generated icon components
|
|
|
|
# Targeted, path-scoped review guidance, version-controlled alongside the code.
|
|
path_instructions:
|
|
- path: 'packages/common/telemetry-constants.ts'
|
|
instructions: |
|
|
Strictly enforce event naming: [object]_[verb] in snake_case. Only approved
|
|
verbs: opened, clicked, submitted, created, removed, updated, retrieved,
|
|
intended, evaluated, added, enabled, disabled, copied, exposed, failed,
|
|
converted. Properties must be camelCase for new events (match existing
|
|
convention when adding to existing events). Flag any usage of
|
|
useSendEventMutation. Verify @group Events and @source JSDoc tags are
|
|
accurate. Check that new interfaces are added to the TelemetryEvent union type.
|
|
- path: 'apps/studio/components/**/!(*.test).tsx' # production components only, not tests
|
|
instructions: |
|
|
Only suggest adding PostHog event tracking (via useTrack from
|
|
lib/telemetry/track, [object]_[verb] snake_case) when a new user-facing
|
|
interaction is growth-relevant: e.g. first-use of a feature, onboarding steps,
|
|
project/org creation, upgrade/billing actions, enabling or disabling a product
|
|
feature, or any action that signals activation or retention. Do not suggest
|
|
tracking for: passive views, page loads, UI-only state changes (e.g. expanding
|
|
a panel, switching tabs in a settings page), developer/internal tooling
|
|
interactions, or interactions clearly unrelated to product adoption.
|
|
|
|
# Applies our internal engineering skills (.claude/skills/) as CodeRabbit review
|
|
# guidelines. The skills are the single source of truth — they are consumed
|
|
# directly, with no copy of their content elsewhere.
|
|
#
|
|
# `applyTo` decouples where a guideline file lives from the code it governs.
|
|
# Without it, CodeRabbit scopes a guideline file to its own directory and below;
|
|
# our skills live in .claude/skills/, which contains no code, so they would never
|
|
# reach apps/studio. `applyTo` points them at the right paths instead.
|
|
knowledge_base:
|
|
code_guidelines:
|
|
filePatterns:
|
|
# Studio code conventions — React/TS, UI patterns, composition, data fetching, errors
|
|
- files: '.claude/skills/{studio-best-practices,studio-ui-patterns,vercel-composition-patterns,studio-queries,studio-error-handling}/SKILL.md'
|
|
applyTo: 'apps/studio/**/*.{ts,tsx}'
|
|
# Studio unit / component test conventions
|
|
- files: '.claude/skills/{studio-testing,studio-mock-api-tests}/SKILL.md'
|
|
applyTo: 'apps/studio/**/*.test.{ts,tsx}'
|
|
# Studio end-to-end (Playwright) test conventions
|
|
- files: '.claude/skills/studio-e2e-tests/SKILL.md'
|
|
applyTo: 'e2e/studio/**/*.spec.ts'
|