You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor unwrap and expect propagation; pluggable server plumbing (#400)
* Refactor connection frame handling
- Flatten frame processing loop to reduce nesting and keep timeout purge logic explicit.
- Bundle framing state into a context struct so handle_frame stays within clippy argument limits without changing behaviour.
Tests:
- make check-fmt
- make test
* Simplify frame handling helpers
- Track deserialization failures with a helper to cut closure argument count and keep error reporting consistent.
- Wrap response forwarding inputs in ResponseContext and flatten send/serialize loop to satisfy clippy nesting limits.
- Adjust connection call site to use the new context wrapper.
Tests:
- make check-fmt
- make test
* Refactor connection construction
- Introduce ConnectionChannels wrapper so with_hooks stays within clippy argument limits and update call sites accordingly.
- Split fragmented frame processing into a helper to eliminate excessive nesting and avoid borrow conflicts.
Tests:
- make check-fmt
- make test
* Refine push handle flow
- Extract rate-limiter wait and DLQ logging into helpers to reduce nesting while preserving non-blocking behaviour.
Tests:
- make check-fmt
- make test
* Reduce reassembler arguments
- Derive message id from the occupied entry so append_and_maybe_complete drops an argument and stays within clippy limits.
Tests:
- make check-fmt
- make test
* Streamline server preamble handling
- Pass preamble hooks into process_stream as a single struct to satisfy clippy argument limits and keep spawn logic simple.
Tests:
- make check-fmt
- make test
* Bundle accept loop options
- Wrap preamble hooks, shutdown signal, tracker, and backoff config into AcceptLoopOptions so accept_loop meets clippy argument limits.
- Update server worker spawn and tests to construct the new options struct and refresh docs example.
Tests:
- make check-fmt
- make test
* Enhanced code metric requirements
* Fix remaining clippy warnings
- Flatten timeout handling and fragmentation purge, collapse DLQ send handling, and simplify echo example handler.
- Reduce nesting in fragmentation tests and multi-packet world producer helper.
- Bundle push policy test cases to satisfy clippy argument limits.
Tests:
- make lint
- make test
* Lint documentation
* Fix envelope rustdoc links
- Point intra-doc links to crate::app::builder::WireframeApp and its handle_connection method so docsrs resolves them.
Tests:
- make check-fmt
- make test
* Fix push builder rustdoc link
- Remove private DEFAULT_PUSH_RATE intra-doc link and describe default rate in prose to satisfy docsrs.
Tests:
- make check-fmt
- make test
* Tidy reassembler rustdoc links
- Remove redundant explicit intra-doc link targets for MessageId and FragmentSeries to satisfy docsrs lint.
Tests:
- make check-fmt
- make test
* Introduce hygeine lints
* Expect private_bounds with reason
- Replace #[allow(private_bounds)] with #[expect(private_bounds)] and document why the helper trait aliases stay private.
Tests:
- make check-fmt
- make test
* Refactor forward_response complexity
- Split response fragmentation, serialization, and send steps into helpers and flatten error paths to satisfy clippy cognitive complexity.
Tests:
- make check-fmt
- make test
* Update markdownlint rules and ignore settings
* Apply documentation and writing style corrections to AGENTS.md
* Revise and expand Rust code and testing conventions in AGENTS.md
* Standardize and clarify command-line tooling sections in AGENTS.md
* Reformat wireframe_testing crate README for improved Markdown flow
* Update logging to use inline variable interpolation and improve error messages
* Refactor fragmenter test to use helper function for checking fragments
* Require Sync on Preamble trait to improve concurrency guarantees
* Refactor preamble handling in connection processing and isolate handler logic
* Refactor accept loop for clarity and extract iteration logic
* Cleanup test utility preamble helpers with consistent lint expectations
* Add and standardize lint expectations for single-line rstest fixtures
* Add crate-level lint expectations for test modules requiring them
* Remove redundant or now-unnecessary allow/expect attributes on simple fixtures
* Standardize lint attributes for test utilities and unused helper code
* Apply consistent lint suppression to push_policies.rs test fixtures
* Deny debug/print macros; use tracing in examples
Add lints to deny dbg_macro, print_stdout and print_stderr to catch leftover debugging prints early.
Replace direct stdout/stderr usage in examples and tests with structured logging (tracing::info / tracing::error)
and initialize a tracing_subscriber in example mains so logs are emitted. Remove the minimal binary that only printed a greeting.
These changes enforce consistent, structured logging and prevent accidental print/debug output from slipping into the codebase.
* Fix clippy findings in connection
* Remove expect from actor harness default
* Guard payload advance against over-slicing
* Make fragment slicing bounds-checked
* Harden fragment payload encoding/decoding
* Bounds-check frame length conversions
* Guard length prefix writes against over-slicing
* Guard preamble reads with checked buffer slices
* Handle DLQ lock poisoning without expect
* Remove panics and allow select lint in queue recv
* Bounds-check rewind stream leftovers
* Allow select! lint in runtime paths
* Replace select lint allow in connection
* Use if-let for fragment chunk slicing
* Handle fragment header length without casts
* Simplify prefix encoding in conversion helpers
* Collapse rate validation branching in push queues
* Replace select allow lint in runtime
* Allow select lint via expect in push queues
* Enable lints for panic prone operations
* Use infallible test app factory
* Propagate push fixture errors in session registry tests
* Guard middleware order test against missing frames
* Make echo example infallible and lint-clean
* Avoid panics in metadata serializer tests
* Propagate errors in metadata tests
* Harden metadata routing example
* Propagate errors in correlation id tests
* Use first helper in session registry test
* Use io::Error::other in metadata routing
* Propagate errors in connection actor error tests
* Propagate errors in connection actor tests
* Propagate errors in push policy and fragmentation tests
* Guard response tests against indexing panics
* Propagate errors in lifecycle tests
* Propagate errors in push policy tests
* Make packet enum example fallible
* Propagate errors in multi-packet streaming tests
* Return errors in metadata tests
* Propagate errors in stream end tests
* Propagate errors in wireframe protocol tests
* Handle errors in ping pong example
* Handle multi-packet streaming without panics
* Handle queue fixture errors in shutdown tests
* Avoid get-first in routes tests
* Return errors instead of panics in push tests
* test(fragmentation): refactor tests for improved error handling and robustness
Refactored tests in fragment_transport.rs and multi_packet.rs to use unified error handling via custom TestError enums and TestResult type aliases. Introduced proper error propagation in async tests and helper functions, reducing panics and expect calls. Enhanced test reliability and maintainability by converting infallible code panics into proper Result error chains.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* refactor(tests): refactor preamble tests to use Result and handle errors properly
- Introduce `TestResult` alias for standardized error handling.
- Update async test functions and helpers to return `TestResult` and use `?` for error propagation.
- Replace multiple `.expect()` calls with error propagation to improve test robustness and clarity.
- Add helper functions `take_sender_io` and `recv_within` to streamline sender handling and timed receive operations.
- Clean up locking code to handle potential poisoning gracefully.
- Overall improve error handling and reduce panics in preamble reading tests.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* test(tests): improve test error reporting and code clarity
- Add a custom Assertion error variant for clearer test failure messages in fragment_transport.rs.
- Replace assert_eq! macros with explicit error returns for payload mismatches.
- Refactor frame access in response.rs tests to use .first().expect() for clarity and consistency.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* test(tests): refactor test assertions for clearer error reporting
Replaced `assert!` and `assert_eq!` macros in tests with explicit error returns providing detailed failure messages. This change improves test diagnostics by making assertion failures produce descriptive errors instead of panics, aiding in debugging test failures in fragment_transport and push test modules.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* Propagate errors through cucumber worlds
* Handle shutdown in ping-pong example
* Return errors for empty multi-packet streams
* Return errors in correlation id tests
* Handle preamble validation errors
* Guard rate limiter priority ordering
* Make fragmentation tests fallible
* Avoid panics in correlation steps
* Make fragment reassembly helpers fallible
* Propagate errors in fragment world
* Return errors from fragment cucumber steps
* Log echo app build failures
* Propagate errors in shutdown tests
* Tighten push policy warning assertions
* Simplify multi-packet world errors
* Make panic world setup fallible
* Propagate errors in panic steps
* Document errors in correlation world
* Document errors in fragment reassembly helpers
* Document fragment world fallible helpers
* Document stream end world errors
* Alias wireframe protocol queue result
* Return errors in fairness tests
* Propagate errors in connection tests
* Avoid indexing in accept loop test
* Use safe access in fragment tests
* Handle short slices in frame tests
* Adjust panic tests in connection handler
* Handle shutdown in ping-pong example
* Refactor accept loop backoff helpers
* Add granular assertions for connection snapshots
* Borrow backoff call log
* Propagate snapshot failures
* Clarify refactoring guidance wording
* Simplify accept loop flow
* Avoid cloning fragmenter per frame
* Propagate response write failures
* Cover fragment payload truncation cases
* Guard fragmenter bounds with test
* Return errors for invalid rewind offsets
* Test frame prefix error paths
* Group accept iteration handles
* Simplify response fallible flow
* Expose fragment cursor for testing
* Trace connection drops in multi_packet example
* Tidy extractor fixtures
* Fix extractor and lifecycle lint issues
* Factor fragment decode error helper
* Clarify fragment slice bounds errors
* Renumber clippy lint sections
* Clarify unsupported size test messages
* Improve accept loop test helpers
* Propagate echo example errors and shutdown
* Centralise TestResult alias in common
* Simplify rewind slice bounds check
* Simplify ActorHarness default
* Documented harness default expectation
* Clarify frame conversion error expectations
* Simplify fragment payload bounds check
* Add graceful shutdown to packet_enum example
* Propagate preamble test server errors
* Use shared TestResult in wireframe_protocol tests
* Use shared TestResult in stream_end tests
* Use shared TestResult in middleware_order tests
* Use shared TestResult in metadata tests
* Use shared TestResult in lifecycle tests
* Use shared TestResult in correlation_id tests
* Use shared TestResult in connection_actor_errors tests
* Use shared TestResult in connection_actor_fairness tests
* Use shared TestResult in connection_actor_shutdown tests
* Use shared TestResult in session_registry tests
* Use shared TestResult in connection tests
* Use shared TestResult in push tests
* refactor(tests): consolidate TestResult type into common module
Replaced the duplicate definitions of the TestResult type alias in multiple test files with a shared import from the new tests/common module. This improves code consistency and reduces redundancy by centralizing error handling types in test code. Additionally, updated test modules to use the common TestResult and adjusted error conversions accordingly.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* test(fragment_transport): map errors to allow usage of ? in test functions
Refactor error handling in test functions to use .map_err(Into::into) for consistent error conversion. This allows the use of the ? operator with various error types, improving test code clarity and ergonomics.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* Fix multi_packet test errors
* Fix fragment_transport error conversions
* Propagate teardown errors in lifecycle tests
* Refactor envelope decode failure handling
* Clarify defensive checks in frame conversion
* Tidy session registry fixture and lint handling
* Guard test clock locks with expected lint
* Tighten frame conversion and preamble handling
* Tidy rate limiting, preamble IO, and test helpers
* Document preamble buffer slice safety
* Scope test util lint handling
* Clarify connection actor fairness assertions
* Propagate push queue config errors
* Harden preamble slicing and tidy must_use
* Address review assertions in metadata and routes
* Apply review fixes across tests
* Align fixtures and fragmentation helpers with review
* Exercise unused_listener helper
* Return errors instead of panics in push tests
* Align multi_packet tests with shared TestResult
* Simplify timeout iteration purge
* Simplify single-frame decode in routes test
* Handle push rate limiter assertions without panics
* Return explicit errors in multi_packet empty stream checks
* Make lifecycle tests fail with Result errors instead of panics
* Convert metadata tests to error returns for clearer diagnostics
* Handle single-frame route test without panic
* Return errors in push rate limiter tests
* Use assertions for multi_packet empty stream diagnostics
* Assert callback counts in lifecycle tests
* Restore assert-based diagnostics in fragment transport tests
* Restore assertions in push rate limiter tests
* Assert closed errors in push queue tests
* Simplify route echo test frame assertions
* Reduce error mapping boilerplate in multi_packet tests
* Align test assertions and error naming per review
* Add timeouts and assertion cleanups
* Clean up middleware and session registry tests
* Improve wireframe protocol test assertions
* Simplify correlation world verification logic
* Fail fast when panic world app setup fails
* Align response context field visibility
* Consolidate rstest fixture lint suppressions
* Improve connection fragmentation test assertions
* Assert correlation ids directly in tests
* Apply additional lint-driven cleanups
* Refactor u64_to_bytes helpers
* Tighten push timeouts and routes assertions
* Improve lifecycle helper assertions
* Guard fragment transport responses with timeouts
* Use assertions in metadata tests
* Propagate route setup errors and tighten streaming assertions
* Tighten middleware, routes, and response tests
* Address review nits in payload decoding and correlation tests
* Refactor fragment transport round-trip tests
* Propagate response test errors and simplify multi-packet overflow
* refactor(frame): simplify write_bytes_with_endianness and improve test slice handling
This change removes the redundant size parameter in `write_bytes_with_endianness`, deriving size from the prefix slice length instead.
In tests/routes.rs, changed frame extraction to use slice pattern matching for clearer and safer handling.
Also added a log warning when closing connections after too many deserialization failures for better observability.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* Clarify oversized prefix test
* Improve missing frame error message
* Guard length conversion prefixes
* Require single terminator frame in correlation test
* Improve send_response error context in test
* Tighten routing tests and prefix handling
* Apply review fixes across fragmentation and routing
* Polish decode handling and tracing init
* Simplify decode envelope error handling
* Refine routing test params and server addr handling
* Handle ctrl_c errors in packet_enum
* Propagate connection errors to callers
* Log ctrl_c errors and tidy connection docs
---------
Co-authored-by: Payton McIntosh <pmcintosh@df12.net>
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
0 commit comments