Skip to content

Commit efc30cf

Browse files
authored
feat: configure CodeRabbit adversarial PR reviews (#1433)
* feat: configure CodeRabbit adversarial PR reviews * fix: apply CodeRabbit review guidance globally
1 parent 8efff00 commit efc30cf

1 file changed

Lines changed: 141 additions & 0 deletions

File tree

.coderabbit.yaml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
2+
language: en-US
3+
tone_instructions: >-
4+
Be direct and evidence-first. Report only concrete, actionable findings grounded in changed code.
5+
Prioritize correctness, security, data loss, lifecycle, and regressions; avoid speculative style
6+
comments and unrelated refactors.
7+
8+
reviews:
9+
profile: assertive
10+
request_changes_workflow: true
11+
high_level_summary: true
12+
high_level_summary_in_walkthrough: true
13+
review_status: true
14+
review_details: true
15+
collapse_walkthrough: true
16+
changed_files_summary: true
17+
poem: false
18+
19+
auto_review:
20+
enabled: true
21+
drafts: false
22+
auto_incremental_review: true
23+
24+
path_filters:
25+
- "!**/node_modules/**"
26+
- "!**/dist/**"
27+
- "!**/out/**"
28+
- "!**/coverage/**"
29+
- "!**/.turbo/**"
30+
- "!apps/vscode-e2e/.vscode-test/**"
31+
- "!bin/*.vsix"
32+
- "!webview-ui/**/__screenshots__/**"
33+
34+
path_instructions:
35+
- path: "**/*"
36+
instructions: >-
37+
Act as an adversarial second-opinion reviewer. Verify PR claims against implementation,
38+
contracts, and tests. Trace changed inputs through normal, boundary, error, cancellation,
39+
retry, and default paths and their consumers. Seek plausible counterexamples and regressions
40+
from removed safeguards. Report only concrete, actionable findings grounded in changed code
41+
and repository conventions. Prioritize correctness, security, data loss, lifecycle, and test
42+
gaps. Avoid speculative style comments and unrelated refactors. Search for existing helpers
43+
before suggesting abstractions, and distinguish actual defects from unsupported checks.
44+
45+
- path: "**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}"
46+
instructions: >-
47+
Check strict typing and exhaustive behavior across normal, boundary, error,
48+
cancellation, retry, and compatibility paths. Verify promises and errors are handled,
49+
existing helpers are reused, and new code introduces no `any`, unjustified double
50+
assertions, floating promises, duplicated helpers, or increased lint suppressions.
51+
52+
- path: "{**/*.{test,spec}.{ts,tsx,js,jsx},**/__tests__/**}"
53+
instructions: >-
54+
Require regression coverage at the lowest valid harness with behavior-focused
55+
assertions, including relevant negative, error, false/unset, and boundary cases.
56+
Check cleanup and deterministic async behavior and prefer shared typed test helpers.
57+
Visible webview changes require a durable Playwright component snapshot; behavior-only
58+
changes do not.
59+
60+
- path: "apps/vscode-e2e/**"
61+
instructions: >-
62+
Reserve end-to-end coverage for behavior that requires the real VS Code host, workspace
63+
APIs, extension activation, webview messaging, file watchers, or a full workflow. Keep
64+
detailed protocol, parsing, storage, retry, and edge cases at lower test layers.
65+
66+
- path: "{packages/types/src/**,webview-ui/src/components/settings/**,src/core/config/**,src/core/webview/**}"
67+
instructions: >-
68+
For persisted settings, verify the complete schema/storage/runtime/webview round trip,
69+
shared default semantics, and focused true plus false/unset tests. SettingsView controls
70+
must read and update local `cachedState`, include the value in the explicit save payload,
71+
and receive the persisted value back from extension state.
72+
73+
- path: "src/**"
74+
instructions: >-
75+
Verify extension/webview contracts, cancellation and error propagation, VS Code
76+
lifecycle correctness, and behavior under retries and partial failure. Check listeners,
77+
resources, and providers are disposed without stale state or duplicate work.
78+
79+
- path: "webview-ui/**"
80+
instructions: >-
81+
Check React state and effect dependencies, cleanup, accessibility, i18n, and light/dark
82+
theme behavior. New markup should use Tailwind; add VS Code CSS variables to
83+
`src/index.css` before Tailwind use. Use Vitest for behavior and Playwright component
84+
snapshots only for durable visible changes.
85+
86+
- path: "{src/api/**,src/core/prompts/**,src/core/tools/**,src/services/mcp/**,src/services/destructive-command-guard/**}"
87+
instructions: >-
88+
Treat model, provider, MCP, path, command, and tool data as untrusted. Check approval and
89+
allowlist bypasses, injection and traversal risks, secrets/PII exposure in logs, abort and
90+
stream behavior, retries, provider compatibility, and enforcement at execution time—not
91+
only at presentation or planning time.
92+
93+
- path: "{src/**/{state,history,task,tasks,service,services,cache,caches,worktree,worktrees}/**,packages/**/{state,history,task,tasks,service,services,cache,caches,worktree,worktrees}/**,webview-ui/src/**/{state,history,task,tasks,service,services,cache,caches,worktree,worktrees}/**}"
94+
instructions: >-
95+
Check persistence and lifecycle invariants: awaited atomic writes, rollback or explicit
96+
partial-failure behavior, cross-window state consistency, stale listeners/watchers,
97+
cancellation, idempotency, and safe restart/resume without lost or duplicated state.
98+
99+
- path: ".github/**"
100+
instructions: >-
101+
Require full commit SHA pins, least-privilege permissions, safe expression and shell
102+
interpolation, and trusted metadata handling. Privileged workflows must never check out,
103+
execute, install from, or otherwise trust a fork PR head.
104+
105+
- path: "{AGENTS.md,**/AGENTS.md,CONTRIBUTING.md,.changeset/**,CHANGELOG.md,src/CHANGELOG.md}"
106+
instructions: >-
107+
Enforce repository policy: routine PRs must not add changesets or edit changelogs except
108+
during release preparation. Verify documentation describes real behavior and contracts,
109+
and deprioritize prose-only nits that do not affect correctness or usability.
110+
111+
pre_merge_checks:
112+
custom_checks:
113+
- name: Regression evidence
114+
mode: warning
115+
instructions: >-
116+
Fail only when a concrete changed behavior lacks focused coverage at the lowest valid
117+
test layer, tests merely mirror implementation, an affected error/negative/unset branch
118+
is omitted, or a durable visible UI change lacks its required Playwright component
119+
snapshot. Do not demand tests for unchanged behavior, mechanical configuration, or every
120+
branch without a plausible regression scenario. Cite the changed behavior and missing
121+
evidence.
122+
- name: Trust and persistence invariants
123+
mode: error
124+
instructions: >-
125+
Fail only for a concrete changed path that leaks secrets or PII, trusts or executes
126+
unvalidated input, bypasses approval or allowlist controls, can lose persisted state due
127+
to a missing await, non-atomic write, or omitted default propagation, or leaks lifecycle
128+
resources. Cite the path and a plausible triggering scenario; pass when no such changed
129+
path exists.
130+
131+
tools:
132+
eslint:
133+
enabled: true
134+
actionlint:
135+
enabled: true
136+
shellcheck:
137+
enabled: true
138+
gitleaks:
139+
enabled: true
140+
semgrep:
141+
enabled: true

0 commit comments

Comments
 (0)