|
1 | 1 | ## Description |
2 | 2 |
|
3 | | -<!-- Describe the changes made in this PR --> |
| 3 | +<!-- Provide a clear summary of the changes and motivation behind them. --> |
| 4 | +<!-- Link related issues using "Closes #123" or "Related to #456". --> |
| 5 | + |
| 6 | +## Changes |
| 7 | + |
| 8 | +<!-- List the key changes in this PR. --> |
| 9 | + |
| 10 | +- |
4 | 11 |
|
5 | 12 | ## Testing |
6 | 13 |
|
7 | | -<!-- Describe the testing done for this PR --> |
| 14 | +<!-- Describe how the changes were tested. --> |
| 15 | +<!-- Include any relevant test commands, scenarios, or edge cases covered. --> |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## PR Lifecycle |
| 20 | + |
| 21 | +> [!IMPORTANT] |
| 22 | +> **Draft PRs** signal that work is still in progress and **will not trigger CI**. |
| 23 | +> Only mark your PR as **Ready for review** when you believe it is complete. |
| 24 | +> All CI checks **must pass** before requesting a review. |
| 25 | +
|
| 26 | +## Code Guidelines |
| 27 | + |
| 28 | +Please keep the following in mind (see [CONTRIBUTING.md](../CONTRIBUTING.md) for full details): |
| 29 | + |
| 30 | +### Commits |
| 31 | + |
| 32 | +- Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) (`feat(rln):`, `fix(utils):`, `chore:`, etc.) |
| 33 | +- Use the appropriate scope: `rln`, `rln-cli`, `rln-wasm`, `utils`, `ci` |
| 34 | +- GPG-sign your commits |
| 35 | + |
| 36 | +### Error Handling |
| 37 | + |
| 38 | +- **No panics in library code.** Do not use `unwrap()`, `expect()`, or `panic!()` |
| 39 | + in production paths inside `rln/src/` or `utils/src/`. |
| 40 | + The only acceptable exception is an internal invariant that is statically guaranteed — and even then, |
| 41 | + prefer returning an error. |
| 42 | +- Use the project's `thiserror`-based error types (`RLNError`, `ProtocolError`, `UtilsError`, etc.) |
| 43 | + and propagate errors with `?`. |
| 44 | +- Provide context in error variants (e.g., `InsufficientData { expected, actual }`). |
| 45 | +- `unwrap()` is fine in **tests**. |
| 46 | + |
| 47 | +### Code Style |
| 48 | + |
| 49 | +- Run `cargo fmt --all -- --check` to verify formatting (CI enforces this on stable). |
| 50 | +- Group imports: std first, then external crates, then local modules (see `rustfmt.toml`). |
| 51 | +- Use `pub(crate)` for items that should not be part of the public API. |
| 52 | +- Apply `Zeroize` / `ZeroizeOnDrop` to any struct holding secret material. |
| 53 | + |
| 54 | +### Linting (mirrors CI) |
| 55 | + |
| 56 | +CI runs clippy across multiple crate/feature combinations. Run the relevant checks locally before pushing: |
| 57 | + |
| 58 | +```bash |
| 59 | +# Default features — workspace root (rln + utils) |
| 60 | +cargo clippy --all-targets --tests --release -- -D warnings |
| 61 | + |
| 62 | +# Stateless feature — from rln/ |
| 63 | +cd rln && cargo clippy --all-targets --tests --release \ |
| 64 | + --features=stateless --no-default-features -- -D warnings |
| 65 | + |
| 66 | +# WASM target — from rln-wasm/ |
| 67 | +cd rln-wasm && cargo clippy --target wasm32-unknown-unknown \ |
| 68 | + --tests --release -- -D warnings |
| 69 | +``` |
8 | 70 |
|
| 71 | +At minimum, run the default-features check. If your changes touch `stateless` or `rln-wasm`, run those checks as well. |
9 | 72 |
|
10 | 73 | ## Checklist |
11 | 74 |
|
12 | | -- [ ] I have run the CI coverage report. Add the `run-coverage` label to this PR to enable it. |
| 75 | +- [ ] My PR title follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format |
| 76 | +- [ ] I have linked the related issue(s) |
| 77 | +- [ ] `cargo fmt --all -- --check` produces no changes |
| 78 | +- [ ] Clippy passes for all affected crate/feature combinations (see [Linting](#linting-mirrors-ci) above) |
| 79 | +- [ ] `make test` passes locally |
| 80 | +- [ ] No new `unwrap()` / `expect()` / `panic!()` in library code |
| 81 | +- [ ] New code includes appropriate tests (unit / integration / WASM where applicable) |
| 82 | +- [ ] I have run the CI coverage report — add the `run-coverage` label to enable it |
| 83 | +- [ ] All CI checks pass and the PR is marked **Ready for review** |
0 commit comments