Skip to content

Commit a535b40

Browse files
committed
chore(git): merge from master
2 parents 18b0d06 + ad1ee65 commit a535b40

6 files changed

Lines changed: 47 additions & 6 deletions

File tree

.github/copilot-instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
1212
- Use `pipe-trait` for chaining through unary functions (constructors, `Some`, `Ok`, free functions, etc.), avoiding nested calls, and continuing method chains — but not for simple standalone calls (prefer `foo(value)` over `value.pipe(foo)`)
1313
- Prefer `where` clauses for multiple trait bounds
1414
- Derive order: std traits → comparison traits → `Hash` → derive_more → feature-gated
15-
- Custom errors: `#[derive(Debug, Display, Error)]`
15+
- Error types: only derive `Display` and `Error` from `derive_more` when each is actually needed — not all displayable types are errors
1616
- Minimize `unwrap()` in non-test code — use proper error handling
1717
- Install toolchain before running tests: `rustup toolchain install "$(< rust-toolchain)" && rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy`
1818
- Run `FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh` to validate changes. If a test fails with a hint about `RUSTFLAGS` and `--cfg pdu_test_skip_*`, follow the hint and rerun with the suggested flags.
1919
- **ALWAYS run the full test suite** (`FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh`) before committing, regardless of how trivial the change seems — this includes documentation-only changes, comment edits, config changes, and refactors. The test suite checks formatting, linting, building, tests, and docs across multiple feature combinations; any type of change can break any of these checks.
20+
- Set `PDU_NO_FAIL_FAST=true` to run all checks instead of stopping at the first failure — this lets you see which checks pass and which fail

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
1212
- Use `pipe-trait` for chaining through unary functions (constructors, `Some`, `Ok`, free functions, etc.), avoiding nested calls, and continuing method chains — but not for simple standalone calls (prefer `foo(value)` over `value.pipe(foo)`)
1313
- Prefer `where` clauses for multiple trait bounds
1414
- Derive order: std traits → comparison traits → `Hash` → derive_more → feature-gated
15-
- Custom errors: `#[derive(Debug, Display, Error)]`
15+
- Error types: only derive `Display` and `Error` from `derive_more` when each is actually needed — not all displayable types are errors
1616
- Minimize `unwrap()` in non-test code — use proper error handling
1717
- Install toolchain before running tests: `rustup toolchain install "$(< rust-toolchain)" && rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy`
1818
- Run `FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh` to validate changes. If a test fails with a hint about `RUSTFLAGS` and `--cfg pdu_test_skip_*`, follow the hint and rerun with the suggested flags.
1919
- **ALWAYS run the full test suite** (`FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh`) before committing, regardless of how trivial the change seems — this includes documentation-only changes, comment edits, config changes, and refactors. The test suite checks formatting, linting, building, tests, and docs across multiple feature combinations; any type of change can break any of these checks.
20+
- Set `PDU_NO_FAIL_FAST=true` to run all checks instead of stopping at the first failure — this lets you see which checks pass and which fail

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
1212
- Use `pipe-trait` for chaining through unary functions (constructors, `Some`, `Ok`, free functions, etc.), avoiding nested calls, and continuing method chains — but not for simple standalone calls (prefer `foo(value)` over `value.pipe(foo)`)
1313
- Prefer `where` clauses for multiple trait bounds
1414
- Derive order: std traits → comparison traits → `Hash` → derive_more → feature-gated
15-
- Custom errors: `#[derive(Debug, Display, Error)]`
15+
- Error types: only derive `Display` and `Error` from `derive_more` when each is actually needed — not all displayable types are errors
1616
- Minimize `unwrap()` in non-test code — use proper error handling
1717
- Install toolchain before running tests: `rustup toolchain install "$(< rust-toolchain)" && rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy`
1818
- Run `FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh` to validate changes. If a test fails with a hint about `RUSTFLAGS` and `--cfg pdu_test_skip_*`, follow the hint and rerun with the suggested flags.
1919
- **ALWAYS run the full test suite** (`FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh`) before committing, regardless of how trivial the change seems — this includes documentation-only changes, comment edits, config changes, and refactors. The test suite checks formatting, linting, building, tests, and docs across multiple feature combinations; any type of change can break any of these checks.
20+
- Set `PDU_NO_FAIL_FAST=true` to run all checks instead of stopping at the first failure — this lets you see which checks pass and which fail
2021
- `gh` (GitHub CLI) is not installed — do not attempt to use it

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ where
198198

