|
1 | 1 | # Code Review & Contribution Guidelines |
2 | 2 |
|
3 | | -> Distilled from maintainer review feedback on this repository, these are a |
4 | | -> **shared baseline for both contributors and reviewers**. They are especially |
5 | | -> useful early on — following the pre-submission self-check avoids the common |
6 | | -> blockers that typically surface in a first review round — and they give |
7 | | -> everyone a common vocabulary for what "ready to merge" means here. |
8 | | -> These are **advisory guidance, not a hard policy**: reviewers and maintainers |
9 | | -> apply them with judgment, and a PR that doesn't need a given check should not |
10 | | -> be blocked on it. |
| 3 | +> This checklist summarizes common considerations for contributors and |
| 4 | +> reviewers. It is advisory, not an exhaustive merge policy: apply the items |
| 5 | +> relevant to the scope and risk of a change, and use maintainer judgment for |
| 6 | +> merge decisions. |
11 | 7 |
|
12 | 8 | ## Review approach |
13 | 9 |
|
14 | | -- **Recheck the current HEAD** — never review a stale version of the branch. |
15 | | -- **Switch to the target branch before probing it** — the same file path can |
16 | | - differ across branches; probing from another branch reads an old copy and |
17 | | - produces false positives/negatives. |
| 10 | +- **Review the current PR HEAD** — confirm the exact revision before probing or |
| 11 | + testing, and use the target branch as the comparison baseline. |
18 | 12 | - **Reproduce the failure against the real version and real behavior**, not an |
19 | 13 | imagined input. |
20 | 14 | - **Check the real third-party contract** — verify the actual CLI/SDK flags and |
21 | 15 | behavior a dependency supports, rather than assuming. |
22 | | -- **Run focused + full test suites** and report the counts as evidence |
23 | | - (e.g. "99 passed / 1 skipped"). |
24 | | -- **Report blockers as "N blockers" with exact file:line and one sentence on why |
25 | | - it matters.** |
26 | | -- When acknowledging, **point to concrete fixable spots** and distinguish |
27 | | - "useful but blocked" from "unusable". |
| 16 | +- **Run tests proportionate to the change** — include focused regression tests |
| 17 | + and, when practical, the relevant broader suite; report the commands and |
| 18 | + results. |
| 19 | +- **Separate blockers from suggestions** and make feedback actionable by citing |
| 20 | + the relevant behavior or location and explaining the impact. |
28 | 21 |
|
29 | 22 | ## Pre-submission self-check |
30 | 23 |
|
31 | | -- [ ] Every supported version of a declared dependency range actually works |
32 | | - (version-adapt APIs; add a real build/launch smoke test per version). |
| 24 | +- [ ] The declared dependency range matches supported behavior; test |
| 25 | + representative boundary versions when compatibility differs or the range |
| 26 | + changes. |
33 | 27 | - [ ] Error fallbacks fire only for the *expected* failure; other errors |
34 | 28 | re-raise; existing targets fail closed; no out-of-bounds mutation. |
35 | | -- [ ] Sensitive data is redacted **structurally** (mapping-key aware), on **every |
36 | | - output boundary** (json/md/stdout/file), while keeping debuggable content. |
37 | | - Secret-key detection uses **endswith** on the normalized key, not substring |
38 | | - (so `token_count` / `token_budget` diagnostics are preserved). |
39 | | -- [ ] Shared mutable state (cache, accounting, errors) goes through a **locked** |
40 | | - helper; one caller's failure does not clobber another's success; accounting |
41 | | - is call-local; transient failures are not cached. |
42 | | -- [ ] A root-cause fix to a shared function/helper verifies **all callers and |
43 | | - subclasses** (via `super()` inheritance) are covered, and gives new threads |
44 | | - a safe default; the test asserts the **quantity itself** so it can fail on |
45 | | - the old bug. |
46 | | -- [ ] Concurrency tests use a **Barrier** to force overlap; degraded inputs are |
47 | | - covered (prefixed stderr, multiline, reentrancy), not just the happy path. |
48 | | -- [ ] Third-party contracts are validated against the real version; smoke tests |
49 | | - exercise real calls, not just `--version`. |
50 | | -- [ ] PR hygiene: original author attribution preserved, rebased on latest main, |
51 | | - no unrelated stacked commits, focused scope. |
| 29 | +- [ ] Sensitive data is redacted at every relevant output boundary while |
| 30 | + preserving useful diagnostics. Prefer structural redaction for structured |
| 31 | + data, and test both secret-key variants and non-secret lookalikes such as |
| 32 | + `token_count`. |
| 33 | +- [ ] Shared mutable state is synchronized with a mechanism appropriate to the |
| 34 | + implementation; failures and accounting remain isolated per operation, |
| 35 | + and cache behavior is explicit. |
| 36 | +- [ ] A bug fix considers all affected callers and subclasses and includes a |
| 37 | + regression test that fails before the fix and verifies externally |
| 38 | + observable behavior. |
| 39 | +- [ ] Concurrency tests coordinate execution deterministically enough to |
| 40 | + exercise the race (for example with barriers, events, or controlled hooks) |
| 41 | + and cover relevant failure inputs. |
| 42 | +- [ ] Third-party behavior is checked against supported versions. Use an |
| 43 | + integration smoke test when practical, or a faithful offline contract test |
| 44 | + when live calls are unsuitable. |
| 45 | +- [ ] PR hygiene: focused scope, no unrelated commits, appropriate attribution, |
| 46 | + and a sufficiently current base to assess conflicts and integration. |
52 | 47 | - [ ] Domain math (stats/research/numeric) is correct and the formula verified. |
53 | 48 | - [ ] Config/role routing is consistent (optimizer/target/judge are role-aware; |
54 | 49 | matching model fields accompany backend changes). |
55 | 50 | - [ ] Data isolation: test/eval data never leaks back into training; holdout/test |
56 | 51 | sets are explicitly excluded. |
57 | | -- [ ] Trust boundaries: external paths/ids are bound to a verified manifest/hash; |
58 | | - fail-closed validation. |
| 52 | +- [ ] External paths and identifiers are validated at the appropriate trust |
| 53 | + boundary; invalid or untrusted inputs are rejected safely. |
59 | 54 | - [ ] Features wired end-to-end (not just primitives). |
60 | 55 | - [ ] Deliberate resilience/fallback contracts are respected, not "cleaned up"; |
61 | 56 | deprecated options retire cleanly rather than being re-purposed. |
62 | | -- [ ] Reuse existing infrastructure over reinventing it. |
| 57 | +- [ ] Prefer existing infrastructure when it fits the requirement; introduce |
| 58 | + new abstractions when they provide a clear benefit. |
63 | 59 | - [ ] Sensitive content is redacted **before** reaching downstream consumers; |
64 | 60 | resource operations are bounded. |
65 | | -- [ ] Mutating endpoints are authenticated and CSRF-protected. |
66 | | -- [ ] Backward compatibility preserved; the same contract behaves identically |
67 | | - across backends. |
| 61 | +- [ ] Mutating endpoints enforce appropriate authorization; browser endpoints |
| 62 | + that rely on ambient credentials include CSRF protection or an equivalent |
| 63 | + defense. |
| 64 | +- [ ] Avoid unintended compatibility regressions across supported backends; |
| 65 | + document and test intentional backend-specific differences. |
68 | 66 | - [ ] Filesystem boundaries handled (cross-drive paths, empty home, path |
69 | 67 | normalization, symlinks). |
70 | | -- [ ] First mergeable slice submitted; follow-ups as independent PRs — each with |
71 | | - its own tests. |
| 68 | +- [ ] Keep each PR a coherent, reviewable slice with tests appropriate to its |
| 69 | + behavior; split unrelated follow-up work into separate PRs. |
72 | 70 |
|
73 | 71 | ## Notes |
74 | 72 |
|
75 | | -- The most common review root cause is **validating the shape you imagined |
76 | | - rather than the shape reality produces**. Prefer running the real entry point |
77 | | - once with a realistic input before writing assertions. |
78 | | -- When a failure is reported, find and fix the **root cause in the shared |
79 | | - function/helper** (one fix covers all callers) — but align the fix with the |
80 | | - codebase's existing conventions to avoid over- or under-correction. |
| 73 | +- A recurring review failure mode is validating an assumed shape rather than |
| 74 | + the behavior the real entry point produces. When practical, exercise the real |
| 75 | + entry point with representative input before writing assertions. |
| 76 | +- Fix failures at the narrowest layer that correctly covers the affected |
| 77 | + callers; check neighboring callers and follow existing conventions to avoid |
| 78 | + over- or under-correction. |
0 commit comments