Skip to content
Merged
Show file tree
Hide file tree
Changes from 227 commits
Commits
Show all changes
228 commits
Select commit Hold shift + click to select a range
4213c0b
Refactor connection frame handling
leynos Dec 2, 2025
2bc9e4a
Simplify frame handling helpers
leynos Dec 2, 2025
9cb2875
Refactor connection construction
leynos Dec 2, 2025
0e566a2
Refine push handle flow
leynos Dec 2, 2025
66db130
Reduce reassembler arguments
leynos Dec 2, 2025
9ba5fd2
Streamline server preamble handling
leynos Dec 2, 2025
5460379
Bundle accept loop options
leynos Dec 2, 2025
761e6b2
Enhanced code metric requirements
leynos Dec 2, 2025
4f45d35
Fix remaining clippy warnings
leynos Dec 2, 2025
4d31e7c
Lint documentation
leynos Dec 2, 2025
fbc9b43
Fix envelope rustdoc links
leynos Dec 2, 2025
4ce7d7c
Fix push builder rustdoc link
leynos Dec 2, 2025
2127fea
Tidy reassembler rustdoc links
leynos Dec 2, 2025
c48c2ef
Introduce hygeine lints
leynos Dec 2, 2025
d96202b
Expect private_bounds with reason
leynos Dec 2, 2025
8eab565
Refactor forward_response complexity
leynos Dec 2, 2025
0d00c52
Update markdownlint rules and ignore settings
leynos Dec 2, 2025
221db91
Apply documentation and writing style corrections to AGENTS.md
leynos Dec 2, 2025
ddcd9ae
Revise and expand Rust code and testing conventions in AGENTS.md
leynos Dec 2, 2025
fa0c048
Standardize and clarify command-line tooling sections in AGENTS.md
leynos Dec 2, 2025
b910279
Reformat wireframe_testing crate README for improved Markdown flow
leynos Dec 2, 2025
72afb86
Update logging to use inline variable interpolation and improve error…
leynos Dec 2, 2025
7fb7759
Refactor fragmenter test to use helper function for checking fragments
leynos Dec 2, 2025
b7f344f
Require Sync on Preamble trait to improve concurrency guarantees
leynos Dec 2, 2025
55b24af
Refactor preamble handling in connection processing and isolate handl…
leynos Dec 2, 2025
680611d
Refactor accept loop for clarity and extract iteration logic
leynos Dec 2, 2025
b8c9499
Cleanup test utility preamble helpers with consistent lint expectations
leynos Dec 2, 2025
2333517
Add and standardize lint expectations for single-line rstest fixtures
leynos Dec 2, 2025
09ca8d8
Add crate-level lint expectations for test modules requiring them
leynos Dec 2, 2025
ec2938d
Remove redundant or now-unnecessary allow/expect attributes on simple…
leynos Dec 2, 2025
aa8f055
Standardize lint attributes for test utilities and unused helper code
leynos Dec 2, 2025
2ede7d3
Apply consistent lint suppression to push_policies.rs test fixtures
leynos Dec 2, 2025
ca904f1
Deny debug/print macros; use tracing in examples
leynos Dec 2, 2025
c81d91b
Fix clippy findings in connection
leynos Dec 2, 2025
ca113ec
Remove expect from actor harness default
leynos Dec 2, 2025
17ffced
Guard payload advance against over-slicing
leynos Dec 2, 2025
11866b4
Make fragment slicing bounds-checked
leynos Dec 2, 2025
ca17d08
Harden fragment payload encoding/decoding
leynos Dec 2, 2025
d374f87
Bounds-check frame length conversions
leynos Dec 2, 2025
abfa6b4
Guard length prefix writes against over-slicing
leynos Dec 2, 2025
f63c3aa
Guard preamble reads with checked buffer slices
leynos Dec 2, 2025
a2a231e
Handle DLQ lock poisoning without expect
leynos Dec 2, 2025
b9871fb
Remove panics and allow select lint in queue recv
leynos Dec 2, 2025
653629a
Bounds-check rewind stream leftovers
leynos Dec 2, 2025
0006319
Allow select! lint in runtime paths
leynos Dec 2, 2025
4f5b255
Replace select lint allow in connection
leynos Dec 2, 2025
7b6b3f2
Use if-let for fragment chunk slicing
leynos Dec 2, 2025
ea90667
Handle fragment header length without casts
leynos Dec 2, 2025
71644d6
Simplify prefix encoding in conversion helpers
leynos Dec 2, 2025
539c59b
Collapse rate validation branching in push queues
leynos Dec 2, 2025
b42ae3d
Replace select allow lint in runtime
leynos Dec 2, 2025
6edc5ae
Allow select lint via expect in push queues
leynos Dec 2, 2025
c6847e7
Enable lints for panic prone operations
leynos Dec 2, 2025
f260f8b
Use infallible test app factory
leynos Dec 2, 2025
c6efb3e
Propagate push fixture errors in session registry tests
leynos Dec 2, 2025
bdac18d
Guard middleware order test against missing frames
leynos Dec 2, 2025
d9523bf
Make echo example infallible and lint-clean
leynos Dec 2, 2025
dc35c59
Avoid panics in metadata serializer tests
leynos Dec 2, 2025
ee4063f
Propagate errors in metadata tests
leynos Dec 2, 2025
c255e6b
Harden metadata routing example
leynos Dec 2, 2025
f9207fe
Propagate errors in correlation id tests
leynos Dec 2, 2025
7a3ecfe
Use first helper in session registry test
leynos Dec 2, 2025
26881f2
Use io::Error::other in metadata routing
leynos Dec 2, 2025
2a9cce1
Propagate errors in connection actor error tests
leynos Dec 2, 2025
5d06fe7
Propagate errors in connection actor tests
leynos Dec 2, 2025
73b6843
Propagate errors in push policy and fragmentation tests
leynos Dec 2, 2025
1b57d9b
Guard response tests against indexing panics
leynos Dec 2, 2025
62acf9b
Propagate errors in lifecycle tests
leynos Dec 2, 2025
e5ca0cd
Propagate errors in push policy tests
leynos Dec 2, 2025
9628d16
Make packet enum example fallible
leynos Dec 2, 2025
04a30eb
Propagate errors in multi-packet streaming tests
leynos Dec 2, 2025
75e5d55
Return errors in metadata tests
leynos Dec 3, 2025
37ae985
Propagate errors in stream end tests
leynos Dec 3, 2025
0425261
Propagate errors in wireframe protocol tests
leynos Dec 3, 2025
e87e04a
Handle errors in ping pong example
leynos Dec 3, 2025
c46bfff
Handle multi-packet streaming without panics
leynos Dec 3, 2025
f5b379a
Handle queue fixture errors in shutdown tests
leynos Dec 3, 2025
de6f499
Avoid get-first in routes tests
leynos Dec 3, 2025
2a8650c
Return errors instead of panics in push tests
leynos Dec 3, 2025
4c4b978
test(fragmentation): refactor tests for improved error handling and r…
leynos Dec 3, 2025
f6bda30
refactor(tests): refactor preamble tests to use Result and handle err…
leynos Dec 3, 2025
7dc0b6c
test(tests): improve test error reporting and code clarity
leynos Dec 3, 2025
e6e8b3f
test(tests): refactor test assertions for clearer error reporting
leynos Dec 3, 2025
016320d
Propagate errors through cucumber worlds
leynos Dec 3, 2025
0e1bedb
Handle shutdown in ping-pong example
leynos Dec 3, 2025
c83ee23
Return errors for empty multi-packet streams
leynos Dec 3, 2025
81a7973
Return errors in correlation id tests
leynos Dec 3, 2025
5df7459
Handle preamble validation errors
leynos Dec 3, 2025
1a0bacc
Guard rate limiter priority ordering
leynos Dec 3, 2025
f20eb8e
Make fragmentation tests fallible
leynos Dec 3, 2025
2389c8c
Avoid panics in correlation steps
leynos Dec 3, 2025
d53e7c4
Make fragment reassembly helpers fallible
leynos Dec 3, 2025
f2234e6
Propagate errors in fragment world
leynos Dec 3, 2025
fb2234d
Return errors from fragment cucumber steps
leynos Dec 3, 2025
2da63b6
Log echo app build failures
leynos Dec 3, 2025
179821f
Propagate errors in shutdown tests
leynos Dec 3, 2025
edc654f
Tighten push policy warning assertions
leynos Dec 3, 2025
b0ef40d
Simplify multi-packet world errors
leynos Dec 3, 2025
fb72b3c
Make panic world setup fallible
leynos Dec 3, 2025
02e4cb7
Propagate errors in panic steps
leynos Dec 3, 2025
a10116b
Document errors in correlation world
leynos Dec 3, 2025
aa6e8d1
Document errors in fragment reassembly helpers
leynos Dec 3, 2025
04b9261
Document fragment world fallible helpers
leynos Dec 3, 2025
f413bb8
Document stream end world errors
leynos Dec 3, 2025
44de394
Alias wireframe protocol queue result
leynos Dec 3, 2025
15ac5e1
Return errors in fairness tests
leynos Dec 3, 2025
b9f691f
Propagate errors in connection tests
leynos Dec 3, 2025
acbe7ed
Avoid indexing in accept loop test
leynos Dec 3, 2025
b74a00c
Use safe access in fragment tests
leynos Dec 3, 2025
06e48ea
Handle short slices in frame tests
leynos Dec 3, 2025
fa1ab5b
Adjust panic tests in connection handler
leynos Dec 3, 2025
6889f4f
Handle shutdown in ping-pong example
leynos Dec 3, 2025
325ef20
Refactor accept loop backoff helpers
leynos Dec 3, 2025
a0bee07
Add granular assertions for connection snapshots
leynos Dec 3, 2025
9beecff
Borrow backoff call log
leynos Dec 3, 2025
30c3439
Propagate snapshot failures
leynos Dec 3, 2025
2a607ef
Clarify refactoring guidance wording
leynos Dec 3, 2025
8bd2600
Simplify accept loop flow
leynos Dec 3, 2025
ed497dd
Avoid cloning fragmenter per frame
leynos Dec 3, 2025
70b59b4
Propagate response write failures
leynos Dec 3, 2025
cd85881
Cover fragment payload truncation cases
leynos Dec 3, 2025
7c51532
Guard fragmenter bounds with test
leynos Dec 3, 2025
28fdd48
Return errors for invalid rewind offsets
leynos Dec 3, 2025
cdfeae9
Test frame prefix error paths
leynos Dec 3, 2025
a626c79
Group accept iteration handles
leynos Dec 3, 2025
b23cf65
Simplify response fallible flow
leynos Dec 3, 2025
c52c635
Expose fragment cursor for testing
leynos Dec 3, 2025
5fa6778
Trace connection drops in multi_packet example
leynos Dec 3, 2025
b9db0d6
Tidy extractor fixtures
leynos Dec 3, 2025
e474475
Fix extractor and lifecycle lint issues
leynos Dec 3, 2025
b104527
Factor fragment decode error helper
leynos Dec 3, 2025
8491ed6
Clarify fragment slice bounds errors
leynos Dec 3, 2025
7c1d70c
Renumber clippy lint sections
leynos Dec 3, 2025
e12fd45
Clarify unsupported size test messages
leynos Dec 3, 2025
18549b7
Improve accept loop test helpers
leynos Dec 3, 2025
2c37090
Propagate echo example errors and shutdown
leynos Dec 3, 2025
56d880f
Centralise TestResult alias in common
leynos Dec 3, 2025
49c3c71
Simplify rewind slice bounds check
leynos Dec 3, 2025
7fdc4f8
Simplify ActorHarness default
leynos Dec 4, 2025
7eeed4b
Documented harness default expectation
leynos Dec 4, 2025
760ece0
Clarify frame conversion error expectations
leynos Dec 4, 2025
7ac7fc6
Simplify fragment payload bounds check
leynos Dec 4, 2025
5f98c70
Add graceful shutdown to packet_enum example
leynos Dec 4, 2025
1b24d1a
Propagate preamble test server errors
leynos Dec 4, 2025
e33eefb
Use shared TestResult in wireframe_protocol tests
leynos Dec 4, 2025
7abf631
Use shared TestResult in stream_end tests
leynos Dec 4, 2025
1b9059e
Use shared TestResult in middleware_order tests
leynos Dec 4, 2025
b587375
Use shared TestResult in metadata tests
leynos Dec 4, 2025
a3758a2
Use shared TestResult in lifecycle tests
leynos Dec 4, 2025
072c274
Use shared TestResult in correlation_id tests
leynos Dec 4, 2025
f8e4a7a
Use shared TestResult in connection_actor_errors tests
leynos Dec 4, 2025
2236562
Use shared TestResult in connection_actor_fairness tests
leynos Dec 4, 2025
0c3ead5
Use shared TestResult in connection_actor_shutdown tests
leynos Dec 4, 2025
1c3ed05
Use shared TestResult in session_registry tests
leynos Dec 4, 2025
78e0529
Use shared TestResult in connection tests
leynos Dec 4, 2025
97a52e9
Use shared TestResult in push tests
leynos Dec 4, 2025
18a6232
refactor(tests): consolidate TestResult type into common module
leynos Dec 4, 2025
753aecf
test(fragment_transport): map errors to allow usage of ? in test func…
leynos Dec 4, 2025
2453ece
Fix multi_packet test errors
leynos Dec 4, 2025
546dbb2
Fix fragment_transport error conversions
leynos Dec 4, 2025
0859485
Propagate teardown errors in lifecycle tests
leynos Dec 4, 2025
10a844c
Refactor envelope decode failure handling
leynos Dec 4, 2025
1e4a7ca
Clarify defensive checks in frame conversion
leynos Dec 4, 2025
9e5b84b
Tidy session registry fixture and lint handling
leynos Dec 4, 2025
f77c30d
Guard test clock locks with expected lint
leynos Dec 4, 2025
f85e697
Tighten frame conversion and preamble handling
leynos Dec 4, 2025
7accad1
Tidy rate limiting, preamble IO, and test helpers
leynos Dec 4, 2025
02f88ce
Document preamble buffer slice safety
leynos Dec 4, 2025
11e0632
Scope test util lint handling
leynos Dec 4, 2025
9f64f41
Clarify connection actor fairness assertions
leynos Dec 4, 2025
981e134
Propagate push queue config errors
leynos Dec 4, 2025
2161944
Harden preamble slicing and tidy must_use
leynos Dec 4, 2025
33f46f1
Address review assertions in metadata and routes
leynos Dec 4, 2025
b74fc9b
Apply review fixes across tests
leynos Dec 4, 2025
0d8cfcf
Align fixtures and fragmentation helpers with review
leynos Dec 4, 2025
b56e145
Exercise unused_listener helper
leynos Dec 4, 2025
d8e99b2
Return errors instead of panics in push tests
leynos Dec 4, 2025
dea6bd1
Align multi_packet tests with shared TestResult
leynos Dec 4, 2025
7771f52
Simplify timeout iteration purge
leynos Dec 4, 2025
5268d93
Simplify single-frame decode in routes test
leynos Dec 4, 2025
5f79efe
Handle push rate limiter assertions without panics
leynos Dec 4, 2025
72e6946
Return explicit errors in multi_packet empty stream checks
leynos Dec 4, 2025
b0f9e34
Make lifecycle tests fail with Result errors instead of panics
leynos Dec 4, 2025
011825e
Convert metadata tests to error returns for clearer diagnostics
leynos Dec 4, 2025
543a93c
Handle single-frame route test without panic
leynos Dec 4, 2025
34af971
Return errors in push rate limiter tests
leynos Dec 4, 2025
82df560
Use assertions for multi_packet empty stream diagnostics
leynos Dec 4, 2025
13d1d33
Assert callback counts in lifecycle tests
leynos Dec 4, 2025
92bd34e
Restore assert-based diagnostics in fragment transport tests
leynos Dec 4, 2025
4fe7f6e
Restore assertions in push rate limiter tests
leynos Dec 4, 2025
6578774
Assert closed errors in push queue tests
leynos Dec 4, 2025
0e9c7bb
Simplify route echo test frame assertions
leynos Dec 4, 2025
a5bffce
Reduce error mapping boilerplate in multi_packet tests
leynos Dec 4, 2025
be4a93c
Align test assertions and error naming per review
leynos Dec 4, 2025
bb22f71
Add timeouts and assertion cleanups
leynos Dec 4, 2025
e3195ad
Clean up middleware and session registry tests
leynos Dec 4, 2025
61a2a2a
Improve wireframe protocol test assertions
leynos Dec 4, 2025
1fb2645
Simplify correlation world verification logic
leynos Dec 4, 2025
5514112
Fail fast when panic world app setup fails
leynos Dec 4, 2025
09d2948
Align response context field visibility
leynos Dec 4, 2025
ec3e721
Consolidate rstest fixture lint suppressions
leynos Dec 4, 2025
a9f2af1
Improve connection fragmentation test assertions
leynos Dec 4, 2025
380ecc8
Assert correlation ids directly in tests
leynos Dec 4, 2025
af43851
Apply additional lint-driven cleanups
leynos Dec 4, 2025
b59ecd6
Refactor u64_to_bytes helpers
leynos Dec 4, 2025
9eb138f
Tighten push timeouts and routes assertions
leynos Dec 4, 2025
5f45379
Improve lifecycle helper assertions
leynos Dec 4, 2025
caba392
Guard fragment transport responses with timeouts
leynos Dec 4, 2025
45159e6
Use assertions in metadata tests
leynos Dec 4, 2025
6878e66
Propagate route setup errors and tighten streaming assertions
leynos Dec 4, 2025
9ed253d
Tighten middleware, routes, and response tests
leynos Dec 4, 2025
a11a725
Address review nits in payload decoding and correlation tests
leynos Dec 4, 2025
461415a
Refactor fragment transport round-trip tests
leynos Dec 4, 2025
211811a
Propagate response test errors and simplify multi-packet overflow
leynos Dec 4, 2025
b5c456b
refactor(frame): simplify write_bytes_with_endianness and improve tes…
leynos Dec 4, 2025
6016334
Clarify oversized prefix test
leynos Dec 4, 2025
4118deb
Improve missing frame error message
leynos Dec 4, 2025
f6af9ae
Guard length conversion prefixes
leynos Dec 4, 2025
2b2f3fb
Require single terminator frame in correlation test
leynos Dec 4, 2025
d9d2e28
Improve send_response error context in test
leynos Dec 4, 2025
9f9a346
Tighten routing tests and prefix handling
leynos Dec 5, 2025
f6e63b2
Apply review fixes across fragmentation and routing
leynos Dec 5, 2025
1fc761a
Polish decode handling and tracing init
leynos Dec 5, 2025
803c29f
Simplify decode envelope error handling
leynos Dec 5, 2025
14a2176
Refine routing test params and server addr handling
leynos Dec 5, 2025
e15c9db
Handle ctrl_c errors in packet_enum
leynos Dec 5, 2025
f840d41
Propagate connection errors to callers
leynos Dec 5, 2025
6bde480
Log ctrl_c errors and tidy connection docs
leynos Dec 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
// Ignore MD013 (line length) inside tables since reflowing
// Markdown tables often breaks formatting and readability.
"config": {
"MD004": { "style": "dash" },
"MD010": { "code_blocks": false },
"MD013": {
"line_length": 80,
"code_block_line_length": 120,
"tables": false
"tables": false,
"headings": false
},
"MD040": false
}
"MD029": { "style": "ordered" }
},
"ignores": ["**/.venv/**", ".node_modules/**", "**/node_modules/**", "**/target/**"]
}
124 changes: 73 additions & 51 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Code Style and Structure

