-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathcode-review.mdc
More file actions
38 lines (24 loc) · 1.79 KB
/
code-review.mdc
File metadata and controls
38 lines (24 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
description: "PR review themes — API docs, compatibility, errors, security, tests (CDA SDK)"
alwaysApply: true
---
# Code review checklist (CDA JavaScript SDK)
Apply when reviewing changes to the **`contentstack`** npm package (Content Delivery API client).
## Public API & documentation
- **JSDoc** updated for new or changed public methods/classes (params, return shape, examples), matching style in `src/core/contentstack.js` / `src/core/stack.js`.
- **`index.d.ts`** updated when TypeScript consumers would see different signatures or new exports.
## Backward compatibility
- Avoid breaking changes to exported function signatures, option objects, or default behavior without a major version rationale.
- If behavior changes, ensure **callers inside `src/`** and tests reflect the new contract.
## Errors & safety
- HTTP failures should continue to reject with a predictable shape from **`src/core/lib/request.js`** where applicable (**`error_message`**, **`error_code`**, **`errors`**, **`status`**, **`statusText`**).
- Do not log full **delivery_token**, **preview_token**, **management_token**, or **api_key** values.
- Respect **null/undefined** edge cases for optional API fields.
## Dependencies & supply chain
- New **dependencies** should be justified (size, maintenance, license).
- Lockfile and **`package.json`** version bumps should be minimal and reviewable.
## Tests
- **Jest** tests for new logic or regressions under **`test/`** (JS and/or **`test/typescript/`** as appropriate).
- Live stack tests must remain compatible with **`test/config.js`** env requirements; document new env needs in **`test/README.md`** or comments near the harness — never commit credentials.
## Security & privacy
- No hardcoded credentials; no accidental exposure of customer content in logs or error messages.