Skip to content

Commit a80fc59

Browse files
Yif-YangPR Review
andauthored
docs: make review checklist advisory and risk-based (#260)
Co-authored-by: PR Review <review@example.invalid>
1 parent 978ec53 commit a80fc59

2 files changed

Lines changed: 52 additions & 54 deletions

File tree

‎docs/contributing.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ mkdocs serve # Preview at http://localhost:8000
7575

7676
## Code Review Guidelines
7777

78-
We maintain a [code review & contribution guide](review_guidelines.md) distilled
79-
from maintainer review feedback. Reviewers and contributors should use it as a
80-
shared checklist before merging.
78+
See the [code review checklist](review_guidelines.md) for common considerations
79+
that may help reviewers and contributors. Apply the items relevant to the scope
80+
and risk of each change.
8181

8282
## License
8383

‎docs/review_guidelines.md‎

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,78 @@
11
# Code Review & Contribution Guidelines
22

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.
117
128
## Review approach
139

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.
1812
- **Reproduce the failure against the real version and real behavior**, not an
1913
imagined input.
2014
- **Check the real third-party contract** — verify the actual CLI/SDK flags and
2115
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.
2821

2922
## Pre-submission self-check
3023

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.
3327
- [ ] Error fallbacks fire only for the *expected* failure; other errors
3428
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.
5247
- [ ] Domain math (stats/research/numeric) is correct and the formula verified.
5348
- [ ] Config/role routing is consistent (optimizer/target/judge are role-aware;
5449
matching model fields accompany backend changes).
5550
- [ ] Data isolation: test/eval data never leaks back into training; holdout/test
5651
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.
5954
- [ ] Features wired end-to-end (not just primitives).
6055
- [ ] Deliberate resilience/fallback contracts are respected, not "cleaned up";
6156
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.
6359
- [ ] Sensitive content is redacted **before** reaching downstream consumers;
6460
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.
6866
- [ ] Filesystem boundaries handled (cross-drive paths, empty home, path
6967
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.
7270

7371
## Notes
7472

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

Comments
 (0)