- **Code is for humans.** Write your code with clarity and empathy—assume a
- **Code is for humans.** Write code with clarity and empathy—assume a
tired teammate will need to debug it at 3 a.m.
- **Comment *why*, not *what*.** Explain assumptions, edge cases, trade-offs, or
complexity. Don't echo the obvious.
Expand Down Expand Up @@ -43,8 +43,10 @@
relevant file(s) in the `docs/` directory to reflect the latest state.
**Ensure the documentation remains accurate and current.**
- Documentation must use en-GB-oxendict ("-ize" / "-yse" / "-our") spelling
and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be
left unchanged for community consistency.)
and grammar. (EXCEPTION: the filename `LICENSE` is left unchanged for
community consistency.)
- A documentation style guide is provided at
`docs/documentation-style-guide.md`.

## Change Quality & Committing

Expand All @@ -68,7 +70,7 @@
- **Imperative Mood:** Use the imperative mood in the subject line (e.g.,
"Fix bug", "Add feature" instead of "Fixed bug", "Added feature").
- **Subject Line:** The first line should be a concise summary of the change
(ideally 50 characters or less).
(ideally 50 characters or fewer).
- **Body:** Separate the subject from the body with a blank line. Subsequent
lines should explain the *what* and *why* of the change in more detail,
including rationale, goals, and scope. Wrap the body at 72 characters.
Expand All @@ -79,7 +81,7 @@
## Refactoring Heuristics & Workflow

