From b09ce8e6b58a124eeb707ed748d9b95e2b394c73 Mon Sep 17 00:00:00 2001 From: Zhengchao An Date: Tue, 1 Sep 2026 16:48:21 +0800 Subject: [PATCH] docs: make pre-pr validation conditional (#7001) --- AGENTS.md | 11 ++++++----- CLAUDE.md | 2 +- CONTRIBUTING.md | 19 ++++++++++++------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index f252c1347..d581061c1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -123,12 +123,13 @@ runtime/build output: - Use `make pre-commit` only when its repository-wide fast checks add confidence beyond the focused checks. -### Broad or High-Risk Changes +### Broad Cross-Module Changes -After the required adversarial review, run `make pre-pr` when targeted coverage -cannot bound the impact, including dependency/toolchain/build-matrix changes, -unbounded cross-crate APIs, or locking, durability, erasure coding, replication, -RPC, IAM/KMS/auth, cryptography, on-disk/on-wire, and S3-visible behavior. +Do not run `make pre-pr` by default before opening a PR. Consider it only when +the final diff is broad, spans multiple modules, and targeted checks cannot +bound the impact. Decide dynamically from the affected boundaries and risks; +otherwise use the scoped formatting, linting, compilation, and test checks +above. `make pre-pr` includes `make pre-commit`; never run both for the same unchanged diff. Do not repeat a check already covered by a successful umbrella gate. diff --git a/CLAUDE.md b/CLAUDE.md index 59893c48b..eca1def46 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,7 +15,7 @@ cargo check -p # fast type-check one crate cargo test -p # test one crate cargo fmt --all # format (required before PR) make pre-commit # fast gate: fmt + arch checks + quick-check (NO clippy/tests) -make pre-pr # full pre-PR gate: fmt + arch checks + clippy + tests +make pre-pr # optional full gate for broad cross-module changes make build-docker BUILD_OS=ubuntu22.04 ``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5842395f4..059bd4731 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ make test # Fast pre-commit gate — see below for exactly what it runs make pre-commit -# Full pre-PR gate (pre-commit gates + clippy + tests) +# Optional full gate for broad cross-module changes (pre-commit + clippy + tests) make pre-pr ``` @@ -88,14 +88,16 @@ make pre-pr 8. `quick-check` — `cargo check --workspace --exclude e2e_test` **`make pre-commit` does NOT run clippy and does NOT run any tests.** -A green `make pre-commit` is not enough to open a pull request. +It does not replace the scoped Clippy and test checks applicable to a change. `make pre-pr` is the **full** gate: it runs all of the guard checks above, then `clippy-check` (`cargo clippy --all-targets --all-features -- -D warnings`) and `test` (shell script tests, workspace tests excluding `e2e_test`, and doc tests). Complete the applicable multi-role adversarial review described in -`AGENTS.md` before running `make pre-pr`; then run the gate before opening or -updating a pull request. This is what CI enforces. +`AGENTS.md` first. Do not run `make pre-pr` locally by default before opening or +updating a pull request. Consider it only for a broad change that spans multiple +modules and whose impact cannot be bounded by targeted checks; decide from the +affected boundaries and risks. CI still runs its configured repository gates. ### 🔒 Git Pre-commit Hooks (optional) @@ -114,8 +116,9 @@ Or manually: chmod +x .git/hooks/pre-commit ``` -With or without a hook, the expectation is the same: run `make pre-commit` -before committing and `make pre-pr` before opening a pull request. +With or without a hook, follow the verification tiers in `AGENTS.md`. Run the +applicable scoped checks, and reserve `make pre-pr` for broad cross-module +changes whose impact cannot be bounded by those checks. ### 📝 Formatting Configuration @@ -154,7 +157,9 @@ Example output when formatting fails: 3. **Run the fast gate**: `make pre-commit` (no clippy, no tests) 4. **Commit your changes**: `git commit -m "your message"` 5. **Complete the applicable multi-role adversarial review** for non-exempt changes (see `AGENTS.md`) -6. **Run the full gate before opening/updating a PR**: `make pre-pr` (clippy + tests) +6. **Run applicable scoped checks before opening/updating a PR**; consider + `make pre-pr` only for broad cross-module changes whose impact cannot be + bounded by targeted checks 7. **Push to your branch**: `git push` ### 🛠️ IDE Integration