199199
### Error Handling
200200

201-
- Define custom error enums with `#[derive(Debug, Display, Error)]` from `derive_more`.
201+
- Use `derive_more` for error types. Only derive the traits that are actually used:
202+
- `Display`: derive when the type needs to be displayed (e.g., printed to stderr, used in format strings).
203+
- `Error`: derive when the type is used as a `std::error::Error` (e.g., as the error type in `Result`, or as a source of another error). Not all types with `Display` need `Error`.
204+
- A type that only needs formatting (not error handling) should derive `Display` without `Error`.
202205
- Minimize `unwrap()` in non-test code — use proper error propagation. `unwrap()` is acceptable in tests and for provably infallible operations (with a comment explaining why). When deliberately ignoring an error, use `.ok()` with a comment explaining why.
203206

204207
```rust

template/ai-instructions/shared.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
1212
- Use `pipe-trait` for chaining through unary functions (constructors, `Some`, `Ok`, free functions, etc.), avoiding nested calls, and continuing method chains — but not for simple standalone calls (prefer `foo(value)` over `value.pipe(foo)`)
1313
- Prefer `where` clauses for multiple trait bounds
1414
- Derive order: std traits → comparison traits → `Hash` → derive_more → feature-gated
15-
- Custom errors: `#[derive(Debug, Display, Error)]`
15+
- Error types: only derive `Display` and `Error` from `derive_more` when each is actually needed — not all displayable types are errors
1616
- Minimize `unwrap()` in non-test code — use proper error handling
1717
- Install toolchain before running tests: `rustup toolchain install "$(< rust-toolchain)" && rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy`
1818
- Run `FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh` to validate changes. If a test fails with a hint about `RUSTFLAGS` and `--cfg pdu_test_skip_*`, follow the hint and rerun with the suggested flags.
1919
- **ALWAYS run the full test suite** (`FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh`) before committing, regardless of how trivial the change seems — this includes documentation-only changes, comment edits, config changes, and refactors. The test suite checks formatting, linting, building, tests, and docs across multiple feature combinations; any type of change can break any of these checks.
20+
- Set `PDU_NO_FAIL_FAST=true` to run all checks instead of stopping at the first failure — this lets you see which checks pass and which fail

test.sh

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
#! /bin/bash
22
set -o errexit -o pipefail -o nounset
33

4+
# Validate PDU_NO_FAIL_FAST
5+
no_fail_fast="${PDU_NO_FAIL_FAST:-false}"
6+
case "$no_fail_fast" in
7+
true | false) ;;
8+
*)
9+
echo "error: Invalid value for PDU_NO_FAIL_FAST: $no_fail_fast (expected 'true' or 'false')" >&2
10+
exit 1
11+
;;
12+
esac
13+
14+
# A temporary file is used instead of a variable because run_if and unit are
15+
# subshells, so variable assignments inside them don't propagate to the parent.
16+
failure_dir=$(mktemp -d)
17+
trap 'rm -rf "$failure_dir"' EXIT
18+
failure_marker="$failure_dir/failed"
19+
420
run() (
521
echo >&2
622
echo "exec> $*" >&2
@@ -16,7 +32,19 @@ run_if() (
1632
condition="$1"
1733
shift
1834
case "$condition" in
19-
true) run "$@" ;;
35+
true)
36+
if [[ $no_fail_fast == 'true' ]]; then
37+
run "$@" || {
38+
exit_status=$?
39+
printf 'error: Command failed with exit code %d: ' "$exit_status" >&2
40+
printf '%q ' "$@" >&2
41+
printf '\n' >&2
42+
touch "$failure_marker"
43+
}
44+
else
45+
run "$@"
46+
fi
47+
;;
2048
false) skip "$@" ;;
2149
*)
2250
echo "error: Invalid condition: $condition" >&2
@@ -39,3 +67,9 @@ unit --all-features "$@"
3967
unit --features cli "$@"
4068
unit --features cli-completions "$@"
4169
unit --features ai-instructions "$@"
70+
71+
if [[ -f "$failure_marker" ]]; then
72+
echo >&2
73+
echo 'error: Some checks have failed. Review the output above for details.' >&2
74+
exit 1
75+
fi

0 commit comments

Comments
 (0)