- **Recognizing Refactoring Needs:** Regularly assess the codebase for potential
refactoring opportunities. Consider refactoring when you observe:
refactoring opportunities. Perform refactoring when you observe:
- **Long Methods/Functions:** Functions or methods that are excessively long
or try to do too many things.
- **Duplicated Code:** Identical or very similar code blocks appearing in
Expand All @@ -103,7 +105,7 @@
- **Separate Atomic Refactors:** If refactoring is deemed necessary:
- Perform the refactoring as a **separate, atomic commit** *after* the
functional change commit.
- Ensure the refactoring adheres to the testing guidelines (behavioral tests
- Ensure refactoring adheres to the testing guidelines (behavioural tests
pass before and after, unit tests added for new units).
- Ensure the refactoring commit itself passes all quality gates.

Expand All @@ -114,26 +116,26 @@ management. Contributors should follow these best practices when working on the
project:

- Run `make check-fmt`, `make lint`, and `make test` before committing. These
targets wrap the following commands so contributors understand the exact
targets wrap the following commands, so contributors understand the exact
behaviour and policy enforced:
- `make check-fmt` executes:

```
```sh
cargo fmt --workspace -- --check
```

validating formatting across the entire workspace without modifying files.
- `make lint` executes:

```
```sh
cargo clippy --workspace --all-targets --all-features -- -D warnings
```

linting every target with all features enabled and denying all Clippy
warnings.
- `make test` executes:

```
```sh
cargo test --workspace
```

Expand All @@ -147,40 +149,34 @@ project:
adhering to separation of concerns and CQRS.
- Where a function has too many parameters, group related parameters in
meaningfully named structs.
- Where a function is returning a large error consider using `Arc` to reduce the
amount of data returned.
- Where a function is returning a large error, consider using `Arc` to reduce
the amount of data returned.
- Write unit and behavioural tests for new functionality. Run both before and
after making any change.
- Every module **must** begin with a module level (`//!`) comment explaining the
module's purpose and utility.
- Document public APIs using Rustdoc comments (`///`) so documentation can be
generated with cargo doc.
- Prefer immutable data and avoid unnecessary `mut` bindings.
- Handle errors with the `Result` type instead of panicking where feasible.
- Use explicit version ranges in `Cargo.toml` and keep dependencies up-to-date.
- Avoid `unsafe` code unless absolutely necessary and document any usage
clearly.
- Avoid `unsafe` code unless absolutely necessary, and document any usage
clearly with a "SAFETY" comment.
- Place function attributes **after** doc comments.
- Do not use `return` in single-line functions.
- Use predicate functions for conditional criteria with more than two branches.
- Lints must not be silenced except as a **last resort**.
- Lint rule suppressions must be tightly scoped and include a clear reason.
- Prefer `expect` over `allow`.
- Use `rstest` fixtures for shared setup.
- Replace duplicated tests with `#[rstest(...)]` parameterised cases.
- Prefer `mockall` for mocks/stubs.
- Prefer `.expect()` over `.unwrap()`.
- Use `concat!()` to combine long string literals rather than escaping newlines
with a backslash.
- Prefer single line versions of functions where appropriate. I.e.,
- Prefer single line versions of functions where appropriate. i.e.,

```
```rust
pub fn new(id: u64) -> Self { Self(id) }
```

Instead of:

```
```rust
pub fn new(id: u64) -> Self {
Self(id)
}
Expand All @@ -190,16 +186,30 @@ project:
`newt-hype` when introducing many homogeneous wrappers that share behaviour;
add small shims such as `From<&str>` and `AsRef<str>` for string-backed
wrappers. For path-centric wrappers implement `AsRef<Path>` alongside
`into_inner()` and `to_path_buf()`; avoid attempting
`into_inner()` and `to_path_buf()`, avoid attempting
`impl From<Wrapper> for PathBuf` because of the orphan rule. Prefer explicit
tuple structs whenever bespoke validation or tailored trait surfaces are
required, customising `Deref`, `AsRef`, and `TryFrom` per type. Use
required, customizing `Deref`, `AsRef`, and `TryFrom` per type. Use
Comment thread
leynos marked this conversation as resolved.
`the-newtype` when defining traits and needing blanket implementations that
apply across wrappers satisfying `Newtype + AsRef/AsMut<Inner>`, or when
establishing a coherent internal convention that keeps trait forwarding
consistent without per-type boilerplate. Combine approaches: lean on
`newt-hype` for the common case, tuple structs for outliers, and
`the-newtype` to unify behaviour when you own the trait definitions.
`the-newtype` to unify behaviour when owning the trait definitions.
- Use `cap_std` and `cap_std::fs_utf8` / `camino` in place of `std::fs` and
`std::path` for enhanced cross-platform support and capability-oriented
filesystem access.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

### Testing

- Use `rstest` fixtures for shared setup.
- Replace duplicated tests with `#[rstest(...)]` parameterized cases.
- Prefer `mockall` for ad hoc mocks/stubs.
- For testing of functionality depending upon environment variables, dependency
injection and the `mockable` crate are the preferred option.
- If mockable cannot be used, env mutations in tests MUST be wrapped in shared
guards and mutexes placed in a shared `test_utils` or `test_helpers` crate.
Direct environment mutation is FORBIDDEN in tests.

### Dependency Management

Expand All @@ -225,6 +235,18 @@ project:
- **Never export the opaque type from a library**. Convert to domain enums at
API boundaries, and to `eyre` only in the main `main()` entrypoint or
top-level async task.
- In tests, prefer `.expect(...)` over `.unwrap()` to surface clearer failure
diagnostics.
- In production code and shared fixtures, avoid `.expect()` entirely: return
`Result` and use `?` to propagate errors instead of panicking.
- Keep `expect_used` **strict**; do not suppress the lint.
- Recognize that `allow-expect-in-tests = true` **doesn’t cover** helpers
outside `#[cfg(test)]` or `#[test]`; avoid `expect` in such fixtures.
- Use `anyhow`/`eyre` with `.context(...)` to **preserve backtraces** and
provide clear, typed failure paths.
- Update helpers (e.g., `set_dir`) to **return errors** rather than panicking.
- Consume fallible fixtures in `rstest` by **making the test return `Result`**
and applying `?` to the fixture.

## Markdown Guidance

Expand All @@ -243,39 +265,39 @@ project:

The following tooling is available in this environment:

- `mbake` A Makefile validator. Run using `mbake validate Makefile`.
- `strace` Traces system calls and signals made by a process; useful for
- `mbake` A Makefile validator. Run using `mbake validate Makefile`.
- `strace` Traces system calls and signals made by a process; useful for
debugging runtime behaviour and syscalls.
- `gdb` The GNU Debugger, for inspecting and controlling programs as they
- `gdb` The GNU Debugger, for inspecting and controlling programs as they
execute (or post-mortem via core dumps).
- `ripgrep` Fast, recursive text search tool (`grep` alternative) that
- `ripgrep` Fast, recursive text search tool (`grep` alternative) that
respects `.gitignore` files.
- `ltrace` Traces calls to dynamic library functions made by a process.
- `valgrind` Suite for detecting memory leaks, profiling, and debugging
- `ltrace` Traces calls to dynamic library functions made by a process.
- `valgrind` Suite for detecting memory leaks, profiling, and debugging
low-level memory errors.
- `bpftrace` High-level tracing tool for eBPF, using a custom scripting
- `bpftrace` High-level tracing tool for eBPF, using a custom scripting
language for kernel and application tracing.
- `lsof` Lists open files and the processes using them.
- `htop` Interactive process viewer (visual upgrade to `top`).
- `iotop` Displays and monitors I/O usage by processes.
- `ncdu` NCurses-based disk usage viewer for finding large files/folders.
- `tree` Displays directory structure as a tree.
- `bat` `cat` clone with syntax highlighting, Git integration, and paging.
- `delta` Syntax-highlighted pager for Git and diff output.
- `tcpdump` Captures and analyses network traffic at the packet level.
- `nmap` Network scanner for host discovery, port scanning, and service
- `lsof` Lists open files and the processes using them.
- `htop` Interactive process viewer (visual upgrade to `top`).
- `iotop` Displays and monitors I/O usage by processes.
- `ncdu` NCurses-based disk usage viewer for finding large files/folders.
- `tree` Displays directory structure as a tree.
- `bat` `cat` clone with syntax highlighting, Git integration, and paging.
- `delta` Syntax-highlighted pager for Git and diff output.
- `tcpdump` Captures and analyses network traffic at the packet level.
- `nmap` Network scanner for host discovery, port scanning, and service
identification.
- `lldb` LLVM debugger, alternative to `gdb`.
- `eza` Modern `ls` replacement with more features and better defaults.
- `fzf` Interactive fuzzy finder for selecting files, commands, etc.
- `hyperfine` Command-line benchmarking tool with statistical output.
- `shellcheck` Linter for shell scripts, identifying errors and bad practices.
- `fd` Fast, user-friendly `find` alternative with sensible defaults.
- `checkmake` Linter for `Makefile`s, ensuring they follow best practices and
- `lldb` LLVM debugger, alternative to `gdb`.
- `eza` Modern `ls` replacement with more features and better defaults.
- `fzf` Interactive fuzzy finder for selecting files, commands, etc.
- `hyperfine` Command-line benchmarking tool with statistical output.
- `shellcheck` Linter for shell scripts, identifying errors and bad practices.
- `fd` Fast, user-friendly `find` alternative with sensible defaults.
- `checkmake` Linter for `Makefile`s, ensuring they follow best practices and
conventions.
- `srgn` [Structural grep](https://github.com/alexpovel/srgn), searches code
- `srgn` [Structural grep](https://github.com/alexpovel/srgn), searches code
and enables editing by syntax tree patterns.
- `difft` **(Difftastic)** Semantic diff tool that compares code structure
- `difft` **(Difftastic)** Semantic diff tool that compares code structure
rather than just text differences.

## Key Takeaway
Expand Down
40 changes: 37 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ log = "0.4.28"
dashmap = "6.1.0"
leaky-bucket = "1.1.2"
tracing = { version = "0.1.41", features = ["log", "log-always"] }
tracing-subscriber = "0.3"
tracing-subscriber = "0.3.18"
metrics = { version = "0.24.2", optional = true }
thiserror = "2.0.16"
static_assertions = "1"
static_assertions = "1.1.0"
derive_more = { version = "2.0.1", features = ["display", "from"] }

[dev-dependencies]
Expand Down Expand Up @@ -85,11 +85,45 @@ cucumber-tests = []
test-support = []

[lints.clippy]
pedantic = "warn"
pedantic = { level = "warn", priority = -1 }

# 1. hygiene
allow_attributes = "deny"
allow_attributes_without_reason = "deny"
blanket_clippy_restriction_lints = "deny"
cognitive_complexity = "deny"
needless_pass_by_value = "deny"
implicit_hasher = "deny"

# 2. debugging leftovers
dbg_macro = "deny"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
print_stdout = "deny"
print_stderr = "deny"

# 3. panic-prone operations
unwrap_used = "deny"
expect_used = "deny"
Comment thread
leynos marked this conversation as resolved.
indexing_slicing = "deny"
string_slice = "deny"
integer_division = "deny"
integer_division_remainder_used = "deny"
panic_in_result_fn = "deny"
unreachable = "deny"

[lints.rust]
unknown_lints = "deny"
renamed_and_removed_lints = "deny"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)'] }

[lints.rustdoc]
missing_crate_level_docs = "deny"
broken_intra_doc_links = "deny"
private_intra_doc_links = "deny"
bare_urls = "deny"
invalid_html_tags = "deny"
invalid_codeblock_attributes = "deny"
unescaped_backticks = "deny"

[[example]]
name = "echo"
path = "examples/echo.rs"
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CRATE ?= wireframe
CARGO ?= cargo
BUILD_JOBS ?=
CLIPPY_FLAGS ?= --all-targets --all-features -- -D warnings
RUSTDOC_FLAGS ?= --cfg docsrs -D warnings
MDLINT ?= markdownlint
NIXIE ?= nixie

Expand All @@ -29,6 +30,7 @@ target/%/lib$(CRATE).rlib: ## Build library in debug or release
$@

lint: ## Run Clippy with warnings denied
RUSTDOCFLAGS="$(RUSTDOC_FLAGS)" $(CARGO) doc --no-deps
$(CARGO) clippy $(CLIPPY_FLAGS)

fmt: ## Format Rust and Markdown sources
Expand Down
7 changes: 7 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Align with CodeScene’s ceiling
cognitive-complexity-threshold = 9 # default is 25
too-many-arguments-threshold = 4 # default is 7
too-many-lines-threshold = 70 # default is 100
excessive-nesting-threshold = 4 # default is off

allow-expect-in-tests = true
5 changes: 4 additions & 1 deletion examples/async_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use async_stream::try_stream;
use futures::StreamExt;
use tracing::info;
use wireframe::response::Response;

#[derive(bincode::Encode, bincode::BorrowDecode, Debug, PartialEq)]
Expand All @@ -22,10 +23,12 @@ fn stream_response() -> Response<Frame> {

#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();

let Response::Stream(mut stream) = stream_response() else {
return;
};
while let Some(Ok(frame)) = stream.next().await {
println!("received frame: {frame:?}");
info!(?frame, "received frame");
}
}
Loading
Loading