From 408f3031e651d1e1f050c25a84e57deb5f1e925e Mon Sep 17 00:00:00 2001 From: Leynos Date: Wed, 25 Jun 2025 00:08:33 +0100 Subject: [PATCH 1/2] Add regression test for large table --- tests/data/regression_table_expected.txt | 8 ++++++++ tests/data/regression_table_input.txt | 8 ++++++++ tests/integration.rs | 13 +++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 tests/data/regression_table_expected.txt create mode 100644 tests/data/regression_table_input.txt diff --git a/tests/data/regression_table_expected.txt b/tests/data/regression_table_expected.txt new file mode 100644 index 00000000..e639ce0c --- /dev/null +++ b/tests/data/regression_table_expected.txt @@ -0,0 +1,8 @@ +| # | Task | Description | Size | Depends On | +| --- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------- | +| 3.1 | Graceful Shutdown | Implement the server-wide graceful shutdown pattern. Use tokio_util::sync::CancellationToken for signalling and tokio_util::task::TaskTracker to ensure all connection actors terminate cleanly. | Large | #1.3 | +| 3.2 | Re-assembly DoS Protection | Harden the FragmentAdapter by adding a non-optional, configurable timeout for partial message re-assembly and strictly enforcing the max_message_size limit to prevent memory exhaustion. | Medium | #1.5 | +| 3.3 | Multiplexed Re-assembly | Enhance the FragmentAdapter's inbound logic to support concurrent re-assembly of multiple messages. Use the msg_id from FragmentMeta as a key into a dashmap::DashMap of partial messages. | Large | #3.2 | +| 3.4 | Per-Connection Rate Limiting | Integrate an asynchronous, token-bucket rate limiter into the PushHandle. The rate limit should be configurable on the WireframeApp builder and enforced on every push. | Medium | #2.2 | +| 3.5 | Dead Letter Queue (DLQ) | Implement the optional Dead Letter Queue mechanism. Allow a user to provide a DLQ channel sender during app setup; failed pushes (due to a full queue) can be routed there instead of being dropped. | Medium | #2.2 | +| 3.6 | Context-Aware FragmentStrategy | Enhance the FragmentStrategy trait. max_fragment_payload and encode_header should receive a reference to the logical Frame being processed, allowing for more dynamic fragmentation rules. | Small | #1.4 | diff --git a/tests/data/regression_table_input.txt b/tests/data/regression_table_input.txt new file mode 100644 index 00000000..e639ce0c --- /dev/null +++ b/tests/data/regression_table_input.txt @@ -0,0 +1,8 @@ +| # | Task | Description | Size | Depends On | +| --- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------- | +| 3.1 | Graceful Shutdown | Implement the server-wide graceful shutdown pattern. Use tokio_util::sync::CancellationToken for signalling and tokio_util::task::TaskTracker to ensure all connection actors terminate cleanly. | Large | #1.3 | +| 3.2 | Re-assembly DoS Protection | Harden the FragmentAdapter by adding a non-optional, configurable timeout for partial message re-assembly and strictly enforcing the max_message_size limit to prevent memory exhaustion. | Medium | #1.5 | +| 3.3 | Multiplexed Re-assembly | Enhance the FragmentAdapter's inbound logic to support concurrent re-assembly of multiple messages. Use the msg_id from FragmentMeta as a key into a dashmap::DashMap of partial messages. | Large | #3.2 | +| 3.4 | Per-Connection Rate Limiting | Integrate an asynchronous, token-bucket rate limiter into the PushHandle. The rate limit should be configurable on the WireframeApp builder and enforced on every push. | Medium | #2.2 | +| 3.5 | Dead Letter Queue (DLQ) | Implement the optional Dead Letter Queue mechanism. Allow a user to provide a DLQ channel sender during app setup; failed pushes (due to a full queue) can be routed there instead of being dropped. | Medium | #2.2 | +| 3.6 | Context-Aware FragmentStrategy | Enhance the FragmentStrategy trait. max_fragment_payload and encode_header should receive a reference to the logical Frame being processed, allowing for more dynamic fragmentation rules. | Small | #1.4 | diff --git a/tests/integration.rs b/tests/integration.rs index 08e0d4e5..60548637 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -646,3 +646,16 @@ fn test_preserve_hard_line_breaks() { assert_eq!(output[0], "Line one with break."); assert_eq!(output[1], "Line two follows."); } + +#[test] +fn test_regression_complex_table() { + let input: Vec = include_str!("data/regression_table_input.txt") + .lines() + .map(str::to_string) + .collect(); + let expected: Vec = include_str!("data/regression_table_expected.txt") + .lines() + .map(str::to_string) + .collect(); + assert_eq!(process_stream(&input), expected); +} From 9677c173be444251618c8620721be0e0d93515fc Mon Sep 17 00:00:00 2001 From: Leynos Date: Wed, 25 Jun 2025 00:41:25 +0100 Subject: [PATCH 2/2] Add doc comment for regression table test --- tests/integration.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration.rs b/tests/integration.rs index 60548637..959685b8 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -648,6 +648,11 @@ fn test_preserve_hard_line_breaks() { } #[test] +/// Tests that `process_stream` preserves complex table formatting without modification. +/// +/// This regression test ensures that properly formatted complex tables with multiple +/// columns and detailed content pass through the processing pipeline unchanged, +/// preventing regressions that might inadvertently alter correct formatting. fn test_regression_complex_table() { let input: Vec = include_str!("data/regression_table_input.txt") .lines()